[libcxx-commits] [libcxx] 2d66ab5 - [libc++][NFC] Run the container tests through clang-format (#126499)
via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Feb 10 21:17:57 PST 2025
Author: Louis Dionne
Date: 2025-02-11T06:17:39+01:00
New Revision: 2d66ab5e8ede4f893b272f5ad1231e87504d7235
URL: https://github.com/llvm/llvm-project/commit/2d66ab5e8ede4f893b272f5ad1231e87504d7235
DIFF: https://github.com/llvm/llvm-project/commit/2d66ab5e8ede4f893b272f5ad1231e87504d7235.diff
LOG: [libc++][NFC] Run the container tests through clang-format (#126499)
We've been improving these the tests for vector quite a bit and we are
probably not done improving our container tests. Formatting everything
at once will make subsequent reviews easier.
Added:
Modified:
libcxx/test/libcxx/containers/associative/map/at.abort.pass.cpp
libcxx/test/libcxx/containers/associative/map/at.const.abort.pass.cpp
libcxx/test/libcxx/containers/associative/map/find.modules.compile.pass.mm
libcxx/test/libcxx/containers/associative/non_const_comparator.incomplete.verify.cpp
libcxx/test/libcxx/containers/associative/tree_balance_after_insert.pass.cpp
libcxx/test/libcxx/containers/associative/tree_key_value_traits.pass.cpp
libcxx/test/libcxx/containers/associative/tree_left_rotate.pass.cpp
libcxx/test/libcxx/containers/associative/tree_remove.pass.cpp
libcxx/test/libcxx/containers/associative/tree_right_rotate.pass.cpp
libcxx/test/libcxx/containers/gnu_cxx/hash_map_name_lookup.pass.cpp
libcxx/test/libcxx/containers/sequences/array/triviality.pass.cpp
libcxx/test/libcxx/containers/sequences/deque/asan.pass.cpp
libcxx/test/libcxx/containers/sequences/deque/assert.pop_back.empty.pass.cpp
libcxx/test/libcxx/containers/sequences/deque/incomplete.pass.cpp
libcxx/test/libcxx/containers/sequences/deque/segmented_iterator.compile.pass.cpp
libcxx/test/libcxx/containers/sequences/deque/spare_block_handling.pass.cpp
libcxx/test/libcxx/containers/sequences/list/list.cons/debug.copy.pass.cpp
libcxx/test/libcxx/containers/sequences/list/list.modifiers/assert.erase_iter.end.pass.cpp
libcxx/test/libcxx/containers/sequences/list/list.modifiers/assert.pop_back.empty.pass.cpp
libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.emplace.pass.cpp
libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.erase.iter.pass.cpp
libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.erase.iter_iter.pass.cpp
libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_iter_iter.pass.cpp
libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_rvalue.pass.cpp
libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_size_value.pass.cpp
libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_value.pass.cpp
libcxx/test/libcxx/containers/sequences/list/list.ops/debug.splice.pos_list.pass.cpp
libcxx/test/libcxx/containers/sequences/list/list.ops/debug.splice.pos_list_iter.pass.cpp
libcxx/test/libcxx/containers/sequences/vector.bool/trivial_for_purposes_of_call.pass.cpp
libcxx/test/libcxx/containers/sequences/vector/asan.pass.cpp
libcxx/test/libcxx/containers/sequences/vector/asan_throw.pass.cpp
libcxx/test/libcxx/containers/sequences/vector/asan_turning_off.pass.cpp
libcxx/test/libcxx/containers/sequences/vector/assert.pop_back.empty.pass.cpp
libcxx/test/libcxx/containers/sequences/vector/erase.modules.compile.pass.mm
libcxx/test/libcxx/containers/sequences/vector/exception_safety_exceptions_disabled.pass.cpp
libcxx/test/libcxx/containers/sequences/vector/invalid_allocator.verify.cpp
libcxx/test/libcxx/containers/sequences/vector/robust_against_adl.pass.cpp
libcxx/test/libcxx/containers/unord/key_value_traits.pass.cpp
libcxx/test/libcxx/containers/unord/next_pow2.pass.cpp
libcxx/test/libcxx/containers/unord/next_prime.pass.cpp
libcxx/test/libcxx/containers/unord/non_const_comparator.incomplete.verify.cpp
libcxx/test/libcxx/containers/unord/unord.map/assert.bucket.pass.cpp
libcxx/test/libcxx/containers/unord/unord.map/assert.bucket_size.pass.cpp
libcxx/test/libcxx/containers/unord/unord.map/assert.max_load_factor.pass.cpp
libcxx/test/libcxx/containers/unord/unord.map/at.abort.pass.cpp
libcxx/test/libcxx/containers/unord/unord.map/at.const.abort.pass.cpp
libcxx/test/libcxx/containers/unord/unord.map/debug.insert.hint_const_lvalue.pass.cpp
libcxx/test/libcxx/containers/unord/unord.map/debug.insert.hint_rvalue.pass.cpp
libcxx/test/libcxx/containers/unord/unord.map/debug.swap.pass.cpp
libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/debug.erase.iter.pass.cpp
libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/debug.erase.iter_iter.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multimap/assert.bucket.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multimap/assert.bucket_size.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multimap/assert.max_load_factor.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multimap/debug.insert.hint_const_lvalue.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multimap/debug.insert.hint_rvalue.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multimap/debug.swap.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/debug.erase.iter.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/debug.erase.iter_iter.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multiset/assert.bucket.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multiset/assert.bucket_size.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multiset/assert.max_load_factor.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multiset/debug.erase.iter.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multiset/debug.erase.iter_iter.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multiset/debug.insert.hint_const_lvalue.pass.cpp
libcxx/test/libcxx/containers/unord/unord.multiset/debug.swap.pass.cpp
libcxx/test/libcxx/containers/unord/unord.set/assert.bucket.pass.cpp
libcxx/test/libcxx/containers/unord/unord.set/assert.bucket_size.pass.cpp
libcxx/test/libcxx/containers/unord/unord.set/assert.max_load_factor.pass.cpp
libcxx/test/libcxx/containers/unord/unord.set/debug.erase.iter.pass.cpp
libcxx/test/libcxx/containers/unord/unord.set/debug.erase.iter_iter.pass.cpp
libcxx/test/libcxx/containers/unord/unord.set/debug.insert.hint_const_lvalue.pass.cpp
libcxx/test/libcxx/containers/unord/unord.set/debug.swap.pass.cpp
libcxx/test/libcxx/containers/unord/unord.set/missing_hash_specialization.verify.cpp
libcxx/test/libcxx/containers/views/mdspan/extents/assert.ctor_from_array.pass.cpp
libcxx/test/libcxx/containers/views/views.span/span.cons/assert.iter_sent.pass.cpp
libcxx/test/libcxx/containers/views/views.span/span.cons/assert.other_span.pass.cpp
libcxx/test/libcxx/containers/views/views.span/span.cons/assert.range.pass.cpp
libcxx/test/libcxx/containers/views/views.span/span.elem/assert.back.pass.cpp
libcxx/test/libcxx/containers/views/views.span/span.elem/assert.front.pass.cpp
libcxx/test/libcxx/containers/views/views.span/span.elem/assert.op_idx.pass.cpp
libcxx/test/libcxx/containers/views/views.span/span.sub/assert.first.pass.cpp
libcxx/test/libcxx/containers/views/views.span/span.sub/assert.last.pass.cpp
libcxx/test/libcxx/containers/views/views.span/span.sub/assert.subspan.pass.cpp
libcxx/test/std/containers/Copyable.h
libcxx/test/std/containers/Emplaceable.h
libcxx/test/std/containers/NotConstructible.h
libcxx/test/std/containers/associative/from_range_associative_containers.h
libcxx/test/std/containers/associative/iterator_types.pass.cpp
libcxx/test/std/containers/associative/map/PR28469_undefined_behavior_segfault.sh.cpp
libcxx/test/std/containers/associative/map/allocator_mismatch.verify.cpp
libcxx/test/std/containers/associative/map/compare.pass.cpp
libcxx/test/std/containers/associative/map/get_allocator.pass.cpp
libcxx/test/std/containers/associative/map/incomplete_type.pass.cpp
libcxx/test/std/containers/associative/map/iterator_concept_conformance.compile.pass.cpp
libcxx/test/std/containers/associative/map/map.access/at.pass.cpp
libcxx/test/std/containers/associative/map/map.access/empty.pass.cpp
libcxx/test/std/containers/associative/map/map.access/empty.verify.cpp
libcxx/test/std/containers/associative/map/map.access/index_key.pass.cpp
libcxx/test/std/containers/associative/map/map.access/index_rv_key.pass.cpp
libcxx/test/std/containers/associative/map/map.access/index_tuple.pass.cpp
libcxx/test/std/containers/associative/map/map.access/iterator.pass.cpp
libcxx/test/std/containers/associative/map/map.access/max_size.pass.cpp
libcxx/test/std/containers/associative/map/map.access/size.pass.cpp
libcxx/test/std/containers/associative/map/map.cons/alloc.pass.cpp
libcxx/test/std/containers/associative/map/map.cons/assign_initializer_list.pass.cpp
libcxx/test/std/containers/associative/map/map.cons/compare.pass.cpp
libcxx/test/std/containers/associative/map/map.cons/compare_alloc.pass.cpp
libcxx/test/std/containers/associative/map/map.cons/compare_copy_constructible.compile.fail.cpp
libcxx/test/std/containers/associative/map/map.cons/copy.pass.cpp
libcxx/test/std/containers/associative/map/map.cons/copy_alloc.pass.cpp
libcxx/test/std/containers/associative/map/map.cons/copy_assign.pass.cpp
libcxx/test/std/containers/associative/map/map.cons/deduct.pass.cpp
libcxx/test/std/containers/associative/map/map.cons/deduct.verify.cpp
libcxx/test/std/containers/associative/map/map.cons/deduct_const.pass.cpp
libcxx/test/std/containers/associative/map/map.cons/default.pass.cpp
libcxx/test/std/containers/associative/map/map.cons/default_noexcept.pass.cpp
libcxx/test/std/containers/associative/map/map.cons/dtor_noexcept.pass.cpp
libcxx/test/std/containers/associative/map/map.cons/from_range.pass.cpp
libcxx/test/std/containers/associative/map/map.cons/initializer_list.pass.cpp
libcxx/test/std/containers/associative/map/map.cons/initializer_list_compare.pass.cpp
libcxx/test/std/containers/associative/map/map.cons/initializer_list_compare_alloc.pass.cpp
libcxx/test/std/containers/associative/map/map.cons/iter_iter.pass.cpp
libcxx/test/std/containers/associative/map/map.cons/iter_iter_comp.pass.cpp
libcxx/test/std/containers/associative/map/map.cons/iter_iter_comp_alloc.pass.cpp
libcxx/test/std/containers/associative/map/map.cons/move.pass.cpp
libcxx/test/std/containers/associative/map/map.cons/move_alloc.pass.cpp
libcxx/test/std/containers/associative/map/map.cons/move_assign.pass.cpp
libcxx/test/std/containers/associative/map/map.cons/move_noexcept.pass.cpp
libcxx/test/std/containers/associative/map/map.erasure/erase_if.pass.cpp
libcxx/test/std/containers/associative/map/map.modifiers/clear.pass.cpp
libcxx/test/std/containers/associative/map/map.modifiers/emplace.pass.cpp
libcxx/test/std/containers/associative/map/map.modifiers/emplace_hint.pass.cpp
libcxx/test/std/containers/associative/map/map.modifiers/erase_iter.pass.cpp
libcxx/test/std/containers/associative/map/map.modifiers/erase_iter_iter.pass.cpp
libcxx/test/std/containers/associative/map/map.modifiers/erase_key.pass.cpp
libcxx/test/std/containers/associative/map/map.modifiers/extract_iterator.pass.cpp
libcxx/test/std/containers/associative/map/map.modifiers/extract_key.pass.cpp
libcxx/test/std/containers/associative/map/map.modifiers/insert_and_emplace_allocator_requirements.pass.cpp
libcxx/test/std/containers/associative/map/map.modifiers/insert_cv.pass.cpp
libcxx/test/std/containers/associative/map/map.modifiers/insert_initializer_list.pass.cpp
libcxx/test/std/containers/associative/map/map.modifiers/insert_iter_cv.pass.cpp
libcxx/test/std/containers/associative/map/map.modifiers/insert_iter_iter.pass.cpp
libcxx/test/std/containers/associative/map/map.modifiers/insert_iter_rv.pass.cpp
libcxx/test/std/containers/associative/map/map.modifiers/insert_node_type.pass.cpp
libcxx/test/std/containers/associative/map/map.modifiers/insert_node_type_hint.pass.cpp
libcxx/test/std/containers/associative/map/map.modifiers/insert_or_assign.pass.cpp
libcxx/test/std/containers/associative/map/map.modifiers/insert_range.pass.cpp
libcxx/test/std/containers/associative/map/map.modifiers/insert_rv.pass.cpp
libcxx/test/std/containers/associative/map/map.modifiers/merge.pass.cpp
libcxx/test/std/containers/associative/map/map.modifiers/try.emplace.pass.cpp
libcxx/test/std/containers/associative/map/map.nonmember/op_compare.pass.cpp
libcxx/test/std/containers/associative/map/map.observers/key_comp.pass.cpp
libcxx/test/std/containers/associative/map/map.observers/value_comp.pass.cpp
libcxx/test/std/containers/associative/map/map.ops/contains.pass.cpp
libcxx/test/std/containers/associative/map/map.ops/contains_transparent.pass.cpp
libcxx/test/std/containers/associative/map/map.ops/count0.pass.cpp
libcxx/test/std/containers/associative/map/map.ops/count1.compile.fail.cpp
libcxx/test/std/containers/associative/map/map.ops/count2.compile.fail.cpp
libcxx/test/std/containers/associative/map/map.ops/count3.compile.fail.cpp
libcxx/test/std/containers/associative/map/map.ops/count_transparent.pass.cpp
libcxx/test/std/containers/associative/map/map.ops/equal_range.pass.cpp
libcxx/test/std/containers/associative/map/map.ops/equal_range0.pass.cpp
libcxx/test/std/containers/associative/map/map.ops/equal_range1.compile.fail.cpp
libcxx/test/std/containers/associative/map/map.ops/equal_range2.compile.fail.cpp
libcxx/test/std/containers/associative/map/map.ops/equal_range3.compile.fail.cpp
libcxx/test/std/containers/associative/map/map.ops/equal_range_transparent.pass.cpp
libcxx/test/std/containers/associative/map/map.ops/find.pass.cpp
libcxx/test/std/containers/associative/map/map.ops/find0.pass.cpp
libcxx/test/std/containers/associative/map/map.ops/find1.compile.fail.cpp
libcxx/test/std/containers/associative/map/map.ops/find2.compile.fail.cpp
libcxx/test/std/containers/associative/map/map.ops/find3.compile.fail.cpp
libcxx/test/std/containers/associative/map/map.ops/lower_bound.pass.cpp
libcxx/test/std/containers/associative/map/map.ops/lower_bound0.pass.cpp
libcxx/test/std/containers/associative/map/map.ops/lower_bound1.compile.fail.cpp
libcxx/test/std/containers/associative/map/map.ops/lower_bound2.compile.fail.cpp
libcxx/test/std/containers/associative/map/map.ops/lower_bound3.compile.fail.cpp
libcxx/test/std/containers/associative/map/map.ops/upper_bound.pass.cpp
libcxx/test/std/containers/associative/map/map.ops/upper_bound0.pass.cpp
libcxx/test/std/containers/associative/map/map.ops/upper_bound1.compile.fail.cpp
libcxx/test/std/containers/associative/map/map.ops/upper_bound2.compile.fail.cpp
libcxx/test/std/containers/associative/map/map.ops/upper_bound3.compile.fail.cpp
libcxx/test/std/containers/associative/map/map.special/member_swap.pass.cpp
libcxx/test/std/containers/associative/map/map.special/non_member_swap.pass.cpp
libcxx/test/std/containers/associative/map/map.special/swap_noexcept.pass.cpp
libcxx/test/std/containers/associative/map/map.value_compare/invoke.pass.cpp
libcxx/test/std/containers/associative/map/map.value_compare/types.pass.cpp
libcxx/test/std/containers/associative/map/range_concept_conformance.compile.pass.cpp
libcxx/test/std/containers/associative/map/types.pass.cpp
libcxx/test/std/containers/associative/multimap/allocator_mismatch.verify.cpp
libcxx/test/std/containers/associative/multimap/empty.pass.cpp
libcxx/test/std/containers/associative/multimap/empty.verify.cpp
libcxx/test/std/containers/associative/multimap/get_allocator.pass.cpp
libcxx/test/std/containers/associative/multimap/incomplete_type.pass.cpp
libcxx/test/std/containers/associative/multimap/iterator.pass.cpp
libcxx/test/std/containers/associative/multimap/iterator_concept_conformance.compile.pass.cpp
libcxx/test/std/containers/associative/multimap/max_size.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.cons/alloc.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.cons/assign_initializer_list.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.cons/compare.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.cons/compare_alloc.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.cons/compare_copy_constructible.compile.fail.cpp
libcxx/test/std/containers/associative/multimap/multimap.cons/copy.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.cons/copy_alloc.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.cons/copy_assign.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.cons/deduct.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.cons/deduct.verify.cpp
libcxx/test/std/containers/associative/multimap/multimap.cons/deduct_const.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.cons/default.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.cons/default_noexcept.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.cons/dtor_noexcept.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.cons/from_range.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.cons/initializer_list.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare_alloc.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.cons/iter_iter.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.cons/iter_iter_comp.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.cons/iter_iter_comp_alloc.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.cons/move.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.cons/move_alloc.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.cons/move_assign.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.cons/move_noexcept.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.erasure/erase_if.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.modifiers/clear.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.modifiers/emplace.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.modifiers/emplace_hint.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.modifiers/erase_iter.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.modifiers/erase_iter_iter.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.modifiers/erase_key.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.modifiers/extract_iterator.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.modifiers/extract_key.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_allocator_requirements.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_cv.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_initializer_list.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_cv.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_iter.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_rv.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_node_type.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_node_type_hint.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_range.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_rv.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.modifiers/merge.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.nonmember/op_compare.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.observers/key_comp.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.observers/value_comp.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.ops/count.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.ops/count0.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.ops/count1.compile.fail.cpp
libcxx/test/std/containers/associative/multimap/multimap.ops/count2.compile.fail.cpp
libcxx/test/std/containers/associative/multimap/multimap.ops/count3.compile.fail.cpp
libcxx/test/std/containers/associative/multimap/multimap.ops/count_transparent.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range0.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range1.compile.fail.cpp
libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range2.compile.fail.cpp
libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range3.compile.fail.cpp
libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range_transparent.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.ops/find.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.ops/find0.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.ops/find1.compile.fail.cpp
libcxx/test/std/containers/associative/multimap/multimap.ops/find2.compile.fail.cpp
libcxx/test/std/containers/associative/multimap/multimap.ops/find3.compile.fail.cpp
libcxx/test/std/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.ops/lower_bound0.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.ops/lower_bound1.compile.fail.cpp
libcxx/test/std/containers/associative/multimap/multimap.ops/lower_bound2.compile.fail.cpp
libcxx/test/std/containers/associative/multimap/multimap.ops/lower_bound3.compile.fail.cpp
libcxx/test/std/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.ops/upper_bound0.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.ops/upper_bound1.compile.fail.cpp
libcxx/test/std/containers/associative/multimap/multimap.ops/upper_bound2.compile.fail.cpp
libcxx/test/std/containers/associative/multimap/multimap.ops/upper_bound3.compile.fail.cpp
libcxx/test/std/containers/associative/multimap/multimap.special/member_swap.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.special/swap_noexcept.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.value_compare/invoke.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.value_compare/types.pass.cpp
libcxx/test/std/containers/associative/multimap/range_concept_conformance.compile.pass.cpp
libcxx/test/std/containers/associative/multimap/scary.pass.cpp
libcxx/test/std/containers/associative/multimap/size.pass.cpp
libcxx/test/std/containers/associative/multimap/types.pass.cpp
libcxx/test/std/containers/associative/multiset/allocator_mismatch.verify.cpp
libcxx/test/std/containers/associative/multiset/clear.pass.cpp
libcxx/test/std/containers/associative/multiset/count.pass.cpp
libcxx/test/std/containers/associative/multiset/count_transparent.pass.cpp
libcxx/test/std/containers/associative/multiset/emplace.pass.cpp
libcxx/test/std/containers/associative/multiset/emplace_hint.pass.cpp
libcxx/test/std/containers/associative/multiset/empty.pass.cpp
libcxx/test/std/containers/associative/multiset/empty.verify.cpp
libcxx/test/std/containers/associative/multiset/equal_range.pass.cpp
libcxx/test/std/containers/associative/multiset/equal_range_transparent.pass.cpp
libcxx/test/std/containers/associative/multiset/erase_iter.pass.cpp
libcxx/test/std/containers/associative/multiset/erase_iter_iter.pass.cpp
libcxx/test/std/containers/associative/multiset/erase_key.pass.cpp
libcxx/test/std/containers/associative/multiset/extract_iterator.pass.cpp
libcxx/test/std/containers/associative/multiset/extract_key.pass.cpp
libcxx/test/std/containers/associative/multiset/find.pass.cpp
libcxx/test/std/containers/associative/multiset/get_allocator.pass.cpp
libcxx/test/std/containers/associative/multiset/incomplete_type.pass.cpp
libcxx/test/std/containers/associative/multiset/insert_cv.pass.cpp
libcxx/test/std/containers/associative/multiset/insert_emplace_allocator_requirements.pass.cpp
libcxx/test/std/containers/associative/multiset/insert_initializer_list.pass.cpp
libcxx/test/std/containers/associative/multiset/insert_iter_cv.pass.cpp
libcxx/test/std/containers/associative/multiset/insert_iter_iter.pass.cpp
libcxx/test/std/containers/associative/multiset/insert_iter_rv.pass.cpp
libcxx/test/std/containers/associative/multiset/insert_node_type.pass.cpp
libcxx/test/std/containers/associative/multiset/insert_node_type_hint.pass.cpp
libcxx/test/std/containers/associative/multiset/insert_rv.pass.cpp
libcxx/test/std/containers/associative/multiset/iterator.pass.cpp
libcxx/test/std/containers/associative/multiset/iterator_concept_conformance.compile.pass.cpp
libcxx/test/std/containers/associative/multiset/lower_bound.pass.cpp
libcxx/test/std/containers/associative/multiset/max_size.pass.cpp
libcxx/test/std/containers/associative/multiset/merge.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.cons/alloc.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.cons/assign_initializer_list.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.cons/compare.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.cons/compare_alloc.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.cons/compare_copy_constructible.compile.fail.cpp
libcxx/test/std/containers/associative/multiset/multiset.cons/copy.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.cons/copy_alloc.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.cons/copy_assign.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.cons/deduct.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.cons/deduct.verify.cpp
libcxx/test/std/containers/associative/multiset/multiset.cons/default.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.cons/default_noexcept.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.cons/dtor_noexcept.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.cons/from_range.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare_alloc.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.cons/iter_iter.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.cons/iter_iter_alloc.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.cons/iter_iter_comp.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.cons/move.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.cons/move_alloc.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.cons/move_assign.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.cons/move_noexcept.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.erasure/erase_if.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.nonmember/op_compare.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.observers/comp.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.special/member_swap.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.special/non_member_swap.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.special/swap_noexcept.pass.cpp
libcxx/test/std/containers/associative/multiset/scary.pass.cpp
libcxx/test/std/containers/associative/multiset/size.pass.cpp
libcxx/test/std/containers/associative/multiset/types.pass.cpp
libcxx/test/std/containers/associative/multiset/upper_bound.pass.cpp
libcxx/test/std/containers/associative/set/allocator_mismatch.verify.cpp
libcxx/test/std/containers/associative/set/clear.pass.cpp
libcxx/test/std/containers/associative/set/contains.pass.cpp
libcxx/test/std/containers/associative/set/contains_transparent.pass.cpp
libcxx/test/std/containers/associative/set/count.pass.cpp
libcxx/test/std/containers/associative/set/count_transparent.pass.cpp
libcxx/test/std/containers/associative/set/emplace.pass.cpp
libcxx/test/std/containers/associative/set/emplace_hint.pass.cpp
libcxx/test/std/containers/associative/set/empty.pass.cpp
libcxx/test/std/containers/associative/set/empty.verify.cpp
libcxx/test/std/containers/associative/set/equal_range.pass.cpp
libcxx/test/std/containers/associative/set/equal_range_transparent.pass.cpp
libcxx/test/std/containers/associative/set/erase_iter.pass.cpp
libcxx/test/std/containers/associative/set/erase_iter_iter.pass.cpp
libcxx/test/std/containers/associative/set/erase_key.pass.cpp
libcxx/test/std/containers/associative/set/extract_iterator.pass.cpp
libcxx/test/std/containers/associative/set/extract_key.pass.cpp
libcxx/test/std/containers/associative/set/find.pass.cpp
libcxx/test/std/containers/associative/set/get_allocator.pass.cpp
libcxx/test/std/containers/associative/set/incomplete_type.pass.cpp
libcxx/test/std/containers/associative/set/insert_and_emplace_allocator_requirements.pass.cpp
libcxx/test/std/containers/associative/set/insert_cv.pass.cpp
libcxx/test/std/containers/associative/set/insert_initializer_list.pass.cpp
libcxx/test/std/containers/associative/set/insert_iter_cv.pass.cpp
libcxx/test/std/containers/associative/set/insert_iter_iter.pass.cpp
libcxx/test/std/containers/associative/set/insert_iter_rv.pass.cpp
libcxx/test/std/containers/associative/set/insert_node_type.pass.cpp
libcxx/test/std/containers/associative/set/insert_node_type_hint.pass.cpp
libcxx/test/std/containers/associative/set/insert_rv.pass.cpp
libcxx/test/std/containers/associative/set/iterator.pass.cpp
libcxx/test/std/containers/associative/set/iterator_concept_conformance.compile.pass.cpp
libcxx/test/std/containers/associative/set/lower_bound.pass.cpp
libcxx/test/std/containers/associative/set/max_size.pass.cpp
libcxx/test/std/containers/associative/set/merge.pass.cpp
libcxx/test/std/containers/associative/set/range_concept_conformance.compile.pass.cpp
libcxx/test/std/containers/associative/set/set.cons/alloc.pass.cpp
libcxx/test/std/containers/associative/set/set.cons/assign_initializer_list.pass.cpp
libcxx/test/std/containers/associative/set/set.cons/compare.pass.cpp
libcxx/test/std/containers/associative/set/set.cons/compare_alloc.pass.cpp
libcxx/test/std/containers/associative/set/set.cons/compare_copy_constructible.compile.fail.cpp
libcxx/test/std/containers/associative/set/set.cons/copy.pass.cpp
libcxx/test/std/containers/associative/set/set.cons/copy_alloc.pass.cpp
libcxx/test/std/containers/associative/set/set.cons/copy_assign.pass.cpp
libcxx/test/std/containers/associative/set/set.cons/deduct.pass.cpp
libcxx/test/std/containers/associative/set/set.cons/deduct.verify.cpp
libcxx/test/std/containers/associative/set/set.cons/default.pass.cpp
libcxx/test/std/containers/associative/set/set.cons/default_noexcept.pass.cpp
libcxx/test/std/containers/associative/set/set.cons/dtor_noexcept.pass.cpp
libcxx/test/std/containers/associative/set/set.cons/from_range.pass.cpp
libcxx/test/std/containers/associative/set/set.cons/initializer_list.pass.cpp
libcxx/test/std/containers/associative/set/set.cons/initializer_list_compare.pass.cpp
libcxx/test/std/containers/associative/set/set.cons/initializer_list_compare_alloc.pass.cpp
libcxx/test/std/containers/associative/set/set.cons/iter_iter.pass.cpp
libcxx/test/std/containers/associative/set/set.cons/iter_iter_alloc.pass.cpp
libcxx/test/std/containers/associative/set/set.cons/iter_iter_comp.pass.cpp
libcxx/test/std/containers/associative/set/set.cons/move.pass.cpp
libcxx/test/std/containers/associative/set/set.cons/move_alloc.pass.cpp
libcxx/test/std/containers/associative/set/set.cons/move_assign.pass.cpp
libcxx/test/std/containers/associative/set/set.cons/move_noexcept.pass.cpp
libcxx/test/std/containers/associative/set/set.erasure/erase_if.pass.cpp
libcxx/test/std/containers/associative/set/set.nonmember/op_compare.pass.cpp
libcxx/test/std/containers/associative/set/set.observers/comp.pass.cpp
libcxx/test/std/containers/associative/set/set.special/member_swap.pass.cpp
libcxx/test/std/containers/associative/set/set.special/non_member_swap.pass.cpp
libcxx/test/std/containers/associative/set/set.special/swap_noexcept.pass.cpp
libcxx/test/std/containers/associative/set/size.pass.cpp
libcxx/test/std/containers/associative/set/types.pass.cpp
libcxx/test/std/containers/associative/set/upper_bound.pass.cpp
libcxx/test/std/containers/check_consecutive.h
libcxx/test/std/containers/container.adaptors/flat.map.syn/sorted_unique.pass.cpp
libcxx/test/std/containers/container.adaptors/from_range_container_adaptors.h
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_alloc.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_alloc.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_cont_alloc.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_rcont_alloc.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_copy_alloc.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_iter_iter_alloc.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_iter_iter_comp_alloc.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_iter_iter_comp_cont_alloc.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_iter_iter_comp_rcont_alloc.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_move_alloc.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/assign_copy.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/assign_move.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_container.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_rcontainer.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_copy.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_default.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_constraint.compile.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp_cont.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp_rcont.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_move.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/deduct.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/deduct.verify.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/default_noexcept.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/dtor_noexcept.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/from_range.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/move_assign_noexcept.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/move_noexcept.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/emplace.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/empty.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/empty.verify.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/pop.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/push.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/push_range.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/push_rvalue.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/size.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/swap.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/top.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.special/swap.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.special/swap_noexcept.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/types.compile.fail.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/types.pass.cpp
libcxx/test/std/containers/container.adaptors/push_range_container_adaptors.h
libcxx/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_alloc.pass.cpp
libcxx/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_container_alloc.pass.cpp
libcxx/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_queue_alloc.pass.cpp
libcxx/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_rcontainer_alloc.pass.cpp
libcxx/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_rqueue_alloc.pass.cpp
libcxx/test/std/containers/container.adaptors/queue/queue.cons/ctor_container.pass.cpp
libcxx/test/std/containers/container.adaptors/queue/queue.cons/ctor_copy.pass.cpp
libcxx/test/std/containers/container.adaptors/queue/queue.cons/ctor_default.pass.cpp
libcxx/test/std/containers/container.adaptors/queue/queue.cons/ctor_iterators.pass.cpp
libcxx/test/std/containers/container.adaptors/queue/queue.cons/ctor_move.pass.cpp
libcxx/test/std/containers/container.adaptors/queue/queue.cons/ctor_rcontainer.pass.cpp
libcxx/test/std/containers/container.adaptors/queue/queue.cons/deduct.pass.cpp
libcxx/test/std/containers/container.adaptors/queue/queue.cons/deduct.verify.cpp
libcxx/test/std/containers/container.adaptors/queue/queue.cons/default_noexcept.pass.cpp
libcxx/test/std/containers/container.adaptors/queue/queue.cons/dtor_noexcept.pass.cpp
libcxx/test/std/containers/container.adaptors/queue/queue.cons/move_assign_noexcept.pass.cpp
libcxx/test/std/containers/container.adaptors/queue/queue.cons/move_noexcept.pass.cpp
libcxx/test/std/containers/container.adaptors/queue/queue.defn/assign_copy.pass.cpp
libcxx/test/std/containers/container.adaptors/queue/queue.defn/assign_move.pass.cpp
libcxx/test/std/containers/container.adaptors/queue/queue.defn/back.pass.cpp
libcxx/test/std/containers/container.adaptors/queue/queue.defn/back_const.pass.cpp
libcxx/test/std/containers/container.adaptors/queue/queue.defn/emplace.pass.cpp
libcxx/test/std/containers/container.adaptors/queue/queue.defn/empty.pass.cpp
libcxx/test/std/containers/container.adaptors/queue/queue.defn/empty.verify.cpp
libcxx/test/std/containers/container.adaptors/queue/queue.defn/front.pass.cpp
libcxx/test/std/containers/container.adaptors/queue/queue.defn/front_const.pass.cpp
libcxx/test/std/containers/container.adaptors/queue/queue.defn/pop.pass.cpp
libcxx/test/std/containers/container.adaptors/queue/queue.defn/push.pass.cpp
libcxx/test/std/containers/container.adaptors/queue/queue.defn/push_rv.pass.cpp
libcxx/test/std/containers/container.adaptors/queue/queue.defn/size.pass.cpp
libcxx/test/std/containers/container.adaptors/queue/queue.defn/swap.pass.cpp
libcxx/test/std/containers/container.adaptors/queue/queue.defn/types.compile.fail.cpp
libcxx/test/std/containers/container.adaptors/queue/queue.defn/types.pass.cpp
libcxx/test/std/containers/container.adaptors/queue/queue.ops/eq.pass.cpp
libcxx/test/std/containers/container.adaptors/queue/queue.ops/lt.pass.cpp
libcxx/test/std/containers/container.adaptors/queue/queue.special/swap.pass.cpp
libcxx/test/std/containers/container.adaptors/queue/queue.special/swap_noexcept.pass.cpp
libcxx/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_alloc.pass.cpp
libcxx/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_container_alloc.pass.cpp
libcxx/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_copy_alloc.pass.cpp
libcxx/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rcontainer_alloc.pass.cpp
libcxx/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rqueue_alloc.pass.cpp
libcxx/test/std/containers/container.adaptors/stack/stack.cons/ctor_container.pass.cpp
libcxx/test/std/containers/container.adaptors/stack/stack.cons/ctor_copy.pass.cpp
libcxx/test/std/containers/container.adaptors/stack/stack.cons/ctor_default.pass.cpp
libcxx/test/std/containers/container.adaptors/stack/stack.cons/ctor_iterators.pass.cpp
libcxx/test/std/containers/container.adaptors/stack/stack.cons/ctor_move.pass.cpp
libcxx/test/std/containers/container.adaptors/stack/stack.cons/ctor_rcontainer.pass.cpp
libcxx/test/std/containers/container.adaptors/stack/stack.cons/deduct.pass.cpp
libcxx/test/std/containers/container.adaptors/stack/stack.cons/deduct.verify.cpp
libcxx/test/std/containers/container.adaptors/stack/stack.cons/default_noexcept.pass.cpp
libcxx/test/std/containers/container.adaptors/stack/stack.cons/dtor_noexcept.pass.cpp
libcxx/test/std/containers/container.adaptors/stack/stack.cons/move_assign_noexcept.pass.cpp
libcxx/test/std/containers/container.adaptors/stack/stack.cons/move_noexcept.pass.cpp
libcxx/test/std/containers/container.adaptors/stack/stack.defn/assign_copy.pass.cpp
libcxx/test/std/containers/container.adaptors/stack/stack.defn/assign_move.pass.cpp
libcxx/test/std/containers/container.adaptors/stack/stack.defn/emplace.pass.cpp
libcxx/test/std/containers/container.adaptors/stack/stack.defn/empty.pass.cpp
libcxx/test/std/containers/container.adaptors/stack/stack.defn/empty.verify.cpp
libcxx/test/std/containers/container.adaptors/stack/stack.defn/pop.pass.cpp
libcxx/test/std/containers/container.adaptors/stack/stack.defn/push.pass.cpp
libcxx/test/std/containers/container.adaptors/stack/stack.defn/push_rv.pass.cpp
libcxx/test/std/containers/container.adaptors/stack/stack.defn/size.pass.cpp
libcxx/test/std/containers/container.adaptors/stack/stack.defn/swap.pass.cpp
libcxx/test/std/containers/container.adaptors/stack/stack.defn/top.pass.cpp
libcxx/test/std/containers/container.adaptors/stack/stack.defn/top_const.pass.cpp
libcxx/test/std/containers/container.adaptors/stack/stack.defn/types.compile.fail.cpp
libcxx/test/std/containers/container.adaptors/stack/stack.defn/types.pass.cpp
libcxx/test/std/containers/container.adaptors/stack/stack.ops/eq.pass.cpp
libcxx/test/std/containers/container.adaptors/stack/stack.ops/lt.pass.cpp
libcxx/test/std/containers/container.adaptors/stack/stack.special/swap.pass.cpp
libcxx/test/std/containers/container.adaptors/stack/stack.special/swap_noexcept.pass.cpp
libcxx/test/std/containers/container.node/node_handle.nodiscard.verify.cpp
libcxx/test/std/containers/container.node/node_handle.pass.cpp
libcxx/test/std/containers/container.requirements/associative.reqmts/associative.reqmts.except/nothing_to_do.pass.cpp
libcxx/test/std/containers/container.requirements/container.requirements.dataraces/nothing_to_do.pass.cpp
libcxx/test/std/containers/container.requirements/container.requirements.general/allocator_move.pass.cpp
libcxx/test/std/containers/container.requirements/sequence.reqmts/nothing_to_do.pass.cpp
libcxx/test/std/containers/container.requirements/unord.req/unord.req.except/nothing_to_do.pass.cpp
libcxx/test/std/containers/containers.general/nothing_to_do.pass.cpp
libcxx/test/std/containers/exception_safety_helpers.h
libcxx/test/std/containers/from_range_helpers.h
libcxx/test/std/containers/insert_range_helpers.h
libcxx/test/std/containers/insert_range_maps_sets.h
libcxx/test/std/containers/iterator.rel_ops.compile.pass.cpp
libcxx/test/std/containers/map_allocator_requirement_test_templates.h
libcxx/test/std/containers/sequences/array/aggregate.pass.cpp
libcxx/test/std/containers/sequences/array/array.cons/deduct.pass.cpp
libcxx/test/std/containers/sequences/array/array.cons/deduct.verify.cpp
libcxx/test/std/containers/sequences/array/array.cons/implicit_copy.pass.cpp
libcxx/test/std/containers/sequences/array/array.cons/initialization.pass.cpp
libcxx/test/std/containers/sequences/array/array.creation/to_array.pass.cpp
libcxx/test/std/containers/sequences/array/array.data/data.pass.cpp
libcxx/test/std/containers/sequences/array/array.data/data_const.pass.cpp
libcxx/test/std/containers/sequences/array/array.fill/fill.pass.cpp
libcxx/test/std/containers/sequences/array/array.size/size.pass.cpp
libcxx/test/std/containers/sequences/array/array.special/swap.pass.cpp
libcxx/test/std/containers/sequences/array/array.swap/swap.pass.cpp
libcxx/test/std/containers/sequences/array/array.swap/swap.verify.cpp
libcxx/test/std/containers/sequences/array/array.tuple/get.pass.cpp
libcxx/test/std/containers/sequences/array/array.tuple/get.verify.cpp
libcxx/test/std/containers/sequences/array/array.tuple/get_const.pass.cpp
libcxx/test/std/containers/sequences/array/array.tuple/get_const_rv.pass.cpp
libcxx/test/std/containers/sequences/array/array.tuple/get_rv.pass.cpp
libcxx/test/std/containers/sequences/array/array.tuple/tuple_element.pass.cpp
libcxx/test/std/containers/sequences/array/array.tuple/tuple_size.pass.cpp
libcxx/test/std/containers/sequences/array/array.zero/tested_elsewhere.pass.cpp
libcxx/test/std/containers/sequences/array/at.pass.cpp
libcxx/test/std/containers/sequences/array/at_const.pass.cpp
libcxx/test/std/containers/sequences/array/contiguous.pass.cpp
libcxx/test/std/containers/sequences/array/empty.pass.cpp
libcxx/test/std/containers/sequences/array/empty.verify.cpp
libcxx/test/std/containers/sequences/array/front_back.pass.cpp
libcxx/test/std/containers/sequences/array/front_back_const.pass.cpp
libcxx/test/std/containers/sequences/array/indexing.pass.cpp
libcxx/test/std/containers/sequences/array/indexing_const.pass.cpp
libcxx/test/std/containers/sequences/array/iterator_concept_conformance.compile.pass.cpp
libcxx/test/std/containers/sequences/array/iterators.pass.cpp
libcxx/test/std/containers/sequences/array/max_size.pass.cpp
libcxx/test/std/containers/sequences/array/range_concept_conformance.compile.pass.cpp
libcxx/test/std/containers/sequences/array/types.pass.cpp
libcxx/test/std/containers/sequences/deque/allocator_mismatch.verify.cpp
libcxx/test/std/containers/sequences/deque/compare.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.capacity/access.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.capacity/empty.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.capacity/empty.verify.cpp
libcxx/test/std/containers/sequences/deque/deque.capacity/max_size.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.capacity/resize_size.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.capacity/shrink_to_fit.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.capacity/size.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.cons/alloc.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.cons/assign_initializer_list.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.cons/assign_iter_iter.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.cons/assign_size_value.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.cons/copy.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.cons/copy_alloc.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.cons/deduct.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.cons/deduct.verify.cpp
libcxx/test/std/containers/sequences/deque/deque.cons/default.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.cons/default_noexcept.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.cons/dtor_noexcept.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.cons/initializer_list.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.cons/initializer_list_alloc.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.cons/iter_iter.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.cons/iter_iter_alloc.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.cons/move.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.cons/move_alloc.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.cons/move_assign.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.cons/move_noexcept.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.cons/op_equal.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.cons/op_equal_initializer_list.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.cons/size.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.cons/size_value.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.cons/size_value_alloc.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.erasure/erase.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.erasure/erase_if.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.modifiers/clear.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.modifiers/emplace.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.modifiers/emplace_back.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.modifiers/emplace_front.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.modifiers/erase_iter.invalidation.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.invalidation.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_iter_initializer_list.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_rvalue.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_size_value.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_value.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_back.invalidation.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_back.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_front.invalidation.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_front.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.modifiers/push_back.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.modifiers/push_back_exception_safety.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.modifiers/push_back_rvalue.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.modifiers/push_front.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.modifiers/push_front_exception_safety.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.special/copy.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.special/copy_backward.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.special/move.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.special/move_backward.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.special/swap.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.special/swap_noexcept.pass.cpp
libcxx/test/std/containers/sequences/deque/get_allocator.pass.cpp
libcxx/test/std/containers/sequences/deque/iterator_concept_conformance.compile.pass.cpp
libcxx/test/std/containers/sequences/deque/iterators.pass.cpp
libcxx/test/std/containers/sequences/deque/range_concept_conformance.compile.pass.cpp
libcxx/test/std/containers/sequences/deque/types.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/allocator_mismatch.verify.cpp
libcxx/test/std/containers/sequences/forwardlist/empty.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/empty.verify.cpp
libcxx/test/std/containers/sequences/forwardlist/exception_safety.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.access/front.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/alloc.compile.fail.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/alloc.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_copy.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_init.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_move.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_op_init.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_range.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_size_value.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/copy.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/copy_alloc.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/deduct.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/deduct.verify.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/default.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/default_noexcept.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/default_recursive.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/dtor_noexcept.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/init.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/init_alloc.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/move.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/move_alloc.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/move_noexcept.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/range.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/range_alloc.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/size.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/size_value.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/size_value_alloc.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.erasure/erase.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.erasure/erase_if.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.iter/before_begin.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.iter/iterator_concept_conformance.compile.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.iter/iterators.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/clear.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_after.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_front.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/erase_after_many.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/erase_after_one.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_const.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_init.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_range.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_rv.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_size_value.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_range_after.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/pop_front.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_const.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_exception_safety.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_rv.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/resize_size.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/resize_size_value.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/merge_rvalue.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/merge_rvalue_pred.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/remove.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/remove_if.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/reverse.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/sort.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/sort_pred.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_flist.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_one.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_range.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/unique.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/unique_pred.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.spec/equal.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.spec/member_swap.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.spec/non_member_swap.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.spec/relational.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.spec/swap_noexcept.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/get_allocator.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/incomplete.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/max_size.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/range_concept_conformance.compile.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/types.pass.cpp
libcxx/test/std/containers/sequences/from_range_sequence_containers.h
libcxx/test/std/containers/sequences/insert_range_sequence_containers.h
libcxx/test/std/containers/sequences/list/allocator_mismatch.verify.cpp
libcxx/test/std/containers/sequences/list/compare.pass.cpp
libcxx/test/std/containers/sequences/list/exception_safety.pass.cpp
libcxx/test/std/containers/sequences/list/get_allocator.pass.cpp
libcxx/test/std/containers/sequences/list/incomplete_type.pass.cpp
libcxx/test/std/containers/sequences/list/iterator_concept_conformance.compile.pass.cpp
libcxx/test/std/containers/sequences/list/iterators.pass.cpp
libcxx/test/std/containers/sequences/list/list.capacity/empty.pass.cpp
libcxx/test/std/containers/sequences/list/list.capacity/empty.verify.cpp
libcxx/test/std/containers/sequences/list/list.capacity/max_size.pass.cpp
libcxx/test/std/containers/sequences/list/list.capacity/resize_size.pass.cpp
libcxx/test/std/containers/sequences/list/list.capacity/resize_size_value.pass.cpp
libcxx/test/std/containers/sequences/list/list.capacity/size.pass.cpp
libcxx/test/std/containers/sequences/list/list.cons/assign_copy.pass.cpp
libcxx/test/std/containers/sequences/list/list.cons/assign_initializer_list.pass.cpp
libcxx/test/std/containers/sequences/list/list.cons/assign_move.pass.cpp
libcxx/test/std/containers/sequences/list/list.cons/copy.pass.cpp
libcxx/test/std/containers/sequences/list/list.cons/copy_alloc.pass.cpp
libcxx/test/std/containers/sequences/list/list.cons/deduct.pass.cpp
libcxx/test/std/containers/sequences/list/list.cons/deduct.verify.cpp
libcxx/test/std/containers/sequences/list/list.cons/default.pass.cpp
libcxx/test/std/containers/sequences/list/list.cons/default_noexcept.pass.cpp
libcxx/test/std/containers/sequences/list/list.cons/default_stack_alloc.pass.cpp
libcxx/test/std/containers/sequences/list/list.cons/dtor.pass.cpp
libcxx/test/std/containers/sequences/list/list.cons/dtor_noexcept.pass.cpp
libcxx/test/std/containers/sequences/list/list.cons/from_range.pass.cpp
libcxx/test/std/containers/sequences/list/list.cons/initializer_list.pass.cpp
libcxx/test/std/containers/sequences/list/list.cons/initializer_list_alloc.pass.cpp
libcxx/test/std/containers/sequences/list/list.cons/input_iterator.pass.cpp
libcxx/test/std/containers/sequences/list/list.cons/move.pass.cpp
libcxx/test/std/containers/sequences/list/list.cons/move_alloc.pass.cpp
libcxx/test/std/containers/sequences/list/list.cons/move_noexcept.pass.cpp
libcxx/test/std/containers/sequences/list/list.cons/op_equal_initializer_list.pass.cpp
libcxx/test/std/containers/sequences/list/list.cons/size_type.pass.cpp
libcxx/test/std/containers/sequences/list/list.cons/size_value_alloc.pass.cpp
libcxx/test/std/containers/sequences/list/list.erasure/erase.pass.cpp
libcxx/test/std/containers/sequences/list/list.erasure/erase_if.pass.cpp
libcxx/test/std/containers/sequences/list/list.modifiers/clear.pass.cpp
libcxx/test/std/containers/sequences/list/list.modifiers/emplace.pass.cpp
libcxx/test/std/containers/sequences/list/list.modifiers/emplace_back.pass.cpp
libcxx/test/std/containers/sequences/list/list.modifiers/emplace_front.pass.cpp
libcxx/test/std/containers/sequences/list/list.modifiers/erase_iter.pass.cpp
libcxx/test/std/containers/sequences/list/list.modifiers/erase_iter_iter.pass.cpp
libcxx/test/std/containers/sequences/list/list.modifiers/insert_iter_initializer_list.pass.cpp
libcxx/test/std/containers/sequences/list/list.modifiers/insert_iter_iter_iter.pass.cpp
libcxx/test/std/containers/sequences/list/list.modifiers/insert_iter_rvalue.pass.cpp
libcxx/test/std/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp
libcxx/test/std/containers/sequences/list/list.modifiers/insert_iter_value.pass.cpp
libcxx/test/std/containers/sequences/list/list.modifiers/pop_back.pass.cpp
libcxx/test/std/containers/sequences/list/list.modifiers/pop_front.pass.cpp
libcxx/test/std/containers/sequences/list/list.modifiers/push_back.pass.cpp
libcxx/test/std/containers/sequences/list/list.modifiers/push_back_exception_safety.pass.cpp
libcxx/test/std/containers/sequences/list/list.modifiers/push_back_rvalue.pass.cpp
libcxx/test/std/containers/sequences/list/list.modifiers/push_front.pass.cpp
libcxx/test/std/containers/sequences/list/list.modifiers/push_front_exception_safety.pass.cpp
libcxx/test/std/containers/sequences/list/list.modifiers/push_front_rvalue.pass.cpp
libcxx/test/std/containers/sequences/list/list.ops/merge.pass.cpp
libcxx/test/std/containers/sequences/list/list.ops/merge_comp.pass.cpp
libcxx/test/std/containers/sequences/list/list.ops/remove.pass.cpp
libcxx/test/std/containers/sequences/list/list.ops/remove_if.pass.cpp
libcxx/test/std/containers/sequences/list/list.ops/reverse.pass.cpp
libcxx/test/std/containers/sequences/list/list.ops/sort.pass.cpp
libcxx/test/std/containers/sequences/list/list.ops/sort_comp.pass.cpp
libcxx/test/std/containers/sequences/list/list.ops/splice_pos_list.pass.cpp
libcxx/test/std/containers/sequences/list/list.ops/splice_pos_list_iter.pass.cpp
libcxx/test/std/containers/sequences/list/list.ops/splice_pos_list_iter_iter.pass.cpp
libcxx/test/std/containers/sequences/list/list.ops/unique.pass.cpp
libcxx/test/std/containers/sequences/list/list.ops/unique_pred.pass.cpp
libcxx/test/std/containers/sequences/list/list.special/swap.pass.cpp
libcxx/test/std/containers/sequences/list/list.special/swap_noexcept.pass.cpp
libcxx/test/std/containers/sequences/list/range_concept_conformance.compile.pass.cpp
libcxx/test/std/containers/sequences/list/types.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/append_range.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/assign_copy.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/assign_initializer_list.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/assign_move.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/assign_range.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/capacity.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/compare.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/const_reference.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/construct_default.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/construct_iter_iter.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/construct_iter_iter_alloc.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/construct_size.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/construct_size_value.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/construct_size_value_alloc.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/copy.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/copy_alloc.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/default_noexcept.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/dtor_noexcept.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/emplace.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/emplace_back.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/empty.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/empty.verify.cpp
libcxx/test/std/containers/sequences/vector.bool/enabled_hash.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/erase_iter.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/erase_iter_iter.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/find.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/get_allocator.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/initializer_list.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/initializer_list_alloc.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/insert_iter_initializer_list.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/insert_iter_iter_iter.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/insert_iter_size_value.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/insert_iter_value.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/insert_range.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/iterator_concept_conformance.compile.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/iterators.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/move.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/move_alloc.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/move_assign_noexcept.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/move_noexcept.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/op_equal_initializer_list.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/push_back.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/range_concept_conformance.compile.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/reference.swap.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/reference/assign_bool.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/reference/assign_copy.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/reference/ctor_copy.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/reference/flip.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/reference/operator_bool.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/reserve.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/resize_size.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/resize_size_value.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/size.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/swap.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/swap_noexcept.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/types.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/vector_bool.pass.cpp
libcxx/test/std/containers/sequences/vector/access.pass.cpp
libcxx/test/std/containers/sequences/vector/addressof.compile.pass.cpp
libcxx/test/std/containers/sequences/vector/allocator_mismatch.verify.cpp
libcxx/test/std/containers/sequences/vector/compare.pass.cpp
libcxx/test/std/containers/sequences/vector/contiguous.pass.cpp
libcxx/test/std/containers/sequences/vector/get_allocator.pass.cpp
libcxx/test/std/containers/sequences/vector/iterator_concept_conformance.compile.pass.cpp
libcxx/test/std/containers/sequences/vector/iterators.pass.cpp
libcxx/test/std/containers/sequences/vector/range_concept_conformance.compile.pass.cpp
libcxx/test/std/containers/sequences/vector/reverse_iterators.pass.cpp
libcxx/test/std/containers/sequences/vector/types.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.capacity/capacity.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.capacity/empty.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.capacity/empty.verify.cpp
libcxx/test/std/containers/sequences/vector/vector.capacity/resize_size.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.capacity/resize_size_value.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.capacity/size.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.capacity/swap.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.cons/assign_copy.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.cons/assign_initializer_list.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.cons/assign_move.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.cons/assign_size_value.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.cons/construct_default.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.cons/construct_size.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.cons/construct_size_value.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.cons/construct_size_value_alloc.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.cons/copy.move_only.verify.cpp
libcxx/test/std/containers/sequences/vector/vector.cons/copy.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.cons/copy_alloc.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.cons/deduct.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.cons/default.recursive.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.cons/default_noexcept.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.cons/dtor_noexcept.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.cons/initializer_list.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.cons/initializer_list_alloc.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.cons/move.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.cons/move_alloc.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.cons/move_assign_noexcept.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.cons/move_noexcept.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.cons/op_equal_initializer_list.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.data/data.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.data/data_const.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.erasure/erase.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.erasure/erase_if.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.modifiers/append_range.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.modifiers/assign_range.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.modifiers/clear.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.modifiers/emplace.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.modifiers/emplace_back.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.modifiers/emplace_extra.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.modifiers/erase_iter.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_initializer_list.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_lvalue.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_rvalue.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_size_value.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_range.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.modifiers/pop_back.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.modifiers/push_back.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.modifiers/push_back_exception_safety.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.modifiers/push_back_rvalue.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.modifiers/resize_not_move_insertable.verify.cpp
libcxx/test/std/containers/sequences/vector/vector.special/swap.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.special/swap_noexcept.compile.pass.cpp
libcxx/test/std/containers/set_allocator_requirement_test_templates.h
libcxx/test/std/containers/test_compare.h
libcxx/test/std/containers/test_hash.h
libcxx/test/std/containers/unord/from_range_unordered_containers.h
libcxx/test/std/containers/unord/iterator_difference_type.pass.cpp
libcxx/test/std/containers/unord/unord.map/allocator_mismatch.verify.cpp
libcxx/test/std/containers/unord/unord.map/bucket.pass.cpp
libcxx/test/std/containers/unord/unord.map/bucket_count.pass.cpp
libcxx/test/std/containers/unord/unord.map/bucket_size.pass.cpp
libcxx/test/std/containers/unord/unord.map/compare.pass.cpp
libcxx/test/std/containers/unord/unord.map/contains.pass.cpp
libcxx/test/std/containers/unord/unord.map/contains.transparent.pass.cpp
libcxx/test/std/containers/unord/unord.map/count.pass.cpp
libcxx/test/std/containers/unord/unord.map/count.transparent.pass.cpp
libcxx/test/std/containers/unord/unord.map/empty.pass.cpp
libcxx/test/std/containers/unord/unord.map/empty.verify.cpp
libcxx/test/std/containers/unord/unord.map/eq.pass.cpp
libcxx/test/std/containers/unord/unord.map/equal_range.transparent.pass.cpp
libcxx/test/std/containers/unord/unord.map/equal_range_const.pass.cpp
libcxx/test/std/containers/unord/unord.map/equal_range_non_const.pass.cpp
libcxx/test/std/containers/unord/unord.map/erase_if.pass.cpp
libcxx/test/std/containers/unord/unord.map/find.transparent.pass.cpp
libcxx/test/std/containers/unord/unord.map/find_const.pass.cpp
libcxx/test/std/containers/unord/unord.map/find_non_const.pass.cpp
libcxx/test/std/containers/unord/unord.map/get_allocator.pass.cpp
libcxx/test/std/containers/unord/unord.map/incomplete_type.pass.cpp
libcxx/test/std/containers/unord/unord.map/iterator.operators.addressof.compile.pass.cpp
libcxx/test/std/containers/unord/unord.map/iterator_concept_conformance.compile.pass.cpp
libcxx/test/std/containers/unord/unord.map/iterators.pass.cpp
libcxx/test/std/containers/unord/unord.map/load_factor.pass.cpp
libcxx/test/std/containers/unord/unord.map/local_iterators.pass.cpp
libcxx/test/std/containers/unord/unord.map/max_bucket_count.pass.cpp
libcxx/test/std/containers/unord/unord.map/max_load_factor.pass.cpp
libcxx/test/std/containers/unord/unord.map/max_size.pass.cpp
libcxx/test/std/containers/unord/unord.map/range_concept_conformance.compile.pass.cpp
libcxx/test/std/containers/unord/unord.map/rehash.pass.cpp
libcxx/test/std/containers/unord/unord.map/reserve.pass.cpp
libcxx/test/std/containers/unord/unord.map/size.pass.cpp
libcxx/test/std/containers/unord/unord.map/swap_member.pass.cpp
libcxx/test/std/containers/unord/unord.map/types.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/allocator.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/assign_copy.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/assign_init.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/assign_move.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/compare_copy_constructible.compile.fail.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/copy.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/copy_alloc.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/deduct.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/deduct.verify.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/deduct_const.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/default.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/default_noexcept.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/dtor_noexcept.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/from_range.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/hash_copy_constructible.compile.fail.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/init.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/init_size.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_allocator.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_allocator.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal_allocator.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/iter_iter.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/iter_iter_size.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/iter_iter_size_allocator.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/iter_iter_size_hash.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/iter_iter_size_hash_allocator.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/iter_iter_size_hash_equal.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/iter_iter_size_hash_equal_allocator.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/move.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/move_alloc.addressof.compile.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/move_alloc.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/move_noexcept.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/size.compile.fail.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/size.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/size_allocator.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/size_hash.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/size_hash_allocator.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/size_hash_equal.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/size_hash_equal_allocator.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.elem/at.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.elem/index.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.elem/index_tuple.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/clear.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/emplace.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/emplace_hint.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/erase_const_iter.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/erase_key.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/erase_range.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/extract_iterator.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/extract_key.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_and_emplace_allocator_requirements.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_const_lvalue.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_hint_const_lvalue.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_hint_rvalue.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_init.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_iter_iter.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_node_type.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_node_type_hint.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_or_assign.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_range.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_rvalue.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/merge.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/try.emplace.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.swap/swap_noexcept.pass.cpp
libcxx/test/std/containers/unord/unord.map/unord.map.swap/swap_non_member.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/allocator_mismatch.verify.cpp
libcxx/test/std/containers/unord/unord.multimap/bucket.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/bucket_count.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/bucket_size.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/contains.transparent.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/count.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/count.transparent.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/empty.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/empty.verify.cpp
libcxx/test/std/containers/unord/unord.multimap/eq.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/equal_range.transparent.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/equal_range_const.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/equal_range_non_const.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/erase_if.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/find.transparent.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/find_const.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/find_non_const.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/get_allocator.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/incomplete.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/iterator_concept_conformance.compile.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/iterators.compile.fail.cpp
libcxx/test/std/containers/unord/unord.multimap/iterators.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/load_factor.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/local_iterators.compile.fail.cpp
libcxx/test/std/containers/unord/unord.multimap/local_iterators.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/max_bucket_count.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/max_load_factor.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/max_size.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/range_concept_conformance.compile.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/rehash.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/reserve.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/scary.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/size.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/swap_member.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/types.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/allocator.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_copy.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_init.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_move.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/compare_copy_constructible.compile.fail.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/copy.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/copy_alloc.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/deduct.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/deduct.verify.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/deduct_const.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/default.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/default_noexcept.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/dtor_noexcept.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/from_range.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/hash_copy_constructible.compile.fail.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_allocator.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_allocator.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal_allocator.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/iter_iter.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/iter_iter_size.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/iter_iter_size_allocator.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/iter_iter_size_hash.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/iter_iter_size_hash_allocator.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/iter_iter_size_hash_equal.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/iter_iter_size_hash_equal_allocator.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_alloc.addressof.compile.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_alloc.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_noexcept.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size.compile.fail.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_allocator.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash_allocator.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash_equal.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash_equal_allocator.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/clear.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_const_iter.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_key.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_range.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/extract_iterator.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/extract_key.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_allocator_requirements.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_const_lvalue.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_hint_const_lvalue.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_hint_rvalue.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_init.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_iter_iter.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_node_type.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_node_type_hint.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_range.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_rvalue.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/merge.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_noexcept.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_non_member.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/allocator_mismatch.verify.cpp
libcxx/test/std/containers/unord/unord.multiset/bucket.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/bucket_count.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/bucket_size.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/clear.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/contains.transparent.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/count.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/count.transparent.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/emplace.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/emplace_hint.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/empty.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/empty.verify.cpp
libcxx/test/std/containers/unord/unord.multiset/eq.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/equal_range.transparent.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/equal_range_const.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/equal_range_non_const.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/erase_const_iter.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/erase_if.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/erase_key.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/erase_range.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/extract_iterator.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/extract_key.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/find.transparent.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/find_const.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/find_non_const.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/get_allocator.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/incomplete.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/insert_const_lvalue.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/insert_emplace_allocator_requirements.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/insert_hint_const_lvalue.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/insert_hint_rvalue.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/insert_init.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/insert_iter_iter.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/insert_node_type.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/insert_node_type_hint.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/insert_range.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/insert_rvalue.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/iterator_concept_conformance.compile.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/iterators.compile.fail.cpp
libcxx/test/std/containers/unord/unord.multiset/iterators.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/load_factor.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/local_iterators.compile.fail.cpp
libcxx/test/std/containers/unord/unord.multiset/local_iterators.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/max_bucket_count.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/max_load_factor.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/max_size.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/merge.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/range_concept_conformance.compile.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/rehash.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/reserve.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/scary.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/size.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/swap_member.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/types.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/allocator.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_copy.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_init.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/compare_copy_constructible.compile.fail.cpp
libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/copy.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/copy_alloc.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/deduct.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/deduct.verify.cpp
libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/default.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/default_noexcept.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/dtor_noexcept.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/from_range.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/hash_copy_constructible.compile.fail.cpp
libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_allocator.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_allocator.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal_allocator.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/iter_iter.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/iter_iter_size.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/iter_iter_size_allocator.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/iter_iter_size_hash.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/iter_iter_size_hash_allocator.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/iter_iter_size_hash_equal.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/iter_iter_size_hash_equal_allocator.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_alloc.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_noexcept.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size.compile.fail.cpp
libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_allocator.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash_allocator.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash_equal.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash_equal_allocator.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_noexcept.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_non_member.pass.cpp
libcxx/test/std/containers/unord/unord.set/allocator_mismatch.verify.cpp
libcxx/test/std/containers/unord/unord.set/bucket.pass.cpp
libcxx/test/std/containers/unord/unord.set/bucket_count.pass.cpp
libcxx/test/std/containers/unord/unord.set/bucket_size.pass.cpp
libcxx/test/std/containers/unord/unord.set/clear.pass.cpp
libcxx/test/std/containers/unord/unord.set/contains.pass.cpp
libcxx/test/std/containers/unord/unord.set/contains.transparent.pass.cpp
libcxx/test/std/containers/unord/unord.set/count.pass.cpp
libcxx/test/std/containers/unord/unord.set/count.transparent.pass.cpp
libcxx/test/std/containers/unord/unord.set/emplace.pass.cpp
libcxx/test/std/containers/unord/unord.set/emplace_hint.pass.cpp
libcxx/test/std/containers/unord/unord.set/empty.pass.cpp
libcxx/test/std/containers/unord/unord.set/empty.verify.cpp
libcxx/test/std/containers/unord/unord.set/eq.pass.cpp
libcxx/test/std/containers/unord/unord.set/equal_range.transparent.pass.cpp
libcxx/test/std/containers/unord/unord.set/equal_range_const.pass.cpp
libcxx/test/std/containers/unord/unord.set/equal_range_non_const.pass.cpp
libcxx/test/std/containers/unord/unord.set/erase_const_iter.pass.cpp
libcxx/test/std/containers/unord/unord.set/erase_if.pass.cpp
libcxx/test/std/containers/unord/unord.set/erase_key.pass.cpp
libcxx/test/std/containers/unord/unord.set/erase_range.pass.cpp
libcxx/test/std/containers/unord/unord.set/extract_iterator.pass.cpp
libcxx/test/std/containers/unord/unord.set/extract_key.pass.cpp
libcxx/test/std/containers/unord/unord.set/find.transparent.pass.cpp
libcxx/test/std/containers/unord/unord.set/find_const.pass.cpp
libcxx/test/std/containers/unord/unord.set/find_non_const.pass.cpp
libcxx/test/std/containers/unord/unord.set/get_allocator.pass.cpp
libcxx/test/std/containers/unord/unord.set/incomplete.pass.cpp
libcxx/test/std/containers/unord/unord.set/insert_and_emplace_allocator_requirements.pass.cpp
libcxx/test/std/containers/unord/unord.set/insert_const_lvalue.pass.cpp
libcxx/test/std/containers/unord/unord.set/insert_hint_const_lvalue.pass.cpp
libcxx/test/std/containers/unord/unord.set/insert_hint_rvalue.pass.cpp
libcxx/test/std/containers/unord/unord.set/insert_init.pass.cpp
libcxx/test/std/containers/unord/unord.set/insert_iter_iter.pass.cpp
libcxx/test/std/containers/unord/unord.set/insert_node_type.pass.cpp
libcxx/test/std/containers/unord/unord.set/insert_node_type_hint.pass.cpp
libcxx/test/std/containers/unord/unord.set/insert_rvalue.pass.cpp
libcxx/test/std/containers/unord/unord.set/iterator.operators.addressof.compile.pass.cpp
libcxx/test/std/containers/unord/unord.set/iterator_concept_conformance.compile.pass.cpp
libcxx/test/std/containers/unord/unord.set/iterators.compile.fail.cpp
libcxx/test/std/containers/unord/unord.set/iterators.pass.cpp
libcxx/test/std/containers/unord/unord.set/load_factor.pass.cpp
libcxx/test/std/containers/unord/unord.set/local_iterators.compile.fail.cpp
libcxx/test/std/containers/unord/unord.set/local_iterators.pass.cpp
libcxx/test/std/containers/unord/unord.set/max_bucket_count.pass.cpp
libcxx/test/std/containers/unord/unord.set/max_load_factor.pass.cpp
libcxx/test/std/containers/unord/unord.set/max_size.pass.cpp
libcxx/test/std/containers/unord/unord.set/merge.pass.cpp
libcxx/test/std/containers/unord/unord.set/range_concept_conformance.compile.pass.cpp
libcxx/test/std/containers/unord/unord.set/rehash.pass.cpp
libcxx/test/std/containers/unord/unord.set/reserve.pass.cpp
libcxx/test/std/containers/unord/unord.set/size.pass.cpp
libcxx/test/std/containers/unord/unord.set/swap_member.pass.cpp
libcxx/test/std/containers/unord/unord.set/types.pass.cpp
libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/allocator.pass.cpp
libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/assign_copy.pass.cpp
libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/assign_init.pass.cpp
libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/assign_move.pass.cpp
libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/compare_copy_constructible.compile.fail.cpp
libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/copy.pass.cpp
libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/copy_alloc.pass.cpp
libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/deduct.pass.cpp
libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/deduct.verify.cpp
libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/default.pass.cpp
libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/default_noexcept.pass.cpp
libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/dtor_noexcept.pass.cpp
libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/from_range.pass.cpp
libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/hash_copy_constructible.compile.fail.cpp
libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/init.pass.cpp
libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/init_size.pass.cpp
libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_allocator.pass.cpp
libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash.pass.cpp
libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_allocator.pass.cpp
libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal.pass.cpp
libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal_allocator.pass.cpp
libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/iter_iter.pass.cpp
libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/iter_iter_size.pass.cpp
libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/iter_iter_size_allocator.pass.cpp
libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/iter_iter_size_hash.pass.cpp
libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/iter_iter_size_hash_allocator.pass.cpp
libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/iter_iter_size_hash_equal.pass.cpp
libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/iter_iter_size_hash_equal_allocator.pass.cpp
libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/move.pass.cpp
libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/move_alloc.pass.cpp
libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/move_noexcept.pass.cpp
libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/size.compile.fail.cpp
libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/size.pass.cpp
libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/size_allocator.pass.cpp
libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash.pass.cpp
libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash_allocator.pass.cpp
libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash_equal.pass.cpp
libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash_equal_allocator.pass.cpp
libcxx/test/std/containers/unord/unord.set/unord.set.swap/swap_noexcept.pass.cpp
libcxx/test/std/containers/unord/unord.set/unord.set.swap/swap_non_member.pass.cpp
libcxx/test/std/containers/views/mdspan/ConvertibleToIntegral.h
libcxx/test/std/containers/views/mdspan/MinimalElementType.h
libcxx/test/std/containers/views/mdspan/default_accessor/access.pass.cpp
libcxx/test/std/containers/views/mdspan/default_accessor/ctor.conversion.pass.cpp
libcxx/test/std/containers/views/mdspan/default_accessor/element_type.verify.cpp
libcxx/test/std/containers/views/mdspan/default_accessor/offset.pass.cpp
libcxx/test/std/containers/views/mdspan/default_accessor/types.pass.cpp
libcxx/test/std/containers/views/mdspan/layout_left/index_operator.pass.cpp
libcxx/test/std/containers/views/mdspan/layout_right/index_operator.pass.cpp
libcxx/test/std/containers/views/mdspan/mdspan/assign.pass.cpp
libcxx/test/std/containers/views/mdspan/mdspan/conversion.pass.cpp
libcxx/test/std/containers/views/mdspan/mdspan/conversion.verify.cpp
libcxx/test/std/containers/views/mdspan/mdspan/ctor.copy.pass.cpp
libcxx/test/std/containers/views/mdspan/mdspan/ctor.default.pass.cpp
libcxx/test/std/containers/views/mdspan/mdspan/ctor.dh_array.pass.cpp
libcxx/test/std/containers/views/mdspan/mdspan/ctor.dh_span.pass.cpp
libcxx/test/std/containers/views/mdspan/mdspan/types.pass.cpp
libcxx/test/std/containers/views/views.span/range_concept_conformance.compile.pass.cpp
libcxx/test/std/containers/views/views.span/span.cons/array.pass.cpp
libcxx/test/std/containers/views/views.span/span.cons/assign.pass.cpp
libcxx/test/std/containers/views/views.span/span.cons/deduct.pass.cpp
libcxx/test/std/containers/views/views.span/span.cons/default.pass.cpp
libcxx/test/std/containers/views/views.span/span.cons/iterator_len.pass.cpp
libcxx/test/std/containers/views/views.span/span.cons/iterator_sentinel.verify.cpp
libcxx/test/std/containers/views/views.span/span.cons/range.pass.cpp
libcxx/test/std/containers/views/views.span/span.cons/span.verify.cpp
libcxx/test/std/containers/views/views.span/span.cons/stdarray.pass.cpp
libcxx/test/std/containers/views/views.span/span.elem/back.pass.cpp
libcxx/test/std/containers/views/views.span/span.elem/data.pass.cpp
libcxx/test/std/containers/views/views.span/span.elem/front.pass.cpp
libcxx/test/std/containers/views/views.span/span.elem/op_idx.pass.cpp
libcxx/test/std/containers/views/views.span/span.iterators/begin.pass.cpp
libcxx/test/std/containers/views/views.span/span.iterators/end.pass.cpp
libcxx/test/std/containers/views/views.span/span.iterators/iterator_concept_conformance.compile.pass.cpp
libcxx/test/std/containers/views/views.span/span.iterators/rbegin.pass.cpp
libcxx/test/std/containers/views/views.span/span.iterators/rend.pass.cpp
libcxx/test/std/containers/views/views.span/span.objectrep/as_bytes.pass.cpp
libcxx/test/std/containers/views/views.span/span.objectrep/as_writable_bytes.pass.cpp
libcxx/test/std/containers/views/views.span/span.objectrep/as_writable_bytes.verify.cpp
libcxx/test/std/containers/views/views.span/span.obs/empty.pass.cpp
libcxx/test/std/containers/views/views.span/span.obs/size.pass.cpp
libcxx/test/std/containers/views/views.span/span.obs/size_bytes.pass.cpp
libcxx/test/std/containers/views/views.span/span.sub/first.pass.cpp
libcxx/test/std/containers/views/views.span/span.sub/first.verify.cpp
libcxx/test/std/containers/views/views.span/span.sub/last.pass.cpp
libcxx/test/std/containers/views/views.span/span.sub/last.verify.cpp
libcxx/test/std/containers/views/views.span/span.sub/subspan.pass.cpp
libcxx/test/std/containers/views/views.span/span.sub/subspan.verify.cpp
libcxx/test/std/containers/views/views.span/types.pass.cpp
Removed:
################################################################################
diff --git a/libcxx/test/libcxx/containers/associative/map/at.abort.pass.cpp b/libcxx/test/libcxx/containers/associative/map/at.abort.pass.cpp
index 36aa644abb596d1..d68ee5f5285991b 100644
--- a/libcxx/test/libcxx/containers/associative/map/at.abort.pass.cpp
+++ b/libcxx/test/libcxx/containers/associative/map/at.abort.pass.cpp
@@ -23,14 +23,11 @@
#include "test_macros.h"
-
-void exit_success(int) {
- std::_Exit(EXIT_SUCCESS);
-}
+void exit_success(int) { std::_Exit(EXIT_SUCCESS); }
int main(int, char**) {
- std::signal(SIGABRT, exit_success);
- std::map<int, int> map;
- map.at(1);
- return EXIT_FAILURE;
+ std::signal(SIGABRT, exit_success);
+ std::map<int, int> map;
+ map.at(1);
+ return EXIT_FAILURE;
}
diff --git a/libcxx/test/libcxx/containers/associative/map/at.const.abort.pass.cpp b/libcxx/test/libcxx/containers/associative/map/at.const.abort.pass.cpp
index f3dcca888f2b0d7..bbc8c7c4d726ac6 100644
--- a/libcxx/test/libcxx/containers/associative/map/at.const.abort.pass.cpp
+++ b/libcxx/test/libcxx/containers/associative/map/at.const.abort.pass.cpp
@@ -23,14 +23,11 @@
#include "test_macros.h"
-
-void exit_success(int) {
- std::_Exit(EXIT_SUCCESS);
-}
+void exit_success(int) { std::_Exit(EXIT_SUCCESS); }
int main(int, char**) {
- std::signal(SIGABRT, exit_success);
- std::map<int, int> const map;
- map.at(1);
- return EXIT_FAILURE;
+ std::signal(SIGABRT, exit_success);
+ std::map<int, int> const map;
+ map.at(1);
+ return EXIT_FAILURE;
}
diff --git a/libcxx/test/libcxx/containers/associative/map/find.modules.compile.pass.mm b/libcxx/test/libcxx/containers/associative/map/find.modules.compile.pass.mm
index 8b2f0057bcbc169..82b1c494c95666d 100644
--- a/libcxx/test/libcxx/containers/associative/map/find.modules.compile.pass.mm
+++ b/libcxx/test/libcxx/containers/associative/map/find.modules.compile.pass.mm
@@ -13,6 +13,4 @@
#include <map>
-void f(std::map<int, int> const& map, int key) {
- (void)map.find(key);
-}
+void f(std::map<int, int> const& map, int key) { (void)map.find(key); }
diff --git a/libcxx/test/libcxx/containers/associative/non_const_comparator.incomplete.verify.cpp b/libcxx/test/libcxx/containers/associative/non_const_comparator.incomplete.verify.cpp
index 3f7086f7e37f340..bae78ba4b78c68c 100644
--- a/libcxx/test/libcxx/containers/associative/non_const_comparator.incomplete.verify.cpp
+++ b/libcxx/test/libcxx/containers/associative/non_const_comparator.incomplete.verify.cpp
@@ -17,31 +17,33 @@
#include <map>
#include <functional>
-template <template <typename ...> class Container>
+template <template <typename...> class Container>
void test_set() {
- struct KeyBase { };
- struct KeyDerived; // derives from KeyBase, but incomplete at this point
+ struct KeyBase {};
+ struct KeyDerived; // derives from KeyBase, but incomplete at this point
// Name the type but don't instantiate it.
using C = Container<KeyDerived*, std::less<KeyBase*>>;
// Instantiate it but don't ODR use any members.
- typename C::value_type dummy; (void)dummy;
+ typename C::value_type dummy;
+ (void)dummy;
// Complete the types.
- struct KeyDerived : KeyBase { };
+ struct KeyDerived : KeyBase {};
C c; // ODR use it, which should be OK
}
-template <template <typename ...> class Container>
+template <template <typename...> class Container>
void test_map() {
- struct Value { };
- struct KeyBase { };
+ struct Value {};
+ struct KeyBase {};
struct KeyDerived;
using C = Container<KeyDerived*, Value, std::less<KeyBase*>>;
- typename C::value_type dummy; (void)dummy;
- struct KeyDerived : KeyBase { };
+ typename C::value_type dummy;
+ (void)dummy;
+ struct KeyDerived : KeyBase {};
C c;
}
diff --git a/libcxx/test/libcxx/containers/associative/tree_balance_after_insert.pass.cpp b/libcxx/test/libcxx/containers/associative/tree_balance_after_insert.pass.cpp
index a99f4fff1300e00..ccd84af44c3a5f2 100644
--- a/libcxx/test/libcxx/containers/associative/tree_balance_after_insert.pass.cpp
+++ b/libcxx/test/libcxx/containers/associative/tree_balance_after_insert.pass.cpp
@@ -20,1021 +20,315 @@
#include "test_macros.h"
-struct Node
-{
- Node* __left_;
- Node* __right_;
- Node* __parent_;
- bool __is_black_;
+struct Node {
+ Node* __left_;
+ Node* __right_;
+ Node* __parent_;
+ bool __is_black_;
- Node* __parent_unsafe() const { return __parent_; }
- void __set_parent(Node* x) { __parent_ = x;}
+ Node* __parent_unsafe() const { return __parent_; }
+ void __set_parent(Node* x) { __parent_ = x; }
- Node() : __left_(), __right_(), __parent_(), __is_black_() {}
+ Node() : __left_(), __right_(), __parent_(), __is_black_() {}
};
-void
-test1()
-{
- {
- Node root;
- Node a;
- Node b;
- Node c;
- Node d;
-
- root.__left_ = &c;
-
- c.__parent_ = &root;
- c.__left_ = &b;
- c.__right_ = &d;
- c.__is_black_ = true;
-
- b.__parent_ = &c;
- b.__left_ = &a;
- b.__right_ = 0;
- b.__is_black_ = false;
-
- d.__parent_ = &c;
- d.__left_ = 0;
- d.__right_ = 0;
- d.__is_black_ = false;
-
- a.__parent_ = &b;
- a.__left_ = 0;
- a.__right_ = 0;
- a.__is_black_ = false;
-
- std::__tree_balance_after_insert(root.__left_, &a);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__left_ == &c);
-
- assert(c.__parent_ == &root);
- assert(c.__left_ == &b);
- assert(c.__right_ == &d);
- assert(c.__is_black_ == true);
-
- assert(b.__parent_ == &c);
- assert(b.__left_ == &a);
- assert(b.__right_ == 0);
- assert(b.__is_black_ == true);
-
- assert(d.__parent_ == &c);
- assert(d.__left_ == 0);
- assert(d.__right_ == 0);
- assert(d.__is_black_ == true);
-
- assert(a.__parent_ == &b);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == false);
- }
- {
- Node root;
- Node a;
- Node b;
- Node c;
- Node d;
-
- root.__left_ = &c;
-
- c.__parent_ = &root;
- c.__left_ = &b;
- c.__right_ = &d;
- c.__is_black_ = true;
-
- b.__parent_ = &c;
- b.__left_ = 0;
- b.__right_ = &a;
- b.__is_black_ = false;
-
- d.__parent_ = &c;
- d.__left_ = 0;
- d.__right_ = 0;
- d.__is_black_ = false;
-
- a.__parent_ = &b;
- a.__left_ = 0;
- a.__right_ = 0;
- a.__is_black_ = false;
-
- std::__tree_balance_after_insert(root.__left_, &a);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__left_ == &c);
-
- assert(c.__parent_ == &root);
- assert(c.__left_ == &b);
- assert(c.__right_ == &d);
- assert(c.__is_black_ == true);
-
- assert(b.__parent_ == &c);
- assert(b.__left_ == 0);
- assert(b.__right_ == &a);
- assert(b.__is_black_ == true);
-
- assert(d.__parent_ == &c);
- assert(d.__left_ == 0);
- assert(d.__right_ == 0);
- assert(d.__is_black_ == true);
-
- assert(a.__parent_ == &b);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == false);
- }
- {
- Node root;
- Node a;
- Node b;
- Node c;
- Node d;
-
- root.__left_ = &c;
-
- c.__parent_ = &root;
- c.__left_ = &b;
- c.__right_ = &d;
- c.__is_black_ = true;
-
- b.__parent_ = &c;
- b.__left_ = 0;
- b.__right_ = 0;
- b.__is_black_ = false;
-
- d.__parent_ = &c;
- d.__left_ = &a;
- d.__right_ = 0;
- d.__is_black_ = false;
-
- a.__parent_ = &d;
- a.__left_ = 0;
- a.__right_ = 0;
- a.__is_black_ = false;
-
- std::__tree_balance_after_insert(root.__left_, &a);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__left_ == &c);
-
- assert(c.__parent_ == &root);
- assert(c.__left_ == &b);
- assert(c.__right_ == &d);
- assert(c.__is_black_ == true);
-
- assert(b.__parent_ == &c);
- assert(b.__left_ == 0);
- assert(b.__right_ == 0);
- assert(b.__is_black_ == true);
-
- assert(d.__parent_ == &c);
- assert(d.__left_ == &a);
- assert(d.__right_ == 0);
- assert(d.__is_black_ == true);
-
- assert(a.__parent_ == &d);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == false);
- }
- {
- Node root;
- Node a;
- Node b;
- Node c;
- Node d;
-
- root.__left_ = &c;
-
- c.__parent_ = &root;
- c.__left_ = &b;
- c.__right_ = &d;
- c.__is_black_ = true;
-
- b.__parent_ = &c;
- b.__left_ = 0;
- b.__right_ = 0;
- b.__is_black_ = false;
-
- d.__parent_ = &c;
- d.__left_ = 0;
- d.__right_ = &a;
- d.__is_black_ = false;
-
- a.__parent_ = &d;
- a.__left_ = 0;
- a.__right_ = 0;
- a.__is_black_ = false;
-
- std::__tree_balance_after_insert(root.__left_, &a);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__left_ == &c);
-
- assert(c.__parent_ == &root);
- assert(c.__left_ == &b);
- assert(c.__right_ == &d);
- assert(c.__is_black_ == true);
-
- assert(b.__parent_ == &c);
- assert(b.__left_ == 0);
- assert(b.__right_ == 0);
- assert(b.__is_black_ == true);
-
- assert(d.__parent_ == &c);
- assert(d.__left_ == 0);
- assert(d.__right_ == &a);
- assert(d.__is_black_ == true);
-
- assert(a.__parent_ == &d);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == false);
- }
- {
- Node root;
- Node a;
- Node b;
- Node c;
- Node d;
- Node e;
- Node f;
- Node g;
- Node h;
- Node i;
-
- root.__left_ = &c;
-
- c.__parent_ = &root;
- c.__left_ = &b;
- c.__right_ = &d;
- c.__is_black_ = true;
-
- b.__parent_ = &c;
- b.__left_ = &a;
- b.__right_ = &g;
- b.__is_black_ = false;
-
- d.__parent_ = &c;
- d.__left_ = &h;
- d.__right_ = &i;
- d.__is_black_ = false;
-
- a.__parent_ = &b;
- a.__left_ = &e;
- a.__right_ = &f;
- a.__is_black_ = false;
-
- e.__parent_ = &a;
- e.__is_black_ = true;
-
- f.__parent_ = &a;
- f.__is_black_ = true;
-
- g.__parent_ = &b;
- g.__is_black_ = true;
-
- h.__parent_ = &d;
- h.__is_black_ = true;
-
- i.__parent_ = &d;
- i.__is_black_ = true;
-
- std::__tree_balance_after_insert(root.__left_, &a);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__left_ == &c);
-
- assert(c.__parent_ == &root);
- assert(c.__left_ == &b);
- assert(c.__right_ == &d);
- assert(c.__is_black_ == true);
-
- assert(b.__parent_ == &c);
- assert(b.__left_ == &a);
- assert(b.__right_ == &g);
- assert(b.__is_black_ == true);
-
- assert(d.__parent_ == &c);
- assert(d.__left_ == &h);
- assert(d.__right_ == &i);
- assert(d.__is_black_ == true);
-
- assert(a.__parent_ == &b);
- assert(a.__left_ == &e);
- assert(a.__right_ == &f);
- assert(a.__is_black_ == false);
- }
- {
- Node root;
- Node a;
- Node b;
- Node c;
- Node d;
- Node e;
- Node f;
- Node g;
- Node h;
- Node i;
-
- root.__left_ = &c;
-
- c.__parent_ = &root;
- c.__left_ = &b;
- c.__right_ = &d;
- c.__is_black_ = true;
-
- b.__parent_ = &c;
- b.__left_ = &g;
- b.__right_ = &a;
- b.__is_black_ = false;
-
- d.__parent_ = &c;
- d.__left_ = &h;
- d.__right_ = &i;
- d.__is_black_ = false;
-
- a.__parent_ = &b;
- a.__left_ = &e;
- a.__right_ = &f;
- a.__is_black_ = false;
-
- e.__parent_ = &a;
- e.__is_black_ = true;
-
- f.__parent_ = &a;
- f.__is_black_ = true;
-
- g.__parent_ = &b;
- g.__is_black_ = true;
-
- h.__parent_ = &d;
- h.__is_black_ = true;
-
- i.__parent_ = &d;
- i.__is_black_ = true;
-
- std::__tree_balance_after_insert(root.__left_, &a);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__left_ == &c);
-
- assert(c.__parent_ == &root);
- assert(c.__left_ == &b);
- assert(c.__right_ == &d);
- assert(c.__is_black_ == true);
-
- assert(b.__parent_ == &c);
- assert(b.__left_ == &g);
- assert(b.__right_ == &a);
- assert(b.__is_black_ == true);
-
- assert(d.__parent_ == &c);
- assert(d.__left_ == &h);
- assert(d.__right_ == &i);
- assert(d.__is_black_ == true);
-
- assert(a.__parent_ == &b);
- assert(a.__left_ == &e);
- assert(a.__right_ == &f);
- assert(a.__is_black_ == false);
- }
- {
- Node root;
- Node a;
- Node b;
- Node c;
- Node d;
- Node e;
- Node f;
- Node g;
- Node h;
- Node i;
-
- root.__left_ = &c;
-
- c.__parent_ = &root;
- c.__left_ = &b;
- c.__right_ = &d;
- c.__is_black_ = true;
-
- b.__parent_ = &c;
- b.__left_ = &g;
- b.__right_ = &h;
- b.__is_black_ = false;
-
- d.__parent_ = &c;
- d.__left_ = &a;
- d.__right_ = &i;
- d.__is_black_ = false;
-
- a.__parent_ = &d;
- a.__left_ = &e;
- a.__right_ = &f;
- a.__is_black_ = false;
-
- e.__parent_ = &a;
- e.__is_black_ = true;
-
- f.__parent_ = &a;
- f.__is_black_ = true;
-
- g.__parent_ = &b;
- g.__is_black_ = true;
-
- h.__parent_ = &b;
- h.__is_black_ = true;
-
- i.__parent_ = &d;
- i.__is_black_ = true;
-
- std::__tree_balance_after_insert(root.__left_, &a);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__left_ == &c);
-
- assert(c.__parent_ == &root);
- assert(c.__left_ == &b);
- assert(c.__right_ == &d);
- assert(c.__is_black_ == true);
-
- assert(b.__parent_ == &c);
- assert(b.__left_ == &g);
- assert(b.__right_ == &h);
- assert(b.__is_black_ == true);
-
- assert(d.__parent_ == &c);
- assert(d.__left_ == &a);
- assert(d.__right_ == &i);
- assert(d.__is_black_ == true);
-
- assert(a.__parent_ == &d);
- assert(a.__left_ == &e);
- assert(a.__right_ == &f);
- assert(a.__is_black_ == false);
- }
- {
- Node root;
- Node a;
- Node b;
- Node c;
- Node d;
- Node e;
- Node f;
- Node g;
- Node h;
- Node i;
-
- root.__left_ = &c;
-
- c.__parent_ = &root;
- c.__left_ = &b;
- c.__right_ = &d;
- c.__is_black_ = true;
-
- b.__parent_ = &c;
- b.__left_ = &g;
- b.__right_ = &h;
- b.__is_black_ = false;
-
- d.__parent_ = &c;
- d.__left_ = &i;
- d.__right_ = &a;
- d.__is_black_ = false;
-
- a.__parent_ = &d;
- a.__left_ = &e;
- a.__right_ = &f;
- a.__is_black_ = false;
-
- e.__parent_ = &a;
- e.__is_black_ = true;
+void test1() {
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+ Node d;
- f.__parent_ = &a;
- f.__is_black_ = true;
-
- g.__parent_ = &b;
- g.__is_black_ = true;
-
- h.__parent_ = &b;
- h.__is_black_ = true;
-
- i.__parent_ = &d;
- i.__is_black_ = true;
+ root.__left_ = &c;
- std::__tree_balance_after_insert(root.__left_, &a);
-
- assert(std::__tree_invariant(root.__left_));
+ c.__parent_ = &root;
+ c.__left_ = &b;
+ c.__right_ = &d;
+ c.__is_black_ = true;
- assert(root.__left_ == &c);
-
- assert(c.__parent_ == &root);
- assert(c.__left_ == &b);
- assert(c.__right_ == &d);
- assert(c.__is_black_ == true);
-
- assert(b.__parent_ == &c);
- assert(b.__left_ == &g);
- assert(b.__right_ == &h);
- assert(b.__is_black_ == true);
+ b.__parent_ = &c;
+ b.__left_ = &a;
+ b.__right_ = 0;
+ b.__is_black_ = false;
- assert(d.__parent_ == &c);
- assert(d.__left_ == &i);
- assert(d.__right_ == &a);
- assert(d.__is_black_ == true);
-
- assert(a.__parent_ == &d);
- assert(a.__left_ == &e);
- assert(a.__right_ == &f);
- assert(a.__is_black_ == false);
- }
-}
+ d.__parent_ = &c;
+ d.__left_ = 0;
+ d.__right_ = 0;
+ d.__is_black_ = false;
-void
-test2()
-{
- {
- Node root;
- Node a;
- Node b;
- Node c;
-
- root.__left_ = &c;
-
- c.__parent_ = &root;
- c.__left_ = &a;
- c.__right_ = 0;
- c.__is_black_ = true;
-
- a.__parent_ = &c;
- a.__left_ = 0;
- a.__right_ = &b;
- a.__is_black_ = false;
-
- b.__parent_ = &a;
- b.__left_ = 0;
- b.__right_ = 0;
- b.__is_black_ = false;
-
- std::__tree_balance_after_insert(root.__left_, &b);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__left_ == &b);
-
- assert(c.__parent_ == &b);
- assert(c.__left_ == 0);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == false);
-
- assert(a.__parent_ == &b);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == false);
-
- assert(b.__parent_ == &root);
- assert(b.__left_ == &a);
- assert(b.__right_ == &c);
- assert(b.__is_black_ == true);
- }
- {
- Node root;
- Node a;
- Node b;
- Node c;
-
- root.__left_ = &a;
-
- a.__parent_ = &root;
- a.__left_ = 0;
- a.__right_ = &c;
- a.__is_black_ = true;
-
- c.__parent_ = &a;
- c.__left_ = &b;
- c.__right_ = 0;
- c.__is_black_ = false;
-
- b.__parent_ = &c;
- b.__left_ = 0;
- b.__right_ = 0;
- b.__is_black_ = false;
-
- std::__tree_balance_after_insert(root.__left_, &b);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__left_ == &b);
-
- assert(a.__parent_ == &b);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == false);
-
- assert(c.__parent_ == &b);
- assert(c.__left_ == 0);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == false);
-
- assert(b.__parent_ == &root);
- assert(b.__left_ == &a);
- assert(b.__right_ == &c);
- assert(b.__is_black_ == true);
- }
- {
- Node root;
- Node a;
- Node b;
- Node c;
- Node d;
- Node e;
- Node f;
- Node g;
-
- root.__left_ = &c;
-
- c.__parent_ = &root;
- c.__left_ = &a;
- c.__right_ = &g;
- c.__is_black_ = true;
+ a.__parent_ = &b;
+ a.__left_ = 0;
+ a.__right_ = 0;
+ a.__is_black_ = false;
- a.__parent_ = &c;
- a.__left_ = &d;
- a.__right_ = &b;
- a.__is_black_ = false;
-
- b.__parent_ = &a;
- b.__left_ = &e;
- b.__right_ = &f;
- b.__is_black_ = false;
-
- d.__parent_ = &a;
- d.__is_black_ = true;
-
- e.__parent_ = &b;
- e.__is_black_ = true;
-
- f.__parent_ = &b;
- f.__is_black_ = true;
-
- g.__parent_ = &c;
- g.__is_black_ = true;
-
- std::__tree_balance_after_insert(root.__left_, &b);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__left_ == &b);
-
- assert(c.__parent_ == &b);
- assert(c.__left_ == &f);
- assert(c.__right_ == &g);
- assert(c.__is_black_ == false);
-
- assert(a.__parent_ == &b);
- assert(a.__left_ == &d);
- assert(a.__right_ == &e);
- assert(a.__is_black_ == false);
-
- assert(b.__parent_ == &root);
- assert(b.__left_ == &a);
- assert(b.__right_ == &c);
- assert(b.__is_black_ == true);
+ std::__tree_balance_after_insert(root.__left_, &a);
- assert(d.__parent_ == &a);
- assert(d.__is_black_ == true);
+ assert(std::__tree_invariant(root.__left_));
- assert(e.__parent_ == &a);
- assert(e.__is_black_ == true);
+ assert(root.__left_ == &c);
- assert(f.__parent_ == &c);
- assert(f.__is_black_ == true);
+ assert(c.__parent_ == &root);
+ assert(c.__left_ == &b);
+ assert(c.__right_ == &d);
+ assert(c.__is_black_ == true);
- assert(g.__parent_ == &c);
- assert(g.__is_black_ == true);
- }
- {
- Node root;
- Node a;
- Node b;
- Node c;
- Node d;
- Node e;
- Node f;
- Node g;
+ assert(b.__parent_ == &c);
+ assert(b.__left_ == &a);
+ assert(b.__right_ == 0);
+ assert(b.__is_black_ == true);
- root.__left_ = &a;
-
- a.__parent_ = &root;
- a.__left_ = &d;
- a.__right_ = &c;
- a.__is_black_ = true;
-
- c.__parent_ = &a;
- c.__left_ = &b;
- c.__right_ = &g;
- c.__is_black_ = false;
+ assert(d.__parent_ == &c);
+ assert(d.__left_ == 0);
+ assert(d.__right_ == 0);
+ assert(d.__is_black_ == true);
- b.__parent_ = &c;
- b.__left_ = &e;
- b.__right_ = &f;
- b.__is_black_ = false;
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == false);
+ }
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+ Node d;
- d.__parent_ = &a;
- d.__is_black_ = true;
+ root.__left_ = &c;
- e.__parent_ = &b;
- e.__is_black_ = true;
+ c.__parent_ = &root;
+ c.__left_ = &b;
+ c.__right_ = &d;
+ c.__is_black_ = true;
- f.__parent_ = &b;
- f.__is_black_ = true;
+ b.__parent_ = &c;
+ b.__left_ = 0;
+ b.__right_ = &a;
+ b.__is_black_ = false;
- g.__parent_ = &c;
- g.__is_black_ = true;
+ d.__parent_ = &c;
+ d.__left_ = 0;
+ d.__right_ = 0;
+ d.__is_black_ = false;
- std::__tree_balance_after_insert(root.__left_, &b);
+ a.__parent_ = &b;
+ a.__left_ = 0;
+ a.__right_ = 0;
+ a.__is_black_ = false;
- assert(std::__tree_invariant(root.__left_));
+ std::__tree_balance_after_insert(root.__left_, &a);
- assert(root.__left_ == &b);
+ assert(std::__tree_invariant(root.__left_));
- assert(c.__parent_ == &b);
- assert(c.__left_ == &f);
- assert(c.__right_ == &g);
- assert(c.__is_black_ == false);
+ assert(root.__left_ == &c);
- assert(a.__parent_ == &b);
- assert(a.__left_ == &d);
- assert(a.__right_ == &e);
- assert(a.__is_black_ == false);
+ assert(c.__parent_ == &root);
+ assert(c.__left_ == &b);
+ assert(c.__right_ == &d);
+ assert(c.__is_black_ == true);
- assert(b.__parent_ == &root);
- assert(b.__left_ == &a);
- assert(b.__right_ == &c);
- assert(b.__is_black_ == true);
+ assert(b.__parent_ == &c);
+ assert(b.__left_ == 0);
+ assert(b.__right_ == &a);
+ assert(b.__is_black_ == true);
- assert(d.__parent_ == &a);
- assert(d.__is_black_ == true);
+ assert(d.__parent_ == &c);
+ assert(d.__left_ == 0);
+ assert(d.__right_ == 0);
+ assert(d.__is_black_ == true);
- assert(e.__parent_ == &a);
- assert(e.__is_black_ == true);
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == false);
+ }
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+ Node d;
- assert(f.__parent_ == &c);
- assert(f.__is_black_ == true);
+ root.__left_ = &c;
- assert(g.__parent_ == &c);
- assert(g.__is_black_ == true);
- }
-}
+ c.__parent_ = &root;
+ c.__left_ = &b;
+ c.__right_ = &d;
+ c.__is_black_ = true;
-void
-test3()
-{
- {
- Node root;
- Node a;
- Node b;
- Node c;
-
- root.__left_ = &c;
-
- c.__parent_ = &root;
- c.__left_ = &b;
- c.__right_ = 0;
- c.__is_black_ = true;
-
- b.__parent_ = &c;
- b.__left_ = &a;
- b.__right_ = 0;
- b.__is_black_ = false;
-
- a.__parent_ = &b;
- a.__left_ = 0;
- a.__right_ = 0;
- a.__is_black_ = false;
-
- std::__tree_balance_after_insert(root.__left_, &a);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__left_ == &b);
-
- assert(c.__parent_ == &b);
- assert(c.__left_ == 0);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == false);
-
- assert(a.__parent_ == &b);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == false);
-
- assert(b.__parent_ == &root);
- assert(b.__left_ == &a);
- assert(b.__right_ == &c);
- assert(b.__is_black_ == true);
- }
- {
- Node root;
- Node a;
- Node b;
- Node c;
-
- root.__left_ = &a;
-
- a.__parent_ = &root;
- a.__left_ = 0;
- a.__right_ = &b;
- a.__is_black_ = true;
-
- b.__parent_ = &a;
- b.__left_ = 0;
- b.__right_ = &c;
- b.__is_black_ = false;
-
- c.__parent_ = &b;
- c.__left_ = 0;
- c.__right_ = 0;
- c.__is_black_ = false;
-
- std::__tree_balance_after_insert(root.__left_, &c);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__left_ == &b);
-
- assert(a.__parent_ == &b);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == false);
-
- assert(c.__parent_ == &b);
- assert(c.__left_ == 0);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == false);
-
- assert(b.__parent_ == &root);
- assert(b.__left_ == &a);
- assert(b.__right_ == &c);
- assert(b.__is_black_ == true);
- }
- {
- Node root;
- Node a;
- Node b;
- Node c;
- Node d;
- Node e;
- Node f;
- Node g;
-
- root.__left_ = &c;
-
- c.__parent_ = &root;
- c.__left_ = &b;
- c.__right_ = &g;
- c.__is_black_ = true;
+ b.__parent_ = &c;
+ b.__left_ = 0;
+ b.__right_ = 0;
+ b.__is_black_ = false;
- b.__parent_ = &c;
- b.__left_ = &a;
- b.__right_ = &f;
- b.__is_black_ = false;
-
- a.__parent_ = &b;
- a.__left_ = &d;
- a.__right_ = &e;
- a.__is_black_ = false;
-
- d.__parent_ = &a;
- d.__is_black_ = true;
-
- e.__parent_ = &a;
- e.__is_black_ = true;
-
- f.__parent_ = &b;
- f.__is_black_ = true;
-
- g.__parent_ = &c;
- g.__is_black_ = true;
-
- std::__tree_balance_after_insert(root.__left_, &a);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__left_ == &b);
-
- assert(c.__parent_ == &b);
- assert(c.__left_ == &f);
- assert(c.__right_ == &g);
- assert(c.__is_black_ == false);
-
- assert(a.__parent_ == &b);
- assert(a.__left_ == &d);
- assert(a.__right_ == &e);
- assert(a.__is_black_ == false);
-
- assert(b.__parent_ == &root);
- assert(b.__left_ == &a);
- assert(b.__right_ == &c);
- assert(b.__is_black_ == true);
+ d.__parent_ = &c;
+ d.__left_ = &a;
+ d.__right_ = 0;
+ d.__is_black_ = false;
- assert(d.__parent_ == &a);
- assert(d.__is_black_ == true);
+ a.__parent_ = &d;
+ a.__left_ = 0;
+ a.__right_ = 0;
+ a.__is_black_ = false;
- assert(e.__parent_ == &a);
- assert(e.__is_black_ == true);
+ std::__tree_balance_after_insert(root.__left_, &a);
- assert(f.__parent_ == &c);
- assert(f.__is_black_ == true);
+ assert(std::__tree_invariant(root.__left_));
- assert(g.__parent_ == &c);
- assert(g.__is_black_ == true);
- }
- {
- Node root;
- Node a;
- Node b;
- Node c;
- Node d;
- Node e;
- Node f;
- Node g;
+ assert(root.__left_ == &c);
- root.__left_ = &a;
-
- a.__parent_ = &root;
- a.__left_ = &d;
- a.__right_ = &b;
- a.__is_black_ = true;
-
- b.__parent_ = &a;
- b.__left_ = &e;
- b.__right_ = &c;
- b.__is_black_ = false;
+ assert(c.__parent_ == &root);
+ assert(c.__left_ == &b);
+ assert(c.__right_ == &d);
+ assert(c.__is_black_ == true);
- c.__parent_ = &b;
- c.__left_ = &f;
- c.__right_ = &g;
- c.__is_black_ = false;
+ assert(b.__parent_ == &c);
+ assert(b.__left_ == 0);
+ assert(b.__right_ == 0);
+ assert(b.__is_black_ == true);
- d.__parent_ = &a;
- d.__is_black_ = true;
+ assert(d.__parent_ == &c);
+ assert(d.__left_ == &a);
+ assert(d.__right_ == 0);
+ assert(d.__is_black_ == true);
- e.__parent_ = &b;
- e.__is_black_ = true;
+ assert(a.__parent_ == &d);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == false);
+ }
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+ Node d;
- f.__parent_ = &c;
- f.__is_black_ = true;
+ root.__left_ = &c;
- g.__parent_ = &c;
- g.__is_black_ = true;
+ c.__parent_ = &root;
+ c.__left_ = &b;
+ c.__right_ = &d;
+ c.__is_black_ = true;
- std::__tree_balance_after_insert(root.__left_, &c);
+ b.__parent_ = &c;
+ b.__left_ = 0;
+ b.__right_ = 0;
+ b.__is_black_ = false;
- assert(std::__tree_invariant(root.__left_));
+ d.__parent_ = &c;
+ d.__left_ = 0;
+ d.__right_ = &a;
+ d.__is_black_ = false;
- assert(root.__left_ == &b);
+ a.__parent_ = &d;
+ a.__left_ = 0;
+ a.__right_ = 0;
+ a.__is_black_ = false;
- assert(c.__parent_ == &b);
- assert(c.__left_ == &f);
- assert(c.__right_ == &g);
- assert(c.__is_black_ == false);
+ std::__tree_balance_after_insert(root.__left_, &a);
- assert(a.__parent_ == &b);
- assert(a.__left_ == &d);
- assert(a.__right_ == &e);
- assert(a.__is_black_ == false);
+ assert(std::__tree_invariant(root.__left_));
- assert(b.__parent_ == &root);
- assert(b.__left_ == &a);
- assert(b.__right_ == &c);
- assert(b.__is_black_ == true);
+ assert(root.__left_ == &c);
- assert(d.__parent_ == &a);
- assert(d.__is_black_ == true);
+ assert(c.__parent_ == &root);
+ assert(c.__left_ == &b);
+ assert(c.__right_ == &d);
+ assert(c.__is_black_ == true);
- assert(e.__parent_ == &a);
- assert(e.__is_black_ == true);
+ assert(b.__parent_ == &c);
+ assert(b.__left_ == 0);
+ assert(b.__right_ == 0);
+ assert(b.__is_black_ == true);
- assert(f.__parent_ == &c);
- assert(f.__is_black_ == true);
+ assert(d.__parent_ == &c);
+ assert(d.__left_ == 0);
+ assert(d.__right_ == &a);
+ assert(d.__is_black_ == true);
- assert(g.__parent_ == &c);
- assert(g.__is_black_ == true);
- }
-}
+ assert(a.__parent_ == &d);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == false);
+ }
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+ Node d;
+ Node e;
+ Node f;
+ Node g;
+ Node h;
+ Node i;
+
+ root.__left_ = &c;
+
+ c.__parent_ = &root;
+ c.__left_ = &b;
+ c.__right_ = &d;
+ c.__is_black_ = true;
+
+ b.__parent_ = &c;
+ b.__left_ = &a;
+ b.__right_ = &g;
+ b.__is_black_ = false;
+
+ d.__parent_ = &c;
+ d.__left_ = &h;
+ d.__right_ = &i;
+ d.__is_black_ = false;
+
+ a.__parent_ = &b;
+ a.__left_ = &e;
+ a.__right_ = &f;
+ a.__is_black_ = false;
+
+ e.__parent_ = &a;
+ e.__is_black_ = true;
+
+ f.__parent_ = &a;
+ f.__is_black_ = true;
+
+ g.__parent_ = &b;
+ g.__is_black_ = true;
+
+ h.__parent_ = &d;
+ h.__is_black_ = true;
+
+ i.__parent_ = &d;
+ i.__is_black_ = true;
+
+ std::__tree_balance_after_insert(root.__left_, &a);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__left_ == &c);
-void
-test4()
-{
+ assert(c.__parent_ == &root);
+ assert(c.__left_ == &b);
+ assert(c.__right_ == &d);
+ assert(c.__is_black_ == true);
+
+ assert(b.__parent_ == &c);
+ assert(b.__left_ == &a);
+ assert(b.__right_ == &g);
+ assert(b.__is_black_ == true);
+
+ assert(d.__parent_ == &c);
+ assert(d.__left_ == &h);
+ assert(d.__right_ == &i);
+ assert(d.__is_black_ == true);
+
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == &e);
+ assert(a.__right_ == &f);
+ assert(a.__is_black_ == false);
+ }
+ {
Node root;
Node a;
Node b;
@@ -1044,57 +338,257 @@ test4()
Node f;
Node g;
Node h;
+ Node i;
- root.__left_ = &a;
- a.__parent_ = &root;
+ root.__left_ = &c;
+
+ c.__parent_ = &root;
+ c.__left_ = &b;
+ c.__right_ = &d;
+ c.__is_black_ = true;
+
+ b.__parent_ = &c;
+ b.__left_ = &g;
+ b.__right_ = &a;
+ b.__is_black_ = false;
+
+ d.__parent_ = &c;
+ d.__left_ = &h;
+ d.__right_ = &i;
+ d.__is_black_ = false;
+
+ a.__parent_ = &b;
+ a.__left_ = &e;
+ a.__right_ = &f;
+ a.__is_black_ = false;
+
+ e.__parent_ = &a;
+ e.__is_black_ = true;
+
+ f.__parent_ = &a;
+ f.__is_black_ = true;
+
+ g.__parent_ = &b;
+ g.__is_black_ = true;
+
+ h.__parent_ = &d;
+ h.__is_black_ = true;
+
+ i.__parent_ = &d;
+ i.__is_black_ = true;
std::__tree_balance_after_insert(root.__left_, &a);
assert(std::__tree_invariant(root.__left_));
- assert(root.__parent_ == 0);
- assert(root.__left_ == &a);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
+ assert(root.__left_ == &c);
- assert(a.__parent_ == &root);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == true);
+ assert(c.__parent_ == &root);
+ assert(c.__left_ == &b);
+ assert(c.__right_ == &d);
+ assert(c.__is_black_ == true);
- a.__right_ = &b;
- b.__parent_ = &a;
+ assert(b.__parent_ == &c);
+ assert(b.__left_ == &g);
+ assert(b.__right_ == &a);
+ assert(b.__is_black_ == true);
- std::__tree_balance_after_insert(root.__left_, &b);
+ assert(d.__parent_ == &c);
+ assert(d.__left_ == &h);
+ assert(d.__right_ == &i);
+ assert(d.__is_black_ == true);
+
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == &e);
+ assert(a.__right_ == &f);
+ assert(a.__is_black_ == false);
+ }
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+ Node d;
+ Node e;
+ Node f;
+ Node g;
+ Node h;
+ Node i;
+
+ root.__left_ = &c;
+
+ c.__parent_ = &root;
+ c.__left_ = &b;
+ c.__right_ = &d;
+ c.__is_black_ = true;
+
+ b.__parent_ = &c;
+ b.__left_ = &g;
+ b.__right_ = &h;
+ b.__is_black_ = false;
+
+ d.__parent_ = &c;
+ d.__left_ = &a;
+ d.__right_ = &i;
+ d.__is_black_ = false;
+
+ a.__parent_ = &d;
+ a.__left_ = &e;
+ a.__right_ = &f;
+ a.__is_black_ = false;
+
+ e.__parent_ = &a;
+ e.__is_black_ = true;
+
+ f.__parent_ = &a;
+ f.__is_black_ = true;
+
+ g.__parent_ = &b;
+ g.__is_black_ = true;
+
+ h.__parent_ = &b;
+ h.__is_black_ = true;
+
+ i.__parent_ = &d;
+ i.__is_black_ = true;
+
+ std::__tree_balance_after_insert(root.__left_, &a);
assert(std::__tree_invariant(root.__left_));
- assert(root.__parent_ == 0);
- assert(root.__left_ == &a);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
+ assert(root.__left_ == &c);
- assert(a.__parent_ == &root);
- assert(a.__left_ == 0);
- assert(a.__right_ == &b);
- assert(a.__is_black_ == true);
+ assert(c.__parent_ == &root);
+ assert(c.__left_ == &b);
+ assert(c.__right_ == &d);
+ assert(c.__is_black_ == true);
- assert(b.__parent_ == &a);
- assert(b.__left_ == 0);
- assert(b.__right_ == 0);
- assert(b.__is_black_ == false);
+ assert(b.__parent_ == &c);
+ assert(b.__left_ == &g);
+ assert(b.__right_ == &h);
+ assert(b.__is_black_ == true);
- b.__right_ = &c;
- c.__parent_ = &b;
+ assert(d.__parent_ == &c);
+ assert(d.__left_ == &a);
+ assert(d.__right_ == &i);
+ assert(d.__is_black_ == true);
- std::__tree_balance_after_insert(root.__left_, &c);
+ assert(a.__parent_ == &d);
+ assert(a.__left_ == &e);
+ assert(a.__right_ == &f);
+ assert(a.__is_black_ == false);
+ }
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+ Node d;
+ Node e;
+ Node f;
+ Node g;
+ Node h;
+ Node i;
+
+ root.__left_ = &c;
+
+ c.__parent_ = &root;
+ c.__left_ = &b;
+ c.__right_ = &d;
+ c.__is_black_ = true;
+
+ b.__parent_ = &c;
+ b.__left_ = &g;
+ b.__right_ = &h;
+ b.__is_black_ = false;
+
+ d.__parent_ = &c;
+ d.__left_ = &i;
+ d.__right_ = &a;
+ d.__is_black_ = false;
+
+ a.__parent_ = &d;
+ a.__left_ = &e;
+ a.__right_ = &f;
+ a.__is_black_ = false;
+
+ e.__parent_ = &a;
+ e.__is_black_ = true;
+
+ f.__parent_ = &a;
+ f.__is_black_ = true;
+
+ g.__parent_ = &b;
+ g.__is_black_ = true;
+
+ h.__parent_ = &b;
+ h.__is_black_ = true;
+
+ i.__parent_ = &d;
+ i.__is_black_ = true;
+
+ std::__tree_balance_after_insert(root.__left_, &a);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__left_ == &c);
+
+ assert(c.__parent_ == &root);
+ assert(c.__left_ == &b);
+ assert(c.__right_ == &d);
+ assert(c.__is_black_ == true);
+
+ assert(b.__parent_ == &c);
+ assert(b.__left_ == &g);
+ assert(b.__right_ == &h);
+ assert(b.__is_black_ == true);
+
+ assert(d.__parent_ == &c);
+ assert(d.__left_ == &i);
+ assert(d.__right_ == &a);
+ assert(d.__is_black_ == true);
+
+ assert(a.__parent_ == &d);
+ assert(a.__left_ == &e);
+ assert(a.__right_ == &f);
+ assert(a.__is_black_ == false);
+ }
+}
+
+void test2() {
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+
+ root.__left_ = &c;
+
+ c.__parent_ = &root;
+ c.__left_ = &a;
+ c.__right_ = 0;
+ c.__is_black_ = true;
+
+ a.__parent_ = &c;
+ a.__left_ = 0;
+ a.__right_ = &b;
+ a.__is_black_ = false;
+
+ b.__parent_ = &a;
+ b.__left_ = 0;
+ b.__right_ = 0;
+ b.__is_black_ = false;
+
+ std::__tree_balance_after_insert(root.__left_, &b);
assert(std::__tree_invariant(root.__left_));
- assert(root.__parent_ == 0);
assert(root.__left_ == &b);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
+
+ assert(c.__parent_ == &b);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == false);
assert(a.__parent_ == &b);
assert(a.__left_ == 0);
@@ -1105,226 +599,359 @@ test4()
assert(b.__left_ == &a);
assert(b.__right_ == &c);
assert(b.__is_black_ == true);
+ }
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
- assert(c.__parent_ == &b);
- assert(c.__left_ == 0);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == false);
+ root.__left_ = &a;
+
+ a.__parent_ = &root;
+ a.__left_ = 0;
+ a.__right_ = &c;
+ a.__is_black_ = true;
- c.__right_ = &d;
- d.__parent_ = &c;
+ c.__parent_ = &a;
+ c.__left_ = &b;
+ c.__right_ = 0;
+ c.__is_black_ = false;
- std::__tree_balance_after_insert(root.__left_, &d);
+ b.__parent_ = &c;
+ b.__left_ = 0;
+ b.__right_ = 0;
+ b.__is_black_ = false;
+
+ std::__tree_balance_after_insert(root.__left_, &b);
assert(std::__tree_invariant(root.__left_));
- assert(root.__parent_ == 0);
assert(root.__left_ == &b);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
assert(a.__parent_ == &b);
assert(a.__left_ == 0);
assert(a.__right_ == 0);
- assert(a.__is_black_ == true);
+ assert(a.__is_black_ == false);
+
+ assert(c.__parent_ == &b);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == false);
assert(b.__parent_ == &root);
assert(b.__left_ == &a);
assert(b.__right_ == &c);
assert(b.__is_black_ == true);
+ }
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+ Node d;
+ Node e;
+ Node f;
+ Node g;
- assert(c.__parent_ == &b);
- assert(c.__left_ == 0);
- assert(c.__right_ == &d);
- assert(c.__is_black_ == true);
+ root.__left_ = &c;
- assert(d.__parent_ == &c);
- assert(d.__left_ == 0);
- assert(d.__right_ == 0);
- assert(d.__is_black_ == false);
+ c.__parent_ = &root;
+ c.__left_ = &a;
+ c.__right_ = &g;
+ c.__is_black_ = true;
- d.__right_ = &e;
- e.__parent_ = &d;
+ a.__parent_ = &c;
+ a.__left_ = &d;
+ a.__right_ = &b;
+ a.__is_black_ = false;
- std::__tree_balance_after_insert(root.__left_, &e);
+ b.__parent_ = &a;
+ b.__left_ = &e;
+ b.__right_ = &f;
+ b.__is_black_ = false;
+
+ d.__parent_ = &a;
+ d.__is_black_ = true;
+
+ e.__parent_ = &b;
+ e.__is_black_ = true;
+
+ f.__parent_ = &b;
+ f.__is_black_ = true;
+
+ g.__parent_ = &c;
+ g.__is_black_ = true;
+
+ std::__tree_balance_after_insert(root.__left_, &b);
assert(std::__tree_invariant(root.__left_));
- assert(root.__parent_ == 0);
assert(root.__left_ == &b);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
+
+ assert(c.__parent_ == &b);
+ assert(c.__left_ == &f);
+ assert(c.__right_ == &g);
+ assert(c.__is_black_ == false);
+
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == &d);
+ assert(a.__right_ == &e);
+ assert(a.__is_black_ == false);
assert(b.__parent_ == &root);
assert(b.__left_ == &a);
- assert(b.__right_ == &d);
+ assert(b.__right_ == &c);
assert(b.__is_black_ == true);
- assert(a.__parent_ == &b);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == true);
-
- assert(d.__parent_ == &b);
- assert(d.__left_ == &c);
- assert(d.__right_ == &e);
+ assert(d.__parent_ == &a);
assert(d.__is_black_ == true);
- assert(c.__parent_ == &d);
- assert(c.__left_ == 0);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == false);
+ assert(e.__parent_ == &a);
+ assert(e.__is_black_ == true);
- assert(e.__parent_ == &d);
- assert(e.__left_ == 0);
- assert(e.__right_ == 0);
- assert(e.__is_black_ == false);
+ assert(f.__parent_ == &c);
+ assert(f.__is_black_ == true);
- e.__right_ = &f;
- f.__parent_ = &e;
+ assert(g.__parent_ == &c);
+ assert(g.__is_black_ == true);
+ }
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+ Node d;
+ Node e;
+ Node f;
+ Node g;
- std::__tree_balance_after_insert(root.__left_, &f);
+ root.__left_ = &a;
+
+ a.__parent_ = &root;
+ a.__left_ = &d;
+ a.__right_ = &c;
+ a.__is_black_ = true;
+
+ c.__parent_ = &a;
+ c.__left_ = &b;
+ c.__right_ = &g;
+ c.__is_black_ = false;
+
+ b.__parent_ = &c;
+ b.__left_ = &e;
+ b.__right_ = &f;
+ b.__is_black_ = false;
+
+ d.__parent_ = &a;
+ d.__is_black_ = true;
+
+ e.__parent_ = &b;
+ e.__is_black_ = true;
+
+ f.__parent_ = &b;
+ f.__is_black_ = true;
+
+ g.__parent_ = &c;
+ g.__is_black_ = true;
+
+ std::__tree_balance_after_insert(root.__left_, &b);
assert(std::__tree_invariant(root.__left_));
- assert(root.__parent_ == 0);
assert(root.__left_ == &b);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
+
+ assert(c.__parent_ == &b);
+ assert(c.__left_ == &f);
+ assert(c.__right_ == &g);
+ assert(c.__is_black_ == false);
+
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == &d);
+ assert(a.__right_ == &e);
+ assert(a.__is_black_ == false);
assert(b.__parent_ == &root);
assert(b.__left_ == &a);
- assert(b.__right_ == &d);
+ assert(b.__right_ == &c);
assert(b.__is_black_ == true);
- assert(a.__parent_ == &b);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == true);
+ assert(d.__parent_ == &a);
+ assert(d.__is_black_ == true);
- assert(d.__parent_ == &b);
- assert(d.__left_ == &c);
- assert(d.__right_ == &e);
- assert(d.__is_black_ == false);
+ assert(e.__parent_ == &a);
+ assert(e.__is_black_ == true);
- assert(c.__parent_ == &d);
- assert(c.__left_ == 0);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == true);
+ assert(f.__parent_ == &c);
+ assert(f.__is_black_ == true);
- assert(e.__parent_ == &d);
- assert(e.__left_ == 0);
- assert(e.__right_ == &f);
- assert(e.__is_black_ == true);
+ assert(g.__parent_ == &c);
+ assert(g.__is_black_ == true);
+ }
+}
- assert(f.__parent_ == &e);
- assert(f.__left_ == 0);
- assert(f.__right_ == 0);
- assert(f.__is_black_ == false);
+void test3() {
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+
+ root.__left_ = &c;
+
+ c.__parent_ = &root;
+ c.__left_ = &b;
+ c.__right_ = 0;
+ c.__is_black_ = true;
- f.__right_ = &g;
- g.__parent_ = &f;
+ b.__parent_ = &c;
+ b.__left_ = &a;
+ b.__right_ = 0;
+ b.__is_black_ = false;
- std::__tree_balance_after_insert(root.__left_, &g);
+ a.__parent_ = &b;
+ a.__left_ = 0;
+ a.__right_ = 0;
+ a.__is_black_ = false;
+
+ std::__tree_balance_after_insert(root.__left_, &a);
assert(std::__tree_invariant(root.__left_));
- assert(root.__parent_ == 0);
assert(root.__left_ == &b);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
+
+ assert(c.__parent_ == &b);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == false);
+
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == false);
assert(b.__parent_ == &root);
assert(b.__left_ == &a);
- assert(b.__right_ == &d);
+ assert(b.__right_ == &c);
assert(b.__is_black_ == true);
+ }
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+
+ root.__left_ = &a;
+
+ a.__parent_ = &root;
+ a.__left_ = 0;
+ a.__right_ = &b;
+ a.__is_black_ = true;
+
+ b.__parent_ = &a;
+ b.__left_ = 0;
+ b.__right_ = &c;
+ b.__is_black_ = false;
+
+ c.__parent_ = &b;
+ c.__left_ = 0;
+ c.__right_ = 0;
+ c.__is_black_ = false;
+
+ std::__tree_balance_after_insert(root.__left_, &c);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__left_ == &b);
assert(a.__parent_ == &b);
assert(a.__left_ == 0);
assert(a.__right_ == 0);
- assert(a.__is_black_ == true);
-
- assert(d.__parent_ == &b);
- assert(d.__left_ == &c);
- assert(d.__right_ == &f);
- assert(d.__is_black_ == false);
+ assert(a.__is_black_ == false);
- assert(c.__parent_ == &d);
+ assert(c.__parent_ == &b);
assert(c.__left_ == 0);
assert(c.__right_ == 0);
- assert(c.__is_black_ == true);
+ assert(c.__is_black_ == false);
- assert(f.__parent_ == &d);
- assert(f.__left_ == &e);
- assert(f.__right_ == &g);
- assert(f.__is_black_ == true);
+ assert(b.__parent_ == &root);
+ assert(b.__left_ == &a);
+ assert(b.__right_ == &c);
+ assert(b.__is_black_ == true);
+ }
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+ Node d;
+ Node e;
+ Node f;
+ Node g;
- assert(e.__parent_ == &f);
- assert(e.__left_ == 0);
- assert(e.__right_ == 0);
- assert(e.__is_black_ == false);
+ root.__left_ = &c;
- assert(g.__parent_ == &f);
- assert(g.__left_ == 0);
- assert(g.__right_ == 0);
- assert(g.__is_black_ == false);
+ c.__parent_ = &root;
+ c.__left_ = &b;
+ c.__right_ = &g;
+ c.__is_black_ = true;
- g.__right_ = &h;
- h.__parent_ = &g;
+ b.__parent_ = &c;
+ b.__left_ = &a;
+ b.__right_ = &f;
+ b.__is_black_ = false;
- std::__tree_balance_after_insert(root.__left_, &h);
+ a.__parent_ = &b;
+ a.__left_ = &d;
+ a.__right_ = &e;
+ a.__is_black_ = false;
- assert(std::__tree_invariant(root.__left_));
+ d.__parent_ = &a;
+ d.__is_black_ = true;
- assert(root.__parent_ == 0);
- assert(root.__left_ == &d);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
+ e.__parent_ = &a;
+ e.__is_black_ = true;
- assert(d.__parent_ == &root);
- assert(d.__left_ == &b);
- assert(d.__right_ == &f);
- assert(d.__is_black_ == true);
+ f.__parent_ = &b;
+ f.__is_black_ = true;
- assert(b.__parent_ == &d);
- assert(b.__left_ == &a);
- assert(b.__right_ == &c);
- assert(b.__is_black_ == false);
+ g.__parent_ = &c;
+ g.__is_black_ = true;
- assert(a.__parent_ == &b);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == true);
+ std::__tree_balance_after_insert(root.__left_, &a);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__left_ == &b);
assert(c.__parent_ == &b);
- assert(c.__left_ == 0);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == true);
+ assert(c.__left_ == &f);
+ assert(c.__right_ == &g);
+ assert(c.__is_black_ == false);
- assert(f.__parent_ == &d);
- assert(f.__left_ == &e);
- assert(f.__right_ == &g);
- assert(f.__is_black_ == false);
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == &d);
+ assert(a.__right_ == &e);
+ assert(a.__is_black_ == false);
- assert(e.__parent_ == &f);
- assert(e.__left_ == 0);
- assert(e.__right_ == 0);
- assert(e.__is_black_ == true);
+ assert(b.__parent_ == &root);
+ assert(b.__left_ == &a);
+ assert(b.__right_ == &c);
+ assert(b.__is_black_ == true);
- assert(g.__parent_ == &f);
- assert(g.__left_ == 0);
- assert(g.__right_ == &h);
- assert(g.__is_black_ == true);
+ assert(d.__parent_ == &a);
+ assert(d.__is_black_ == true);
- assert(h.__parent_ == &g);
- assert(h.__left_ == 0);
- assert(h.__right_ == 0);
- assert(h.__is_black_ == false);
-}
+ assert(e.__parent_ == &a);
+ assert(e.__is_black_ == true);
-void
-test5()
-{
+ assert(f.__parent_ == &c);
+ assert(f.__is_black_ == true);
+
+ assert(g.__parent_ == &c);
+ assert(g.__is_black_ == true);
+ }
+ {
Node root;
Node a;
Node b;
@@ -1333,292 +960,653 @@ test5()
Node e;
Node f;
Node g;
- Node h;
- root.__left_ = &h;
- h.__parent_ = &root;
+ root.__left_ = &a;
- std::__tree_balance_after_insert(root.__left_, &h);
+ a.__parent_ = &root;
+ a.__left_ = &d;
+ a.__right_ = &b;
+ a.__is_black_ = true;
- assert(std::__tree_invariant(root.__left_));
+ b.__parent_ = &a;
+ b.__left_ = &e;
+ b.__right_ = &c;
+ b.__is_black_ = false;
+
+ c.__parent_ = &b;
+ c.__left_ = &f;
+ c.__right_ = &g;
+ c.__is_black_ = false;
+
+ d.__parent_ = &a;
+ d.__is_black_ = true;
- assert(root.__parent_ == 0);
- assert(root.__left_ == &h);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
+ e.__parent_ = &b;
+ e.__is_black_ = true;
- assert(h.__parent_ == &root);
- assert(h.__left_ == 0);
- assert(h.__right_ == 0);
- assert(h.__is_black_ == true);
+ f.__parent_ = &c;
+ f.__is_black_ = true;
- h.__left_ = &g;
- g.__parent_ = &h;
+ g.__parent_ = &c;
+ g.__is_black_ = true;
- std::__tree_balance_after_insert(root.__left_, &g);
+ std::__tree_balance_after_insert(root.__left_, &c);
assert(std::__tree_invariant(root.__left_));
- assert(root.__parent_ == 0);
- assert(root.__left_ == &h);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
+ assert(root.__left_ == &b);
- assert(h.__parent_ == &root);
- assert(h.__left_ == &g);
- assert(h.__right_ == 0);
- assert(h.__is_black_ == true);
+ assert(c.__parent_ == &b);
+ assert(c.__left_ == &f);
+ assert(c.__right_ == &g);
+ assert(c.__is_black_ == false);
- assert(g.__parent_ == &h);
- assert(g.__left_ == 0);
- assert(g.__right_ == 0);
- assert(g.__is_black_ == false);
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == &d);
+ assert(a.__right_ == &e);
+ assert(a.__is_black_ == false);
- g.__left_ = &f;
- f.__parent_ = &g;
+ assert(b.__parent_ == &root);
+ assert(b.__left_ == &a);
+ assert(b.__right_ == &c);
+ assert(b.__is_black_ == true);
- std::__tree_balance_after_insert(root.__left_, &f);
+ assert(d.__parent_ == &a);
+ assert(d.__is_black_ == true);
- assert(std::__tree_invariant(root.__left_));
+ assert(e.__parent_ == &a);
+ assert(e.__is_black_ == true);
- assert(root.__parent_ == 0);
- assert(root.__left_ == &g);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
+ assert(f.__parent_ == &c);
+ assert(f.__is_black_ == true);
- assert(g.__parent_ == &root);
- assert(g.__left_ == &f);
- assert(g.__right_ == &h);
+ assert(g.__parent_ == &c);
assert(g.__is_black_ == true);
+ }
+}
- assert(f.__parent_ == &g);
- assert(f.__left_ == 0);
- assert(f.__right_ == 0);
- assert(f.__is_black_ == false);
+void test4() {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+ Node d;
+ Node e;
+ Node f;
+ Node g;
+ Node h;
- assert(h.__parent_ == &g);
- assert(h.__left_ == 0);
- assert(h.__right_ == 0);
- assert(h.__is_black_ == false);
+ root.__left_ = &a;
+ a.__parent_ = &root;
- f.__left_ = &e;
- e.__parent_ = &f;
+ std::__tree_balance_after_insert(root.__left_, &a);
- std::__tree_balance_after_insert(root.__left_, &e);
+ assert(std::__tree_invariant(root.__left_));
- assert(std::__tree_invariant(root.__left_));
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &a);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
- assert(root.__parent_ == 0);
- assert(root.__left_ == &g);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
+ assert(a.__parent_ == &root);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == true);
- assert(g.__parent_ == &root);
- assert(g.__left_ == &f);
- assert(g.__right_ == &h);
- assert(g.__is_black_ == true);
+ a.__right_ = &b;
+ b.__parent_ = &a;
- assert(f.__parent_ == &g);
- assert(f.__left_ == &e);
- assert(f.__right_ == 0);
- assert(f.__is_black_ == true);
+ std::__tree_balance_after_insert(root.__left_, &b);
- assert(e.__parent_ == &f);
- assert(e.__left_ == 0);
- assert(e.__right_ == 0);
- assert(e.__is_black_ == false);
+ assert(std::__tree_invariant(root.__left_));
- assert(h.__parent_ == &g);
- assert(h.__left_ == 0);
- assert(h.__right_ == 0);
- assert(h.__is_black_ == true);
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &a);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
- e.__left_ = &d;
- d.__parent_ = &e;
+ assert(a.__parent_ == &root);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == &b);
+ assert(a.__is_black_ == true);
- std::__tree_balance_after_insert(root.__left_, &d);
+ assert(b.__parent_ == &a);
+ assert(b.__left_ == 0);
+ assert(b.__right_ == 0);
+ assert(b.__is_black_ == false);
- assert(std::__tree_invariant(root.__left_));
+ b.__right_ = &c;
+ c.__parent_ = &b;
- assert(root.__parent_ == 0);
- assert(root.__left_ == &g);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
+ std::__tree_balance_after_insert(root.__left_, &c);
- assert(g.__parent_ == &root);
- assert(g.__left_ == &e);
- assert(g.__right_ == &h);
- assert(g.__is_black_ == true);
+ assert(std::__tree_invariant(root.__left_));
- assert(e.__parent_ == &g);
- assert(e.__left_ == &d);
- assert(e.__right_ == &f);
- assert(e.__is_black_ == true);
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &b);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
- assert(d.__parent_ == &e);
- assert(d.__left_ == 0);
- assert(d.__right_ == 0);
- assert(d.__is_black_ == false);
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == false);
- assert(f.__parent_ == &e);
- assert(f.__left_ == 0);
- assert(f.__right_ == 0);
- assert(f.__is_black_ == false);
+ assert(b.__parent_ == &root);
+ assert(b.__left_ == &a);
+ assert(b.__right_ == &c);
+ assert(b.__is_black_ == true);
- assert(h.__parent_ == &g);
- assert(h.__left_ == 0);
- assert(h.__right_ == 0);
- assert(h.__is_black_ == true);
+ assert(c.__parent_ == &b);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == false);
- d.__left_ = &c;
- c.__parent_ = &d;
+ c.__right_ = &d;
+ d.__parent_ = &c;
- std::__tree_balance_after_insert(root.__left_, &c);
+ std::__tree_balance_after_insert(root.__left_, &d);
- assert(std::__tree_invariant(root.__left_));
+ assert(std::__tree_invariant(root.__left_));
- assert(root.__parent_ == 0);
- assert(root.__left_ == &g);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &b);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
- assert(g.__parent_ == &root);
- assert(g.__left_ == &e);
- assert(g.__right_ == &h);
- assert(g.__is_black_ == true);
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == true);
- assert(e.__parent_ == &g);
- assert(e.__left_ == &d);
- assert(e.__right_ == &f);
- assert(e.__is_black_ == false);
+ assert(b.__parent_ == &root);
+ assert(b.__left_ == &a);
+ assert(b.__right_ == &c);
+ assert(b.__is_black_ == true);
- assert(d.__parent_ == &e);
- assert(d.__left_ == &c);
- assert(d.__right_ == 0);
- assert(d.__is_black_ == true);
+ assert(c.__parent_ == &b);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == &d);
+ assert(c.__is_black_ == true);
- assert(c.__parent_ == &d);
- assert(c.__left_ == 0);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == false);
+ assert(d.__parent_ == &c);
+ assert(d.__left_ == 0);
+ assert(d.__right_ == 0);
+ assert(d.__is_black_ == false);
- assert(f.__parent_ == &e);
- assert(f.__left_ == 0);
- assert(f.__right_ == 0);
- assert(f.__is_black_ == true);
+ d.__right_ = &e;
+ e.__parent_ = &d;
- assert(h.__parent_ == &g);
- assert(h.__left_ == 0);
- assert(h.__right_ == 0);
- assert(h.__is_black_ == true);
+ std::__tree_balance_after_insert(root.__left_, &e);
- c.__left_ = &b;
- b.__parent_ = &c;
+ assert(std::__tree_invariant(root.__left_));
- std::__tree_balance_after_insert(root.__left_, &b);
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &b);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
- assert(std::__tree_invariant(root.__left_));
+ assert(b.__parent_ == &root);
+ assert(b.__left_ == &a);
+ assert(b.__right_ == &d);
+ assert(b.__is_black_ == true);
- assert(root.__parent_ == 0);
- assert(root.__left_ == &g);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == true);
- assert(g.__parent_ == &root);
- assert(g.__left_ == &e);
- assert(g.__right_ == &h);
- assert(g.__is_black_ == true);
+ assert(d.__parent_ == &b);
+ assert(d.__left_ == &c);
+ assert(d.__right_ == &e);
+ assert(d.__is_black_ == true);
+
+ assert(c.__parent_ == &d);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == false);
+
+ assert(e.__parent_ == &d);
+ assert(e.__left_ == 0);
+ assert(e.__right_ == 0);
+ assert(e.__is_black_ == false);
+
+ e.__right_ = &f;
+ f.__parent_ = &e;
- assert(e.__parent_ == &g);
- assert(e.__left_ == &c);
- assert(e.__right_ == &f);
- assert(e.__is_black_ == false);
+ std::__tree_balance_after_insert(root.__left_, &f);
+
+ assert(std::__tree_invariant(root.__left_));
- assert(c.__parent_ == &e);
- assert(c.__left_ == &b);
- assert(c.__right_ == &d);
- assert(c.__is_black_ == true);
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &b);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(b.__parent_ == &root);
+ assert(b.__left_ == &a);
+ assert(b.__right_ == &d);
+ assert(b.__is_black_ == true);
+
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == true);
+
+ assert(d.__parent_ == &b);
+ assert(d.__left_ == &c);
+ assert(d.__right_ == &e);
+ assert(d.__is_black_ == false);
+
+ assert(c.__parent_ == &d);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == true);
+
+ assert(e.__parent_ == &d);
+ assert(e.__left_ == 0);
+ assert(e.__right_ == &f);
+ assert(e.__is_black_ == true);
+
+ assert(f.__parent_ == &e);
+ assert(f.__left_ == 0);
+ assert(f.__right_ == 0);
+ assert(f.__is_black_ == false);
+
+ f.__right_ = &g;
+ g.__parent_ = &f;
+
+ std::__tree_balance_after_insert(root.__left_, &g);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &b);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(b.__parent_ == &root);
+ assert(b.__left_ == &a);
+ assert(b.__right_ == &d);
+ assert(b.__is_black_ == true);
+
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == true);
+
+ assert(d.__parent_ == &b);
+ assert(d.__left_ == &c);
+ assert(d.__right_ == &f);
+ assert(d.__is_black_ == false);
+
+ assert(c.__parent_ == &d);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == true);
+
+ assert(f.__parent_ == &d);
+ assert(f.__left_ == &e);
+ assert(f.__right_ == &g);
+ assert(f.__is_black_ == true);
+
+ assert(e.__parent_ == &f);
+ assert(e.__left_ == 0);
+ assert(e.__right_ == 0);
+ assert(e.__is_black_ == false);
+
+ assert(g.__parent_ == &f);
+ assert(g.__left_ == 0);
+ assert(g.__right_ == 0);
+ assert(g.__is_black_ == false);
+
+ g.__right_ = &h;
+ h.__parent_ = &g;
+
+ std::__tree_balance_after_insert(root.__left_, &h);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &d);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(d.__parent_ == &root);
+ assert(d.__left_ == &b);
+ assert(d.__right_ == &f);
+ assert(d.__is_black_ == true);
+
+ assert(b.__parent_ == &d);
+ assert(b.__left_ == &a);
+ assert(b.__right_ == &c);
+ assert(b.__is_black_ == false);
+
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == true);
+
+ assert(c.__parent_ == &b);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == true);
+
+ assert(f.__parent_ == &d);
+ assert(f.__left_ == &e);
+ assert(f.__right_ == &g);
+ assert(f.__is_black_ == false);
+
+ assert(e.__parent_ == &f);
+ assert(e.__left_ == 0);
+ assert(e.__right_ == 0);
+ assert(e.__is_black_ == true);
+
+ assert(g.__parent_ == &f);
+ assert(g.__left_ == 0);
+ assert(g.__right_ == &h);
+ assert(g.__is_black_ == true);
+
+ assert(h.__parent_ == &g);
+ assert(h.__left_ == 0);
+ assert(h.__right_ == 0);
+ assert(h.__is_black_ == false);
+}
- assert(b.__parent_ == &c);
- assert(b.__left_ == 0);
- assert(b.__right_ == 0);
- assert(b.__is_black_ == false);
+void test5() {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+ Node d;
+ Node e;
+ Node f;
+ Node g;
+ Node h;
- assert(d.__parent_ == &c);
- assert(d.__left_ == 0);
- assert(d.__right_ == 0);
- assert(d.__is_black_ == false);
+ root.__left_ = &h;
+ h.__parent_ = &root;
- assert(f.__parent_ == &e);
- assert(f.__left_ == 0);
- assert(f.__right_ == 0);
- assert(f.__is_black_ == true);
+ std::__tree_balance_after_insert(root.__left_, &h);
- assert(h.__parent_ == &g);
- assert(h.__left_ == 0);
- assert(h.__right_ == 0);
- assert(h.__is_black_ == true);
+ assert(std::__tree_invariant(root.__left_));
- b.__left_ = &a;
- a.__parent_ = &b;
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &h);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
- std::__tree_balance_after_insert(root.__left_, &a);
+ assert(h.__parent_ == &root);
+ assert(h.__left_ == 0);
+ assert(h.__right_ == 0);
+ assert(h.__is_black_ == true);
- assert(std::__tree_invariant(root.__left_));
+ h.__left_ = &g;
+ g.__parent_ = &h;
- assert(root.__parent_ == 0);
- assert(root.__left_ == &e);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
+ std::__tree_balance_after_insert(root.__left_, &g);
- assert(e.__parent_ == &root);
- assert(e.__left_ == &c);
- assert(e.__right_ == &g);
- assert(e.__is_black_ == true);
+ assert(std::__tree_invariant(root.__left_));
- assert(c.__parent_ == &e);
- assert(c.__left_ == &b);
- assert(c.__right_ == &d);
- assert(c.__is_black_ == false);
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &h);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
- assert(b.__parent_ == &c);
- assert(b.__left_ == &a);
- assert(b.__right_ == 0);
- assert(b.__is_black_ == true);
+ assert(h.__parent_ == &root);
+ assert(h.__left_ == &g);
+ assert(h.__right_ == 0);
+ assert(h.__is_black_ == true);
- assert(a.__parent_ == &b);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == false);
+ assert(g.__parent_ == &h);
+ assert(g.__left_ == 0);
+ assert(g.__right_ == 0);
+ assert(g.__is_black_ == false);
- assert(d.__parent_ == &c);
- assert(d.__left_ == 0);
- assert(d.__right_ == 0);
- assert(d.__is_black_ == true);
+ g.__left_ = &f;
+ f.__parent_ = &g;
- assert(g.__parent_ == &e);
- assert(g.__left_ == &f);
- assert(g.__right_ == &h);
- assert(g.__is_black_ == false);
+ std::__tree_balance_after_insert(root.__left_, &f);
- assert(f.__parent_ == &g);
- assert(f.__left_ == 0);
- assert(f.__right_ == 0);
- assert(f.__is_black_ == true);
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &g);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(g.__parent_ == &root);
+ assert(g.__left_ == &f);
+ assert(g.__right_ == &h);
+ assert(g.__is_black_ == true);
+
+ assert(f.__parent_ == &g);
+ assert(f.__left_ == 0);
+ assert(f.__right_ == 0);
+ assert(f.__is_black_ == false);
+
+ assert(h.__parent_ == &g);
+ assert(h.__left_ == 0);
+ assert(h.__right_ == 0);
+ assert(h.__is_black_ == false);
+
+ f.__left_ = &e;
+ e.__parent_ = &f;
+
+ std::__tree_balance_after_insert(root.__left_, &e);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &g);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(g.__parent_ == &root);
+ assert(g.__left_ == &f);
+ assert(g.__right_ == &h);
+ assert(g.__is_black_ == true);
+
+ assert(f.__parent_ == &g);
+ assert(f.__left_ == &e);
+ assert(f.__right_ == 0);
+ assert(f.__is_black_ == true);
+
+ assert(e.__parent_ == &f);
+ assert(e.__left_ == 0);
+ assert(e.__right_ == 0);
+ assert(e.__is_black_ == false);
+
+ assert(h.__parent_ == &g);
+ assert(h.__left_ == 0);
+ assert(h.__right_ == 0);
+ assert(h.__is_black_ == true);
+
+ e.__left_ = &d;
+ d.__parent_ = &e;
+
+ std::__tree_balance_after_insert(root.__left_, &d);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &g);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(g.__parent_ == &root);
+ assert(g.__left_ == &e);
+ assert(g.__right_ == &h);
+ assert(g.__is_black_ == true);
+
+ assert(e.__parent_ == &g);
+ assert(e.__left_ == &d);
+ assert(e.__right_ == &f);
+ assert(e.__is_black_ == true);
+
+ assert(d.__parent_ == &e);
+ assert(d.__left_ == 0);
+ assert(d.__right_ == 0);
+ assert(d.__is_black_ == false);
+
+ assert(f.__parent_ == &e);
+ assert(f.__left_ == 0);
+ assert(f.__right_ == 0);
+ assert(f.__is_black_ == false);
+
+ assert(h.__parent_ == &g);
+ assert(h.__left_ == 0);
+ assert(h.__right_ == 0);
+ assert(h.__is_black_ == true);
+
+ d.__left_ = &c;
+ c.__parent_ = &d;
+
+ std::__tree_balance_after_insert(root.__left_, &c);
+
+ assert(std::__tree_invariant(root.__left_));
- assert(h.__parent_ == &g);
- assert(h.__left_ == 0);
- assert(h.__right_ == 0);
- assert(h.__is_black_ == true);
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &g);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(g.__parent_ == &root);
+ assert(g.__left_ == &e);
+ assert(g.__right_ == &h);
+ assert(g.__is_black_ == true);
+
+ assert(e.__parent_ == &g);
+ assert(e.__left_ == &d);
+ assert(e.__right_ == &f);
+ assert(e.__is_black_ == false);
+
+ assert(d.__parent_ == &e);
+ assert(d.__left_ == &c);
+ assert(d.__right_ == 0);
+ assert(d.__is_black_ == true);
+
+ assert(c.__parent_ == &d);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == false);
+
+ assert(f.__parent_ == &e);
+ assert(f.__left_ == 0);
+ assert(f.__right_ == 0);
+ assert(f.__is_black_ == true);
+
+ assert(h.__parent_ == &g);
+ assert(h.__left_ == 0);
+ assert(h.__right_ == 0);
+ assert(h.__is_black_ == true);
+
+ c.__left_ = &b;
+ b.__parent_ = &c;
+
+ std::__tree_balance_after_insert(root.__left_, &b);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &g);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(g.__parent_ == &root);
+ assert(g.__left_ == &e);
+ assert(g.__right_ == &h);
+ assert(g.__is_black_ == true);
+
+ assert(e.__parent_ == &g);
+ assert(e.__left_ == &c);
+ assert(e.__right_ == &f);
+ assert(e.__is_black_ == false);
+
+ assert(c.__parent_ == &e);
+ assert(c.__left_ == &b);
+ assert(c.__right_ == &d);
+ assert(c.__is_black_ == true);
+
+ assert(b.__parent_ == &c);
+ assert(b.__left_ == 0);
+ assert(b.__right_ == 0);
+ assert(b.__is_black_ == false);
+
+ assert(d.__parent_ == &c);
+ assert(d.__left_ == 0);
+ assert(d.__right_ == 0);
+ assert(d.__is_black_ == false);
+
+ assert(f.__parent_ == &e);
+ assert(f.__left_ == 0);
+ assert(f.__right_ == 0);
+ assert(f.__is_black_ == true);
+
+ assert(h.__parent_ == &g);
+ assert(h.__left_ == 0);
+ assert(h.__right_ == 0);
+ assert(h.__is_black_ == true);
+
+ b.__left_ = &a;
+ a.__parent_ = &b;
+
+ std::__tree_balance_after_insert(root.__left_, &a);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &e);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(e.__parent_ == &root);
+ assert(e.__left_ == &c);
+ assert(e.__right_ == &g);
+ assert(e.__is_black_ == true);
+
+ assert(c.__parent_ == &e);
+ assert(c.__left_ == &b);
+ assert(c.__right_ == &d);
+ assert(c.__is_black_ == false);
+
+ assert(b.__parent_ == &c);
+ assert(b.__left_ == &a);
+ assert(b.__right_ == 0);
+ assert(b.__is_black_ == true);
+
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == false);
+
+ assert(d.__parent_ == &c);
+ assert(d.__left_ == 0);
+ assert(d.__right_ == 0);
+ assert(d.__is_black_ == true);
+
+ assert(g.__parent_ == &e);
+ assert(g.__left_ == &f);
+ assert(g.__right_ == &h);
+ assert(g.__is_black_ == false);
+
+ assert(f.__parent_ == &g);
+ assert(f.__left_ == 0);
+ assert(f.__right_ == 0);
+ assert(f.__is_black_ == true);
+
+ assert(h.__parent_ == &g);
+ assert(h.__left_ == 0);
+ assert(h.__right_ == 0);
+ assert(h.__is_black_ == true);
}
-int main(int, char**)
-{
- test1();
- test2();
- test3();
- test4();
- test5();
+int main(int, char**) {
+ test1();
+ test2();
+ test3();
+ test4();
+ test5();
return 0;
}
diff --git a/libcxx/test/libcxx/containers/associative/tree_key_value_traits.pass.cpp b/libcxx/test/libcxx/containers/associative/tree_key_value_traits.pass.cpp
index bebdcaaedf10373..e3a5a6f63413830 100644
--- a/libcxx/test/libcxx/containers/associative/tree_key_value_traits.pass.cpp
+++ b/libcxx/test/libcxx/containers/associative/tree_key_value_traits.pass.cpp
@@ -47,10 +47,8 @@ void testKeyValueTrait() {
static_assert((std::is_same<Traits::key_type, int>::value), "");
static_assert((std::is_same<Traits::mapped_type, int>::value), "");
static_assert((std::is_same<Traits::__node_value_type, Tp>::value), "");
- static_assert((std::is_same<Traits::__container_value_type,
- std::pair<const int, int> >::value), "");
- static_assert((std::is_same<Traits::__map_value_type,
- std::pair<const int, int> >::value), "");
+ static_assert((std::is_same<Traits::__container_value_type, std::pair<const int, int> >::value), "");
+ static_assert((std::is_same<Traits::__map_value_type, std::pair<const int, int> >::value), "");
static_assert(Traits::__is_map == true, "");
}
}
diff --git a/libcxx/test/libcxx/containers/associative/tree_left_rotate.pass.cpp b/libcxx/test/libcxx/containers/associative/tree_left_rotate.pass.cpp
index f8073d6233c9b3a..d97a1c89f1f7092 100644
--- a/libcxx/test/libcxx/containers/associative/tree_left_rotate.pass.cpp
+++ b/libcxx/test/libcxx/containers/associative/tree_left_rotate.pass.cpp
@@ -20,87 +20,81 @@
#include "test_macros.h"
-struct Node
-{
- Node* __left_;
- Node* __right_;
- Node* __parent_;
+struct Node {
+ Node* __left_;
+ Node* __right_;
+ Node* __parent_;
- Node* __parent_unsafe() const { return __parent_; }
- void __set_parent(Node* x) { __parent_ = x;}
+ Node* __parent_unsafe() const { return __parent_; }
+ void __set_parent(Node* x) { __parent_ = x; }
- Node() : __left_(), __right_(), __parent_() {}
+ Node() : __left_(), __right_(), __parent_() {}
};
-void
-test1()
-{
- Node root;
- Node x;
- Node y;
- root.__left_ = &x;
- x.__left_ = 0;
- x.__right_ = &y;
- x.__parent_ = &root;
- y.__left_ = 0;
- y.__right_ = 0;
- y.__parent_ = &x;
- std::__tree_left_rotate(&x);
- assert(root.__parent_ == 0);
- assert(root.__left_ == &y);
- assert(root.__right_ == 0);
- assert(y.__parent_ == &root);
- assert(y.__left_ == &x);
- assert(y.__right_ == 0);
- assert(x.__parent_ == &y);
- assert(x.__left_ == 0);
- assert(x.__right_ == 0);
+void test1() {
+ Node root;
+ Node x;
+ Node y;
+ root.__left_ = &x;
+ x.__left_ = 0;
+ x.__right_ = &y;
+ x.__parent_ = &root;
+ y.__left_ = 0;
+ y.__right_ = 0;
+ y.__parent_ = &x;
+ std::__tree_left_rotate(&x);
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &y);
+ assert(root.__right_ == 0);
+ assert(y.__parent_ == &root);
+ assert(y.__left_ == &x);
+ assert(y.__right_ == 0);
+ assert(x.__parent_ == &y);
+ assert(x.__left_ == 0);
+ assert(x.__right_ == 0);
}
-void
-test2()
-{
- Node root;
- Node x;
- Node y;
- Node a;
- Node b;
- Node c;
- root.__left_ = &x;
- x.__left_ = &a;
- x.__right_ = &y;
- x.__parent_ = &root;
- y.__left_ = &b;
- y.__right_ = &c;
- y.__parent_ = &x;
- a.__parent_ = &x;
- b.__parent_ = &y;
- c.__parent_ = &y;
- std::__tree_left_rotate(&x);
- assert(root.__parent_ == 0);
- assert(root.__left_ == &y);
- assert(root.__right_ == 0);
- assert(y.__parent_ == &root);
- assert(y.__left_ == &x);
- assert(y.__right_ == &c);
- assert(x.__parent_ == &y);
- assert(x.__left_ == &a);
- assert(x.__right_ == &b);
- assert(a.__parent_ == &x);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(b.__parent_ == &x);
- assert(b.__left_ == 0);
- assert(b.__right_ == 0);
- assert(c.__parent_ == &y);
- assert(c.__left_ == 0);
- assert(c.__right_ == 0);
+void test2() {
+ Node root;
+ Node x;
+ Node y;
+ Node a;
+ Node b;
+ Node c;
+ root.__left_ = &x;
+ x.__left_ = &a;
+ x.__right_ = &y;
+ x.__parent_ = &root;
+ y.__left_ = &b;
+ y.__right_ = &c;
+ y.__parent_ = &x;
+ a.__parent_ = &x;
+ b.__parent_ = &y;
+ c.__parent_ = &y;
+ std::__tree_left_rotate(&x);
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &y);
+ assert(root.__right_ == 0);
+ assert(y.__parent_ == &root);
+ assert(y.__left_ == &x);
+ assert(y.__right_ == &c);
+ assert(x.__parent_ == &y);
+ assert(x.__left_ == &a);
+ assert(x.__right_ == &b);
+ assert(a.__parent_ == &x);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(b.__parent_ == &x);
+ assert(b.__left_ == 0);
+ assert(b.__right_ == 0);
+ assert(c.__parent_ == &y);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == 0);
}
-int main(int, char**)
-{
- test1();
- test2();
+int main(int, char**) {
+ test1();
+ test2();
return 0;
}
diff --git a/libcxx/test/libcxx/containers/associative/tree_remove.pass.cpp b/libcxx/test/libcxx/containers/associative/tree_remove.pass.cpp
index 0b2d86722912ebb..e543c3360a6852e 100644
--- a/libcxx/test/libcxx/containers/associative/tree_remove.pass.cpp
+++ b/libcxx/test/libcxx/containers/associative/tree_remove.pass.cpp
@@ -20,1317 +20,911 @@
#include "test_macros.h"
-struct Node
-{
- Node* __left_;
- Node* __right_;
- Node* __parent_;
- bool __is_black_;
+struct Node {
+ Node* __left_;
+ Node* __right_;
+ Node* __parent_;
+ bool __is_black_;
- Node* __parent_unsafe() const { return __parent_; }
- void __set_parent(Node* x) { __parent_ = x;}
+ Node* __parent_unsafe() const { return __parent_; }
+ void __set_parent(Node* x) { __parent_ = x; }
- Node() : __left_(), __right_(), __parent_(), __is_black_() {}
+ Node() : __left_(), __right_(), __parent_(), __is_black_() {}
};
-void
-test1()
-{
- {
- // Left
- // Case 1 -> Case 2 -> x is red turned to black
- Node root;
- Node b;
- Node c;
- Node d;
- Node e;
- Node y;
-
- root.__left_ = &b;
-
- b.__parent_ = &root;
- b.__left_ = &y;
- b.__right_ = &d;
- b.__is_black_ = true;
-
- y.__parent_ = &b;
- y.__left_ = 0;
- y.__right_ = 0;
- y.__is_black_ = true;
-
- d.__parent_ = &b;
- d.__left_ = &c;
- d.__right_ = &e;
- d.__is_black_ = false;
-
- c.__parent_ = &d;
- c.__left_ = 0;
- c.__right_ = 0;
- c.__is_black_ = true;
-
- e.__parent_ = &d;
- e.__left_ = 0;
- e.__right_ = 0;
- e.__is_black_ = true;
-
- std::__tree_remove(root.__left_, &y);
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &d);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(d.__parent_ == &root);
- assert(d.__left_ == &b);
- assert(d.__right_ == &e);
- assert(d.__is_black_ == true);
-
- assert(b.__parent_ == &d);
- assert(b.__left_ == 0);
- assert(b.__right_ == &c);
- assert(b.__is_black_ == true);
-
- assert(c.__parent_ == &b);
- assert(c.__left_ == 0);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == false);
-
- assert(e.__parent_ == &d);
- assert(e.__left_ == 0);
- assert(e.__right_ == 0);
- assert(e.__is_black_ == true);
- }
- {
- // Right
- // Case 1 -> Case 2 -> x is red turned to black
- Node root;
- Node b;
- Node c;
- Node d;
- Node e;
- Node y;
-
- root.__left_ = &b;
-
- b.__parent_ = &root;
- b.__right_ = &y;
- b.__left_ = &d;
- b.__is_black_ = true;
-
- y.__parent_ = &b;
- y.__right_ = 0;
- y.__left_ = 0;
- y.__is_black_ = true;
-
- d.__parent_ = &b;
- d.__right_ = &c;
- d.__left_ = &e;
- d.__is_black_ = false;
-
- c.__parent_ = &d;
- c.__right_ = 0;
- c.__left_ = 0;
- c.__is_black_ = true;
-
- e.__parent_ = &d;
- e.__right_ = 0;
- e.__left_ = 0;
- e.__is_black_ = true;
-
- std::__tree_remove(root.__left_, &y);
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &d);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(d.__parent_ == &root);
- assert(d.__right_ == &b);
- assert(d.__left_ == &e);
- assert(d.__is_black_ == true);
-
- assert(b.__parent_ == &d);
- assert(b.__right_ == 0);
- assert(b.__left_ == &c);
- assert(b.__is_black_ == true);
-
- assert(c.__parent_ == &b);
- assert(c.__right_ == 0);
- assert(c.__left_ == 0);
- assert(c.__is_black_ == false);
-
- assert(e.__parent_ == &d);
- assert(e.__right_ == 0);
- assert(e.__left_ == 0);
- assert(e.__is_black_ == true);
- }
- {
- // Left
- // Case 1 -> Case 3 -> Case 4
- Node root;
- Node b;
- Node c;
- Node d;
- Node e;
- Node f;
- Node y;
-
- root.__left_ = &b;
-
- b.__parent_ = &root;
- b.__left_ = &y;
- b.__right_ = &d;
- b.__is_black_ = true;
-
- y.__parent_ = &b;
- y.__left_ = 0;
- y.__right_ = 0;
- y.__is_black_ = true;
-
- d.__parent_ = &b;
- d.__left_ = &c;
- d.__right_ = &e;
- d.__is_black_ = false;
-
- c.__parent_ = &d;
- c.__left_ = &f;
- c.__right_ = 0;
- c.__is_black_ = true;
-
- e.__parent_ = &d;
- e.__left_ = 0;
- e.__right_ = 0;
- e.__is_black_ = true;
-
- f.__parent_ = &c;
- f.__left_ = 0;
- f.__right_ = 0;
- f.__is_black_ = false;
-
- std::__tree_remove(root.__left_, &y);
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &d);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(d.__parent_ == &root);
- assert(d.__left_ == &f);
- assert(d.__right_ == &e);
- assert(d.__is_black_ == true);
-
- assert(f.__parent_ == &d);
- assert(f.__left_ == &b);
- assert(f.__right_ == &c);
- assert(f.__is_black_ == false);
-
- assert(b.__parent_ == &f);
- assert(b.__left_ == 0);
- assert(b.__right_ == 0);
- assert(b.__is_black_ == true);
-
- assert(c.__parent_ == &f);
- assert(c.__left_ == 0);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == true);
-
- assert(e.__parent_ == &d);
- assert(e.__left_ == 0);
- assert(e.__right_ == 0);
- assert(e.__is_black_ == true);
- }
- {
- // Right
- // Case 1 -> Case 3 -> Case 4
- Node root;
- Node b;
- Node c;
- Node d;
- Node e;
- Node f;
- Node y;
-
- root.__left_ = &b;
-
- b.__parent_ = &root;
- b.__right_ = &y;
- b.__left_ = &d;
- b.__is_black_ = true;
-
- y.__parent_ = &b;
- y.__right_ = 0;
- y.__left_ = 0;
- y.__is_black_ = true;
-
- d.__parent_ = &b;
- d.__right_ = &c;
- d.__left_ = &e;
- d.__is_black_ = false;
-
- c.__parent_ = &d;
- c.__right_ = &f;
- c.__left_ = 0;
- c.__is_black_ = true;
-
- e.__parent_ = &d;
- e.__right_ = 0;
- e.__left_ = 0;
- e.__is_black_ = true;
-
- f.__parent_ = &c;
- f.__right_ = 0;
- f.__left_ = 0;
- f.__is_black_ = false;
-
- std::__tree_remove(root.__left_, &y);
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &d);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(d.__parent_ == &root);
- assert(d.__right_ == &f);
- assert(d.__left_ == &e);
- assert(d.__is_black_ == true);
-
- assert(f.__parent_ == &d);
- assert(f.__right_ == &b);
- assert(f.__left_ == &c);
- assert(f.__is_black_ == false);
-
- assert(b.__parent_ == &f);
- assert(b.__right_ == 0);
- assert(b.__left_ == 0);
- assert(b.__is_black_ == true);
-
- assert(c.__parent_ == &f);
- assert(c.__right_ == 0);
- assert(c.__left_ == 0);
- assert(c.__is_black_ == true);
-
- assert(e.__parent_ == &d);
- assert(e.__right_ == 0);
- assert(e.__left_ == 0);
- assert(e.__is_black_ == true);
- }
-}
+void test1() {
+ {
+ // Left
+ // Case 1 -> Case 2 -> x is red turned to black
+ Node root;
+ Node b;
+ Node c;
+ Node d;
+ Node e;
+ Node y;
-void
-test2()
-{
- {
- Node root;
- Node a;
- Node b;
- Node c;
-
- root.__left_ = &b;
-
- b.__parent_ = &root;
- b.__left_ = &a;
- b.__right_ = &c;
- b.__is_black_ = true;
+ root.__left_ = &b;
- a.__parent_ = &b;
- a.__left_ = 0;
- a.__right_ = 0;
- a.__is_black_ = true;
+ b.__parent_ = &root;
+ b.__left_ = &y;
+ b.__right_ = &d;
+ b.__is_black_ = true;
- c.__parent_ = &b;
- c.__left_ = 0;
- c.__right_ = 0;
- c.__is_black_ = true;
+ y.__parent_ = &b;
+ y.__left_ = 0;
+ y.__right_ = 0;
+ y.__is_black_ = true;
- std::__tree_remove(root.__left_, &a);
+ d.__parent_ = &b;
+ d.__left_ = &c;
+ d.__right_ = &e;
+ d.__is_black_ = false;
- assert(std::__tree_invariant(root.__left_));
+ c.__parent_ = &d;
+ c.__left_ = 0;
+ c.__right_ = 0;
+ c.__is_black_ = true;
- assert(root.__parent_ == 0);
- assert(root.__left_ == &b);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(b.__parent_ == &root);
- assert(b.__left_ == 0);
- assert(b.__right_ == &c);
- assert(b.__is_black_ == true);
-
- assert(c.__parent_ == &b);
- assert(c.__left_ == 0);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == false);
-
- std::__tree_remove(root.__left_, &b);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &c);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(c.__parent_ == &root);
- assert(c.__left_ == 0);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == true);
-
- std::__tree_remove(root.__left_, &c);
+ e.__parent_ = &d;
+ e.__left_ = 0;
+ e.__right_ = 0;
+ e.__is_black_ = true;
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == 0);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
- }
- {
- Node root;
- Node a;
- Node b;
- Node c;
-
- root.__left_ = &b;
-
- b.__parent_ = &root;
- b.__left_ = &a;
- b.__right_ = &c;
- b.__is_black_ = true;
+ std::__tree_remove(root.__left_, &y);
+ assert(std::__tree_invariant(root.__left_));
- a.__parent_ = &b;
- a.__left_ = 0;
- a.__right_ = 0;
- a.__is_black_ = false;
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &d);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
- c.__parent_ = &b;
- c.__left_ = 0;
- c.__right_ = 0;
- c.__is_black_ = false;
+ assert(d.__parent_ == &root);
+ assert(d.__left_ == &b);
+ assert(d.__right_ == &e);
+ assert(d.__is_black_ == true);
- std::__tree_remove(root.__left_, &a);
+ assert(b.__parent_ == &d);
+ assert(b.__left_ == 0);
+ assert(b.__right_ == &c);
+ assert(b.__is_black_ == true);
- assert(std::__tree_invariant(root.__left_));
+ assert(c.__parent_ == &b);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == false);
- assert(root.__parent_ == 0);
- assert(root.__left_ == &b);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(b.__parent_ == &root);
- assert(b.__left_ == 0);
- assert(b.__right_ == &c);
- assert(b.__is_black_ == true);
-
- assert(c.__parent_ == &b);
- assert(c.__left_ == 0);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == false);
-
- std::__tree_remove(root.__left_, &b);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &c);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(c.__parent_ == &root);
- assert(c.__left_ == 0);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == true);
+ assert(e.__parent_ == &d);
+ assert(e.__left_ == 0);
+ assert(e.__right_ == 0);
+ assert(e.__is_black_ == true);
+ }
+ {
+ // Right
+ // Case 1 -> Case 2 -> x is red turned to black
+ Node root;
+ Node b;
+ Node c;
+ Node d;
+ Node e;
+ Node y;
- std::__tree_remove(root.__left_, &c);
+ root.__left_ = &b;
- assert(std::__tree_invariant(root.__left_));
+ b.__parent_ = &root;
+ b.__right_ = &y;
+ b.__left_ = &d;
+ b.__is_black_ = true;
- assert(root.__parent_ == 0);
- assert(root.__left_ == 0);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
- }
- {
- Node root;
- Node a;
- Node b;
- Node c;
-
- root.__left_ = &b;
-
- b.__parent_ = &root;
- b.__left_ = &a;
- b.__right_ = &c;
- b.__is_black_ = true;
+ y.__parent_ = &b;
+ y.__right_ = 0;
+ y.__left_ = 0;
+ y.__is_black_ = true;
- a.__parent_ = &b;
- a.__left_ = 0;
- a.__right_ = 0;
- a.__is_black_ = true;
-
- c.__parent_ = &b;
- c.__left_ = 0;
- c.__right_ = 0;
- c.__is_black_ = true;
+ d.__parent_ = &b;
+ d.__right_ = &c;
+ d.__left_ = &e;
+ d.__is_black_ = false;
- std::__tree_remove(root.__left_, &a);
+ c.__parent_ = &d;
+ c.__right_ = 0;
+ c.__left_ = 0;
+ c.__is_black_ = true;
- assert(std::__tree_invariant(root.__left_));
+ e.__parent_ = &d;
+ e.__right_ = 0;
+ e.__left_ = 0;
+ e.__is_black_ = true;
- assert(root.__parent_ == 0);
- assert(root.__left_ == &b);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(b.__parent_ == &root);
- assert(b.__left_ == 0);
- assert(b.__right_ == &c);
- assert(b.__is_black_ == true);
-
- assert(c.__parent_ == &b);
- assert(c.__left_ == 0);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == false);
-
- std::__tree_remove(root.__left_, &c);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &b);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(b.__parent_ == &root);
- assert(b.__left_ == 0);
- assert(b.__right_ == 0);
- assert(b.__is_black_ == true);
+ std::__tree_remove(root.__left_, &y);
+ assert(std::__tree_invariant(root.__left_));
- std::__tree_remove(root.__left_, &b);
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &d);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
- assert(std::__tree_invariant(root.__left_));
+ assert(d.__parent_ == &root);
+ assert(d.__right_ == &b);
+ assert(d.__left_ == &e);
+ assert(d.__is_black_ == true);
- assert(root.__parent_ == 0);
- assert(root.__left_ == 0);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
- }
- {
- Node root;
- Node a;
- Node b;
- Node c;
-
- root.__left_ = &b;
-
- b.__parent_ = &root;
- b.__left_ = &a;
- b.__right_ = &c;
- b.__is_black_ = true;
+ assert(b.__parent_ == &d);
+ assert(b.__right_ == 0);
+ assert(b.__left_ == &c);
+ assert(b.__is_black_ == true);
- a.__parent_ = &b;
- a.__left_ = 0;
- a.__right_ = 0;
- a.__is_black_ = false;
-
- c.__parent_ = &b;
- c.__left_ = 0;
- c.__right_ = 0;
- c.__is_black_ = false;
+ assert(c.__parent_ == &b);
+ assert(c.__right_ == 0);
+ assert(c.__left_ == 0);
+ assert(c.__is_black_ == false);
- std::__tree_remove(root.__left_, &a);
+ assert(e.__parent_ == &d);
+ assert(e.__right_ == 0);
+ assert(e.__left_ == 0);
+ assert(e.__is_black_ == true);
+ }
+ {
+ // Left
+ // Case 1 -> Case 3 -> Case 4
+ Node root;
+ Node b;
+ Node c;
+ Node d;
+ Node e;
+ Node f;
+ Node y;
- assert(std::__tree_invariant(root.__left_));
+ root.__left_ = &b;
- assert(root.__parent_ == 0);
- assert(root.__left_ == &b);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(b.__parent_ == &root);
- assert(b.__left_ == 0);
- assert(b.__right_ == &c);
- assert(b.__is_black_ == true);
-
- assert(c.__parent_ == &b);
- assert(c.__left_ == 0);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == false);
-
- std::__tree_remove(root.__left_, &c);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &b);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(b.__parent_ == &root);
- assert(b.__left_ == 0);
- assert(b.__right_ == 0);
- assert(b.__is_black_ == true);
+ b.__parent_ = &root;
+ b.__left_ = &y;
+ b.__right_ = &d;
+ b.__is_black_ = true;
- std::__tree_remove(root.__left_, &b);
+ y.__parent_ = &b;
+ y.__left_ = 0;
+ y.__right_ = 0;
+ y.__is_black_ = true;
- assert(std::__tree_invariant(root.__left_));
+ d.__parent_ = &b;
+ d.__left_ = &c;
+ d.__right_ = &e;
+ d.__is_black_ = false;
- assert(root.__parent_ == 0);
- assert(root.__left_ == 0);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
- }
- {
- Node root;
- Node a;
- Node b;
- Node c;
-
- root.__left_ = &b;
-
- b.__parent_ = &root;
- b.__left_ = &a;
- b.__right_ = &c;
- b.__is_black_ = true;
+ c.__parent_ = &d;
+ c.__left_ = &f;
+ c.__right_ = 0;
+ c.__is_black_ = true;
- a.__parent_ = &b;
- a.__left_ = 0;
- a.__right_ = 0;
- a.__is_black_ = true;
-
- c.__parent_ = &b;
- c.__left_ = 0;
- c.__right_ = 0;
- c.__is_black_ = true;
+ e.__parent_ = &d;
+ e.__left_ = 0;
+ e.__right_ = 0;
+ e.__is_black_ = true;
- std::__tree_remove(root.__left_, &b);
+ f.__parent_ = &c;
+ f.__left_ = 0;
+ f.__right_ = 0;
+ f.__is_black_ = false;
- assert(std::__tree_invariant(root.__left_));
+ std::__tree_remove(root.__left_, &y);
+ assert(std::__tree_invariant(root.__left_));
- assert(root.__parent_ == 0);
- assert(root.__left_ == &c);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(a.__parent_ == &c);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == false);
-
- assert(c.__parent_ == &root);
- assert(c.__left_ == &a);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == true);
-
- std::__tree_remove(root.__left_, &a);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &c);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(c.__parent_ == &root);
- assert(c.__left_ == 0);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == true);
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &d);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
- std::__tree_remove(root.__left_, &c);
+ assert(d.__parent_ == &root);
+ assert(d.__left_ == &f);
+ assert(d.__right_ == &e);
+ assert(d.__is_black_ == true);
- assert(std::__tree_invariant(root.__left_));
+ assert(f.__parent_ == &d);
+ assert(f.__left_ == &b);
+ assert(f.__right_ == &c);
+ assert(f.__is_black_ == false);
- assert(root.__parent_ == 0);
- assert(root.__left_ == 0);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
- }
- {
- Node root;
- Node a;
- Node b;
- Node c;
-
- root.__left_ = &b;
-
- b.__parent_ = &root;
- b.__left_ = &a;
- b.__right_ = &c;
- b.__is_black_ = true;
+ assert(b.__parent_ == &f);
+ assert(b.__left_ == 0);
+ assert(b.__right_ == 0);
+ assert(b.__is_black_ == true);
- a.__parent_ = &b;
- a.__left_ = 0;
- a.__right_ = 0;
- a.__is_black_ = false;
-
- c.__parent_ = &b;
- c.__left_ = 0;
- c.__right_ = 0;
- c.__is_black_ = false;
+ assert(c.__parent_ == &f);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == true);
+
+ assert(e.__parent_ == &d);
+ assert(e.__left_ == 0);
+ assert(e.__right_ == 0);
+ assert(e.__is_black_ == true);
+ }
+ {
+ // Right
+ // Case 1 -> Case 3 -> Case 4
+ Node root;
+ Node b;
+ Node c;
+ Node d;
+ Node e;
+ Node f;
+ Node y;
+
+ root.__left_ = &b;
- std::__tree_remove(root.__left_, &b);
+ b.__parent_ = &root;
+ b.__right_ = &y;
+ b.__left_ = &d;
+ b.__is_black_ = true;
- assert(std::__tree_invariant(root.__left_));
+ y.__parent_ = &b;
+ y.__right_ = 0;
+ y.__left_ = 0;
+ y.__is_black_ = true;
- assert(root.__parent_ == 0);
- assert(root.__left_ == &c);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(a.__parent_ == &c);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == false);
-
- assert(c.__parent_ == &root);
- assert(c.__left_ == &a);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == true);
-
- std::__tree_remove(root.__left_, &a);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &c);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(c.__parent_ == &root);
- assert(c.__left_ == 0);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == true);
+ d.__parent_ = &b;
+ d.__right_ = &c;
+ d.__left_ = &e;
+ d.__is_black_ = false;
- std::__tree_remove(root.__left_, &c);
+ c.__parent_ = &d;
+ c.__right_ = &f;
+ c.__left_ = 0;
+ c.__is_black_ = true;
- assert(std::__tree_invariant(root.__left_));
+ e.__parent_ = &d;
+ e.__right_ = 0;
+ e.__left_ = 0;
+ e.__is_black_ = true;
- assert(root.__parent_ == 0);
- assert(root.__left_ == 0);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
- }
- {
- Node root;
- Node a;
- Node b;
- Node c;
-
- root.__left_ = &b;
-
- b.__parent_ = &root;
- b.__left_ = &a;
- b.__right_ = &c;
- b.__is_black_ = true;
+ f.__parent_ = &c;
+ f.__right_ = 0;
+ f.__left_ = 0;
+ f.__is_black_ = false;
- a.__parent_ = &b;
- a.__left_ = 0;
- a.__right_ = 0;
- a.__is_black_ = true;
-
- c.__parent_ = &b;
- c.__left_ = 0;
- c.__right_ = 0;
- c.__is_black_ = true;
+ std::__tree_remove(root.__left_, &y);
+ assert(std::__tree_invariant(root.__left_));
- std::__tree_remove(root.__left_, &b);
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &d);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(d.__parent_ == &root);
+ assert(d.__right_ == &f);
+ assert(d.__left_ == &e);
+ assert(d.__is_black_ == true);
- assert(std::__tree_invariant(root.__left_));
+ assert(f.__parent_ == &d);
+ assert(f.__right_ == &b);
+ assert(f.__left_ == &c);
+ assert(f.__is_black_ == false);
+
+ assert(b.__parent_ == &f);
+ assert(b.__right_ == 0);
+ assert(b.__left_ == 0);
+ assert(b.__is_black_ == true);
+
+ assert(c.__parent_ == &f);
+ assert(c.__right_ == 0);
+ assert(c.__left_ == 0);
+ assert(c.__is_black_ == true);
+
+ assert(e.__parent_ == &d);
+ assert(e.__right_ == 0);
+ assert(e.__left_ == 0);
+ assert(e.__is_black_ == true);
+ }
+}
+
+void test2() {
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+
+ root.__left_ = &b;
+
+ b.__parent_ = &root;
+ b.__left_ = &a;
+ b.__right_ = &c;
+ b.__is_black_ = true;
+
+ a.__parent_ = &b;
+ a.__left_ = 0;
+ a.__right_ = 0;
+ a.__is_black_ = true;
+
+ c.__parent_ = &b;
+ c.__left_ = 0;
+ c.__right_ = 0;
+ c.__is_black_ = true;
+
+ std::__tree_remove(root.__left_, &a);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &b);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(b.__parent_ == &root);
+ assert(b.__left_ == 0);
+ assert(b.__right_ == &c);
+ assert(b.__is_black_ == true);
+
+ assert(c.__parent_ == &b);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == false);
+
+ std::__tree_remove(root.__left_, &b);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &c);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(c.__parent_ == &root);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == true);
+
+ std::__tree_remove(root.__left_, &c);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == 0);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+ }
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+
+ root.__left_ = &b;
+
+ b.__parent_ = &root;
+ b.__left_ = &a;
+ b.__right_ = &c;
+ b.__is_black_ = true;
+
+ a.__parent_ = &b;
+ a.__left_ = 0;
+ a.__right_ = 0;
+ a.__is_black_ = false;
+
+ c.__parent_ = &b;
+ c.__left_ = 0;
+ c.__right_ = 0;
+ c.__is_black_ = false;
+
+ std::__tree_remove(root.__left_, &a);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &b);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(b.__parent_ == &root);
+ assert(b.__left_ == 0);
+ assert(b.__right_ == &c);
+ assert(b.__is_black_ == true);
+
+ assert(c.__parent_ == &b);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == false);
+
+ std::__tree_remove(root.__left_, &b);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &c);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
- assert(root.__parent_ == 0);
- assert(root.__left_ == &c);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(a.__parent_ == &c);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == false);
-
- assert(c.__parent_ == &root);
- assert(c.__left_ == &a);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == true);
-
- std::__tree_remove(root.__left_, &c);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &a);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(a.__parent_ == &root);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == true);
+ assert(c.__parent_ == &root);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == true);
- std::__tree_remove(root.__left_, &a);
+ std::__tree_remove(root.__left_, &c);
- assert(std::__tree_invariant(root.__left_));
+ assert(std::__tree_invariant(root.__left_));
- assert(root.__parent_ == 0);
- assert(root.__left_ == 0);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
- }
- {
- Node root;
- Node a;
- Node b;
- Node c;
-
- root.__left_ = &b;
-
- b.__parent_ = &root;
- b.__left_ = &a;
- b.__right_ = &c;
- b.__is_black_ = true;
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == 0);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+ }
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
- a.__parent_ = &b;
- a.__left_ = 0;
- a.__right_ = 0;
- a.__is_black_ = false;
-
- c.__parent_ = &b;
- c.__left_ = 0;
- c.__right_ = 0;
- c.__is_black_ = false;
+ root.__left_ = &b;
- std::__tree_remove(root.__left_, &b);
+ b.__parent_ = &root;
+ b.__left_ = &a;
+ b.__right_ = &c;
+ b.__is_black_ = true;
- assert(std::__tree_invariant(root.__left_));
+ a.__parent_ = &b;
+ a.__left_ = 0;
+ a.__right_ = 0;
+ a.__is_black_ = true;
- assert(root.__parent_ == 0);
- assert(root.__left_ == &c);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(a.__parent_ == &c);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == false);
-
- assert(c.__parent_ == &root);
- assert(c.__left_ == &a);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == true);
-
- std::__tree_remove(root.__left_, &c);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &a);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(a.__parent_ == &root);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == true);
+ c.__parent_ = &b;
+ c.__left_ = 0;
+ c.__right_ = 0;
+ c.__is_black_ = true;
- std::__tree_remove(root.__left_, &a);
+ std::__tree_remove(root.__left_, &a);
- assert(std::__tree_invariant(root.__left_));
+ assert(std::__tree_invariant(root.__left_));
- assert(root.__parent_ == 0);
- assert(root.__left_ == 0);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
- }
- {
- Node root;
- Node a;
- Node b;
- Node c;
-
- root.__left_ = &b;
-
- b.__parent_ = &root;
- b.__left_ = &a;
- b.__right_ = &c;
- b.__is_black_ = true;
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &b);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
- a.__parent_ = &b;
- a.__left_ = 0;
- a.__right_ = 0;
- a.__is_black_ = true;
-
- c.__parent_ = &b;
- c.__left_ = 0;
- c.__right_ = 0;
- c.__is_black_ = true;
+ assert(b.__parent_ == &root);
+ assert(b.__left_ == 0);
+ assert(b.__right_ == &c);
+ assert(b.__is_black_ == true);
- std::__tree_remove(root.__left_, &c);
+ assert(c.__parent_ == &b);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == false);
- assert(std::__tree_invariant(root.__left_));
+ std::__tree_remove(root.__left_, &c);
- assert(root.__parent_ == 0);
- assert(root.__left_ == &b);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(a.__parent_ == &b);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == false);
-
- assert(b.__parent_ == &root);
- assert(b.__left_ == &a);
- assert(b.__right_ == 0);
- assert(b.__is_black_ == true);
-
- std::__tree_remove(root.__left_, &b);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &a);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(a.__parent_ == &root);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == true);
+ assert(std::__tree_invariant(root.__left_));
- std::__tree_remove(root.__left_, &a);
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &b);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
- assert(std::__tree_invariant(root.__left_));
+ assert(b.__parent_ == &root);
+ assert(b.__left_ == 0);
+ assert(b.__right_ == 0);
+ assert(b.__is_black_ == true);
- assert(root.__parent_ == 0);
- assert(root.__left_ == 0);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
- }
- {
- Node root;
- Node a;
- Node b;
- Node c;
-
- root.__left_ = &b;
-
- b.__parent_ = &root;
- b.__left_ = &a;
- b.__right_ = &c;
- b.__is_black_ = true;
+ std::__tree_remove(root.__left_, &b);
- a.__parent_ = &b;
- a.__left_ = 0;
- a.__right_ = 0;
- a.__is_black_ = false;
-
- c.__parent_ = &b;
- c.__left_ = 0;
- c.__right_ = 0;
- c.__is_black_ = false;
+ assert(std::__tree_invariant(root.__left_));
- std::__tree_remove(root.__left_, &c);
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == 0);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+ }
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
- assert(std::__tree_invariant(root.__left_));
+ root.__left_ = &b;
- assert(root.__parent_ == 0);
- assert(root.__left_ == &b);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(a.__parent_ == &b);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == false);
-
- assert(b.__parent_ == &root);
- assert(b.__left_ == &a);
- assert(b.__right_ == 0);
- assert(b.__is_black_ == true);
-
- std::__tree_remove(root.__left_, &b);
-
- assert(std::__tree_invariant(root.__left_));
-
- assert(root.__parent_ == 0);
- assert(root.__left_ == &a);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(a.__parent_ == &root);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == true);
+ b.__parent_ = &root;
+ b.__left_ = &a;
+ b.__right_ = &c;
+ b.__is_black_ = true;
- std::__tree_remove(root.__left_, &a);
+ a.__parent_ = &b;
+ a.__left_ = 0;
+ a.__right_ = 0;
+ a.__is_black_ = false;
- assert(std::__tree_invariant(root.__left_));
+ c.__parent_ = &b;
+ c.__left_ = 0;
+ c.__right_ = 0;
+ c.__is_black_ = false;
- assert(root.__parent_ == 0);
- assert(root.__left_ == 0);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
- }
- {
- Node root;
- Node a;
- Node b;
- Node c;
-
- root.__left_ = &b;
-
- b.__parent_ = &root;
- b.__left_ = &a;
- b.__right_ = &c;
- b.__is_black_ = true;
+ std::__tree_remove(root.__left_, &a);
- a.__parent_ = &b;
- a.__left_ = 0;
- a.__right_ = 0;
- a.__is_black_ = true;
-
- c.__parent_ = &b;
- c.__left_ = 0;
- c.__right_ = 0;
- c.__is_black_ = true;
+ assert(std::__tree_invariant(root.__left_));
- std::__tree_remove(root.__left_, &c);
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &b);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
- assert(std::__tree_invariant(root.__left_));
+ assert(b.__parent_ == &root);
+ assert(b.__left_ == 0);
+ assert(b.__right_ == &c);
+ assert(b.__is_black_ == true);
- assert(root.__parent_ == 0);
- assert(root.__left_ == &b);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(a.__parent_ == &b);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == false);
+ assert(c.__parent_ == &b);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == false);
- assert(b.__parent_ == &root);
- assert(b.__left_ == &a);
- assert(b.__right_ == 0);
- assert(b.__is_black_ == true);
+ std::__tree_remove(root.__left_, &c);
- std::__tree_remove(root.__left_, &a);
+ assert(std::__tree_invariant(root.__left_));
- assert(std::__tree_invariant(root.__left_));
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &b);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
- assert(root.__parent_ == 0);
- assert(root.__left_ == &b);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
+ assert(b.__parent_ == &root);
+ assert(b.__left_ == 0);
+ assert(b.__right_ == 0);
+ assert(b.__is_black_ == true);
- assert(b.__parent_ == &root);
- assert(b.__left_ == 0);
- assert(b.__right_ == 0);
- assert(b.__is_black_ == true);
+ std::__tree_remove(root.__left_, &b);
- std::__tree_remove(root.__left_, &b);
+ assert(std::__tree_invariant(root.__left_));
- assert(std::__tree_invariant(root.__left_));
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == 0);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+ }
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
- assert(root.__parent_ == 0);
- assert(root.__left_ == 0);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
- }
- {
- Node root;
- Node a;
- Node b;
- Node c;
+ root.__left_ = &b;
- root.__left_ = &b;
+ b.__parent_ = &root;
+ b.__left_ = &a;
+ b.__right_ = &c;
+ b.__is_black_ = true;
- b.__parent_ = &root;
- b.__left_ = &a;
- b.__right_ = &c;
- b.__is_black_ = true;
+ a.__parent_ = &b;
+ a.__left_ = 0;
+ a.__right_ = 0;
+ a.__is_black_ = true;
- a.__parent_ = &b;
- a.__left_ = 0;
- a.__right_ = 0;
- a.__is_black_ = false;
-
- c.__parent_ = &b;
- c.__left_ = 0;
- c.__right_ = 0;
- c.__is_black_ = false;
+ c.__parent_ = &b;
+ c.__left_ = 0;
+ c.__right_ = 0;
+ c.__is_black_ = true;
- std::__tree_remove(root.__left_, &c);
+ std::__tree_remove(root.__left_, &b);
- assert(std::__tree_invariant(root.__left_));
+ assert(std::__tree_invariant(root.__left_));
- assert(root.__parent_ == 0);
- assert(root.__left_ == &b);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
-
- assert(a.__parent_ == &b);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == false);
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &c);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
- assert(b.__parent_ == &root);
- assert(b.__left_ == &a);
- assert(b.__right_ == 0);
- assert(b.__is_black_ == true);
+ assert(a.__parent_ == &c);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == false);
- std::__tree_remove(root.__left_, &a);
+ assert(c.__parent_ == &root);
+ assert(c.__left_ == &a);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == true);
- assert(std::__tree_invariant(root.__left_));
+ std::__tree_remove(root.__left_, &a);
- assert(root.__parent_ == 0);
- assert(root.__left_ == &b);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
+ assert(std::__tree_invariant(root.__left_));
- assert(b.__parent_ == &root);
- assert(b.__left_ == 0);
- assert(b.__right_ == 0);
- assert(b.__is_black_ == true);
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &c);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
- std::__tree_remove(root.__left_, &b);
+ assert(c.__parent_ == &root);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == true);
- assert(std::__tree_invariant(root.__left_));
+ std::__tree_remove(root.__left_, &c);
- assert(root.__parent_ == 0);
- assert(root.__left_ == 0);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
- }
-}
+ assert(std::__tree_invariant(root.__left_));
-void
-test3()
-{
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == 0);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+ }
+ {
Node root;
Node a;
Node b;
Node c;
- Node d;
- Node e;
- Node f;
- Node g;
- Node h;
- root.__left_ = &e;
+ root.__left_ = &b;
- e.__parent_ = &root;
- e.__left_ = &c;
- e.__right_ = &g;
- e.__is_black_ = true;
+ b.__parent_ = &root;
+ b.__left_ = &a;
+ b.__right_ = &c;
+ b.__is_black_ = true;
- c.__parent_ = &e;
- c.__left_ = &b;
- c.__right_ = &d;
+ a.__parent_ = &b;
+ a.__left_ = 0;
+ a.__right_ = 0;
+ a.__is_black_ = false;
+
+ c.__parent_ = &b;
+ c.__left_ = 0;
+ c.__right_ = 0;
c.__is_black_ = false;
- g.__parent_ = &e;
- g.__left_ = &f;
- g.__right_ = &h;
- g.__is_black_ = false;
+ std::__tree_remove(root.__left_, &b);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &c);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(a.__parent_ == &c);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == false);
+
+ assert(c.__parent_ == &root);
+ assert(c.__left_ == &a);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == true);
+
+ std::__tree_remove(root.__left_, &a);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &c);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(c.__parent_ == &root);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == true);
+
+ std::__tree_remove(root.__left_, &c);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == 0);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+ }
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+
+ root.__left_ = &b;
- b.__parent_ = &c;
- b.__left_ = &a;
- b.__right_ = 0;
+ b.__parent_ = &root;
+ b.__left_ = &a;
+ b.__right_ = &c;
b.__is_black_ = true;
- d.__parent_ = &c;
- d.__left_ = 0;
- d.__right_ = 0;
- d.__is_black_ = true;
+ a.__parent_ = &b;
+ a.__left_ = 0;
+ a.__right_ = 0;
+ a.__is_black_ = true;
+
+ c.__parent_ = &b;
+ c.__left_ = 0;
+ c.__right_ = 0;
+ c.__is_black_ = true;
+
+ std::__tree_remove(root.__left_, &b);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &c);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(a.__parent_ == &c);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == false);
+
+ assert(c.__parent_ == &root);
+ assert(c.__left_ == &a);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == true);
+
+ std::__tree_remove(root.__left_, &c);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &a);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(a.__parent_ == &root);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == true);
+
+ std::__tree_remove(root.__left_, &a);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == 0);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+ }
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
- f.__parent_ = &g;
- f.__left_ = 0;
- f.__right_ = 0;
- f.__is_black_ = true;
+ root.__left_ = &b;
- h.__parent_ = &g;
- h.__left_ = 0;
- h.__right_ = 0;
- h.__is_black_ = true;
+ b.__parent_ = &root;
+ b.__left_ = &a;
+ b.__right_ = &c;
+ b.__is_black_ = true;
- a.__parent_ = &b;
- a.__left_ = 0;
- a.__right_ = 0;
+ a.__parent_ = &b;
+ a.__left_ = 0;
+ a.__right_ = 0;
a.__is_black_ = false;
- assert(std::__tree_invariant(root.__left_));
+ c.__parent_ = &b;
+ c.__left_ = 0;
+ c.__right_ = 0;
+ c.__is_black_ = false;
- std::__tree_remove(root.__left_, &h);
+ std::__tree_remove(root.__left_, &b);
assert(std::__tree_invariant(root.__left_));
assert(root.__parent_ == 0);
- assert(root.__left_ == &e);
+ assert(root.__left_ == &c);
assert(root.__right_ == 0);
assert(root.__is_black_ == false);
- assert(e.__parent_ == &root);
- assert(e.__left_ == &c);
- assert(e.__right_ == &g);
- assert(e.__is_black_ == true);
-
- assert(c.__parent_ == &e);
- assert(c.__left_ == &b);
- assert(c.__right_ == &d);
- assert(c.__is_black_ == false);
-
- assert(g.__parent_ == &e);
- assert(g.__left_ == &f);
- assert(g.__right_ == 0);
- assert(g.__is_black_ == true);
-
- assert(b.__parent_ == &c);
- assert(b.__left_ == &a);
- assert(b.__right_ == 0);
- assert(b.__is_black_ == true);
-
- assert(a.__parent_ == &b);
+ assert(a.__parent_ == &c);
assert(a.__left_ == 0);
assert(a.__right_ == 0);
assert(a.__is_black_ == false);
- assert(d.__parent_ == &c);
- assert(d.__left_ == 0);
- assert(d.__right_ == 0);
- assert(d.__is_black_ == true);
-
- assert(f.__parent_ == &g);
- assert(f.__left_ == 0);
- assert(f.__right_ == 0);
- assert(f.__is_black_ == false);
+ assert(c.__parent_ == &root);
+ assert(c.__left_ == &a);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == true);
- std::__tree_remove(root.__left_, &g);
+ std::__tree_remove(root.__left_, &c);
assert(std::__tree_invariant(root.__left_));
assert(root.__parent_ == 0);
- assert(root.__left_ == &e);
+ assert(root.__left_ == &a);
assert(root.__right_ == 0);
assert(root.__is_black_ == false);
- assert(e.__parent_ == &root);
- assert(e.__left_ == &c);
- assert(e.__right_ == &f);
- assert(e.__is_black_ == true);
-
- assert(c.__parent_ == &e);
- assert(c.__left_ == &b);
- assert(c.__right_ == &d);
- assert(c.__is_black_ == false);
-
- assert(b.__parent_ == &c);
- assert(b.__left_ == &a);
- assert(b.__right_ == 0);
- assert(b.__is_black_ == true);
-
- assert(a.__parent_ == &b);
+ assert(a.__parent_ == &root);
assert(a.__left_ == 0);
assert(a.__right_ == 0);
- assert(a.__is_black_ == false);
-
- assert(d.__parent_ == &c);
- assert(d.__left_ == 0);
- assert(d.__right_ == 0);
- assert(d.__is_black_ == true);
-
- assert(f.__parent_ == &e);
- assert(f.__left_ == 0);
- assert(f.__right_ == 0);
- assert(f.__is_black_ == true);
+ assert(a.__is_black_ == true);
- std::__tree_remove(root.__left_, &f);
+ std::__tree_remove(root.__left_, &a);
assert(std::__tree_invariant(root.__left_));
assert(root.__parent_ == 0);
- assert(root.__left_ == &c);
+ assert(root.__left_ == 0);
assert(root.__right_ == 0);
assert(root.__is_black_ == false);
+ }
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
- assert(c.__parent_ == &root);
- assert(c.__left_ == &b);
- assert(c.__right_ == &e);
- assert(c.__is_black_ == true);
-
- assert(b.__parent_ == &c);
- assert(b.__left_ == &a);
- assert(b.__right_ == 0);
- assert(b.__is_black_ == true);
+ root.__left_ = &b;
- assert(e.__parent_ == &c);
- assert(e.__left_ == &d);
- assert(e.__right_ == 0);
- assert(e.__is_black_ == true);
+ b.__parent_ = &root;
+ b.__left_ = &a;
+ b.__right_ = &c;
+ b.__is_black_ = true;
- assert(a.__parent_ == &b);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(a.__is_black_ == false);
+ a.__parent_ = &b;
+ a.__left_ = 0;
+ a.__right_ = 0;
+ a.__is_black_ = true;
- assert(d.__parent_ == &e);
- assert(d.__left_ == 0);
- assert(d.__right_ == 0);
- assert(d.__is_black_ == false);
+ c.__parent_ = &b;
+ c.__left_ = 0;
+ c.__right_ = 0;
+ c.__is_black_ = true;
- std::__tree_remove(root.__left_, &e);
+ std::__tree_remove(root.__left_, &c);
assert(std::__tree_invariant(root.__left_));
assert(root.__parent_ == 0);
- assert(root.__left_ == &c);
+ assert(root.__left_ == &b);
assert(root.__right_ == 0);
assert(root.__is_black_ == false);
- assert(c.__parent_ == &root);
- assert(c.__left_ == &b);
- assert(c.__right_ == &d);
- assert(c.__is_black_ == true);
-
- assert(b.__parent_ == &c);
- assert(b.__left_ == &a);
- assert(b.__right_ == 0);
- assert(b.__is_black_ == true);
-
assert(a.__parent_ == &b);
assert(a.__left_ == 0);
assert(a.__right_ == 0);
assert(a.__is_black_ == false);
- assert(d.__parent_ == &c);
- assert(d.__left_ == 0);
- assert(d.__right_ == 0);
- assert(d.__is_black_ == true);
+ assert(b.__parent_ == &root);
+ assert(b.__left_ == &a);
+ assert(b.__right_ == 0);
+ assert(b.__is_black_ == true);
- std::__tree_remove(root.__left_, &d);
+ std::__tree_remove(root.__left_, &b);
assert(std::__tree_invariant(root.__left_));
assert(root.__parent_ == 0);
- assert(root.__left_ == &b);
+ assert(root.__left_ == &a);
assert(root.__right_ == 0);
assert(root.__is_black_ == false);
- assert(b.__parent_ == &root);
- assert(b.__left_ == &a);
- assert(b.__right_ == &c);
- assert(b.__is_black_ == true);
-
- assert(a.__parent_ == &b);
+ assert(a.__parent_ == &root);
assert(a.__left_ == 0);
assert(a.__right_ == 0);
assert(a.__is_black_ == true);
- assert(c.__parent_ == &b);
- assert(c.__left_ == 0);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == true);
+ std::__tree_remove(root.__left_, &a);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == 0);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+ }
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+
+ root.__left_ = &b;
+
+ b.__parent_ = &root;
+ b.__left_ = &a;
+ b.__right_ = &c;
+ b.__is_black_ = true;
+
+ a.__parent_ = &b;
+ a.__left_ = 0;
+ a.__right_ = 0;
+ a.__is_black_ = false;
+
+ c.__parent_ = &b;
+ c.__left_ = 0;
+ c.__right_ = 0;
+ c.__is_black_ = false;
std::__tree_remove(root.__left_, &c);
@@ -1341,16 +935,16 @@ test3()
assert(root.__right_ == 0);
assert(root.__is_black_ == false);
- assert(b.__parent_ == &root);
- assert(b.__left_ == &a);
- assert(b.__right_ == 0);
- assert(b.__is_black_ == true);
-
assert(a.__parent_ == &b);
assert(a.__left_ == 0);
assert(a.__right_ == 0);
assert(a.__is_black_ == false);
+ assert(b.__parent_ == &root);
+ assert(b.__left_ == &a);
+ assert(b.__right_ == 0);
+ assert(b.__is_black_ == true);
+
std::__tree_remove(root.__left_, &b);
assert(std::__tree_invariant(root.__left_));
@@ -1373,284 +967,680 @@ test3()
assert(root.__left_ == 0);
assert(root.__right_ == 0);
assert(root.__is_black_ == false);
-}
-
-void
-test4()
-{
+ }
+ {
Node root;
Node a;
Node b;
Node c;
- Node d;
- Node e;
- Node f;
- Node g;
- Node h;
-
- root.__left_ = &d;
- d.__parent_ = &root;
- d.__left_ = &b;
- d.__right_ = &f;
- d.__is_black_ = true;
+ root.__left_ = &b;
- b.__parent_ = &d;
- b.__left_ = &a;
- b.__right_ = &c;
- b.__is_black_ = false;
-
- f.__parent_ = &d;
- f.__left_ = &e;
- f.__right_ = &g;
- f.__is_black_ = false;
+ b.__parent_ = &root;
+ b.__left_ = &a;
+ b.__right_ = &c;
+ b.__is_black_ = true;
- a.__parent_ = &b;
- a.__left_ = 0;
- a.__right_ = 0;
+ a.__parent_ = &b;
+ a.__left_ = 0;
+ a.__right_ = 0;
a.__is_black_ = true;
- c.__parent_ = &b;
- c.__left_ = 0;
- c.__right_ = 0;
+ c.__parent_ = &b;
+ c.__left_ = 0;
+ c.__right_ = 0;
c.__is_black_ = true;
- e.__parent_ = &f;
- e.__left_ = 0;
- e.__right_ = 0;
- e.__is_black_ = true;
+ std::__tree_remove(root.__left_, &c);
- g.__parent_ = &f;
- g.__left_ = 0;
- g.__right_ = &h;
- g.__is_black_ = true;
+ assert(std::__tree_invariant(root.__left_));
- h.__parent_ = &g;
- h.__left_ = 0;
- h.__right_ = 0;
- h.__is_black_ = false;
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &b);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
- assert(std::__tree_invariant(root.__left_));
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == false);
+
+ assert(b.__parent_ == &root);
+ assert(b.__left_ == &a);
+ assert(b.__right_ == 0);
+ assert(b.__is_black_ == true);
std::__tree_remove(root.__left_, &a);
assert(std::__tree_invariant(root.__left_));
assert(root.__parent_ == 0);
- assert(root.__left_ == &d);
+ assert(root.__left_ == &b);
assert(root.__right_ == 0);
assert(root.__is_black_ == false);
- assert(d.__parent_ == &root);
- assert(d.__left_ == &b);
- assert(d.__right_ == &f);
- assert(d.__is_black_ == true);
-
- assert(b.__parent_ == &d);
+ assert(b.__parent_ == &root);
assert(b.__left_ == 0);
- assert(b.__right_ == &c);
+ assert(b.__right_ == 0);
assert(b.__is_black_ == true);
- assert(f.__parent_ == &d);
- assert(f.__left_ == &e);
- assert(f.__right_ == &g);
- assert(f.__is_black_ == false);
+ std::__tree_remove(root.__left_, &b);
- assert(c.__parent_ == &b);
- assert(c.__left_ == 0);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == false);
+ assert(std::__tree_invariant(root.__left_));
- assert(e.__parent_ == &f);
- assert(e.__left_ == 0);
- assert(e.__right_ == 0);
- assert(e.__is_black_ == true);
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == 0);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+ }
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
- assert(g.__parent_ == &f);
- assert(g.__left_ == 0);
- assert(g.__right_ == &h);
- assert(g.__is_black_ == true);
+ root.__left_ = &b;
- assert(h.__parent_ == &g);
- assert(h.__left_ == 0);
- assert(h.__right_ == 0);
- assert(h.__is_black_ == false);
+ b.__parent_ = &root;
+ b.__left_ = &a;
+ b.__right_ = &c;
+ b.__is_black_ = true;
- std::__tree_remove(root.__left_, &b);
+ a.__parent_ = &b;
+ a.__left_ = 0;
+ a.__right_ = 0;
+ a.__is_black_ = false;
+
+ c.__parent_ = &b;
+ c.__left_ = 0;
+ c.__right_ = 0;
+ c.__is_black_ = false;
+
+ std::__tree_remove(root.__left_, &c);
assert(std::__tree_invariant(root.__left_));
assert(root.__parent_ == 0);
- assert(root.__left_ == &d);
+ assert(root.__left_ == &b);
assert(root.__right_ == 0);
assert(root.__is_black_ == false);
- assert(d.__parent_ == &root);
- assert(d.__left_ == &c);
- assert(d.__right_ == &f);
- assert(d.__is_black_ == true);
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == false);
- assert(c.__parent_ == &d);
- assert(c.__left_ == 0);
- assert(c.__right_ == 0);
- assert(c.__is_black_ == true);
+ assert(b.__parent_ == &root);
+ assert(b.__left_ == &a);
+ assert(b.__right_ == 0);
+ assert(b.__is_black_ == true);
- assert(f.__parent_ == &d);
- assert(f.__left_ == &e);
- assert(f.__right_ == &g);
- assert(f.__is_black_ == false);
+ std::__tree_remove(root.__left_, &a);
- assert(e.__parent_ == &f);
- assert(e.__left_ == 0);
- assert(e.__right_ == 0);
- assert(e.__is_black_ == true);
+ assert(std::__tree_invariant(root.__left_));
- assert(g.__parent_ == &f);
- assert(g.__left_ == 0);
- assert(g.__right_ == &h);
- assert(g.__is_black_ == true);
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &b);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
- assert(h.__parent_ == &g);
- assert(h.__left_ == 0);
- assert(h.__right_ == 0);
- assert(h.__is_black_ == false);
+ assert(b.__parent_ == &root);
+ assert(b.__left_ == 0);
+ assert(b.__right_ == 0);
+ assert(b.__is_black_ == true);
- std::__tree_remove(root.__left_, &c);
+ std::__tree_remove(root.__left_, &b);
assert(std::__tree_invariant(root.__left_));
assert(root.__parent_ == 0);
- assert(root.__left_ == &f);
+ assert(root.__left_ == 0);
assert(root.__right_ == 0);
assert(root.__is_black_ == false);
+ }
+}
- assert(f.__parent_ == &root);
- assert(f.__left_ == &d);
- assert(f.__right_ == &g);
- assert(f.__is_black_ == true);
+void test3() {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+ Node d;
+ Node e;
+ Node f;
+ Node g;
+ Node h;
+
+ root.__left_ = &e;
+
+ e.__parent_ = &root;
+ e.__left_ = &c;
+ e.__right_ = &g;
+ e.__is_black_ = true;
+
+ c.__parent_ = &e;
+ c.__left_ = &b;
+ c.__right_ = &d;
+ c.__is_black_ = false;
+
+ g.__parent_ = &e;
+ g.__left_ = &f;
+ g.__right_ = &h;
+ g.__is_black_ = false;
+
+ b.__parent_ = &c;
+ b.__left_ = &a;
+ b.__right_ = 0;
+ b.__is_black_ = true;
+
+ d.__parent_ = &c;
+ d.__left_ = 0;
+ d.__right_ = 0;
+ d.__is_black_ = true;
+
+ f.__parent_ = &g;
+ f.__left_ = 0;
+ f.__right_ = 0;
+ f.__is_black_ = true;
+
+ h.__parent_ = &g;
+ h.__left_ = 0;
+ h.__right_ = 0;
+ h.__is_black_ = true;
+
+ a.__parent_ = &b;
+ a.__left_ = 0;
+ a.__right_ = 0;
+ a.__is_black_ = false;
+
+ assert(std::__tree_invariant(root.__left_));
+
+ std::__tree_remove(root.__left_, &h);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &e);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(e.__parent_ == &root);
+ assert(e.__left_ == &c);
+ assert(e.__right_ == &g);
+ assert(e.__is_black_ == true);
+
+ assert(c.__parent_ == &e);
+ assert(c.__left_ == &b);
+ assert(c.__right_ == &d);
+ assert(c.__is_black_ == false);
+
+ assert(g.__parent_ == &e);
+ assert(g.__left_ == &f);
+ assert(g.__right_ == 0);
+ assert(g.__is_black_ == true);
+
+ assert(b.__parent_ == &c);
+ assert(b.__left_ == &a);
+ assert(b.__right_ == 0);
+ assert(b.__is_black_ == true);
+
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == false);
+
+ assert(d.__parent_ == &c);
+ assert(d.__left_ == 0);
+ assert(d.__right_ == 0);
+ assert(d.__is_black_ == true);
+
+ assert(f.__parent_ == &g);
+ assert(f.__left_ == 0);
+ assert(f.__right_ == 0);
+ assert(f.__is_black_ == false);
+
+ std::__tree_remove(root.__left_, &g);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &e);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(e.__parent_ == &root);
+ assert(e.__left_ == &c);
+ assert(e.__right_ == &f);
+ assert(e.__is_black_ == true);
+
+ assert(c.__parent_ == &e);
+ assert(c.__left_ == &b);
+ assert(c.__right_ == &d);
+ assert(c.__is_black_ == false);
+
+ assert(b.__parent_ == &c);
+ assert(b.__left_ == &a);
+ assert(b.__right_ == 0);
+ assert(b.__is_black_ == true);
+
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == false);
+
+ assert(d.__parent_ == &c);
+ assert(d.__left_ == 0);
+ assert(d.__right_ == 0);
+ assert(d.__is_black_ == true);
+
+ assert(f.__parent_ == &e);
+ assert(f.__left_ == 0);
+ assert(f.__right_ == 0);
+ assert(f.__is_black_ == true);
+
+ std::__tree_remove(root.__left_, &f);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &c);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(c.__parent_ == &root);
+ assert(c.__left_ == &b);
+ assert(c.__right_ == &e);
+ assert(c.__is_black_ == true);
+
+ assert(b.__parent_ == &c);
+ assert(b.__left_ == &a);
+ assert(b.__right_ == 0);
+ assert(b.__is_black_ == true);
+
+ assert(e.__parent_ == &c);
+ assert(e.__left_ == &d);
+ assert(e.__right_ == 0);
+ assert(e.__is_black_ == true);
+
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == false);
+
+ assert(d.__parent_ == &e);
+ assert(d.__left_ == 0);
+ assert(d.__right_ == 0);
+ assert(d.__is_black_ == false);
+
+ std::__tree_remove(root.__left_, &e);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &c);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(c.__parent_ == &root);
+ assert(c.__left_ == &b);
+ assert(c.__right_ == &d);
+ assert(c.__is_black_ == true);
+
+ assert(b.__parent_ == &c);
+ assert(b.__left_ == &a);
+ assert(b.__right_ == 0);
+ assert(b.__is_black_ == true);
+
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == false);
- assert(d.__parent_ == &f);
- assert(d.__left_ == 0);
- assert(d.__right_ == &e);
- assert(d.__is_black_ == true);
+ assert(d.__parent_ == &c);
+ assert(d.__left_ == 0);
+ assert(d.__right_ == 0);
+ assert(d.__is_black_ == true);
- assert(g.__parent_ == &f);
- assert(g.__left_ == 0);
- assert(g.__right_ == &h);
- assert(g.__is_black_ == true);
+ std::__tree_remove(root.__left_, &d);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &b);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(b.__parent_ == &root);
+ assert(b.__left_ == &a);
+ assert(b.__right_ == &c);
+ assert(b.__is_black_ == true);
+
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == true);
- assert(e.__parent_ == &d);
- assert(e.__left_ == 0);
- assert(e.__right_ == 0);
- assert(e.__is_black_ == false);
+ assert(c.__parent_ == &b);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == true);
- assert(h.__parent_ == &g);
- assert(h.__left_ == 0);
- assert(h.__right_ == 0);
- assert(h.__is_black_ == false);
+ std::__tree_remove(root.__left_, &c);
- std::__tree_remove(root.__left_, &d);
+ assert(std::__tree_invariant(root.__left_));
- assert(std::__tree_invariant(root.__left_));
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &b);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
- assert(root.__parent_ == 0);
- assert(root.__left_ == &f);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
+ assert(b.__parent_ == &root);
+ assert(b.__left_ == &a);
+ assert(b.__right_ == 0);
+ assert(b.__is_black_ == true);
- assert(f.__parent_ == &root);
- assert(f.__left_ == &e);
- assert(f.__right_ == &g);
- assert(f.__is_black_ == true);
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == false);
- assert(e.__parent_ == &f);
- assert(e.__left_ == 0);
- assert(e.__right_ == 0);
- assert(e.__is_black_ == true);
+ std::__tree_remove(root.__left_, &b);
- assert(g.__parent_ == &f);
- assert(g.__left_ == 0);
- assert(g.__right_ == &h);
- assert(g.__is_black_ == true);
+ assert(std::__tree_invariant(root.__left_));
- assert(h.__parent_ == &g);
- assert(h.__left_ == 0);
- assert(h.__right_ == 0);
- assert(h.__is_black_ == false);
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &a);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
- std::__tree_remove(root.__left_, &e);
+ assert(a.__parent_ == &root);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == true);
- assert(std::__tree_invariant(root.__left_));
+ std::__tree_remove(root.__left_, &a);
- assert(root.__parent_ == 0);
- assert(root.__left_ == &g);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
+ assert(std::__tree_invariant(root.__left_));
- assert(g.__parent_ == &root);
- assert(g.__left_ == &f);
- assert(g.__right_ == &h);
- assert(g.__is_black_ == true);
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == 0);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+}
- assert(f.__parent_ == &g);
- assert(f.__left_ == 0);
- assert(f.__right_ == 0);
- assert(f.__is_black_ == true);
+void test4() {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+ Node d;
+ Node e;
+ Node f;
+ Node g;
+ Node h;
+
+ root.__left_ = &d;
+
+ d.__parent_ = &root;
+ d.__left_ = &b;
+ d.__right_ = &f;
+ d.__is_black_ = true;
+
+ b.__parent_ = &d;
+ b.__left_ = &a;
+ b.__right_ = &c;
+ b.__is_black_ = false;
+
+ f.__parent_ = &d;
+ f.__left_ = &e;
+ f.__right_ = &g;
+ f.__is_black_ = false;
+
+ a.__parent_ = &b;
+ a.__left_ = 0;
+ a.__right_ = 0;
+ a.__is_black_ = true;
+
+ c.__parent_ = &b;
+ c.__left_ = 0;
+ c.__right_ = 0;
+ c.__is_black_ = true;
+
+ e.__parent_ = &f;
+ e.__left_ = 0;
+ e.__right_ = 0;
+ e.__is_black_ = true;
+
+ g.__parent_ = &f;
+ g.__left_ = 0;
+ g.__right_ = &h;
+ g.__is_black_ = true;
+
+ h.__parent_ = &g;
+ h.__left_ = 0;
+ h.__right_ = 0;
+ h.__is_black_ = false;
+
+ assert(std::__tree_invariant(root.__left_));
+
+ std::__tree_remove(root.__left_, &a);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &d);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(d.__parent_ == &root);
+ assert(d.__left_ == &b);
+ assert(d.__right_ == &f);
+ assert(d.__is_black_ == true);
+
+ assert(b.__parent_ == &d);
+ assert(b.__left_ == 0);
+ assert(b.__right_ == &c);
+ assert(b.__is_black_ == true);
+
+ assert(f.__parent_ == &d);
+ assert(f.__left_ == &e);
+ assert(f.__right_ == &g);
+ assert(f.__is_black_ == false);
+
+ assert(c.__parent_ == &b);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == false);
+
+ assert(e.__parent_ == &f);
+ assert(e.__left_ == 0);
+ assert(e.__right_ == 0);
+ assert(e.__is_black_ == true);
+
+ assert(g.__parent_ == &f);
+ assert(g.__left_ == 0);
+ assert(g.__right_ == &h);
+ assert(g.__is_black_ == true);
+
+ assert(h.__parent_ == &g);
+ assert(h.__left_ == 0);
+ assert(h.__right_ == 0);
+ assert(h.__is_black_ == false);
+
+ std::__tree_remove(root.__left_, &b);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &d);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(d.__parent_ == &root);
+ assert(d.__left_ == &c);
+ assert(d.__right_ == &f);
+ assert(d.__is_black_ == true);
+
+ assert(c.__parent_ == &d);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == true);
+
+ assert(f.__parent_ == &d);
+ assert(f.__left_ == &e);
+ assert(f.__right_ == &g);
+ assert(f.__is_black_ == false);
+
+ assert(e.__parent_ == &f);
+ assert(e.__left_ == 0);
+ assert(e.__right_ == 0);
+ assert(e.__is_black_ == true);
+
+ assert(g.__parent_ == &f);
+ assert(g.__left_ == 0);
+ assert(g.__right_ == &h);
+ assert(g.__is_black_ == true);
+
+ assert(h.__parent_ == &g);
+ assert(h.__left_ == 0);
+ assert(h.__right_ == 0);
+ assert(h.__is_black_ == false);
+
+ std::__tree_remove(root.__left_, &c);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &f);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(f.__parent_ == &root);
+ assert(f.__left_ == &d);
+ assert(f.__right_ == &g);
+ assert(f.__is_black_ == true);
+
+ assert(d.__parent_ == &f);
+ assert(d.__left_ == 0);
+ assert(d.__right_ == &e);
+ assert(d.__is_black_ == true);
+
+ assert(g.__parent_ == &f);
+ assert(g.__left_ == 0);
+ assert(g.__right_ == &h);
+ assert(g.__is_black_ == true);
+
+ assert(e.__parent_ == &d);
+ assert(e.__left_ == 0);
+ assert(e.__right_ == 0);
+ assert(e.__is_black_ == false);
+
+ assert(h.__parent_ == &g);
+ assert(h.__left_ == 0);
+ assert(h.__right_ == 0);
+ assert(h.__is_black_ == false);
+
+ std::__tree_remove(root.__left_, &d);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &f);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(f.__parent_ == &root);
+ assert(f.__left_ == &e);
+ assert(f.__right_ == &g);
+ assert(f.__is_black_ == true);
+
+ assert(e.__parent_ == &f);
+ assert(e.__left_ == 0);
+ assert(e.__right_ == 0);
+ assert(e.__is_black_ == true);
+
+ assert(g.__parent_ == &f);
+ assert(g.__left_ == 0);
+ assert(g.__right_ == &h);
+ assert(g.__is_black_ == true);
- assert(h.__parent_ == &g);
- assert(h.__left_ == 0);
- assert(h.__right_ == 0);
- assert(h.__is_black_ == true);
+ assert(h.__parent_ == &g);
+ assert(h.__left_ == 0);
+ assert(h.__right_ == 0);
+ assert(h.__is_black_ == false);
- std::__tree_remove(root.__left_, &f);
+ std::__tree_remove(root.__left_, &e);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &g);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(g.__parent_ == &root);
+ assert(g.__left_ == &f);
+ assert(g.__right_ == &h);
+ assert(g.__is_black_ == true);
+
+ assert(f.__parent_ == &g);
+ assert(f.__left_ == 0);
+ assert(f.__right_ == 0);
+ assert(f.__is_black_ == true);
- assert(std::__tree_invariant(root.__left_));
+ assert(h.__parent_ == &g);
+ assert(h.__left_ == 0);
+ assert(h.__right_ == 0);
+ assert(h.__is_black_ == true);
- assert(root.__parent_ == 0);
- assert(root.__left_ == &g);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
+ std::__tree_remove(root.__left_, &f);
- assert(g.__parent_ == &root);
- assert(g.__left_ == 0);
- assert(g.__right_ == &h);
- assert(g.__is_black_ == true);
+ assert(std::__tree_invariant(root.__left_));
- assert(h.__parent_ == &g);
- assert(h.__left_ == 0);
- assert(h.__right_ == 0);
- assert(h.__is_black_ == false);
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &g);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
- std::__tree_remove(root.__left_, &g);
+ assert(g.__parent_ == &root);
+ assert(g.__left_ == 0);
+ assert(g.__right_ == &h);
+ assert(g.__is_black_ == true);
- assert(std::__tree_invariant(root.__left_));
+ assert(h.__parent_ == &g);
+ assert(h.__left_ == 0);
+ assert(h.__right_ == 0);
+ assert(h.__is_black_ == false);
- assert(root.__parent_ == 0);
- assert(root.__left_ == &h);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
+ std::__tree_remove(root.__left_, &g);
- assert(h.__parent_ == &root);
- assert(h.__left_ == 0);
- assert(h.__right_ == 0);
- assert(h.__is_black_ == true);
+ assert(std::__tree_invariant(root.__left_));
- std::__tree_remove(root.__left_, &h);
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &h);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
- assert(std::__tree_invariant(root.__left_));
+ assert(h.__parent_ == &root);
+ assert(h.__left_ == 0);
+ assert(h.__right_ == 0);
+ assert(h.__is_black_ == true);
- assert(root.__parent_ == 0);
- assert(root.__left_ == 0);
- assert(root.__right_ == 0);
- assert(root.__is_black_ == false);
+ std::__tree_remove(root.__left_, &h);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == 0);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
}
-int main(int, char**)
-{
- test1();
- test2();
- test3();
- test4();
+int main(int, char**) {
+ test1();
+ test2();
+ test3();
+ test4();
return 0;
}
diff --git a/libcxx/test/libcxx/containers/associative/tree_right_rotate.pass.cpp b/libcxx/test/libcxx/containers/associative/tree_right_rotate.pass.cpp
index 16ca81fddc7dc37..b86446f5be101a0 100644
--- a/libcxx/test/libcxx/containers/associative/tree_right_rotate.pass.cpp
+++ b/libcxx/test/libcxx/containers/associative/tree_right_rotate.pass.cpp
@@ -20,87 +20,81 @@
#include "test_macros.h"
-struct Node
-{
- Node* __left_;
- Node* __right_;
- Node* __parent_;
+struct Node {
+ Node* __left_;
+ Node* __right_;
+ Node* __parent_;
- Node* __parent_unsafe() const { return __parent_; }
- void __set_parent(Node* x) { __parent_ = x;}
+ Node* __parent_unsafe() const { return __parent_; }
+ void __set_parent(Node* x) { __parent_ = x; }
- Node() : __left_(), __right_(), __parent_() {}
+ Node() : __left_(), __right_(), __parent_() {}
};
-void
-test1()
-{
- Node root;
- Node x;
- Node y;
- root.__left_ = &x;
- x.__left_ = &y;
- x.__right_ = 0;
- x.__parent_ = &root;
- y.__left_ = 0;
- y.__right_ = 0;
- y.__parent_ = &x;
- std::__tree_right_rotate(&x);
- assert(root.__parent_ == 0);
- assert(root.__left_ == &y);
- assert(root.__right_ == 0);
- assert(y.__parent_ == &root);
- assert(y.__left_ == 0);
- assert(y.__right_ == &x);
- assert(x.__parent_ == &y);
- assert(x.__left_ == 0);
- assert(x.__right_ == 0);
+void test1() {
+ Node root;
+ Node x;
+ Node y;
+ root.__left_ = &x;
+ x.__left_ = &y;
+ x.__right_ = 0;
+ x.__parent_ = &root;
+ y.__left_ = 0;
+ y.__right_ = 0;
+ y.__parent_ = &x;
+ std::__tree_right_rotate(&x);
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &y);
+ assert(root.__right_ == 0);
+ assert(y.__parent_ == &root);
+ assert(y.__left_ == 0);
+ assert(y.__right_ == &x);
+ assert(x.__parent_ == &y);
+ assert(x.__left_ == 0);
+ assert(x.__right_ == 0);
}
-void
-test2()
-{
- Node root;
- Node x;
- Node y;
- Node a;
- Node b;
- Node c;
- root.__left_ = &x;
- x.__left_ = &y;
- x.__right_ = &c;
- x.__parent_ = &root;
- y.__left_ = &a;
- y.__right_ = &b;
- y.__parent_ = &x;
- a.__parent_ = &y;
- b.__parent_ = &y;
- c.__parent_ = &x;
- std::__tree_right_rotate(&x);
- assert(root.__parent_ == 0);
- assert(root.__left_ == &y);
- assert(root.__right_ == 0);
- assert(y.__parent_ == &root);
- assert(y.__left_ == &a);
- assert(y.__right_ == &x);
- assert(x.__parent_ == &y);
- assert(x.__left_ == &b);
- assert(x.__right_ == &c);
- assert(a.__parent_ == &y);
- assert(a.__left_ == 0);
- assert(a.__right_ == 0);
- assert(b.__parent_ == &x);
- assert(b.__left_ == 0);
- assert(b.__right_ == 0);
- assert(c.__parent_ == &x);
- assert(c.__left_ == 0);
- assert(c.__right_ == 0);
+void test2() {
+ Node root;
+ Node x;
+ Node y;
+ Node a;
+ Node b;
+ Node c;
+ root.__left_ = &x;
+ x.__left_ = &y;
+ x.__right_ = &c;
+ x.__parent_ = &root;
+ y.__left_ = &a;
+ y.__right_ = &b;
+ y.__parent_ = &x;
+ a.__parent_ = &y;
+ b.__parent_ = &y;
+ c.__parent_ = &x;
+ std::__tree_right_rotate(&x);
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &y);
+ assert(root.__right_ == 0);
+ assert(y.__parent_ == &root);
+ assert(y.__left_ == &a);
+ assert(y.__right_ == &x);
+ assert(x.__parent_ == &y);
+ assert(x.__left_ == &b);
+ assert(x.__right_ == &c);
+ assert(a.__parent_ == &y);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(b.__parent_ == &x);
+ assert(b.__left_ == 0);
+ assert(b.__right_ == 0);
+ assert(c.__parent_ == &x);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == 0);
}
-int main(int, char**)
-{
- test1();
- test2();
+int main(int, char**) {
+ test1();
+ test2();
return 0;
}
diff --git a/libcxx/test/libcxx/containers/gnu_cxx/hash_map_name_lookup.pass.cpp b/libcxx/test/libcxx/containers/gnu_cxx/hash_map_name_lookup.pass.cpp
index 50d35f3dd8b80a9..7e87330ef855dc4 100644
--- a/libcxx/test/libcxx/containers/gnu_cxx/hash_map_name_lookup.pass.cpp
+++ b/libcxx/test/libcxx/containers/gnu_cxx/hash_map_name_lookup.pass.cpp
@@ -22,7 +22,6 @@ struct unique_ptr;
#include "test_macros.h"
-
namespace __gnu_cxx {
template class hash_map<int, int>;
}
diff --git a/libcxx/test/libcxx/containers/sequences/array/triviality.pass.cpp b/libcxx/test/libcxx/containers/sequences/array/triviality.pass.cpp
index d124e847716574f..8b0f5a391eb327b 100644
--- a/libcxx/test/libcxx/containers/sequences/array/triviality.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/array/triviality.pass.cpp
@@ -13,42 +13,39 @@
#include <array>
#include <type_traits>
-
-struct Empty { };
+struct Empty {};
struct TrivialCopy {
- int i;
- double j;
+ int i;
+ double j;
};
struct NonTrivialCopy {
- NonTrivialCopy(NonTrivialCopy const&) { }
- NonTrivialCopy& operator=(NonTrivialCopy const&) { return *this; }
+ NonTrivialCopy(NonTrivialCopy const&) {}
+ NonTrivialCopy& operator=(NonTrivialCopy const&) { return *this; }
};
template <typename T>
-void check_trivially_copyable()
-{
- static_assert(std::is_trivially_copyable<std::array<T, 0> >::value, "");
- static_assert(std::is_trivially_copyable<std::array<T, 1> >::value, "");
- static_assert(std::is_trivially_copyable<std::array<T, 2> >::value, "");
- static_assert(std::is_trivially_copyable<std::array<T, 3> >::value, "");
+void check_trivially_copyable() {
+ static_assert(std::is_trivially_copyable<std::array<T, 0> >::value, "");
+ static_assert(std::is_trivially_copyable<std::array<T, 1> >::value, "");
+ static_assert(std::is_trivially_copyable<std::array<T, 2> >::value, "");
+ static_assert(std::is_trivially_copyable<std::array<T, 3> >::value, "");
}
-int main(int, char**)
-{
- check_trivially_copyable<int>();
- check_trivially_copyable<long>();
- check_trivially_copyable<double>();
- check_trivially_copyable<long double>();
- check_trivially_copyable<Empty>();
- check_trivially_copyable<TrivialCopy>();
-
- // Check that std::array<T, 0> is still trivially copyable when T is not
- static_assert( std::is_trivially_copyable<std::array<NonTrivialCopy, 0> >::value, "");
- static_assert(!std::is_trivially_copyable<std::array<NonTrivialCopy, 1> >::value, "");
- static_assert(!std::is_trivially_copyable<std::array<NonTrivialCopy, 2> >::value, "");
- static_assert(!std::is_trivially_copyable<std::array<NonTrivialCopy, 3> >::value, "");
-
- return 0;
+int main(int, char**) {
+ check_trivially_copyable<int>();
+ check_trivially_copyable<long>();
+ check_trivially_copyable<double>();
+ check_trivially_copyable<long double>();
+ check_trivially_copyable<Empty>();
+ check_trivially_copyable<TrivialCopy>();
+
+ // Check that std::array<T, 0> is still trivially copyable when T is not
+ static_assert(std::is_trivially_copyable<std::array<NonTrivialCopy, 0> >::value, "");
+ static_assert(!std::is_trivially_copyable<std::array<NonTrivialCopy, 1> >::value, "");
+ static_assert(!std::is_trivially_copyable<std::array<NonTrivialCopy, 2> >::value, "");
+ static_assert(!std::is_trivially_copyable<std::array<NonTrivialCopy, 3> >::value, "");
+
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/deque/asan.pass.cpp b/libcxx/test/libcxx/containers/sequences/deque/asan.pass.cpp
index e8091acefc36818..46ca62dda7b2043 100644
--- a/libcxx/test/libcxx/containers/sequences/deque/asan.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/deque/asan.pass.cpp
@@ -23,49 +23,46 @@
extern "C" void __sanitizer_set_death_callback(void (*callback)(void));
-void do_exit() {
- exit(0);
-}
+void do_exit() { exit(0); }
-int main(int, char**)
-{
- {
- typedef cpp17_input_iterator<int*> MyInputIter;
- // Should not trigger ASan.
- std::deque<int> v;
- int i[] = {42};
- v.insert(v.begin(), MyInputIter(i), MyInputIter(i + 1));
- assert(v[0] == 42);
- assert(is_double_ended_contiguous_container_asan_correct(v));
- }
- {
- typedef int T;
- typedef std::deque<T, min_allocator<T> > C;
- const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- C c(std::begin(t), std::end(t));
- assert(is_double_ended_contiguous_container_asan_correct(c));
- }
- {
- typedef char T;
- typedef std::deque<T, safe_allocator<T> > C;
- const T t[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
- C c(std::begin(t), std::end(t));
- c.pop_front();
- assert(is_double_ended_contiguous_container_asan_correct(c));
- }
- __sanitizer_set_death_callback(do_exit);
- {
- typedef int T;
- typedef std::deque<T> C;
- const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- C c(std::begin(t), std::end(t));
- assert(is_double_ended_contiguous_container_asan_correct(c));
- T* ptr = &c[0];
- for(size_t i = 0; i < (8 + sizeof(T) - 1)/sizeof(T); ++i)
- c.pop_front();
- *ptr = 1;
- volatile T foo = c[c.size()]; // should trigger ASAN. Use volatile to prevent being optimized away.
- assert(false); // if we got here, ASAN didn't trigger
- ((void)foo);
- }
+int main(int, char**) {
+ {
+ typedef cpp17_input_iterator<int*> MyInputIter;
+ // Should not trigger ASan.
+ std::deque<int> v;
+ int i[] = {42};
+ v.insert(v.begin(), MyInputIter(i), MyInputIter(i + 1));
+ assert(v[0] == 42);
+ assert(is_double_ended_contiguous_container_asan_correct(v));
+ }
+ {
+ typedef int T;
+ typedef std::deque<T, min_allocator<T> > C;
+ const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ C c(std::begin(t), std::end(t));
+ assert(is_double_ended_contiguous_container_asan_correct(c));
+ }
+ {
+ typedef char T;
+ typedef std::deque<T, safe_allocator<T> > C;
+ const T t[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
+ C c(std::begin(t), std::end(t));
+ c.pop_front();
+ assert(is_double_ended_contiguous_container_asan_correct(c));
+ }
+ __sanitizer_set_death_callback(do_exit);
+ {
+ typedef int T;
+ typedef std::deque<T> C;
+ const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ C c(std::begin(t), std::end(t));
+ assert(is_double_ended_contiguous_container_asan_correct(c));
+ T* ptr = &c[0];
+ for (size_t i = 0; i < (8 + sizeof(T) - 1) / sizeof(T); ++i)
+ c.pop_front();
+ *ptr = 1;
+ volatile T foo = c[c.size()]; // should trigger ASAN. Use volatile to prevent being optimized away.
+ assert(false); // if we got here, ASAN didn't trigger
+ ((void)foo);
+ }
}
diff --git a/libcxx/test/libcxx/containers/sequences/deque/assert.pop_back.empty.pass.cpp b/libcxx/test/libcxx/containers/sequences/deque/assert.pop_back.empty.pass.cpp
index 19cd41f4cf3a2a8..6bdb117485609dc 100644
--- a/libcxx/test/libcxx/containers/sequences/deque/assert.pop_back.empty.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/deque/assert.pop_back.empty.pass.cpp
@@ -20,10 +20,10 @@
#include "check_assertion.h"
int main(int, char**) {
- std::deque<int> q;
- q.push_back(0);
- q.pop_back();
- TEST_LIBCPP_ASSERT_FAILURE(q.pop_back(), "deque::pop_back called on an empty deque");
+ std::deque<int> q;
+ q.push_back(0);
+ q.pop_back();
+ TEST_LIBCPP_ASSERT_FAILURE(q.pop_back(), "deque::pop_back called on an empty deque");
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/deque/incomplete.pass.cpp b/libcxx/test/libcxx/containers/sequences/deque/incomplete.pass.cpp
index 004a7c8b1600623..ebf586907833168 100644
--- a/libcxx/test/libcxx/containers/sequences/deque/incomplete.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/deque/incomplete.pass.cpp
@@ -24,11 +24,10 @@ struct A {
std::deque<A>::reverse_iterator it2;
};
-int main(int, char**)
-{
+int main(int, char**) {
A a;
assert(a.d.size() == 0);
- a.it = a.d.begin();
+ a.it = a.d.begin();
a.it2 = a.d.rend();
return 0;
diff --git a/libcxx/test/libcxx/containers/sequences/deque/segmented_iterator.compile.pass.cpp b/libcxx/test/libcxx/containers/sequences/deque/segmented_iterator.compile.pass.cpp
index 27100f9b45e3e87..7ae67d8d0252f52 100644
--- a/libcxx/test/libcxx/containers/sequences/deque/segmented_iterator.compile.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/deque/segmented_iterator.compile.pass.cpp
@@ -8,6 +8,5 @@
#include <deque>
-
using DequeIterator = typename std::deque<int>::iterator;
static_assert(std::__is_segmented_iterator<DequeIterator>::value, "");
diff --git a/libcxx/test/libcxx/containers/sequences/deque/spare_block_handling.pass.cpp b/libcxx/test/libcxx/containers/sequences/deque/spare_block_handling.pass.cpp
index e9e003432301e67..4fa4982de88fa0b 100644
--- a/libcxx/test/libcxx/containers/sequences/deque/spare_block_handling.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/deque/spare_block_handling.pass.cpp
@@ -33,12 +33,16 @@ struct ContainerAdaptor : public Adaptor {
template <class Deque>
static void print(const Deque& d) {
- std::printf("%zu : __front_spare() == %zu"
- " : __back_spare() == %zu"
- " : __capacity() == %zu"
- " : bytes allocated == %zu\n",
- d.size(), d.__front_spare(), d.__back_spare(), d.__capacity(),
- malloc_allocator_base::outstanding_bytes);
+ std::printf(
+ "%zu : __front_spare() == %zu"
+ " : __back_spare() == %zu"
+ " : __capacity() == %zu"
+ " : bytes allocated == %zu\n",
+ d.size(),
+ d.__front_spare(),
+ d.__back_spare(),
+ d.__capacity(),
+ malloc_allocator_base::outstanding_bytes);
}
template <class T>
@@ -48,7 +52,7 @@ template <class T>
using BlockSize = std::__deque_block_size<T, std::ptr
diff _t>;
struct LargeT {
- LargeT() = default;
+ LargeT() = default;
char buff[256] = {};
};
static_assert(BlockSize<LargeT>::value == 16, "");
@@ -57,15 +61,15 @@ const auto& AllocBytes = malloc_allocator_base::outstanding_bytes;
template <class Deque>
struct PrintOnFailure {
- explicit PrintOnFailure(Deque const& deque) : deque_(&deque) {}
- void operator()() const { print(*deque_); }
+ explicit PrintOnFailure(Deque const& deque) : deque_(&deque) {}
+ void operator()() const { print(*deque_); }
+
private:
const Deque* deque_;
PrintOnFailure(PrintOnFailure const&) = delete;
};
-
static void push_back() {
const auto BS = BlockSize<LargeT>::value;
std::unique_ptr<Deque<LargeT>> dp(new Deque<LargeT>);
@@ -194,11 +198,11 @@ static void push_front() {
}
static void std_queue() {
- using D = Deque<LargeT>;
+ using D = Deque<LargeT>;
using Queue = std::queue<LargeT, D>;
ContainerAdaptor<Queue> CA;
const D& d = CA.GetContainer();
- Queue &q = CA;
+ Queue& q = CA;
PrintOnFailure<Deque<LargeT>> on_fail(d);
while (d.__block_count() < 4)
diff --git a/libcxx/test/libcxx/containers/sequences/list/list.cons/debug.copy.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/list.cons/debug.copy.pass.cpp
index 8277a1b71038fbd..144a69691b4d314 100644
--- a/libcxx/test/libcxx/containers/sequences/list/list.cons/debug.copy.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/list/list.cons/debug.copy.pass.cpp
@@ -18,11 +18,13 @@
#include "check_assertion.h"
int main(int, char**) {
- std::list<int> l1;
- l1.push_back(1); l1.push_back(2); l1.push_back(3);
- std::list<int>::iterator i = l1.begin();
- std::list<int> l2 = l1;
- TEST_LIBCPP_ASSERT_FAILURE(l2.erase(i), "list::erase(iterator) called with an iterator not referring to this list");
+ std::list<int> l1;
+ l1.push_back(1);
+ l1.push_back(2);
+ l1.push_back(3);
+ std::list<int>::iterator i = l1.begin();
+ std::list<int> l2 = l1;
+ TEST_LIBCPP_ASSERT_FAILURE(l2.erase(i), "list::erase(iterator) called with an iterator not referring to this list");
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/assert.erase_iter.end.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/assert.erase_iter.end.pass.cpp
index 531dd8de399deb1..6441d533cfa2900 100644
--- a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/assert.erase_iter.end.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/assert.erase_iter.end.pass.cpp
@@ -20,10 +20,10 @@
#include "check_assertion.h"
int main(int, char**) {
- int a1[] = {1, 2, 3};
- std::list<int> l1(a1, a1+3);
- std::list<int>::const_iterator i = l1.end();
- TEST_LIBCPP_ASSERT_FAILURE(l1.erase(i), "list::erase(iterator) called with a non-dereferenceable iterator");
+ int a1[] = {1, 2, 3};
+ std::list<int> l1(a1, a1 + 3);
+ std::list<int>::const_iterator i = l1.end();
+ TEST_LIBCPP_ASSERT_FAILURE(l1.erase(i), "list::erase(iterator) called with a non-dereferenceable iterator");
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/assert.pop_back.empty.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/assert.pop_back.empty.pass.cpp
index d7c69991622704f..c34426485299591 100644
--- a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/assert.pop_back.empty.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/assert.pop_back.empty.pass.cpp
@@ -21,15 +21,15 @@
#include "check_assertion.h"
int main(int, char**) {
- int a[] = {1, 2, 3};
- std::list<int> c(a, a+3);
- c.pop_back();
- assert(c == std::list<int>(a, a+2));
- c.pop_back();
- assert(c == std::list<int>(a, a+1));
- c.pop_back();
- assert(c.empty());
- TEST_LIBCPP_ASSERT_FAILURE(c.pop_back(), "list::pop_back() called on an empty list");
+ int a[] = {1, 2, 3};
+ std::list<int> c(a, a + 3);
+ c.pop_back();
+ assert(c == std::list<int>(a, a + 2));
+ c.pop_back();
+ assert(c == std::list<int>(a, a + 1));
+ c.pop_back();
+ assert(c.empty());
+ TEST_LIBCPP_ASSERT_FAILURE(c.pop_back(), "list::pop_back() called on an empty list");
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.emplace.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.emplace.pass.cpp
index d0f82ed5055eee0..cd2f1eeea976ad0 100644
--- a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.emplace.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.emplace.pass.cpp
@@ -25,10 +25,10 @@ struct A {
};
int main(int, char**) {
- std::list<A> c1;
- std::list<A> c2;
- TEST_LIBCPP_ASSERT_FAILURE(c1.emplace(c2.cbegin(), 2, 3.5),
- "list::emplace(iterator, args...) called with an iterator not referring to this list");
+ std::list<A> c1;
+ std::list<A> c2;
+ TEST_LIBCPP_ASSERT_FAILURE(c1.emplace(c2.cbegin(), 2, 3.5),
+ "list::emplace(iterator, args...) called with an iterator not referring to this list");
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.erase.iter.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.erase.iter.pass.cpp
index d85b42a6c73e150..fb61673f4b7a4c4 100644
--- a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.erase.iter.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.erase.iter.pass.cpp
@@ -18,11 +18,11 @@
#include "check_assertion.h"
int main(int, char**) {
- int a1[] = {1, 2, 3};
- std::list<int> l1(a1, a1+3);
- std::list<int> l2(a1, a1+3);
- std::list<int>::const_iterator i = l2.begin();
- TEST_LIBCPP_ASSERT_FAILURE(l1.erase(i), "list::erase(iterator) called with an iterator not referring to this list");
+ int a1[] = {1, 2, 3};
+ std::list<int> l1(a1, a1 + 3);
+ std::list<int> l2(a1, a1 + 3);
+ std::list<int>::const_iterator i = l2.begin();
+ TEST_LIBCPP_ASSERT_FAILURE(l1.erase(i), "list::erase(iterator) called with an iterator not referring to this list");
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.erase.iter_iter.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.erase.iter_iter.pass.cpp
index a7c4ea492c797da..9d4198a120f99ea 100644
--- a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.erase.iter_iter.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.erase.iter_iter.pass.cpp
@@ -18,40 +18,40 @@
#include "check_assertion.h"
int main(int, char**) {
- // First iterator from another container
- {
- int a1[] = {1, 2, 3};
- std::list<int> l1(a1, a1+3);
- std::list<int> l2(a1, a1+3);
- TEST_LIBCPP_ASSERT_FAILURE(l1.erase(l2.cbegin(), std::next(l1.cbegin())),
- "list::erase(iterator, iterator) called with an iterator not referring to this list");
- }
-
- // Second iterator from another container
- {
- int a1[] = {1, 2, 3};
- std::list<int> l1(a1, a1+3);
- std::list<int> l2(a1, a1+3);
- TEST_LIBCPP_ASSERT_FAILURE(l1.erase(l1.cbegin(), std::next(l2.cbegin())),
- "list::erase(iterator, iterator) called with an iterator not referring to this list");
- }
-
- // Both iterators from another container
- {
- int a1[] = {1, 2, 3};
- std::list<int> l1(a1, a1+3);
- std::list<int> l2(a1, a1+3);
- TEST_LIBCPP_ASSERT_FAILURE(l1.erase(l2.cbegin(), std::next(l2.cbegin())),
- "list::erase(iterator, iterator) called with an iterator not referring to this list");
- }
-
- // With an invalid range
- {
- int a1[] = {1, 2, 3};
- std::list<int> l1(a1, a1+3);
- TEST_LIBCPP_ASSERT_FAILURE(l1.erase(std::next(l1.cbegin()), l1.cbegin()),
- "Attempted to increment a non-incrementable list::const_iterator");
- }
-
- return 0;
+ // First iterator from another container
+ {
+ int a1[] = {1, 2, 3};
+ std::list<int> l1(a1, a1 + 3);
+ std::list<int> l2(a1, a1 + 3);
+ TEST_LIBCPP_ASSERT_FAILURE(l1.erase(l2.cbegin(), std::next(l1.cbegin())),
+ "list::erase(iterator, iterator) called with an iterator not referring to this list");
+ }
+
+ // Second iterator from another container
+ {
+ int a1[] = {1, 2, 3};
+ std::list<int> l1(a1, a1 + 3);
+ std::list<int> l2(a1, a1 + 3);
+ TEST_LIBCPP_ASSERT_FAILURE(l1.erase(l1.cbegin(), std::next(l2.cbegin())),
+ "list::erase(iterator, iterator) called with an iterator not referring to this list");
+ }
+
+ // Both iterators from another container
+ {
+ int a1[] = {1, 2, 3};
+ std::list<int> l1(a1, a1 + 3);
+ std::list<int> l2(a1, a1 + 3);
+ TEST_LIBCPP_ASSERT_FAILURE(l1.erase(l2.cbegin(), std::next(l2.cbegin())),
+ "list::erase(iterator, iterator) called with an iterator not referring to this list");
+ }
+
+ // With an invalid range
+ {
+ int a1[] = {1, 2, 3};
+ std::list<int> l1(a1, a1 + 3);
+ TEST_LIBCPP_ASSERT_FAILURE(l1.erase(std::next(l1.cbegin()), l1.cbegin()),
+ "Attempted to increment a non-incrementable list::const_iterator");
+ }
+
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_iter_iter.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_iter_iter.pass.cpp
index 124f6c4b63065b0..13326a1d97ce508 100644
--- a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_iter_iter.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_iter_iter.pass.cpp
@@ -19,11 +19,11 @@
#include "check_assertion.h"
int main(int, char**) {
- std::list<int> v(100);
- std::list<int> v2(100);
- int a[] = {1, 2, 3, 4, 5};
- TEST_LIBCPP_ASSERT_FAILURE(v.insert(v2.cbegin(), a, a + 5),
- "list::insert(iterator, range) called with an iterator not referring to this list");
+ std::list<int> v(100);
+ std::list<int> v2(100);
+ int a[] = {1, 2, 3, 4, 5};
+ TEST_LIBCPP_ASSERT_FAILURE(v.insert(v2.cbegin(), a, a + 5),
+ "list::insert(iterator, range) called with an iterator not referring to this list");
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_rvalue.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_rvalue.pass.cpp
index fd4e8b82cb4128e..f4bce9a50a0500c 100644
--- a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_rvalue.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_rvalue.pass.cpp
@@ -18,10 +18,10 @@
#include "check_assertion.h"
int main(int, char**) {
- std::list<int> v1(3);
- std::list<int> v2(3);
- TEST_LIBCPP_ASSERT_FAILURE(v1.insert(v2.begin(), 4),
- "list::insert(iterator, x) called with an iterator not referring to this list");
+ std::list<int> v1(3);
+ std::list<int> v2(3);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ v1.insert(v2.begin(), 4), "list::insert(iterator, x) called with an iterator not referring to this list");
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_size_value.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_size_value.pass.cpp
index ee442a2b513dba9..46bad61f9c981d1 100644
--- a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_size_value.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_size_value.pass.cpp
@@ -18,10 +18,10 @@
#include "check_assertion.h"
int main(int, char**) {
- std::list<int> c1(100);
- std::list<int> c2;
- TEST_LIBCPP_ASSERT_FAILURE(c1.insert(c2.cbegin(), 5, 1),
- "list::insert(iterator, n, x) called with an iterator not referring to this list");
+ std::list<int> c1(100);
+ std::list<int> c2;
+ TEST_LIBCPP_ASSERT_FAILURE(
+ c1.insert(c2.cbegin(), 5, 1), "list::insert(iterator, n, x) called with an iterator not referring to this list");
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_value.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_value.pass.cpp
index b61d66ecaaa6234..16fa8efd07b6ba5 100644
--- a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_value.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/debug.insert.iter_value.pass.cpp
@@ -18,11 +18,11 @@
#include "check_assertion.h"
int main(int, char**) {
- std::list<int> v1(3);
- std::list<int> v2(3);
- int i = 4;
- TEST_LIBCPP_ASSERT_FAILURE(v1.insert(v2.begin(), i),
- "list::insert(iterator, x) called with an iterator not referring to this list");
+ std::list<int> v1(3);
+ std::list<int> v2(3);
+ int i = 4;
+ TEST_LIBCPP_ASSERT_FAILURE(
+ v1.insert(v2.begin(), i), "list::insert(iterator, x) called with an iterator not referring to this list");
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/list/list.ops/debug.splice.pos_list.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/list.ops/debug.splice.pos_list.pass.cpp
index 81890ea309bdd19..be759d06036c3a0 100644
--- a/libcxx/test/libcxx/containers/sequences/list/list.ops/debug.splice.pos_list.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/list/list.ops/debug.splice.pos_list.pass.cpp
@@ -20,7 +20,7 @@
int main(int, char**) {
std::list<int> v1(3);
std::list<int> v2(3);
- TEST_LIBCPP_ASSERT_FAILURE(v1.splice(v2.begin(), v2),
- "list::splice(iterator, list) called with an iterator not referring to this list");
+ TEST_LIBCPP_ASSERT_FAILURE(
+ v1.splice(v2.begin(), v2), "list::splice(iterator, list) called with an iterator not referring to this list");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/list/list.ops/debug.splice.pos_list_iter.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/list.ops/debug.splice.pos_list_iter.pass.cpp
index 05aa7aae8f43b46..1786a6c64edcb8e 100644
--- a/libcxx/test/libcxx/containers/sequences/list/list.ops/debug.splice.pos_list_iter.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/list/list.ops/debug.splice.pos_list_iter.pass.cpp
@@ -18,11 +18,11 @@
#include "check_assertion.h"
int main(int, char**) {
- std::list<int> v1(3);
- std::list<int> v2(3);
- TEST_LIBCPP_ASSERT_FAILURE(
- v1.splice(v1.begin(), v2, v1.begin()),
- "list::splice(iterator, list, iterator) called with the second iterator not referring to the list argument");
+ std::list<int> v1(3);
+ std::list<int> v2(3);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ v1.splice(v1.begin(), v2, v1.begin()),
+ "list::splice(iterator, list, iterator) called with the second iterator not referring to the list argument");
return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/vector.bool/trivial_for_purposes_of_call.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector.bool/trivial_for_purposes_of_call.pass.cpp
index d29b0f1a95abdd7..4d37b83ba9cd615 100644
--- a/libcxx/test/libcxx/containers/sequences/vector.bool/trivial_for_purposes_of_call.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/vector.bool/trivial_for_purposes_of_call.pass.cpp
@@ -31,12 +31,12 @@
#include <vector>
template <class T>
-using IsTrivialForCall = std::integral_constant<bool,
- std::is_trivially_copy_constructible<T>::value &&
- std::is_trivially_move_constructible<T>::value &&
- std::is_trivially_destructible<T>::value
- // Ignore the all-deleted case, it shouldn't occur here.
- >;
+using IsTrivialForCall = std::integral_constant<
+ bool,
+ std::is_trivially_copy_constructible<T>::value && std::is_trivially_move_constructible<T>::value &&
+ std::is_trivially_destructible<T>::value
+ // Ignore the all-deleted case, it shouldn't occur here.
+ >;
void test_const_iterator() {
using It = std::vector<bool>::const_iterator;
diff --git a/libcxx/test/libcxx/containers/sequences/vector/asan.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/asan.pass.cpp
index 614323b1ffd7bed..03d2b3e6ce9b95c 100644
--- a/libcxx/test/libcxx/containers/sequences/vector/asan.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/vector/asan.pass.cpp
@@ -23,12 +23,9 @@
extern "C" void __sanitizer_set_death_callback(void (*callback)(void));
-void do_exit() {
- exit(0);
-}
+void do_exit() { exit(0); }
-int main(int, char**)
-{
+int main(int, char**) {
#if TEST_STD_VER >= 11
{
typedef int T;
diff --git a/libcxx/test/libcxx/containers/sequences/vector/asan_throw.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/asan_throw.pass.cpp
index 6a267e546f927ce..dcfa8029cfc0d90 100644
--- a/libcxx/test/libcxx/containers/sequences/vector/asan_throw.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/vector/asan_throw.pass.cpp
@@ -17,10 +17,10 @@
class X {
public:
- X(const X &x) { Init(x.a); }
+ X(const X& x) { Init(x.a); }
X(char arg) { Init(arg); }
X() { Init(42); }
- X &operator=(const X &x) {
+ X& operator=(const X& x) {
Init(x.a);
return *this;
}
@@ -40,19 +40,17 @@ class X {
class ThrowOnCopy {
public:
- ThrowOnCopy() : should_throw(false) {}
- explicit ThrowOnCopy(bool xshould_throw) : should_throw(xshould_throw) {}
-
- ThrowOnCopy(ThrowOnCopy const & other)
- : should_throw(other.should_throw)
- {
- if (should_throw) {
- throw 0;
- }
+ ThrowOnCopy() : should_throw(false) {}
+ explicit ThrowOnCopy(bool xshould_throw) : should_throw(xshould_throw) {}
+
+ ThrowOnCopy(ThrowOnCopy const& other) : should_throw(other.should_throw) {
+ if (should_throw) {
+ throw 0;
}
- ThrowOnCopy& operator=(ThrowOnCopy const&) = default;
+ }
+ ThrowOnCopy& operator=(ThrowOnCopy const&) = default;
- bool should_throw;
+ bool should_throw;
};
void test_push_back() {
@@ -175,7 +173,6 @@ void test_insert_n() {
assert(0);
}
-
void test_insert_n2() {
std::vector<ThrowOnCopy> v(10);
v.reserve(100);
diff --git a/libcxx/test/libcxx/containers/sequences/vector/asan_turning_off.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/asan_turning_off.pass.cpp
index e2760271d60a55a..1ad60d0544d413a 100644
--- a/libcxx/test/libcxx/containers/sequences/vector/asan_turning_off.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/vector/asan_turning_off.pass.cpp
@@ -25,7 +25,7 @@ struct reuse_allocator {
static size_t const N = 100;
reuse_allocator() {
for (size_t i = 0; i < N; ++i)
- __buffers[i] = malloc(8*1024);
+ __buffers[i] = malloc(8 * 1024);
}
~reuse_allocator() {
for (size_t i = 0; i < N; ++i)
@@ -46,8 +46,8 @@ struct user_allocator {
user_allocator() = default;
template <class U>
user_allocator(user_allocator<U>) {}
- friend bool operator==(user_allocator, user_allocator) {return true;}
- friend bool operator!=(user_allocator x, user_allocator y) {return !(x == y);}
+ friend bool operator==(user_allocator, user_allocator) { return true; }
+ friend bool operator!=(user_allocator x, user_allocator y) { return !(x == y); }
T* allocate(size_t) { return (T*)reuse_buffers.alloc(); }
void deallocate(T*, size_t) noexcept {}
diff --git a/libcxx/test/libcxx/containers/sequences/vector/assert.pop_back.empty.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/assert.pop_back.empty.pass.cpp
index ad80be69897edc7..6734f25b9db1020 100644
--- a/libcxx/test/libcxx/containers/sequences/vector/assert.pop_back.empty.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/vector/assert.pop_back.empty.pass.cpp
@@ -20,10 +20,10 @@
#include "check_assertion.h"
int main(int, char**) {
- std::vector<int> v;
- v.push_back(0);
- v.pop_back();
- TEST_LIBCPP_ASSERT_FAILURE(v.pop_back(), "vector::pop_back called on an empty vector");
+ std::vector<int> v;
+ v.push_back(0);
+ v.pop_back();
+ TEST_LIBCPP_ASSERT_FAILURE(v.pop_back(), "vector::pop_back called on an empty vector");
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/sequences/vector/erase.modules.compile.pass.mm b/libcxx/test/libcxx/containers/sequences/vector/erase.modules.compile.pass.mm
index 0e21a2e168b2c18..d27067399eda8e8 100644
--- a/libcxx/test/libcxx/containers/sequences/vector/erase.modules.compile.pass.mm
+++ b/libcxx/test/libcxx/containers/sequences/vector/erase.modules.compile.pass.mm
@@ -13,6 +13,4 @@
#include <vector>
-void f(std::vector<int> vec, std::vector<int>::iterator it) {
- (void)vec.erase(it);
-}
+void f(std::vector<int> vec, std::vector<int>::iterator it) { (void)vec.erase(it); }
diff --git a/libcxx/test/libcxx/containers/sequences/vector/exception_safety_exceptions_disabled.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/exception_safety_exceptions_disabled.pass.cpp
index df562474c185a36..66fdf37556bce31 100644
--- a/libcxx/test/libcxx/containers/sequences/vector/exception_safety_exceptions_disabled.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/vector/exception_safety_exceptions_disabled.pass.cpp
@@ -22,7 +22,7 @@
#include "test_macros.h"
#ifndef TEST_HAS_NO_EXCEPTIONS
-#error exceptions should be disabled.
+# error exceptions should be disabled.
#endif
bool allow_moves = false;
diff --git a/libcxx/test/libcxx/containers/sequences/vector/invalid_allocator.verify.cpp b/libcxx/test/libcxx/containers/sequences/vector/invalid_allocator.verify.cpp
index c1d72bcd555ceb3..e2de7730f25991a 100644
--- a/libcxx/test/libcxx/containers/sequences/vector/invalid_allocator.verify.cpp
+++ b/libcxx/test/libcxx/containers/sequences/vector/invalid_allocator.verify.cpp
@@ -11,9 +11,9 @@
#include <vector>
class FooAllocator {
- public:
+public:
using value_type = int;
- FooAllocator() = default;
+ FooAllocator() = default;
int* allocate(int num_objects);
@@ -24,5 +24,6 @@ class FooAllocator {
};
void func() {
- std::vector<int, FooAllocator> v; //expected-error-re@*:* {{static assertion failed {{.*}}This allocator has to implement rebind}}
+ std::vector<int, FooAllocator>
+ v; //expected-error-re@*:* {{static assertion failed {{.*}}This allocator has to implement rebind}}
}
diff --git a/libcxx/test/libcxx/containers/sequences/vector/robust_against_adl.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/robust_against_adl.pass.cpp
index 9c780ae98d1e840..c6868ce4cb867a1 100644
--- a/libcxx/test/libcxx/containers/sequences/vector/robust_against_adl.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/vector/robust_against_adl.pass.cpp
@@ -17,35 +17,38 @@
#include "test_macros.h"
struct Incomplete;
-template<class T> struct Holder { T t; };
+template <class T>
+struct Holder {
+ T t;
+};
-template<class T, class AdlTrap = Holder<Incomplete>>
+template <class T, class AdlTrap = Holder<Incomplete>>
struct MyAlloc {
- using value_type = T;
- MyAlloc() = default;
- template<class U> MyAlloc(const MyAlloc<U>&) {}
- T *allocate(std::size_t n) { return std::allocator<T>().allocate(n); }
- void deallocate(T *p, std::size_t n) { return std::allocator<T>().deallocate(p, n); }
+ using value_type = T;
+ MyAlloc() = default;
+ template <class U>
+ MyAlloc(const MyAlloc<U>&) {}
+ T* allocate(std::size_t n) { return std::allocator<T>().allocate(n); }
+ void deallocate(T* p, std::size_t n) { return std::allocator<T>().deallocate(p, n); }
};
-int main(int, char**)
-{
- std::vector<bool, MyAlloc<bool>> vb;
- // std::fill_n triggers ADL because __bit_iterator has the container type as a template argument
- // std::vector<bool, MyAlloc<bool>> wb(100);
-
- std::vector<int, MyAlloc<int>> v;
- std::vector<int, MyAlloc<int>> w(100);
- v.push_back(1);
- v.insert(v.end(), 2);
- v.insert(v.end(), w.begin(), w.end());
- v.pop_back();
- v.erase(v.begin());
- v.erase(v.begin(), v.end());
+int main(int, char**) {
+ std::vector<bool, MyAlloc<bool>> vb;
+ // std::fill_n triggers ADL because __bit_iterator has the container type as a template argument
+ // std::vector<bool, MyAlloc<bool>> wb(100);
+
+ std::vector<int, MyAlloc<int>> v;
+ std::vector<int, MyAlloc<int>> w(100);
+ v.push_back(1);
+ v.insert(v.end(), 2);
+ v.insert(v.end(), w.begin(), w.end());
+ v.pop_back();
+ v.erase(v.begin());
+ v.erase(v.begin(), v.end());
#if TEST_STD_VER >= 14
- // TODO: vector::swap is not robust against ADL because we compare allocators, and that
- // triggers ADL when looking up operator==.
- // v.swap(w);
+ // TODO: vector::swap is not robust against ADL because we compare allocators, and that
+ // triggers ADL when looking up operator==.
+ // v.swap(w);
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/key_value_traits.pass.cpp b/libcxx/test/libcxx/containers/unord/key_value_traits.pass.cpp
index 4b389fa759f895d..e00a028489a7265 100644
--- a/libcxx/test/libcxx/containers/unord/key_value_traits.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/key_value_traits.pass.cpp
@@ -47,10 +47,8 @@ void testKeyValueTrait() {
static_assert((std::is_same<Traits::key_type, int>::value), "");
static_assert((std::is_same<Traits::mapped_type, int>::value), "");
static_assert((std::is_same<Traits::__node_value_type, Tp>::value), "");
- static_assert((std::is_same<Traits::__container_value_type,
- std::pair<const int, int> >::value), "");
- static_assert((std::is_same<Traits::__map_value_type,
- std::pair<const int, int> >::value), "");
+ static_assert((std::is_same<Traits::__container_value_type, std::pair<const int, int> >::value), "");
+ static_assert((std::is_same<Traits::__map_value_type, std::pair<const int, int> >::value), "");
static_assert(Traits::__is_map == true, "");
}
}
diff --git a/libcxx/test/libcxx/containers/unord/next_pow2.pass.cpp b/libcxx/test/libcxx/containers/unord/next_pow2.pass.cpp
index 8a5d448dbf922b8..53a1dd2d3fa766f 100644
--- a/libcxx/test/libcxx/containers/unord/next_pow2.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/next_pow2.pass.cpp
@@ -27,65 +27,52 @@
#include "test_macros.h"
+bool is_power_of_two(unsigned long n) { return __builtin_popcount(n) == 1; }
-bool
-is_power_of_two(unsigned long n)
-{
- return __builtin_popcount(n) == 1;
+void test_next_pow2_val(std::size_t n) {
+ std::size_t npow2 = std::__next_hash_pow2(n);
+ assert(is_power_of_two(npow2) && npow2 > n);
}
-void test_next_pow2_val(std::size_t n)
-{
- std::size_t npow2 = std::__next_hash_pow2(n);
- assert(is_power_of_two(npow2) && npow2 > n);
-}
-
-void
-test_next_pow2()
-{
- assert(!is_power_of_two(0));
- assert(is_power_of_two(1));
- assert(is_power_of_two(2));
- assert(!is_power_of_two(3));
-
- assert(std::__next_hash_pow2(0) == 0);
- assert(std::__next_hash_pow2(1) == 1);
-
- for (std::size_t n = 2; n < (sizeof(std::size_t) * 8 - 1); ++n)
- {
- std::size_t pow2 = 1ULL << n;
- assert(std::__next_hash_pow2(pow2) == pow2);
- }
-
- test_next_pow2_val(3);
- test_next_pow2_val(7);
- test_next_pow2_val(9);
- test_next_pow2_val(15);
- test_next_pow2_val(127);
- test_next_pow2_val(129);
+void test_next_pow2() {
+ assert(!is_power_of_two(0));
+ assert(is_power_of_two(1));
+ assert(is_power_of_two(2));
+ assert(!is_power_of_two(3));
+
+ assert(std::__next_hash_pow2(0) == 0);
+ assert(std::__next_hash_pow2(1) == 1);
+
+ for (std::size_t n = 2; n < (sizeof(std::size_t) * 8 - 1); ++n) {
+ std::size_t pow2 = 1ULL << n;
+ assert(std::__next_hash_pow2(pow2) == pow2);
+ }
+
+ test_next_pow2_val(3);
+ test_next_pow2_val(7);
+ test_next_pow2_val(9);
+ test_next_pow2_val(15);
+ test_next_pow2_val(127);
+ test_next_pow2_val(129);
}
// Note: this is only really useful when run with -fsanitize=undefined.
-void
-fuzz_unordered_map_reserve(unsigned num_inserts,
- unsigned num_reserve1,
- unsigned num_reserve2)
-{
- std::unordered_map<std::uint64_t, unsigned long> m;
- m.reserve(num_reserve1);
- for (unsigned I = 0; I < num_inserts; ++I) m[I] = 0;
- m.reserve(num_reserve2);
- assert(m.bucket_count() >= num_reserve2);
+void fuzz_unordered_map_reserve(unsigned num_inserts, unsigned num_reserve1, unsigned num_reserve2) {
+ std::unordered_map<std::uint64_t, unsigned long> m;
+ m.reserve(num_reserve1);
+ for (unsigned I = 0; I < num_inserts; ++I)
+ m[I] = 0;
+ m.reserve(num_reserve2);
+ assert(m.bucket_count() >= num_reserve2);
}
-int main(int, char**)
-{
- test_next_pow2();
+int main(int, char**) {
+ test_next_pow2();
- for (unsigned num_inserts = 0; num_inserts <= 64; ++num_inserts)
- for (unsigned num_reserve1 = 1; num_reserve1 <= 64; ++num_reserve1)
- for (unsigned num_reserve2 = 1; num_reserve2 <= 64; ++num_reserve2)
- fuzz_unordered_map_reserve(num_inserts, num_reserve1, num_reserve2);
+ for (unsigned num_inserts = 0; num_inserts <= 64; ++num_inserts)
+ for (unsigned num_reserve1 = 1; num_reserve1 <= 64; ++num_reserve1)
+ for (unsigned num_reserve2 = 1; num_reserve2 <= 64; ++num_reserve2)
+ fuzz_unordered_map_reserve(num_inserts, num_reserve1, num_reserve2);
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/next_prime.pass.cpp b/libcxx/test/libcxx/containers/unord/next_prime.pass.cpp
index 17a29033856c923..44b0eb96e2b9bc7 100644
--- a/libcxx/test/libcxx/containers/unord/next_prime.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/next_prime.pass.cpp
@@ -24,34 +24,28 @@
#include "test_macros.h"
-bool
-is_prime(std::size_t n)
-{
- switch (n)
- {
- case 0:
- case 1:
- return false;
- }
- for (std::size_t i = 2; i*i <= n; ++i)
- {
- if (n % i == 0)
- return false;
- }
- return true;
+bool is_prime(std::size_t n) {
+ switch (n) {
+ case 0:
+ case 1:
+ return false;
+ }
+ for (std::size_t i = 2; i * i <= n; ++i) {
+ if (n % i == 0)
+ return false;
+ }
+ return true;
}
-int main(int, char**)
-{
- assert(std::__next_prime(0) == 0);
- for (std::size_t n = 1; n <= 100000; ++n)
- {
- std::size_t p = std::__next_prime(n);
- assert(p >= n);
- for (std::size_t i = n; i < p; ++i)
- assert(!is_prime(i));
- assert(is_prime(p));
- }
+int main(int, char**) {
+ assert(std::__next_prime(0) == 0);
+ for (std::size_t n = 1; n <= 100000; ++n) {
+ std::size_t p = std::__next_prime(n);
+ assert(p >= n);
+ for (std::size_t i = n; i < p; ++i)
+ assert(!is_prime(i));
+ assert(is_prime(p));
+ }
return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/non_const_comparator.incomplete.verify.cpp b/libcxx/test/libcxx/containers/unord/non_const_comparator.incomplete.verify.cpp
index 9fd4f698b5f96d2..c370cd65085a103 100644
--- a/libcxx/test/libcxx/containers/unord/non_const_comparator.incomplete.verify.cpp
+++ b/libcxx/test/libcxx/containers/unord/non_const_comparator.incomplete.verify.cpp
@@ -19,32 +19,33 @@
#include "test_macros.h"
-
-template <template <typename ...> class Container>
+template <template <typename...> class Container>
void test_set() {
- struct KeyBase { };
- struct KeyDerived; // derives from KeyBase, but incomplete at this point
+ struct KeyBase {};
+ struct KeyDerived; // derives from KeyBase, but incomplete at this point
// Name the type but don't instantiate it.
using C = Container<KeyDerived*, std::hash<KeyBase*>, std::equal_to<KeyBase*>>;
// Instantiate it but don't ODR use any members.
- typename C::value_type dummy; (void)dummy;
+ typename C::value_type dummy;
+ (void)dummy;
// Complete the types.
- struct KeyDerived : KeyBase { };
+ struct KeyDerived : KeyBase {};
C c; // ODR use it, which should be OK
}
-template <template <typename ...> class Container>
+template <template <typename...> class Container>
void test_map() {
- struct Value { };
- struct KeyBase { };
+ struct Value {};
+ struct KeyBase {};
struct KeyDerived;
using C = Container<KeyDerived*, Value, std::hash<KeyBase*>, std::equal_to<KeyBase*>>;
- typename C::value_type dummy; (void)dummy;
- struct KeyDerived : KeyBase { };
+ typename C::value_type dummy;
+ (void)dummy;
+ struct KeyDerived : KeyBase {};
C c;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.map/assert.bucket.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/assert.bucket.pass.cpp
index 8d23673dfc50f2d..26621bce5218773 100644
--- a/libcxx/test/libcxx/containers/unord/unord.map/assert.bucket.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.map/assert.bucket.pass.cpp
@@ -21,9 +21,9 @@
#include "check_assertion.h"
int main(int, char**) {
- typedef std::unordered_map<int, std::string> C;
- C c;
- TEST_LIBCPP_ASSERT_FAILURE(c.bucket(3), "unordered container::bucket(key) called when bucket_count() == 0");
+ typedef std::unordered_map<int, std::string> C;
+ C c;
+ TEST_LIBCPP_ASSERT_FAILURE(c.bucket(3), "unordered container::bucket(key) called when bucket_count() == 0");
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.map/assert.bucket_size.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/assert.bucket_size.pass.cpp
index 0a0bb888182e9e0..ce6534f95f8dcff 100644
--- a/libcxx/test/libcxx/containers/unord/unord.map/assert.bucket_size.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.map/assert.bucket_size.pass.cpp
@@ -25,9 +25,9 @@
#include "check_assertion.h"
int main(int, char**) {
- typedef std::unordered_map<int, std::string> C;
- C c;
- TEST_LIBCPP_ASSERT_FAILURE(c.bucket_size(3), "unordered container::bucket_size(n) called with n >= bucket_count()");
+ typedef std::unordered_map<int, std::string> C;
+ C c;
+ TEST_LIBCPP_ASSERT_FAILURE(c.bucket_size(3), "unordered container::bucket_size(n) called with n >= bucket_count()");
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.map/assert.max_load_factor.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/assert.max_load_factor.pass.cpp
index 452a3ae8c3818f8..117758c5385e017 100644
--- a/libcxx/test/libcxx/containers/unord/unord.map/assert.max_load_factor.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.map/assert.max_load_factor.pass.cpp
@@ -26,9 +26,9 @@
#include "check_assertion.h"
int main(int, char**) {
- typedef std::unordered_map<int, std::string> C;
- C c;
- TEST_LIBCPP_ASSERT_FAILURE(c.max_load_factor(0), "unordered container::max_load_factor(lf) called with lf <= 0");
+ typedef std::unordered_map<int, std::string> C;
+ C c;
+ TEST_LIBCPP_ASSERT_FAILURE(c.max_load_factor(0), "unordered container::max_load_factor(lf) called with lf <= 0");
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.map/at.abort.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/at.abort.pass.cpp
index 01fcdf8a8910e49..bd6da6c4d69c9fe 100644
--- a/libcxx/test/libcxx/containers/unord/unord.map/at.abort.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.map/at.abort.pass.cpp
@@ -24,10 +24,9 @@
#include "test_macros.h"
-
int main(int, char**) {
- std::signal(SIGABRT, [](int) { std::_Exit(EXIT_SUCCESS); });
- std::unordered_map<int, int> map;
- map.at(1);
- return EXIT_FAILURE;
+ std::signal(SIGABRT, [](int) { std::_Exit(EXIT_SUCCESS); });
+ std::unordered_map<int, int> map;
+ map.at(1);
+ return EXIT_FAILURE;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.map/at.const.abort.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/at.const.abort.pass.cpp
index 9e3ba1189bcd14a..badd243dc1264c1 100644
--- a/libcxx/test/libcxx/containers/unord/unord.map/at.const.abort.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.map/at.const.abort.pass.cpp
@@ -24,10 +24,9 @@
#include "test_macros.h"
-
int main(int, char**) {
- std::signal(SIGABRT, [](int) { std::_Exit(EXIT_SUCCESS); });
- std::unordered_map<int, int> const map;
- map.at(1);
- return EXIT_FAILURE;
+ std::signal(SIGABRT, [](int) { std::_Exit(EXIT_SUCCESS); });
+ std::unordered_map<int, int> const map;
+ map.at(1);
+ return EXIT_FAILURE;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.map/debug.insert.hint_const_lvalue.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/debug.insert.hint_const_lvalue.pass.cpp
index 9826941477e70b1..927a9e8813325de 100644
--- a/libcxx/test/libcxx/containers/unord/unord.map/debug.insert.hint_const_lvalue.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.map/debug.insert.hint_const_lvalue.pass.cpp
@@ -19,21 +19,23 @@
#include "test_macros.h"
int main(int, char**) {
- typedef std::unordered_map<double, int> C;
- typedef C::value_type P;
- C c;
- C c2;
- C::const_iterator e = c2.end();
- P v(3.5, 3);
+ typedef std::unordered_map<double, int> C;
+ typedef C::value_type P;
+ C c;
+ C c2;
+ C::const_iterator e = c2.end();
+ P v(3.5, 3);
#if TEST_STD_VER < 11
- TEST_LIBCPP_ASSERT_FAILURE(
- c.insert(e, v),
- "unordered_map::insert(const_iterator, const value_type&) called with an iterator not referring to this unordered_map");
+ TEST_LIBCPP_ASSERT_FAILURE(
+ c.insert(e, v),
+ "unordered_map::insert(const_iterator, const value_type&) called with an iterator not "
+ "referring to this unordered_map");
#else
- TEST_LIBCPP_ASSERT_FAILURE(
- c.insert(e, v),
- "unordered_map::insert(const_iterator, value_type&&) called with an iterator not referring to this unordered_map");
+ TEST_LIBCPP_ASSERT_FAILURE(
+ c.insert(e, v),
+ "unordered_map::insert(const_iterator, value_type&&) called with an iterator not "
+ "referring to this unordered_map");
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.map/debug.insert.hint_rvalue.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/debug.insert.hint_rvalue.pass.cpp
index e4adb91b8e7f946..e8a34c3c60851f8 100644
--- a/libcxx/test/libcxx/containers/unord/unord.map/debug.insert.hint_rvalue.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.map/debug.insert.hint_rvalue.pass.cpp
@@ -21,14 +21,15 @@
#include "test_macros.h"
int main(int, char**) {
- typedef std::unordered_map<double, int> C;
- typedef C::value_type P;
- C c;
- C c2;
- C::const_iterator e = c2.end();
- TEST_LIBCPP_ASSERT_FAILURE(
- c.insert(e, P(3.5, 3)),
- "unordered_map::insert(const_iterator, const value_type&) called with an iterator not referring to this unordered_map");
+ typedef std::unordered_map<double, int> C;
+ typedef C::value_type P;
+ C c;
+ C c2;
+ C::const_iterator e = c2.end();
+ TEST_LIBCPP_ASSERT_FAILURE(
+ c.insert(e, P(3.5, 3)),
+ "unordered_map::insert(const_iterator, const value_type&) called with an iterator not "
+ "referring to this unordered_map");
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.map/debug.swap.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/debug.swap.pass.cpp
index c9c100979ff08cf..cda7f971da1e567 100644
--- a/libcxx/test/libcxx/containers/unord/unord.map/debug.swap.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.map/debug.swap.pass.cpp
@@ -22,17 +22,17 @@
#include "check_assertion.h"
int main(int, char**) {
- typedef std::pair<int, int> P;
- P a1[] = {P(1, 1), P(3, 3), P(7, 7), P(9, 9), P(10, 10)};
- P a2[] = {P(0, 0), P(2, 2), P(4, 4), P(5, 5), P(6, 6), P(8, 8), P(11, 11)};
- std::unordered_map<int, int> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
- std::unordered_map<int, int> c2(a2, a2+sizeof(a2)/sizeof(a2[0]));
- std::unordered_map<int, int>::iterator i1 = c1.begin();
- std::unordered_map<int, int>::iterator i2 = c2.begin();
- swap(c1, c2);
- c1.erase(i2);
- TEST_LIBCPP_ASSERT_FAILURE(
- c1.erase(i1), "unordered container erase(iterator) called with an iterator not referring to this container");
-
- return 0;
+ typedef std::pair<int, int> P;
+ P a1[] = {P(1, 1), P(3, 3), P(7, 7), P(9, 9), P(10, 10)};
+ P a2[] = {P(0, 0), P(2, 2), P(4, 4), P(5, 5), P(6, 6), P(8, 8), P(11, 11)};
+ std::unordered_map<int, int> c1(a1, a1 + sizeof(a1) / sizeof(a1[0]));
+ std::unordered_map<int, int> c2(a2, a2 + sizeof(a2) / sizeof(a2[0]));
+ std::unordered_map<int, int>::iterator i1 = c1.begin();
+ std::unordered_map<int, int>::iterator i2 = c2.begin();
+ swap(c1, c2);
+ c1.erase(i2);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ c1.erase(i1), "unordered container erase(iterator) called with an iterator not referring to this container");
+
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/debug.erase.iter.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/debug.erase.iter.pass.cpp
index 777b00ec2d4259f..ef5a53e3de47062 100644
--- a/libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/debug.erase.iter.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/debug.erase.iter.pass.cpp
@@ -18,26 +18,26 @@
#include "check_assertion.h"
int main(int, char**) {
- // With end()
- {
- typedef std::pair<int, int> P;
- P a1[] = {P(1, 1), P(2, 2), P(3, 3)};
- std::unordered_map<int, int> l1(a1, a1+3);
- std::unordered_map<int, int>::const_iterator i = l1.end();
- TEST_LIBCPP_ASSERT_FAILURE(l1.erase(i),
- "unordered container erase(iterator) called with a non-dereferenceable iterator");
- }
-
- // With iterator from another container
- {
- typedef std::pair<int, int> P;
- P a1[] = {P(1, 1), P(2, 2), P(3, 3)};
- std::unordered_map<int, int> l1(a1, a1+3);
- std::unordered_map<int, int> l2(a1, a1+3);
- std::unordered_map<int, int>::const_iterator i = l2.begin();
- TEST_LIBCPP_ASSERT_FAILURE(
- l1.erase(i), "unordered container erase(iterator) called with an iterator not referring to this container");
- }
-
- return 0;
+ // With end()
+ {
+ typedef std::pair<int, int> P;
+ P a1[] = {P(1, 1), P(2, 2), P(3, 3)};
+ std::unordered_map<int, int> l1(a1, a1 + 3);
+ std::unordered_map<int, int>::const_iterator i = l1.end();
+ TEST_LIBCPP_ASSERT_FAILURE(
+ l1.erase(i), "unordered container erase(iterator) called with a non-dereferenceable iterator");
+ }
+
+ // With iterator from another container
+ {
+ typedef std::pair<int, int> P;
+ P a1[] = {P(1, 1), P(2, 2), P(3, 3)};
+ std::unordered_map<int, int> l1(a1, a1 + 3);
+ std::unordered_map<int, int> l2(a1, a1 + 3);
+ std::unordered_map<int, int>::const_iterator i = l2.begin();
+ TEST_LIBCPP_ASSERT_FAILURE(
+ l1.erase(i), "unordered container erase(iterator) called with an iterator not referring to this container");
+ }
+
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/debug.erase.iter_iter.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/debug.erase.iter_iter.pass.cpp
index b99e4451a434ab8..1f364bf2ec19254 100644
--- a/libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/debug.erase.iter_iter.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.map/unord.map.modifiers/debug.erase.iter_iter.pass.cpp
@@ -18,47 +18,47 @@
#include "check_assertion.h"
int main(int, char**) {
- // First iterator from a
diff erent container
- {
- typedef std::pair<int, int> P;
- P a1[] = {P(1, 1), P(2, 2), P(3, 3)};
- std::unordered_map<int, int> l1(a1, a1+3);
- std::unordered_map<int, int> l2(a1, a1+3);
- TEST_LIBCPP_ASSERT_FAILURE(
- l1.erase(l2.cbegin(), std::next(l1.cbegin())),
- "unordered container::erase(iterator, iterator) called with an iterator not referring to this container");
- }
+ // First iterator from a
diff erent container
+ {
+ typedef std::pair<int, int> P;
+ P a1[] = {P(1, 1), P(2, 2), P(3, 3)};
+ std::unordered_map<int, int> l1(a1, a1 + 3);
+ std::unordered_map<int, int> l2(a1, a1 + 3);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ l1.erase(l2.cbegin(), std::next(l1.cbegin())),
+ "unordered container::erase(iterator, iterator) called with an iterator not referring to this container");
+ }
- // Second iterator from a
diff erent container
- {
- typedef std::pair<int, int> P;
- P a1[] = {P(1, 1), P(2, 2), P(3, 3)};
- std::unordered_map<int, int> l1(a1, a1+3);
- std::unordered_map<int, int> l2(a1, a1+3);
- TEST_LIBCPP_ASSERT_FAILURE(
- l1.erase(l1.cbegin(), std::next(l2.cbegin())),
- "unordered container::erase(iterator, iterator) called with an iterator not referring to this container");
- }
+ // Second iterator from a
diff erent container
+ {
+ typedef std::pair<int, int> P;
+ P a1[] = {P(1, 1), P(2, 2), P(3, 3)};
+ std::unordered_map<int, int> l1(a1, a1 + 3);
+ std::unordered_map<int, int> l2(a1, a1 + 3);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ l1.erase(l1.cbegin(), std::next(l2.cbegin())),
+ "unordered container::erase(iterator, iterator) called with an iterator not referring to this container");
+ }
- // Both iterators from a
diff erent container
- {
- typedef std::pair<int, int> P;
- P a1[] = {P(1, 1), P(2, 2), P(3, 3)};
- std::unordered_map<int, int> l1(a1, a1+3);
- std::unordered_map<int, int> l2(a1, a1+3);
- TEST_LIBCPP_ASSERT_FAILURE(
- l1.erase(l2.cbegin(), std::next(l2.cbegin())),
- "unordered container::erase(iterator, iterator) called with an iterator not referring to this container");
- }
+ // Both iterators from a
diff erent container
+ {
+ typedef std::pair<int, int> P;
+ P a1[] = {P(1, 1), P(2, 2), P(3, 3)};
+ std::unordered_map<int, int> l1(a1, a1 + 3);
+ std::unordered_map<int, int> l2(a1, a1 + 3);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ l1.erase(l2.cbegin(), std::next(l2.cbegin())),
+ "unordered container::erase(iterator, iterator) called with an iterator not referring to this container");
+ }
- // With iterators that don't form a valid range
- {
- typedef std::pair<int, int> P;
- P a1[] = {P(1, 1), P(2, 2), P(3, 3)};
- std::unordered_map<int, int> l1(a1, a1+3);
- TEST_LIBCPP_ASSERT_FAILURE(l1.erase(std::next(l1.cbegin()), l1.cbegin()),
- "Attempted to increment a non-incrementable unordered container const_iterator");
- }
+ // With iterators that don't form a valid range
+ {
+ typedef std::pair<int, int> P;
+ P a1[] = {P(1, 1), P(2, 2), P(3, 3)};
+ std::unordered_map<int, int> l1(a1, a1 + 3);
+ TEST_LIBCPP_ASSERT_FAILURE(l1.erase(std::next(l1.cbegin()), l1.cbegin()),
+ "Attempted to increment a non-incrementable unordered container const_iterator");
+ }
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multimap/assert.bucket.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multimap/assert.bucket.pass.cpp
index ec3892f444cd6b4..61c1651fdd956c8 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multimap/assert.bucket.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multimap/assert.bucket.pass.cpp
@@ -25,9 +25,9 @@
#include "check_assertion.h"
int main(int, char**) {
- typedef std::unordered_multimap<int, std::string> C;
- C c;
- TEST_LIBCPP_ASSERT_FAILURE(c.bucket(3), "unordered container::bucket(key) called when bucket_count() == 0");
+ typedef std::unordered_multimap<int, std::string> C;
+ C c;
+ TEST_LIBCPP_ASSERT_FAILURE(c.bucket(3), "unordered container::bucket(key) called when bucket_count() == 0");
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multimap/assert.bucket_size.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multimap/assert.bucket_size.pass.cpp
index ea5904b94019eb4..8f2efdb6e56e62f 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multimap/assert.bucket_size.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multimap/assert.bucket_size.pass.cpp
@@ -25,9 +25,9 @@
#include "check_assertion.h"
int main(int, char**) {
- typedef std::unordered_multimap<int, std::string> C;
- C c;
- TEST_LIBCPP_ASSERT_FAILURE(c.bucket_size(3), "unordered container::bucket_size(n) called with n >= bucket_count()");
+ typedef std::unordered_multimap<int, std::string> C;
+ C c;
+ TEST_LIBCPP_ASSERT_FAILURE(c.bucket_size(3), "unordered container::bucket_size(n) called with n >= bucket_count()");
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multimap/assert.max_load_factor.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multimap/assert.max_load_factor.pass.cpp
index 65f7c91d293d6c5..dda5fe8b632bd1f 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multimap/assert.max_load_factor.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multimap/assert.max_load_factor.pass.cpp
@@ -26,9 +26,9 @@
#include "check_assertion.h"
int main(int, char**) {
- typedef std::unordered_multimap<int, std::string> C;
- C c;
- TEST_LIBCPP_ASSERT_FAILURE(c.max_load_factor(0), "unordered container::max_load_factor(lf) called with lf <= 0");
+ typedef std::unordered_multimap<int, std::string> C;
+ C c;
+ TEST_LIBCPP_ASSERT_FAILURE(c.max_load_factor(0), "unordered container::max_load_factor(lf) called with lf <= 0");
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multimap/debug.insert.hint_const_lvalue.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multimap/debug.insert.hint_const_lvalue.pass.cpp
index e84c8f245ea35cd..017431077b7143a 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multimap/debug.insert.hint_const_lvalue.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multimap/debug.insert.hint_const_lvalue.pass.cpp
@@ -18,15 +18,16 @@
#include "check_assertion.h"
int main(int, char**) {
- typedef std::unordered_multimap<double, int> C;
- typedef C::value_type P;
- C c;
- C c2;
- C::const_iterator e = c2.end();
- P v(3.5, 3);
- TEST_LIBCPP_ASSERT_FAILURE(
- c.insert(e, v),
- "unordered container::emplace_hint(const_iterator, args...) called with an iterator not referring to this unordered container");
+ typedef std::unordered_multimap<double, int> C;
+ typedef C::value_type P;
+ C c;
+ C c2;
+ C::const_iterator e = c2.end();
+ P v(3.5, 3);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ c.insert(e, v),
+ "unordered container::emplace_hint(const_iterator, args...) called with an iterator not "
+ "referring to this unordered container");
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multimap/debug.insert.hint_rvalue.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multimap/debug.insert.hint_rvalue.pass.cpp
index 43663d0dd47b5ad..3713d78e347fab1 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multimap/debug.insert.hint_rvalue.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multimap/debug.insert.hint_rvalue.pass.cpp
@@ -20,14 +20,15 @@
#include "check_assertion.h"
int main(int, char**) {
- typedef std::unordered_multimap<double, int> C;
- typedef C::value_type P;
- C c;
- C c2;
- C::const_iterator e = c2.end();
- TEST_LIBCPP_ASSERT_FAILURE(
- c.insert(e, P(3.5, 3)),
- "unordered container::emplace_hint(const_iterator, args...) called with an iterator not referring to this unordered container");
+ typedef std::unordered_multimap<double, int> C;
+ typedef C::value_type P;
+ C c;
+ C c2;
+ C::const_iterator e = c2.end();
+ TEST_LIBCPP_ASSERT_FAILURE(
+ c.insert(e, P(3.5, 3)),
+ "unordered container::emplace_hint(const_iterator, args...) called with an iterator not "
+ "referring to this unordered container");
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multimap/debug.swap.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multimap/debug.swap.pass.cpp
index fe4663f8ee295e3..d467182c8fae90b 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multimap/debug.swap.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multimap/debug.swap.pass.cpp
@@ -22,17 +22,17 @@
#include "check_assertion.h"
int main(int, char**) {
- typedef std::pair<int, int> P;
- P a1[] = {P(1, 1), P(3, 3), P(7, 7), P(9, 9), P(10, 10)};
- P a2[] = {P(0, 0), P(2, 2), P(4, 4), P(5, 5), P(6, 6), P(8, 8), P(11, 11)};
- std::unordered_multimap<int, int> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
- std::unordered_multimap<int, int> c2(a2, a2+sizeof(a2)/sizeof(a2[0]));
- std::unordered_multimap<int, int>::iterator i1 = c1.begin();
- std::unordered_multimap<int, int>::iterator i2 = c2.begin();
- swap(c1, c2);
- c1.erase(i2);
- TEST_LIBCPP_ASSERT_FAILURE(
- c1.erase(i1), "unordered container erase(iterator) called with an iterator not referring to this container");
-
- return 0;
+ typedef std::pair<int, int> P;
+ P a1[] = {P(1, 1), P(3, 3), P(7, 7), P(9, 9), P(10, 10)};
+ P a2[] = {P(0, 0), P(2, 2), P(4, 4), P(5, 5), P(6, 6), P(8, 8), P(11, 11)};
+ std::unordered_multimap<int, int> c1(a1, a1 + sizeof(a1) / sizeof(a1[0]));
+ std::unordered_multimap<int, int> c2(a2, a2 + sizeof(a2) / sizeof(a2[0]));
+ std::unordered_multimap<int, int>::iterator i1 = c1.begin();
+ std::unordered_multimap<int, int>::iterator i2 = c2.begin();
+ swap(c1, c2);
+ c1.erase(i2);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ c1.erase(i1), "unordered container erase(iterator) called with an iterator not referring to this container");
+
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/debug.erase.iter.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/debug.erase.iter.pass.cpp
index f114a25b49673e8..0a430edf8b7b68e 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/debug.erase.iter.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/debug.erase.iter.pass.cpp
@@ -18,26 +18,26 @@
#include "check_assertion.h"
int main(int, char**) {
- // With end()
- {
- typedef std::pair<int, int> P;
- P a1[] = {P(1, 1), P(2, 2), P(3, 3)};
- std::unordered_multimap<int, int> l1(a1, a1+3);
- std::unordered_multimap<int, int>::const_iterator i = l1.end();
- TEST_LIBCPP_ASSERT_FAILURE(l1.erase(i),
- "unordered container erase(iterator) called with a non-dereferenceable iterator");
- }
-
- // With iterator from another container
- {
- typedef std::pair<int, int> P;
- P a1[] = {P(1, 1), P(2, 2), P(3, 3)};
- std::unordered_multimap<int, int> l1(a1, a1+3);
- std::unordered_multimap<int, int> l2(a1, a1+3);
- std::unordered_multimap<int, int>::const_iterator i = l2.begin();
- TEST_LIBCPP_ASSERT_FAILURE(
- l1.erase(i), "unordered container erase(iterator) called with an iterator not referring to this container");
- }
-
- return 0;
+ // With end()
+ {
+ typedef std::pair<int, int> P;
+ P a1[] = {P(1, 1), P(2, 2), P(3, 3)};
+ std::unordered_multimap<int, int> l1(a1, a1 + 3);
+ std::unordered_multimap<int, int>::const_iterator i = l1.end();
+ TEST_LIBCPP_ASSERT_FAILURE(
+ l1.erase(i), "unordered container erase(iterator) called with a non-dereferenceable iterator");
+ }
+
+ // With iterator from another container
+ {
+ typedef std::pair<int, int> P;
+ P a1[] = {P(1, 1), P(2, 2), P(3, 3)};
+ std::unordered_multimap<int, int> l1(a1, a1 + 3);
+ std::unordered_multimap<int, int> l2(a1, a1 + 3);
+ std::unordered_multimap<int, int>::const_iterator i = l2.begin();
+ TEST_LIBCPP_ASSERT_FAILURE(
+ l1.erase(i), "unordered container erase(iterator) called with an iterator not referring to this container");
+ }
+
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/debug.erase.iter_iter.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/debug.erase.iter_iter.pass.cpp
index 9c63ac6a651b759..8c1382c5bbae48e 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/debug.erase.iter_iter.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multimap/unord.multimap.modifiers/debug.erase.iter_iter.pass.cpp
@@ -18,47 +18,47 @@
#include "check_assertion.h"
int main(int, char**) {
- // With first iterator from another container
- {
- typedef std::pair<int, int> P;
- P a1[] = {P(1, 1), P(2, 2), P(3, 3)};
- std::unordered_multimap<int, int> l1(a1, a1+3);
- std::unordered_multimap<int, int> l2(a1, a1+3);
- TEST_LIBCPP_ASSERT_FAILURE(
- l1.erase(l2.cbegin(), std::next(l1.cbegin())),
- "unordered container::erase(iterator, iterator) called with an iterator not referring to this container");
- }
+ // With first iterator from another container
+ {
+ typedef std::pair<int, int> P;
+ P a1[] = {P(1, 1), P(2, 2), P(3, 3)};
+ std::unordered_multimap<int, int> l1(a1, a1 + 3);
+ std::unordered_multimap<int, int> l2(a1, a1 + 3);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ l1.erase(l2.cbegin(), std::next(l1.cbegin())),
+ "unordered container::erase(iterator, iterator) called with an iterator not referring to this container");
+ }
- // With second iterator from another container
- {
- typedef std::pair<int, int> P;
- P a1[] = {P(1, 1), P(2, 2), P(3, 3)};
- std::unordered_multimap<int, int> l1(a1, a1+3);
- std::unordered_multimap<int, int> l2(a1, a1+3);
- TEST_LIBCPP_ASSERT_FAILURE(
- l1.erase(l1.cbegin(), std::next(l2.cbegin())),
- "unordered container::erase(iterator, iterator) called with an iterator not referring to this container");
- }
+ // With second iterator from another container
+ {
+ typedef std::pair<int, int> P;
+ P a1[] = {P(1, 1), P(2, 2), P(3, 3)};
+ std::unordered_multimap<int, int> l1(a1, a1 + 3);
+ std::unordered_multimap<int, int> l2(a1, a1 + 3);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ l1.erase(l1.cbegin(), std::next(l2.cbegin())),
+ "unordered container::erase(iterator, iterator) called with an iterator not referring to this container");
+ }
- // With both iterators from another container
- {
- typedef std::pair<int, int> P;
- P a1[] = {P(1, 1), P(2, 2), P(3, 3)};
- std::unordered_multimap<int, int> l1(a1, a1+3);
- std::unordered_multimap<int, int> l2(a1, a1+3);
- TEST_LIBCPP_ASSERT_FAILURE(
- l1.erase(l2.cbegin(), std::next(l2.cbegin())),
- "unordered container::erase(iterator, iterator) called with an iterator not referring to this container");
- }
+ // With both iterators from another container
+ {
+ typedef std::pair<int, int> P;
+ P a1[] = {P(1, 1), P(2, 2), P(3, 3)};
+ std::unordered_multimap<int, int> l1(a1, a1 + 3);
+ std::unordered_multimap<int, int> l2(a1, a1 + 3);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ l1.erase(l2.cbegin(), std::next(l2.cbegin())),
+ "unordered container::erase(iterator, iterator) called with an iterator not referring to this container");
+ }
- // With an invalid range
- {
- typedef std::pair<int, int> P;
- P a1[] = {P(1, 1), P(2, 2), P(3, 3)};
- std::unordered_multimap<int, int> l1(a1, a1+3);
- TEST_LIBCPP_ASSERT_FAILURE(l1.erase(std::next(l1.cbegin()), l1.cbegin()),
- "Attempted to increment a non-incrementable unordered container const_iterator");
- }
+ // With an invalid range
+ {
+ typedef std::pair<int, int> P;
+ P a1[] = {P(1, 1), P(2, 2), P(3, 3)};
+ std::unordered_multimap<int, int> l1(a1, a1 + 3);
+ TEST_LIBCPP_ASSERT_FAILURE(l1.erase(std::next(l1.cbegin()), l1.cbegin()),
+ "Attempted to increment a non-incrementable unordered container const_iterator");
+ }
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multiset/assert.bucket.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multiset/assert.bucket.pass.cpp
index 49fdb723b423018..eebf11c27bb1711 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multiset/assert.bucket.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multiset/assert.bucket.pass.cpp
@@ -24,9 +24,9 @@
#include "check_assertion.h"
int main(int, char**) {
- typedef std::unordered_multiset<int> C;
- C c;
- TEST_LIBCPP_ASSERT_FAILURE(c.bucket(3), "unordered container::bucket(key) called when bucket_count() == 0");
+ typedef std::unordered_multiset<int> C;
+ C c;
+ TEST_LIBCPP_ASSERT_FAILURE(c.bucket(3), "unordered container::bucket(key) called when bucket_count() == 0");
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multiset/assert.bucket_size.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multiset/assert.bucket_size.pass.cpp
index 5709fd1e30d9ab5..1c107ca11193c8a 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multiset/assert.bucket_size.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multiset/assert.bucket_size.pass.cpp
@@ -24,9 +24,9 @@
#include "check_assertion.h"
int main(int, char**) {
- typedef std::unordered_multiset<int> C;
- C c;
- TEST_LIBCPP_ASSERT_FAILURE(c.bucket_size(3), "unordered container::bucket_size(n) called with n >= bucket_count()");
+ typedef std::unordered_multiset<int> C;
+ C c;
+ TEST_LIBCPP_ASSERT_FAILURE(c.bucket_size(3), "unordered container::bucket_size(n) called with n >= bucket_count()");
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multiset/assert.max_load_factor.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multiset/assert.max_load_factor.pass.cpp
index c54bb833e724031..a38849482cee9fc 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multiset/assert.max_load_factor.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multiset/assert.max_load_factor.pass.cpp
@@ -25,9 +25,9 @@
#include "check_assertion.h"
int main(int, char**) {
- typedef std::unordered_multiset<int> C;
- C c;
- TEST_LIBCPP_ASSERT_FAILURE(c.max_load_factor(0), "unordered container::max_load_factor(lf) called with lf <= 0");
+ typedef std::unordered_multiset<int> C;
+ C c;
+ TEST_LIBCPP_ASSERT_FAILURE(c.max_load_factor(0), "unordered container::max_load_factor(lf) called with lf <= 0");
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multiset/debug.erase.iter.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multiset/debug.erase.iter.pass.cpp
index 16bab55067bae73..41818b814cf98e4 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multiset/debug.erase.iter.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multiset/debug.erase.iter.pass.cpp
@@ -18,24 +18,24 @@
#include "check_assertion.h"
int main(int, char**) {
- // With end()
- {
- int a1[] = {1, 2, 3};
- std::unordered_multiset<int> l1(a1, a1+3);
- std::unordered_multiset<int>::const_iterator i = l1.end();
- TEST_LIBCPP_ASSERT_FAILURE(l1.erase(i),
- "unordered container erase(iterator) called with a non-dereferenceable iterator");
- }
-
- // With iterator from another container
- {
- int a1[] = {1, 2, 3};
- std::unordered_multiset<int> l1(a1, a1+3);
- std::unordered_multiset<int> l2(a1, a1+3);
- std::unordered_multiset<int>::const_iterator i = l2.begin();
- TEST_LIBCPP_ASSERT_FAILURE(
- l1.erase(i), "unordered container erase(iterator) called with an iterator not referring to this container");
- }
-
- return 0;
+ // With end()
+ {
+ int a1[] = {1, 2, 3};
+ std::unordered_multiset<int> l1(a1, a1 + 3);
+ std::unordered_multiset<int>::const_iterator i = l1.end();
+ TEST_LIBCPP_ASSERT_FAILURE(
+ l1.erase(i), "unordered container erase(iterator) called with a non-dereferenceable iterator");
+ }
+
+ // With iterator from another container
+ {
+ int a1[] = {1, 2, 3};
+ std::unordered_multiset<int> l1(a1, a1 + 3);
+ std::unordered_multiset<int> l2(a1, a1 + 3);
+ std::unordered_multiset<int>::const_iterator i = l2.begin();
+ TEST_LIBCPP_ASSERT_FAILURE(
+ l1.erase(i), "unordered container erase(iterator) called with an iterator not referring to this container");
+ }
+
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multiset/debug.erase.iter_iter.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multiset/debug.erase.iter_iter.pass.cpp
index 30b9d80752de882..a85a61c17575cf6 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multiset/debug.erase.iter_iter.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multiset/debug.erase.iter_iter.pass.cpp
@@ -18,43 +18,43 @@
#include "check_assertion.h"
int main(int, char**) {
- // With first iterator from another container
- {
- int a1[] = {1, 2, 3};
- std::unordered_multiset<int> l1(a1, a1+3);
- std::unordered_multiset<int> l2(a1, a1+3);
- TEST_LIBCPP_ASSERT_FAILURE(
- l1.erase(l2.cbegin(), std::next(l1.cbegin())),
- "unordered container::erase(iterator, iterator) called with an iterator not referring to this container");
- }
-
- // With second iterator from another container
- {
- int a1[] = {1, 2, 3};
- std::unordered_multiset<int> l1(a1, a1+3);
- std::unordered_multiset<int> l2(a1, a1+3);
- TEST_LIBCPP_ASSERT_FAILURE(
- l1.erase(l1.cbegin(), std::next(l2.cbegin())),
- "unordered container::erase(iterator, iterator) called with an iterator not referring to this container");
- }
-
- // With both iterators from another container
- {
- int a1[] = {1, 2, 3};
- std::unordered_multiset<int> l1(a1, a1+3);
- std::unordered_multiset<int> l2(a1, a1+3);
- TEST_LIBCPP_ASSERT_FAILURE(
- l1.erase(l2.cbegin(), std::next(l2.cbegin())),
- "unordered container::erase(iterator, iterator) called with an iterator not referring to this container");
- }
-
- // With an invalid range
- {
- int a1[] = {1, 2, 3};
- std::unordered_multiset<int> l1(a1, a1+3);
- TEST_LIBCPP_ASSERT_FAILURE(l1.erase(std::next(l1.cbegin()), l1.cbegin()),
- "Attempted to increment a non-incrementable unordered container const_iterator");
- }
-
- return 0;
+ // With first iterator from another container
+ {
+ int a1[] = {1, 2, 3};
+ std::unordered_multiset<int> l1(a1, a1 + 3);
+ std::unordered_multiset<int> l2(a1, a1 + 3);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ l1.erase(l2.cbegin(), std::next(l1.cbegin())),
+ "unordered container::erase(iterator, iterator) called with an iterator not referring to this container");
+ }
+
+ // With second iterator from another container
+ {
+ int a1[] = {1, 2, 3};
+ std::unordered_multiset<int> l1(a1, a1 + 3);
+ std::unordered_multiset<int> l2(a1, a1 + 3);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ l1.erase(l1.cbegin(), std::next(l2.cbegin())),
+ "unordered container::erase(iterator, iterator) called with an iterator not referring to this container");
+ }
+
+ // With both iterators from another container
+ {
+ int a1[] = {1, 2, 3};
+ std::unordered_multiset<int> l1(a1, a1 + 3);
+ std::unordered_multiset<int> l2(a1, a1 + 3);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ l1.erase(l2.cbegin(), std::next(l2.cbegin())),
+ "unordered container::erase(iterator, iterator) called with an iterator not referring to this container");
+ }
+
+ // With an invalid range
+ {
+ int a1[] = {1, 2, 3};
+ std::unordered_multiset<int> l1(a1, a1 + 3);
+ TEST_LIBCPP_ASSERT_FAILURE(l1.erase(std::next(l1.cbegin()), l1.cbegin()),
+ "Attempted to increment a non-incrementable unordered container const_iterator");
+ }
+
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multiset/debug.insert.hint_const_lvalue.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multiset/debug.insert.hint_const_lvalue.pass.cpp
index 71ce908af04b096..2274dd3e710ee72 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multiset/debug.insert.hint_const_lvalue.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multiset/debug.insert.hint_const_lvalue.pass.cpp
@@ -18,15 +18,16 @@
#include "check_assertion.h"
int main(int, char**) {
- typedef std::unordered_multiset<double> C;
- typedef C::value_type P;
- C c;
- C c2;
- C::const_iterator e = c2.end();
- P v(3.5);
- TEST_LIBCPP_ASSERT_FAILURE(
- c.insert(e, v),
- "unordered container::emplace_hint(const_iterator, args...) called with an iterator not referring to this unordered container");
+ typedef std::unordered_multiset<double> C;
+ typedef C::value_type P;
+ C c;
+ C c2;
+ C::const_iterator e = c2.end();
+ P v(3.5);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ c.insert(e, v),
+ "unordered container::emplace_hint(const_iterator, args...) called with an iterator not "
+ "referring to this unordered container");
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multiset/debug.swap.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multiset/debug.swap.pass.cpp
index b94107da04e97ee..aa6b56f83fcc9cc 100644
--- a/libcxx/test/libcxx/containers/unord/unord.multiset/debug.swap.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.multiset/debug.swap.pass.cpp
@@ -22,16 +22,16 @@
#include "check_assertion.h"
int main(int, char**) {
- int a1[] = {1, 3, 7, 9, 10};
- int a2[] = {0, 2, 4, 5, 6, 8, 11};
- std::unordered_multiset<int> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
- std::unordered_multiset<int> c2(a2, a2+sizeof(a2)/sizeof(a2[0]));
- std::unordered_multiset<int>::iterator i1 = c1.begin();
- std::unordered_multiset<int>::iterator i2 = c2.begin();
- swap(c1, c2);
- c1.erase(i2);
- TEST_LIBCPP_ASSERT_FAILURE(
- c1.erase(i1), "unordered container erase(iterator) called with an iterator not referring to this container");
-
- return 0;
+ int a1[] = {1, 3, 7, 9, 10};
+ int a2[] = {0, 2, 4, 5, 6, 8, 11};
+ std::unordered_multiset<int> c1(a1, a1 + sizeof(a1) / sizeof(a1[0]));
+ std::unordered_multiset<int> c2(a2, a2 + sizeof(a2) / sizeof(a2[0]));
+ std::unordered_multiset<int>::iterator i1 = c1.begin();
+ std::unordered_multiset<int>::iterator i2 = c2.begin();
+ swap(c1, c2);
+ c1.erase(i2);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ c1.erase(i1), "unordered container erase(iterator) called with an iterator not referring to this container");
+
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.set/assert.bucket.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.set/assert.bucket.pass.cpp
index c0bfb00efc68aec..6504a88a2e1f6c5 100644
--- a/libcxx/test/libcxx/containers/unord/unord.set/assert.bucket.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.set/assert.bucket.pass.cpp
@@ -24,9 +24,9 @@
#include "check_assertion.h"
int main(int, char**) {
- typedef std::unordered_set<int> C;
- C c;
- TEST_LIBCPP_ASSERT_FAILURE(c.bucket(3), "unordered container::bucket(key) called when bucket_count() == 0");
+ typedef std::unordered_set<int> C;
+ C c;
+ TEST_LIBCPP_ASSERT_FAILURE(c.bucket(3), "unordered container::bucket(key) called when bucket_count() == 0");
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.set/assert.bucket_size.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.set/assert.bucket_size.pass.cpp
index 3e25b448cb87268..18440548d76c242 100644
--- a/libcxx/test/libcxx/containers/unord/unord.set/assert.bucket_size.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.set/assert.bucket_size.pass.cpp
@@ -24,9 +24,9 @@
#include "check_assertion.h"
int main(int, char**) {
- typedef std::unordered_set<int> C;
- C c;
- TEST_LIBCPP_ASSERT_FAILURE(c.bucket_size(3), "unordered container::bucket_size(n) called with n >= bucket_count()");
+ typedef std::unordered_set<int> C;
+ C c;
+ TEST_LIBCPP_ASSERT_FAILURE(c.bucket_size(3), "unordered container::bucket_size(n) called with n >= bucket_count()");
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.set/assert.max_load_factor.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.set/assert.max_load_factor.pass.cpp
index ec1f1f3bd5ce17f..80e89411d99c3e4 100644
--- a/libcxx/test/libcxx/containers/unord/unord.set/assert.max_load_factor.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.set/assert.max_load_factor.pass.cpp
@@ -25,10 +25,9 @@
#include "check_assertion.h"
int main(int, char**) {
- typedef std::unordered_set<int> C;
- C c;
- TEST_LIBCPP_ASSERT_FAILURE(c.max_load_factor(-0.5f),
- "unordered container::max_load_factor(lf) called with lf <= 0");
+ typedef std::unordered_set<int> C;
+ C c;
+ TEST_LIBCPP_ASSERT_FAILURE(c.max_load_factor(-0.5f), "unordered container::max_load_factor(lf) called with lf <= 0");
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.set/debug.erase.iter.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.set/debug.erase.iter.pass.cpp
index 580829c1b6fc3fd..8dbcb0576cd8530 100644
--- a/libcxx/test/libcxx/containers/unord/unord.set/debug.erase.iter.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.set/debug.erase.iter.pass.cpp
@@ -18,24 +18,24 @@
#include "check_assertion.h"
int main(int, char**) {
- // With end()
- {
- int a1[] = {1, 2, 3};
- std::unordered_set<int> l1(a1, a1+3);
- std::unordered_set<int>::const_iterator i = l1.end();
- TEST_LIBCPP_ASSERT_FAILURE(l1.erase(i),
- "unordered container erase(iterator) called with a non-dereferenceable iterator");
- }
-
- // With iterator from another container
- {
- int a1[] = {1, 2, 3};
- std::unordered_set<int> l1(a1, a1+3);
- std::unordered_set<int> l2(a1, a1+3);
- std::unordered_set<int>::const_iterator i = l2.begin();
- TEST_LIBCPP_ASSERT_FAILURE(
- l1.erase(i), "unordered container erase(iterator) called with an iterator not referring to this container");
- }
-
- return 0;
+ // With end()
+ {
+ int a1[] = {1, 2, 3};
+ std::unordered_set<int> l1(a1, a1 + 3);
+ std::unordered_set<int>::const_iterator i = l1.end();
+ TEST_LIBCPP_ASSERT_FAILURE(
+ l1.erase(i), "unordered container erase(iterator) called with a non-dereferenceable iterator");
+ }
+
+ // With iterator from another container
+ {
+ int a1[] = {1, 2, 3};
+ std::unordered_set<int> l1(a1, a1 + 3);
+ std::unordered_set<int> l2(a1, a1 + 3);
+ std::unordered_set<int>::const_iterator i = l2.begin();
+ TEST_LIBCPP_ASSERT_FAILURE(
+ l1.erase(i), "unordered container erase(iterator) called with an iterator not referring to this container");
+ }
+
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.set/debug.erase.iter_iter.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.set/debug.erase.iter_iter.pass.cpp
index 5b5b71ab31af2ba..c714b70ced328a1 100644
--- a/libcxx/test/libcxx/containers/unord/unord.set/debug.erase.iter_iter.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.set/debug.erase.iter_iter.pass.cpp
@@ -18,43 +18,43 @@
#include "check_assertion.h"
int main(int, char**) {
- // With first iterator from another container
- {
- int a1[] = {1, 2, 3};
- std::unordered_set<int> l1(a1, a1+3);
- std::unordered_set<int> l2(a1, a1+3);
- TEST_LIBCPP_ASSERT_FAILURE(
- l1.erase(l2.cbegin(), std::next(l1.cbegin())),
- "unordered container::erase(iterator, iterator) called with an iterator not referring to this container");
- }
-
- // With second iterator from another container
- {
- int a1[] = {1, 2, 3};
- std::unordered_set<int> l1(a1, a1+3);
- std::unordered_set<int> l2(a1, a1+3);
- TEST_LIBCPP_ASSERT_FAILURE(
- l1.erase(l1.cbegin(), std::next(l2.cbegin())),
- "unordered container::erase(iterator, iterator) called with an iterator not referring to this container");
- }
-
- // With both iterators from another container
- {
- int a1[] = {1, 2, 3};
- std::unordered_set<int> l1(a1, a1+3);
- std::unordered_set<int> l2(a1, a1+3);
- TEST_LIBCPP_ASSERT_FAILURE(
- l1.erase(l2.cbegin(), std::next(l2.cbegin())),
- "unordered container::erase(iterator, iterator) called with an iterator not referring to this container");
- }
-
- // With an invalid range
- {
- int a1[] = {1, 2, 3};
- std::unordered_set<int> l1(a1, a1+3);
- TEST_LIBCPP_ASSERT_FAILURE(l1.erase(std::next(l1.cbegin()), l1.cbegin()),
- "Attempted to increment a non-incrementable unordered container const_iterator");
- }
-
- return 0;
+ // With first iterator from another container
+ {
+ int a1[] = {1, 2, 3};
+ std::unordered_set<int> l1(a1, a1 + 3);
+ std::unordered_set<int> l2(a1, a1 + 3);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ l1.erase(l2.cbegin(), std::next(l1.cbegin())),
+ "unordered container::erase(iterator, iterator) called with an iterator not referring to this container");
+ }
+
+ // With second iterator from another container
+ {
+ int a1[] = {1, 2, 3};
+ std::unordered_set<int> l1(a1, a1 + 3);
+ std::unordered_set<int> l2(a1, a1 + 3);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ l1.erase(l1.cbegin(), std::next(l2.cbegin())),
+ "unordered container::erase(iterator, iterator) called with an iterator not referring to this container");
+ }
+
+ // With both iterators from another container
+ {
+ int a1[] = {1, 2, 3};
+ std::unordered_set<int> l1(a1, a1 + 3);
+ std::unordered_set<int> l2(a1, a1 + 3);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ l1.erase(l2.cbegin(), std::next(l2.cbegin())),
+ "unordered container::erase(iterator, iterator) called with an iterator not referring to this container");
+ }
+
+ // With an invalid range
+ {
+ int a1[] = {1, 2, 3};
+ std::unordered_set<int> l1(a1, a1 + 3);
+ TEST_LIBCPP_ASSERT_FAILURE(l1.erase(std::next(l1.cbegin()), l1.cbegin()),
+ "Attempted to increment a non-incrementable unordered container const_iterator");
+ }
+
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.set/debug.insert.hint_const_lvalue.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.set/debug.insert.hint_const_lvalue.pass.cpp
index 8a95111632247ba..2d4e0e7350831f4 100644
--- a/libcxx/test/libcxx/containers/unord/unord.set/debug.insert.hint_const_lvalue.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.set/debug.insert.hint_const_lvalue.pass.cpp
@@ -18,15 +18,16 @@
#include "check_assertion.h"
int main(int, char**) {
- typedef std::unordered_set<double> C;
- typedef C::value_type P;
- C c;
- C c2;
- C::const_iterator e = c2.end();
- P v(3.5);
- TEST_LIBCPP_ASSERT_FAILURE(
- c.insert(e, v),
- "unordered_set::insert(const_iterator, const value_type&) called with an iterator not referring to this unordered_set");
+ typedef std::unordered_set<double> C;
+ typedef C::value_type P;
+ C c;
+ C c2;
+ C::const_iterator e = c2.end();
+ P v(3.5);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ c.insert(e, v),
+ "unordered_set::insert(const_iterator, const value_type&) called with an iterator not "
+ "referring to this unordered_set");
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.set/debug.swap.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.set/debug.swap.pass.cpp
index 12d7fb71977a84d..8f362f318f2e3a1 100644
--- a/libcxx/test/libcxx/containers/unord/unord.set/debug.swap.pass.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.set/debug.swap.pass.cpp
@@ -22,16 +22,16 @@
#include "check_assertion.h"
int main(int, char**) {
- int a1[] = {1, 3, 7, 9, 10};
- int a2[] = {0, 2, 4, 5, 6, 8, 11};
- std::unordered_set<int> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
- std::unordered_set<int> c2(a2, a2+sizeof(a2)/sizeof(a2[0]));
- std::unordered_set<int>::iterator i1 = c1.begin();
- std::unordered_set<int>::iterator i2 = c2.begin();
- swap(c1, c2);
- c1.erase(i2);
- TEST_LIBCPP_ASSERT_FAILURE(
- c1.erase(i1), "unordered container erase(iterator) called with an iterator not referring to this container");
-
- return 0;
+ int a1[] = {1, 3, 7, 9, 10};
+ int a2[] = {0, 2, 4, 5, 6, 8, 11};
+ std::unordered_set<int> c1(a1, a1 + sizeof(a1) / sizeof(a1[0]));
+ std::unordered_set<int> c2(a2, a2 + sizeof(a2) / sizeof(a2[0]));
+ std::unordered_set<int>::iterator i1 = c1.begin();
+ std::unordered_set<int>::iterator i2 = c2.begin();
+ swap(c1, c2);
+ c1.erase(i2);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ c1.erase(i1), "unordered container erase(iterator) called with an iterator not referring to this container");
+
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/unord/unord.set/missing_hash_specialization.verify.cpp b/libcxx/test/libcxx/containers/unord/unord.set/missing_hash_specialization.verify.cpp
index f6d93c7e6ca5731..c66496acc6d078a 100644
--- a/libcxx/test/libcxx/containers/unord/unord.set/missing_hash_specialization.verify.cpp
+++ b/libcxx/test/libcxx/containers/unord/unord.set/missing_hash_specialization.verify.cpp
@@ -24,26 +24,26 @@
using VT = std::pair<int, int>;
struct BadHashNoCopy {
- BadHashNoCopy() = default;
+ BadHashNoCopy() = default;
BadHashNoCopy(BadHashNoCopy const&) = delete;
template <class T>
- std::size_t operator()(T const&) const { return 0; }
-};
-
-struct BadHashNoCall {
-
+ std::size_t operator()(T const&) const {
+ return 0;
+ }
};
+struct BadHashNoCall {};
struct GoodHashNoDefault {
explicit GoodHashNoDefault(void*) {}
template <class T>
- std::size_t operator()(T const&) const { return 0; }
+ std::size_t operator()(T const&) const {
+ return 0;
+ }
};
int main(int, char**) {
-
{
using Set = std::unordered_set<VT>;
Set s; // expected-error at __hash_table:* {{the specified hash does not meet the Hash requirements}}
@@ -63,7 +63,7 @@ int main(int, char**) {
}
{
using Set = std::unordered_set<int, GoodHashNoDefault>;
- Set s(/*bucketcount*/42, GoodHashNoDefault(nullptr));
+ Set s(/*bucketcount*/ 42, GoodHashNoDefault(nullptr));
}
return 0;
diff --git a/libcxx/test/libcxx/containers/views/mdspan/extents/assert.ctor_from_array.pass.cpp b/libcxx/test/libcxx/containers/views/mdspan/extents/assert.ctor_from_array.pass.cpp
index 7fe78a788bf8737..90cb0c84a063bf6 100644
--- a/libcxx/test/libcxx/containers/views/mdspan/extents/assert.ctor_from_array.pass.cpp
+++ b/libcxx/test/libcxx/containers/views/mdspan/extents/assert.ctor_from_array.pass.cpp
@@ -43,11 +43,8 @@ int main(int, char**) {
}
// mismatch of static extent
{
- TEST_LIBCPP_ASSERT_FAILURE(
- ([] {
- std::extents<int, D, 5> e1(std::array{1000, 3});
- }()),
- "extents construction: mismatch of provided arguments with static extents.");
+ TEST_LIBCPP_ASSERT_FAILURE(([] { std::extents<int, D, 5> e1(std::array{1000, 3}); }()),
+ "extents construction: mismatch of provided arguments with static extents.");
}
// value out of range
{
diff --git a/libcxx/test/libcxx/containers/views/views.span/span.cons/assert.iter_sent.pass.cpp b/libcxx/test/libcxx/containers/views/views.span/span.cons/assert.iter_sent.pass.cpp
index fa2a98e33b8f0ed..64e3cc8750cd156 100644
--- a/libcxx/test/libcxx/containers/views/views.span/span.cons/assert.iter_sent.pass.cpp
+++ b/libcxx/test/libcxx/containers/views/views.span/span.cons/assert.iter_sent.pass.cpp
@@ -28,21 +28,31 @@
#include "check_assertion.h"
int main(int, char**) {
- {
- std::array<int, 3> array{0, 1, 2};
-
- auto invalid_range = [&] { std::span<int> const s(array.end(), array.begin()); (void)s; };
- TEST_LIBCPP_ASSERT_FAILURE(invalid_range(), "invalid range in span's constructor (iterator, sentinel)");
- }
- {
- std::array<int, 3> array{0, 1, 2};
-
- auto invalid_range = [&] { std::span<int, 3> const s(array.end(), array.begin()); (void)s; };
- TEST_LIBCPP_ASSERT_FAILURE(invalid_range(), "invalid range in span's constructor (iterator, sentinel)");
-
- auto invalid_size = [&] { std::span<int, 3> const s(array.begin(), array.begin() + 2); (void)s; };
- TEST_LIBCPP_ASSERT_FAILURE(invalid_size(), "invalid range in span's constructor (iterator, sentinel): last - first != extent");
- }
-
- return 0;
+ {
+ std::array<int, 3> array{0, 1, 2};
+
+ auto invalid_range = [&] {
+ std::span<int> const s(array.end(), array.begin());
+ (void)s;
+ };
+ TEST_LIBCPP_ASSERT_FAILURE(invalid_range(), "invalid range in span's constructor (iterator, sentinel)");
+ }
+ {
+ std::array<int, 3> array{0, 1, 2};
+
+ auto invalid_range = [&] {
+ std::span<int, 3> const s(array.end(), array.begin());
+ (void)s;
+ };
+ TEST_LIBCPP_ASSERT_FAILURE(invalid_range(), "invalid range in span's constructor (iterator, sentinel)");
+
+ auto invalid_size = [&] {
+ std::span<int, 3> const s(array.begin(), array.begin() + 2);
+ (void)s;
+ };
+ TEST_LIBCPP_ASSERT_FAILURE(
+ invalid_size(), "invalid range in span's constructor (iterator, sentinel): last - first != extent");
+ }
+
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/views/views.span/span.cons/assert.other_span.pass.cpp b/libcxx/test/libcxx/containers/views/views.span/span.cons/assert.other_span.pass.cpp
index c288c2acd6b59f1..9a4e65b0af903d6 100644
--- a/libcxx/test/libcxx/containers/views/views.span/span.cons/assert.other_span.pass.cpp
+++ b/libcxx/test/libcxx/containers/views/views.span/span.cons/assert.other_span.pass.cpp
@@ -23,11 +23,14 @@
#include "check_assertion.h"
int main(int, char**) {
- std::array<int, 3> array{0, 1, 2};
- std::span<int> other(array.data(), 3);
+ std::array<int, 3> array{0, 1, 2};
+ std::span<int> other(array.data(), 3);
- auto invalid_source = [&] { std::span<int, 2> const s(other); (void)s; };
- TEST_LIBCPP_ASSERT_FAILURE(invalid_source(), "size mismatch in span's constructor (other span)");
+ auto invalid_source = [&] {
+ std::span<int, 2> const s(other);
+ (void)s;
+ };
+ TEST_LIBCPP_ASSERT_FAILURE(invalid_source(), "size mismatch in span's constructor (other span)");
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/views/views.span/span.cons/assert.range.pass.cpp b/libcxx/test/libcxx/containers/views/views.span/span.cons/assert.range.pass.cpp
index 1f9af3e03009ab4..5e36e9a0418aeb2 100644
--- a/libcxx/test/libcxx/containers/views/views.span/span.cons/assert.range.pass.cpp
+++ b/libcxx/test/libcxx/containers/views/views.span/span.cons/assert.range.pass.cpp
@@ -23,10 +23,16 @@
#include "check_assertion.h"
int main(int, char**) {
- std::vector<int> vec{0, 1, 2}; // must use std::vector instead of std::array, because std::span has a special constructor from std::array
+ std::vector<int> vec{
+ 0,
+ 1,
+ 2}; // must use std::vector instead of std::array, because std::span has a special constructor from std::array
- auto invalid_size = [&] { std::span<int, 2> const s(vec); (void)s; };
- TEST_LIBCPP_ASSERT_FAILURE(invalid_size(), "size mismatch in span's constructor (range)");
+ auto invalid_size = [&] {
+ std::span<int, 2> const s(vec);
+ (void)s;
+ };
+ TEST_LIBCPP_ASSERT_FAILURE(invalid_size(), "size mismatch in span's constructor (range)");
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/views/views.span/span.elem/assert.back.pass.cpp b/libcxx/test/libcxx/containers/views/views.span/span.elem/assert.back.pass.cpp
index ea98fe81ee2f8a8..7e656b7f0b6e98b 100644
--- a/libcxx/test/libcxx/containers/views/views.span/span.elem/assert.back.pass.cpp
+++ b/libcxx/test/libcxx/containers/views/views.span/span.elem/assert.back.pass.cpp
@@ -23,17 +23,17 @@
#include "check_assertion.h"
int main(int, char**) {
- {
- std::array<int, 3> array{0, 1, 2};
- std::span<int> const s(array.data(), 0);
- TEST_LIBCPP_ASSERT_FAILURE(s.back(), "span<T>::back() on empty span");
- }
-
- {
- std::array<int, 3> array{0, 1, 2};
- std::span<int, 0> const s(array.data(), 0);
- TEST_LIBCPP_ASSERT_FAILURE(s.back(), "span<T, N>::back() on empty span");
- }
-
- return 0;
+ {
+ std::array<int, 3> array{0, 1, 2};
+ std::span<int> const s(array.data(), 0);
+ TEST_LIBCPP_ASSERT_FAILURE(s.back(), "span<T>::back() on empty span");
+ }
+
+ {
+ std::array<int, 3> array{0, 1, 2};
+ std::span<int, 0> const s(array.data(), 0);
+ TEST_LIBCPP_ASSERT_FAILURE(s.back(), "span<T, N>::back() on empty span");
+ }
+
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/views/views.span/span.elem/assert.front.pass.cpp b/libcxx/test/libcxx/containers/views/views.span/span.elem/assert.front.pass.cpp
index 2660ca1f90c1410..0068aad8cc34606 100644
--- a/libcxx/test/libcxx/containers/views/views.span/span.elem/assert.front.pass.cpp
+++ b/libcxx/test/libcxx/containers/views/views.span/span.elem/assert.front.pass.cpp
@@ -23,17 +23,17 @@
#include "check_assertion.h"
int main(int, char**) {
- {
- std::array<int, 3> array{0, 1, 2};
- std::span<int> const s(array.data(), 0);
- TEST_LIBCPP_ASSERT_FAILURE(s.front(), "span<T>::front() on empty span");
- }
-
- {
- std::array<int, 3> array{0, 1, 2};
- std::span<int, 0> const s(array.data(), 0);
- TEST_LIBCPP_ASSERT_FAILURE(s.front(), "span<T, N>::front() on empty span");
- }
-
- return 0;
+ {
+ std::array<int, 3> array{0, 1, 2};
+ std::span<int> const s(array.data(), 0);
+ TEST_LIBCPP_ASSERT_FAILURE(s.front(), "span<T>::front() on empty span");
+ }
+
+ {
+ std::array<int, 3> array{0, 1, 2};
+ std::span<int, 0> const s(array.data(), 0);
+ TEST_LIBCPP_ASSERT_FAILURE(s.front(), "span<T, N>::front() on empty span");
+ }
+
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/views/views.span/span.elem/assert.op_idx.pass.cpp b/libcxx/test/libcxx/containers/views/views.span/span.elem/assert.op_idx.pass.cpp
index e7d79588441818c..501067f7407888f 100644
--- a/libcxx/test/libcxx/containers/views/views.span/span.elem/assert.op_idx.pass.cpp
+++ b/libcxx/test/libcxx/containers/views/views.span/span.elem/assert.op_idx.pass.cpp
@@ -23,17 +23,17 @@
#include "check_assertion.h"
int main(int, char**) {
- {
- std::array<int, 3> array{0, 1, 2};
- std::span<int> const s(array.data(), array.size());
- TEST_LIBCPP_ASSERT_FAILURE(s[3], "span<T>::operator[](index): index out of range");
- }
-
- {
- std::array<int, 3> array{0, 1, 2};
- std::span<int, 3> const s(array.data(), array.size());
- TEST_LIBCPP_ASSERT_FAILURE(s[3], "span<T, N>::operator[](index): index out of range");
- }
-
- return 0;
+ {
+ std::array<int, 3> array{0, 1, 2};
+ std::span<int> const s(array.data(), array.size());
+ TEST_LIBCPP_ASSERT_FAILURE(s[3], "span<T>::operator[](index): index out of range");
+ }
+
+ {
+ std::array<int, 3> array{0, 1, 2};
+ std::span<int, 3> const s(array.data(), array.size());
+ TEST_LIBCPP_ASSERT_FAILURE(s[3], "span<T, N>::operator[](index): index out of range");
+ }
+
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/views/views.span/span.sub/assert.first.pass.cpp b/libcxx/test/libcxx/containers/views/views.span/span.sub/assert.first.pass.cpp
index eb6b442d6484999..f241f2a5aadf2c9 100644
--- a/libcxx/test/libcxx/containers/views/views.span/span.sub/assert.first.pass.cpp
+++ b/libcxx/test/libcxx/containers/views/views.span/span.sub/assert.first.pass.cpp
@@ -23,18 +23,18 @@
#include "check_assertion.h"
int main(int, char**) {
- {
- std::array<int, 3> array{0, 1, 2};
- std::span<int> const s(array.data(), array.size());
- TEST_LIBCPP_ASSERT_FAILURE(s.first(4), "span<T>::first(count): count out of range");
- TEST_LIBCPP_ASSERT_FAILURE(s.first<4>(), "span<T>::first<Count>(): Count out of range");
- }
- {
- std::array<int, 3> array{0, 1, 2};
- std::span<int, 3> const s(array.data(), array.size());
- TEST_LIBCPP_ASSERT_FAILURE(s.first(4), "span<T, N>::first(count): count out of range");
- // s.first<4>() caught at compile-time (tested elsewhere)
- }
+ {
+ std::array<int, 3> array{0, 1, 2};
+ std::span<int> const s(array.data(), array.size());
+ TEST_LIBCPP_ASSERT_FAILURE(s.first(4), "span<T>::first(count): count out of range");
+ TEST_LIBCPP_ASSERT_FAILURE(s.first<4>(), "span<T>::first<Count>(): Count out of range");
+ }
+ {
+ std::array<int, 3> array{0, 1, 2};
+ std::span<int, 3> const s(array.data(), array.size());
+ TEST_LIBCPP_ASSERT_FAILURE(s.first(4), "span<T, N>::first(count): count out of range");
+ // s.first<4>() caught at compile-time (tested elsewhere)
+ }
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/views/views.span/span.sub/assert.last.pass.cpp b/libcxx/test/libcxx/containers/views/views.span/span.sub/assert.last.pass.cpp
index 141735db02a602f..032df689b1b88cf 100644
--- a/libcxx/test/libcxx/containers/views/views.span/span.sub/assert.last.pass.cpp
+++ b/libcxx/test/libcxx/containers/views/views.span/span.sub/assert.last.pass.cpp
@@ -23,18 +23,18 @@
#include "check_assertion.h"
int main(int, char**) {
- {
- std::array<int, 3> array{0, 1, 2};
- std::span<int> const s(array.data(), array.size());
- TEST_LIBCPP_ASSERT_FAILURE(s.last(4), "span<T>::last(count): count out of range");
- TEST_LIBCPP_ASSERT_FAILURE(s.last<4>(), "span<T>::last<Count>(): Count out of range");
- }
- {
- std::array<int, 3> array{0, 1, 2};
- std::span<int, 3> const s(array.data(), array.size());
- TEST_LIBCPP_ASSERT_FAILURE(s.last(4), "span<T, N>::last(count): count out of range");
- // s.last<4>() caught at compile-time (tested elsewhere)
- }
+ {
+ std::array<int, 3> array{0, 1, 2};
+ std::span<int> const s(array.data(), array.size());
+ TEST_LIBCPP_ASSERT_FAILURE(s.last(4), "span<T>::last(count): count out of range");
+ TEST_LIBCPP_ASSERT_FAILURE(s.last<4>(), "span<T>::last<Count>(): Count out of range");
+ }
+ {
+ std::array<int, 3> array{0, 1, 2};
+ std::span<int, 3> const s(array.data(), array.size());
+ TEST_LIBCPP_ASSERT_FAILURE(s.last(4), "span<T, N>::last(count): count out of range");
+ // s.last<4>() caught at compile-time (tested elsewhere)
+ }
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx/containers/views/views.span/span.sub/assert.subspan.pass.cpp b/libcxx/test/libcxx/containers/views/views.span/span.sub/assert.subspan.pass.cpp
index 7ed228e96a4837a..5dd0fa0530189f5 100644
--- a/libcxx/test/libcxx/containers/views/views.span/span.sub/assert.subspan.pass.cpp
+++ b/libcxx/test/libcxx/containers/views/views.span/span.sub/assert.subspan.pass.cpp
@@ -32,30 +32,30 @@
#include "check_assertion.h"
int main(int, char**) {
- {
- std::array<int, 3> array{0, 1, 2};
- std::span<int> const s(array.data(), array.size());
- TEST_LIBCPP_ASSERT_FAILURE(s.subspan(4), "span<T>::subspan(offset, count): offset out of range");
- TEST_LIBCPP_ASSERT_FAILURE(s.subspan<4>(), "span<T>::subspan<Offset, Count>(): Offset out of range");
-
- TEST_LIBCPP_ASSERT_FAILURE(s.subspan(0, 4), "span<T>::subspan(offset, count): offset + count out of range");
- TEST_LIBCPP_ASSERT_FAILURE((s.subspan<0, 4>()), "span<T>::subspan<Offset, Count>(): Offset + Count out of range");
-
- TEST_LIBCPP_ASSERT_FAILURE(s.subspan(1, 3), "span<T>::subspan(offset, count): offset + count out of range");
- TEST_LIBCPP_ASSERT_FAILURE((s.subspan<1, 3>()), "span<T>::subspan<Offset, Count>(): Offset + Count out of range");
- }
- {
- std::array<int, 3> array{0, 1, 2};
- std::span<int, 3> const s(array.data(), array.size());
- TEST_LIBCPP_ASSERT_FAILURE(s.subspan(4), "span<T, N>::subspan(offset, count): offset out of range");
- // s.subspan<4>() caught at compile-time (tested in libcxx/test/std/containers/views/views.span/span.sub/subspan.verify.cpp)
-
- TEST_LIBCPP_ASSERT_FAILURE(s.subspan(0, 4), "span<T, N>::subspan(offset, count): offset + count out of range");
- // s.subspan<0, 4>() caught at compile-time (tested in libcxx/test/std/containers/views/views.span/span.sub/subspan.verify.cpp)
-
- TEST_LIBCPP_ASSERT_FAILURE(s.subspan(1, 3), "span<T, N>::subspan(offset, count): offset + count out of range");
- // s.subspan<1, 3>() caught at compile-time (tested in libcxx/test/std/containers/views/views.span/span.sub/subspan.verify.cpp)
- }
-
- return 0;
+ {
+ std::array<int, 3> array{0, 1, 2};
+ std::span<int> const s(array.data(), array.size());
+ TEST_LIBCPP_ASSERT_FAILURE(s.subspan(4), "span<T>::subspan(offset, count): offset out of range");
+ TEST_LIBCPP_ASSERT_FAILURE(s.subspan<4>(), "span<T>::subspan<Offset, Count>(): Offset out of range");
+
+ TEST_LIBCPP_ASSERT_FAILURE(s.subspan(0, 4), "span<T>::subspan(offset, count): offset + count out of range");
+ TEST_LIBCPP_ASSERT_FAILURE((s.subspan<0, 4>()), "span<T>::subspan<Offset, Count>(): Offset + Count out of range");
+
+ TEST_LIBCPP_ASSERT_FAILURE(s.subspan(1, 3), "span<T>::subspan(offset, count): offset + count out of range");
+ TEST_LIBCPP_ASSERT_FAILURE((s.subspan<1, 3>()), "span<T>::subspan<Offset, Count>(): Offset + Count out of range");
+ }
+ {
+ std::array<int, 3> array{0, 1, 2};
+ std::span<int, 3> const s(array.data(), array.size());
+ TEST_LIBCPP_ASSERT_FAILURE(s.subspan(4), "span<T, N>::subspan(offset, count): offset out of range");
+ // s.subspan<4>() caught at compile-time (tested in libcxx/test/std/containers/views/views.span/span.sub/subspan.verify.cpp)
+
+ TEST_LIBCPP_ASSERT_FAILURE(s.subspan(0, 4), "span<T, N>::subspan(offset, count): offset + count out of range");
+ // s.subspan<0, 4>() caught at compile-time (tested in libcxx/test/std/containers/views/views.span/span.sub/subspan.verify.cpp)
+
+ TEST_LIBCPP_ASSERT_FAILURE(s.subspan(1, 3), "span<T, N>::subspan(offset, count): offset + count out of range");
+ // s.subspan<1, 3>() caught at compile-time (tested in libcxx/test/std/containers/views/views.span/span.sub/subspan.verify.cpp)
+ }
+
+ return 0;
}
diff --git a/libcxx/test/std/containers/Copyable.h b/libcxx/test/std/containers/Copyable.h
index 4aa5a97afe6b00a..984cd6ac00d799b 100644
--- a/libcxx/test/std/containers/Copyable.h
+++ b/libcxx/test/std/containers/Copyable.h
@@ -9,8 +9,7 @@
#ifndef COPYABLE_H
#define COPYABLE_H
-class Copyable
-{
+class Copyable {
public:
};
diff --git a/libcxx/test/std/containers/Emplaceable.h b/libcxx/test/std/containers/Emplaceable.h
index 001886eece7d75e..afc4e2e38b0eb65 100644
--- a/libcxx/test/std/containers/Emplaceable.h
+++ b/libcxx/test/std/containers/Emplaceable.h
@@ -14,30 +14,32 @@
#if TEST_STD_VER >= 11
-class Emplaceable
-{
- Emplaceable(const Emplaceable&);
- Emplaceable& operator=(const Emplaceable&);
+class Emplaceable {
+ Emplaceable(const Emplaceable&);
+ Emplaceable& operator=(const Emplaceable&);
+
+ int int_;
+ double double_;
- int int_;
- double double_;
public:
- Emplaceable() : int_(0), double_(0) {}
- Emplaceable(int i, double d) : int_(i), double_(d) {}
- Emplaceable(Emplaceable&& x)
- : int_(x.int_), double_(x.double_)
- {x.int_ = 0; x.double_ = 0;}
- Emplaceable& operator=(Emplaceable&& x)
- {int_ = x.int_; x.int_ = 0;
- double_ = x.double_; x.double_ = 0;
- return *this;}
-
- bool operator==(const Emplaceable& x) const
- {return int_ == x.int_ && double_ == x.double_;}
- bool operator<(const Emplaceable& x) const
- {return int_ < x.int_ || (int_ == x.int_ && double_ < x.double_);}
-
- int get() const {return int_;}
+ Emplaceable() : int_(0), double_(0) {}
+ Emplaceable(int i, double d) : int_(i), double_(d) {}
+ Emplaceable(Emplaceable&& x) : int_(x.int_), double_(x.double_) {
+ x.int_ = 0;
+ x.double_ = 0;
+ }
+ Emplaceable& operator=(Emplaceable&& x) {
+ int_ = x.int_;
+ x.int_ = 0;
+ double_ = x.double_;
+ x.double_ = 0;
+ return *this;
+ }
+
+ bool operator==(const Emplaceable& x) const { return int_ == x.int_ && double_ == x.double_; }
+ bool operator<(const Emplaceable& x) const { return int_ < x.int_ || (int_ == x.int_ && double_ < x.double_); }
+
+ int get() const { return int_; }
};
template <>
diff --git a/libcxx/test/std/containers/NotConstructible.h b/libcxx/test/std/containers/NotConstructible.h
index 213aa1442d5c200..8c74be44de21bf5 100644
--- a/libcxx/test/std/containers/NotConstructible.h
+++ b/libcxx/test/std/containers/NotConstructible.h
@@ -11,17 +11,14 @@
#include <functional>
-class NotConstructible
-{
- NotConstructible(const NotConstructible&);
- NotConstructible& operator=(const NotConstructible&);
+class NotConstructible {
+ NotConstructible(const NotConstructible&);
+ NotConstructible& operator=(const NotConstructible&);
+
public:
};
-inline
-bool
-operator==(const NotConstructible&, const NotConstructible&)
-{return true;}
+inline bool operator==(const NotConstructible&, const NotConstructible&) { return true; }
template <>
struct std::hash<NotConstructible> {
diff --git a/libcxx/test/std/containers/associative/from_range_associative_containers.h b/libcxx/test/std/containers/associative/from_range_associative_containers.h
index d227c41f6d84a8f..cb3646d738968cc 100644
--- a/libcxx/test/std/containers/associative/from_range_associative_containers.h
+++ b/libcxx/test/std/containers/associative/from_range_associative_containers.h
@@ -25,11 +25,13 @@
#include "test_macros.h"
template <class Container, class Range>
-concept HasFromRangeCtr = requires (Range&& range) {
+concept HasFromRangeCtr = requires(Range&& range) {
Container(std::from_range, std::forward<Range>(range));
Container(std::from_range, std::forward<Range>(range), std::less<typename Container::key_type>());
- Container(std::from_range, std::forward<Range>(range), std::less<typename Container::key_type>(),
- std::allocator<typename Container::value_type>());
+ Container(std::from_range,
+ std::forward<Range>(range),
+ std::less<typename Container::key_type>(),
+ std::allocator<typename Container::value_type>());
Container(std::from_range, std::forward<Range>(range), std::allocator<typename Container::value_type>());
};
@@ -50,7 +52,7 @@ constexpr bool test_map_constraints() {
return true;
}
-template <template <class ...> class Container,
+template <template <class...> class Container,
class K,
class V,
class Iter,
@@ -100,13 +102,7 @@ void test_associative_map_with_input(std::vector<ValueType>&& input) {
}
}
-template <template <class ...> class Container,
- class K,
- class V,
- class Iter,
- class Sent,
- class Comp,
- class Alloc>
+template <template <class...> class Container, class K, class V, class Iter, class Sent, class Comp, class Alloc>
void test_associative_map() {
auto test_with_input = &test_associative_map_with_input<Container, K, V, Iter, Sent, Comp, Alloc>;
@@ -118,7 +114,7 @@ void test_associative_map() {
test_with_input({{1, 2}});
}
-template <template <class ...> class Container>
+template <template <class...> class Container>
void test_associative_map_move_only() {
std::pair<const int, MoveOnly> input[5];
std::ranges::subrange in(std::move_iterator{input}, std::move_iterator{input + 5});
@@ -126,17 +122,15 @@ void test_associative_map_move_only() {
[[maybe_unused]] Container<int, MoveOnly> c(std::from_range, in);
}
-template <template <class ...> class Container>
+template <template <class...> class Container>
void test_map_exception_safety_throwing_copy() {
#if !defined(TEST_HAS_NO_EXCEPTIONS)
using K = int;
using V = ThrowingCopy<3>;
- V::throwing_enabled = false;
- std::pair<const K, V> in[5] = {
- {1, {}}, {2, {}}, {3, {}}, {4, {}}, {5, {}}
- };
- V::throwing_enabled = true;
+ V::throwing_enabled = false;
+ std::pair<const K, V> in[5] = {{1, {}}, {2, {}}, {3, {}}, {4, {}}, {5, {}}};
+ V::throwing_enabled = true;
V::reset();
try {
@@ -150,13 +144,11 @@ void test_map_exception_safety_throwing_copy() {
#endif
}
-template <template <class ...> class Container, class K, class V>
+template <template <class...> class Container, class K, class V>
void test_map_exception_safety_throwing_allocator() {
#if !defined(TEST_HAS_NO_EXCEPTIONS)
using ValueType = std::pair<const K, V>;
- ValueType in[] = {
- ValueType{K{1}, V{1}}
- };
+ ValueType in[] = {ValueType{K{1}, V{1}}};
try {
ThrowingAllocator<ValueType> alloc;
@@ -172,11 +164,13 @@ void test_map_exception_safety_throwing_allocator() {
}
template <class Container, class Range>
-concept SetHasFromRangeCtr = requires (Range&& range) {
+concept SetHasFromRangeCtr = requires(Range&& range) {
Container(std::from_range, std::forward<Range>(range));
Container(std::from_range, std::forward<Range>(range), std::less<typename Container::value_type>());
- Container(std::from_range, std::forward<Range>(range), std::less<typename Container::value_type>(),
- std::allocator<typename Container::value_type>());
+ Container(std::from_range,
+ std::forward<Range>(range),
+ std::less<typename Container::value_type>(),
+ std::allocator<typename Container::value_type>());
Container(std::from_range, std::forward<Range>(range), std::allocator<typename Container::value_type>());
};
@@ -194,12 +188,7 @@ constexpr bool test_set_constraints() {
return true;
}
-template <template <class ...> class Container,
- class T,
- class Iter,
- class Sent,
- class Comp,
- class Alloc>
+template <template <class...> class Container, class T, class Iter, class Sent, class Comp, class Alloc>
void test_associative_set_with_input(std::vector<T>&& input) {
{ // (range)
std::ranges::subrange in(Iter(input.data()), Sent(Iter(input.data() + input.size())));
@@ -242,12 +231,7 @@ void test_associative_set_with_input(std::vector<T>&& input) {
}
}
-template <template <class ...> class Container,
- class T,
- class Iter,
- class Sent,
- class Comp,
- class Alloc>
+template <template <class...> class Container, class T, class Iter, class Sent, class Comp, class Alloc>
void test_associative_set() {
auto test_with_input = &test_associative_set_with_input<Container, T, Iter, Sent, Comp, Alloc>;
@@ -259,7 +243,7 @@ void test_associative_set() {
test_with_input({5});
}
-template <template <class ...> class Container>
+template <template <class...> class Container>
void test_associative_set_move_only() {
MoveOnly input[5];
std::ranges::subrange in(std::move_iterator{input}, std::move_iterator{input + 5});
@@ -267,7 +251,7 @@ void test_associative_set_move_only() {
[[maybe_unused]] Container<MoveOnly> c(std::from_range, in);
}
-template <template <class ...> class Container>
+template <template <class...> class Container>
void test_set_exception_safety_throwing_copy() {
#if !defined(TEST_HAS_NO_EXCEPTIONS)
using T = ThrowingCopy<3>;
@@ -285,7 +269,7 @@ void test_set_exception_safety_throwing_copy() {
#endif
}
-template <template <class ...> class Container, class T>
+template <template <class...> class Container, class T>
void test_set_exception_safety_throwing_allocator() {
#if !defined(TEST_HAS_NO_EXCEPTIONS)
T in[] = {1, 2};
diff --git a/libcxx/test/std/containers/associative/iterator_types.pass.cpp b/libcxx/test/std/containers/associative/iterator_types.pass.cpp
index 1b8556fb558aa8d..2800549905f1ba1 100644
--- a/libcxx/test/std/containers/associative/iterator_types.pass.cpp
+++ b/libcxx/test/std/containers/associative/iterator_types.pass.cpp
@@ -14,7 +14,6 @@
#include "min_allocator.h"
#include "test_allocator.h"
-
template <class Map, class ValueTp, class PtrT, class CPtrT>
void testMap() {
typedef typename Map::
diff erence_type Diff;
@@ -34,11 +33,9 @@ void testMap() {
}
}
-
template <class Set, class ValueTp, class CPtrT>
void testSet() {
- static_assert((std::is_same<typename Set::iterator,
- typename Set::const_iterator>::value), "");
+ static_assert((std::is_same<typename Set::iterator, typename Set::const_iterator>::value), "");
typedef typename Set::
diff erence_type Diff;
{
typedef typename Set::iterator It;
@@ -46,7 +43,6 @@ void testSet() {
static_assert((std::is_same<typename It::reference, ValueTp const&>::value), "");
static_assert((std::is_same<typename It::pointer, CPtrT>::value), "");
static_assert((std::is_same<typename It::
diff erence_type, Diff>::value), "");
-
}
}
diff --git a/libcxx/test/std/containers/associative/map/PR28469_undefined_behavior_segfault.sh.cpp b/libcxx/test/std/containers/associative/map/PR28469_undefined_behavior_segfault.sh.cpp
index 584b829e36aa186..a72ad8187e7e96f 100644
--- a/libcxx/test/std/containers/associative/map/PR28469_undefined_behavior_segfault.sh.cpp
+++ b/libcxx/test/std/containers/associative/map/PR28469_undefined_behavior_segfault.sh.cpp
@@ -22,13 +22,13 @@
void dummy() {}
struct F {
- std::map<int, std::function<void()> > m;
- F() { m[42] = &dummy; }
+ std::map<int, std::function<void()> > m;
+ F() { m[42] = &dummy; }
};
int main(int, char**) {
- F f;
- f = F();
+ F f;
+ f = F();
return 0;
}
diff --git a/libcxx/test/std/containers/associative/map/allocator_mismatch.verify.cpp b/libcxx/test/std/containers/associative/map/allocator_mismatch.verify.cpp
index 1a72c6327977f70..48bdaf2390ff759 100644
--- a/libcxx/test/std/containers/associative/map/allocator_mismatch.verify.cpp
+++ b/libcxx/test/std/containers/associative/map/allocator_mismatch.verify.cpp
@@ -12,4 +12,4 @@
#include <map>
std::map<int, int, std::less<int>, std::allocator<long> > m;
- // expected-error-re@*:* {{static assertion failed{{.*}}Allocator::value_type must be same type as value_type}}
+// expected-error-re@*:* {{static assertion failed{{.*}}Allocator::value_type must be same type as value_type}}
diff --git a/libcxx/test/std/containers/associative/map/compare.pass.cpp b/libcxx/test/std/containers/associative/map/compare.pass.cpp
index 31221b234af5e3f..cb7a64b0409fc87 100644
--- a/libcxx/test/std/containers/associative/map/compare.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/compare.pass.cpp
@@ -22,34 +22,34 @@
#include "test_macros.h"
struct Key {
- template <typename T> Key(const T&) {}
- bool operator< (const Key&) const { return false; }
+ template <typename T>
+ Key(const T&) {}
+ bool operator<(const Key&) const { return false; }
};
-int main(int, char**)
-{
- typedef std::map<Key, int> MapT;
- typedef MapT::iterator Iter;
- typedef std::pair<Iter, bool> IterBool;
- {
- MapT m_empty;
- MapT m_contains;
- m_contains[Key(0)] = 42;
-
- Iter it = m_empty.find(Key(0));
- assert(it == m_empty.end());
- it = m_contains.find(Key(0));
- assert(it != m_contains.end());
- }
- {
- MapT map;
- IterBool result = map.insert(std::make_pair(Key(0), 42));
- assert(result.second);
- assert(result.first->second == 42);
- IterBool result2 = map.insert(std::make_pair(Key(0), 43));
- assert(!result2.second);
- assert(map[Key(0)] == 42);
- }
+int main(int, char**) {
+ typedef std::map<Key, int> MapT;
+ typedef MapT::iterator Iter;
+ typedef std::pair<Iter, bool> IterBool;
+ {
+ MapT m_empty;
+ MapT m_contains;
+ m_contains[Key(0)] = 42;
+
+ Iter it = m_empty.find(Key(0));
+ assert(it == m_empty.end());
+ it = m_contains.find(Key(0));
+ assert(it != m_contains.end());
+ }
+ {
+ MapT map;
+ IterBool result = map.insert(std::make_pair(Key(0), 42));
+ assert(result.second);
+ assert(result.first->second == 42);
+ IterBool result2 = map.insert(std::make_pair(Key(0), 43));
+ assert(!result2.second);
+ assert(map[Key(0)] == 42);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/map/get_allocator.pass.cpp b/libcxx/test/std/containers/associative/map/get_allocator.pass.cpp
index b214e44b41ba5ff..2dbd662d3b7acdf 100644
--- a/libcxx/test/std/containers/associative/map/get_allocator.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/get_allocator.pass.cpp
@@ -20,18 +20,17 @@
#include "test_macros.h"
int main(int, char**) {
- typedef std::pair<const int, std::string> ValueType;
- {
- std::allocator<ValueType> alloc;
- const std::map<int, std::string> m(alloc);
- assert(m.get_allocator() == alloc);
- }
- {
- other_allocator<ValueType> alloc(1);
- const std::map<int, std::string, std::less<int>,
- other_allocator<ValueType> > m(alloc);
- assert(m.get_allocator() == alloc);
- }
+ typedef std::pair<const int, std::string> ValueType;
+ {
+ std::allocator<ValueType> alloc;
+ const std::map<int, std::string> m(alloc);
+ assert(m.get_allocator() == alloc);
+ }
+ {
+ other_allocator<ValueType> alloc(1);
+ const std::map<int, std::string, std::less<int>, other_allocator<ValueType> > m(alloc);
+ assert(m.get_allocator() == alloc);
+ }
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/associative/map/incomplete_type.pass.cpp b/libcxx/test/std/containers/associative/map/incomplete_type.pass.cpp
index c663f8b618c3a38..99fc61269809491 100644
--- a/libcxx/test/std/containers/associative/map/incomplete_type.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/incomplete_type.pass.cpp
@@ -16,17 +16,17 @@
#include "test_macros.h"
struct A {
- typedef std::map<A, A> Map;
- int data;
- Map m;
- Map::iterator it;
- Map::const_iterator cit;
+ typedef std::map<A, A> Map;
+ int data;
+ Map m;
+ Map::iterator it;
+ Map::const_iterator cit;
};
inline bool operator==(A const& L, A const& R) { return &L == &R; }
-inline bool operator<(A const& L, A const& R) { return L.data < R.data; }
+inline bool operator<(A const& L, A const& R) { return L.data < R.data; }
int main(int, char**) {
- A a;
+ A a;
return 0;
}
diff --git a/libcxx/test/std/containers/associative/map/iterator_concept_conformance.compile.pass.cpp b/libcxx/test/std/containers/associative/map/iterator_concept_conformance.compile.pass.cpp
index 4676b2eb9561b0a..13cf0255794973f 100644
--- a/libcxx/test/std/containers/associative/map/iterator_concept_conformance.compile.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/iterator_concept_conformance.compile.pass.cpp
@@ -14,11 +14,11 @@
#include <iterator>
-using iterator = std::map<int, int>::iterator;
-using const_iterator = std::map<int, int>::const_iterator;
-using reverse_iterator = std::map<int, int>::reverse_iterator;
+using iterator = std::map<int, int>::iterator;
+using const_iterator = std::map<int, int>::const_iterator;
+using reverse_iterator = std::map<int, int>::reverse_iterator;
using const_reverse_iterator = std::map<int, int>::const_reverse_iterator;
-using value_type = std::pair<const int, int>;
+using value_type = std::pair<const int, int>;
static_assert(std::bidirectional_iterator<iterator>);
static_assert(!std::random_access_iterator<iterator>);
@@ -31,9 +31,9 @@ static_assert(!std::sized_sentinel_for<iterator, iterator>);
static_assert(!std::sized_sentinel_for<iterator, const_iterator>);
static_assert(!std::sized_sentinel_for<iterator, reverse_iterator>);
static_assert(!std::sized_sentinel_for<iterator, const_reverse_iterator>);
-static_assert( std::indirectly_movable<iterator, std::pair<int, int>*>);
+static_assert(std::indirectly_movable<iterator, std::pair<int, int>*>);
static_assert(!std::indirectly_movable_storable<iterator, std::pair<int, int>*>);
-static_assert( std::indirectly_copyable<iterator, std::pair<int, int>*>);
+static_assert(std::indirectly_copyable<iterator, std::pair<int, int>*>);
static_assert(!std::indirectly_copyable_storable<iterator, std::pair<int, int>*>);
static_assert(!std::indirectly_swappable<iterator, iterator>);
diff --git a/libcxx/test/std/containers/associative/map/map.access/at.pass.cpp b/libcxx/test/std/containers/associative/map/map.access/at.pass.cpp
index c13c6a64acb20b3..cabc9f7eb106664 100644
--- a/libcxx/test/std/containers/associative/map/map.access/at.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.access/at.pass.cpp
@@ -20,145 +20,128 @@
#include "min_allocator.h"
#include "test_macros.h"
-int main(int, char**)
-{
- {
- typedef std::pair<const int, double> V;
- V ar[] =
- {
- V(1, 1.5),
- V(2, 2.5),
- V(3, 3.5),
- V(4, 4.5),
- V(5, 5.5),
- V(7, 7.5),
- V(8, 8.5),
- };
- std::map<int, double> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- assert(m.size() == 7);
- assert(m.at(1) == 1.5);
- m.at(1) = -1.5;
- assert(m.at(1) == -1.5);
- assert(m.at(2) == 2.5);
- assert(m.at(3) == 3.5);
- assert(m.at(4) == 4.5);
- assert(m.at(5) == 5.5);
+int main(int, char**) {
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] = {
+ V(1, 1.5),
+ V(2, 2.5),
+ V(3, 3.5),
+ V(4, 4.5),
+ V(5, 5.5),
+ V(7, 7.5),
+ V(8, 8.5),
+ };
+ std::map<int, double> m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(m.size() == 7);
+ assert(m.at(1) == 1.5);
+ m.at(1) = -1.5;
+ assert(m.at(1) == -1.5);
+ assert(m.at(2) == 2.5);
+ assert(m.at(3) == 3.5);
+ assert(m.at(4) == 4.5);
+ assert(m.at(5) == 5.5);
#ifndef TEST_HAS_NO_EXCEPTIONS
- try
- {
- TEST_IGNORE_NODISCARD m.at(6);
- assert(false);
- }
- catch (std::out_of_range&)
- {
- }
-#endif
- assert(m.at(7) == 7.5);
- assert(m.at(8) == 8.5);
- assert(m.size() == 7);
+ try {
+ TEST_IGNORE_NODISCARD m.at(6);
+ assert(false);
+ } catch (std::out_of_range&) {
}
- {
- typedef std::pair<const int, double> V;
- V ar[] =
- {
- V(1, 1.5),
- V(2, 2.5),
- V(3, 3.5),
- V(4, 4.5),
- V(5, 5.5),
- V(7, 7.5),
- V(8, 8.5),
- };
- const std::map<int, double> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- assert(m.size() == 7);
- assert(m.at(1) == 1.5);
- assert(m.at(2) == 2.5);
- assert(m.at(3) == 3.5);
- assert(m.at(4) == 4.5);
- assert(m.at(5) == 5.5);
-#ifndef TEST_HAS_NO_EXCEPTIONS
- try
- {
- TEST_IGNORE_NODISCARD m.at(6);
- assert(false);
- }
- catch (std::out_of_range&)
- {
- }
#endif
- assert(m.at(7) == 7.5);
- assert(m.at(8) == 8.5);
- assert(m.size() == 7);
- }
-#if TEST_STD_VER >= 11
- {
- typedef std::pair<const int, double> V;
- V ar[] =
- {
- V(1, 1.5),
- V(2, 2.5),
- V(3, 3.5),
- V(4, 4.5),
- V(5, 5.5),
- V(7, 7.5),
- V(8, 8.5),
- };
- std::map<int, double, std::less<int>, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- assert(m.size() == 7);
- assert(m.at(1) == 1.5);
- m.at(1) = -1.5;
- assert(m.at(1) == -1.5);
- assert(m.at(2) == 2.5);
- assert(m.at(3) == 3.5);
- assert(m.at(4) == 4.5);
- assert(m.at(5) == 5.5);
+ assert(m.at(7) == 7.5);
+ assert(m.at(8) == 8.5);
+ assert(m.size() == 7);
+ }
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] = {
+ V(1, 1.5),
+ V(2, 2.5),
+ V(3, 3.5),
+ V(4, 4.5),
+ V(5, 5.5),
+ V(7, 7.5),
+ V(8, 8.5),
+ };
+ const std::map<int, double> m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(m.size() == 7);
+ assert(m.at(1) == 1.5);
+ assert(m.at(2) == 2.5);
+ assert(m.at(3) == 3.5);
+ assert(m.at(4) == 4.5);
+ assert(m.at(5) == 5.5);
#ifndef TEST_HAS_NO_EXCEPTIONS
- try
- {
- TEST_IGNORE_NODISCARD m.at(6);
- assert(false);
- }
- catch (std::out_of_range&)
- {
- }
-#endif
- assert(m.at(7) == 7.5);
- assert(m.at(8) == 8.5);
- assert(m.size() == 7);
+ try {
+ TEST_IGNORE_NODISCARD m.at(6);
+ assert(false);
+ } catch (std::out_of_range&) {
}
- {
- typedef std::pair<const int, double> V;
- V ar[] =
- {
- V(1, 1.5),
- V(2, 2.5),
- V(3, 3.5),
- V(4, 4.5),
- V(5, 5.5),
- V(7, 7.5),
- V(8, 8.5),
- };
- const std::map<int, double, std::less<int>, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- assert(m.size() == 7);
- assert(m.at(1) == 1.5);
- assert(m.at(2) == 2.5);
- assert(m.at(3) == 3.5);
- assert(m.at(4) == 4.5);
- assert(m.at(5) == 5.5);
-#ifndef TEST_HAS_NO_EXCEPTIONS
- try
- {
- TEST_IGNORE_NODISCARD m.at(6);
- assert(false);
- }
- catch (std::out_of_range&)
- {
- }
#endif
- assert(m.at(7) == 7.5);
- assert(m.at(8) == 8.5);
- assert(m.size() == 7);
+ assert(m.at(7) == 7.5);
+ assert(m.at(8) == 8.5);
+ assert(m.size() == 7);
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] = {
+ V(1, 1.5),
+ V(2, 2.5),
+ V(3, 3.5),
+ V(4, 4.5),
+ V(5, 5.5),
+ V(7, 7.5),
+ V(8, 8.5),
+ };
+ std::map<int, double, std::less<int>, min_allocator<V>> m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(m.size() == 7);
+ assert(m.at(1) == 1.5);
+ m.at(1) = -1.5;
+ assert(m.at(1) == -1.5);
+ assert(m.at(2) == 2.5);
+ assert(m.at(3) == 3.5);
+ assert(m.at(4) == 4.5);
+ assert(m.at(5) == 5.5);
+# ifndef TEST_HAS_NO_EXCEPTIONS
+ try {
+ TEST_IGNORE_NODISCARD m.at(6);
+ assert(false);
+ } catch (std::out_of_range&) {
+ }
+# endif
+ assert(m.at(7) == 7.5);
+ assert(m.at(8) == 8.5);
+ assert(m.size() == 7);
+ }
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] = {
+ V(1, 1.5),
+ V(2, 2.5),
+ V(3, 3.5),
+ V(4, 4.5),
+ V(5, 5.5),
+ V(7, 7.5),
+ V(8, 8.5),
+ };
+ const std::map<int, double, std::less<int>, min_allocator<V>> m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(m.size() == 7);
+ assert(m.at(1) == 1.5);
+ assert(m.at(2) == 2.5);
+ assert(m.at(3) == 3.5);
+ assert(m.at(4) == 4.5);
+ assert(m.at(5) == 5.5);
+# ifndef TEST_HAS_NO_EXCEPTIONS
+ try {
+ TEST_IGNORE_NODISCARD m.at(6);
+ assert(false);
+ } catch (std::out_of_range&) {
}
+# endif
+ assert(m.at(7) == 7.5);
+ assert(m.at(8) == 8.5);
+ assert(m.size() == 7);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/map/map.access/empty.pass.cpp b/libcxx/test/std/containers/associative/map/map.access/empty.pass.cpp
index a4cd019ee4df318..21118eca6969397 100644
--- a/libcxx/test/std/containers/associative/map/map.access/empty.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.access/empty.pass.cpp
@@ -18,9 +18,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::map<int, double> M;
M m;
assert(m.empty());
@@ -28,9 +27,9 @@ int main(int, char**)
assert(!m.empty());
m.clear();
assert(m.empty());
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
M m;
assert(m.empty());
@@ -38,7 +37,7 @@ int main(int, char**)
assert(!m.empty());
m.clear();
assert(m.empty());
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/map/map.access/empty.verify.cpp b/libcxx/test/std/containers/associative/map/map.access/empty.verify.cpp
index 27ca7c66ccebf65..f44411df0bb0081 100644
--- a/libcxx/test/std/containers/associative/map/map.access/empty.verify.cpp
+++ b/libcxx/test/std/containers/associative/map/map.access/empty.verify.cpp
@@ -17,6 +17,6 @@
#include <map>
void f() {
- std::map<int, int> c;
- c.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::map<int, int> c;
+ c.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}
diff --git a/libcxx/test/std/containers/associative/map/map.access/index_key.pass.cpp b/libcxx/test/std/containers/associative/map/map.access/index_key.pass.cpp
index eaa8e1d6d3848cd..58610c69ed3dcc9 100644
--- a/libcxx/test/std/containers/associative/map/map.access/index_key.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.access/index_key.pass.cpp
@@ -20,15 +20,13 @@
#include "min_allocator.h"
#include "private_constructor.h"
#if TEST_STD_VER >= 11
-#include "container_test_types.h"
+# include "container_test_types.h"
#endif
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::pair<const int, double> V;
- V ar[] =
- {
+ V ar[] = {
V(1, 1.5),
V(2, 2.5),
V(3, 3.5),
@@ -37,7 +35,7 @@ int main(int, char**)
V(7, 7.5),
V(8, 8.5),
};
- std::map<int, double> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ std::map<int, double> m(ar, ar + sizeof(ar) / sizeof(ar[0]));
assert(m.size() == 7);
assert(m[1] == 1.5);
assert(m.size() == 7);
@@ -49,12 +47,11 @@ int main(int, char**)
m[6] = 6.5;
assert(m[6] == 6.5);
assert(m.size() == 8);
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::pair<const int, double> V;
- V ar[] =
- {
+ V ar[] = {
V(1, 1.5),
V(2, 2.5),
V(3, 3.5),
@@ -63,12 +60,12 @@ int main(int, char**)
V(7, 7.5),
V(8, 8.5),
};
- std::map<int, double, std::less<int>, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ std::map<int, double, std::less<int>, min_allocator<V>> m(ar, ar + sizeof(ar) / sizeof(ar[0]));
assert(m.size() == 7);
assert(m[1] == 1.5);
assert(m.size() == 7);
const int i = 1;
- m[i] = -1.5;
+ m[i] = -1.5;
assert(m[1] == -1.5);
assert(m.size() == 7);
assert(m[6] == 0);
@@ -76,46 +73,45 @@ int main(int, char**)
m[6] = 6.5;
assert(m[6] == 6.5);
assert(m.size() == 8);
+ }
+ {
+ // Use "container_test_types.h" to check what arguments get passed
+ // to the allocator for operator[]
+ using Container = TCT::map<>;
+ using Key = Container::key_type;
+ using MappedType = Container::mapped_type;
+ ConstructController* cc = getConstructController();
+ cc->reset();
+ {
+ Container c;
+ const Key k(1);
+ cc->expect<std::piecewise_construct_t const&, std::tuple<Key const&>&&, std::tuple<>&&>();
+ MappedType& mref = c[k];
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ MappedType& mref2 = c[k];
+ assert(&mref == &mref2);
+ }
}
{
- // Use "container_test_types.h" to check what arguments get passed
- // to the allocator for operator[]
- using Container = TCT::map<>;
- using Key = Container::key_type;
- using MappedType = Container::mapped_type;
- ConstructController* cc = getConstructController();
- cc->reset();
- {
- Container c;
- const Key k(1);
- cc->expect<std::piecewise_construct_t const&, std::tuple<Key const&>&&, std::tuple<>&&>();
- MappedType& mref = c[k];
- assert(!cc->unchecked());
- {
- DisableAllocationGuard g;
- MappedType& mref2 = c[k];
- assert(&mref == &mref2);
- }
- }
- {
- Container c;
- Key k(1);
- cc->expect<std::piecewise_construct_t const&, std::tuple<Key const&>&&, std::tuple<>&&>();
- MappedType& mref = c[k];
- assert(!cc->unchecked());
- {
- DisableAllocationGuard g;
- MappedType& mref2 = c[k];
- assert(&mref == &mref2);
- }
- }
+ Container c;
+ Key k(1);
+ cc->expect<std::piecewise_construct_t const&, std::tuple<Key const&>&&, std::tuple<>&&>();
+ MappedType& mref = c[k];
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ MappedType& mref2 = c[k];
+ assert(&mref == &mref2);
+ }
}
+ }
#endif
#if TEST_STD_VER > 11
- {
+ {
typedef std::pair<const int, double> V;
- V ar[] =
- {
+ V ar[] = {
V(1, 1.5),
V(2, 2.5),
V(3, 3.5),
@@ -124,7 +120,7 @@ int main(int, char**)
V(7, 7.5),
V(8, 8.5),
};
- std::map<int, double, std::less<>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ std::map<int, double, std::less<>> m(ar, ar + sizeof(ar) / sizeof(ar[0]));
assert(m.size() == 7);
assert(m[1] == 1.5);
@@ -137,7 +133,7 @@ int main(int, char**)
m[6] = 6.5;
assert(m[6] == 6.5);
assert(m.size() == 8);
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/map/map.access/index_rv_key.pass.cpp b/libcxx/test/std/containers/associative/map/map.access/index_rv_key.pass.cpp
index 5e92e6d1b2b0c28..d5d01b96a6988e5 100644
--- a/libcxx/test/std/containers/associative/map/map.access/index_rv_key.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.access/index_rv_key.pass.cpp
@@ -23,9 +23,8 @@
#include "min_allocator.h"
#include "container_test_types.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
std::map<MoveOnly, double> m;
assert(m.size() == 0);
assert(m[1] == 0.0);
@@ -38,8 +37,8 @@ int main(int, char**)
m[6] = 6.5;
assert(m[6] == 6.5);
assert(m.size() == 2);
- }
- {
+ }
+ {
typedef std::pair<const MoveOnly, double> V;
std::map<MoveOnly, double, std::less<MoveOnly>, min_allocator<V>> m;
assert(m.size() == 0);
@@ -53,29 +52,29 @@ int main(int, char**)
m[6] = 6.5;
assert(m[6] == 6.5);
assert(m.size() == 2);
- }
+ }
+ {
+ // Use "container_test_types.h" to check what arguments get passed
+ // to the allocator for operator[]
+ using Container = TCT::map<>;
+ using Key = Container::key_type;
+ using MappedType = Container::mapped_type;
+ ConstructController* cc = getConstructController();
+ cc->reset();
{
- // Use "container_test_types.h" to check what arguments get passed
- // to the allocator for operator[]
- using Container = TCT::map<>;
- using Key = Container::key_type;
- using MappedType = Container::mapped_type;
- ConstructController* cc = getConstructController();
- cc->reset();
- {
- Container c;
- Key k(1);
- cc->expect<std::piecewise_construct_t const&, std::tuple<Key &&>&&, std::tuple<>&&>();
- MappedType& mref = c[std::move(k)];
- assert(!cc->unchecked());
- {
- Key k2(1);
- DisableAllocationGuard g;
- MappedType& mref2 = c[std::move(k2)];
- assert(&mref == &mref2);
- }
- }
+ Container c;
+ Key k(1);
+ cc->expect<std::piecewise_construct_t const&, std::tuple<Key&&>&&, std::tuple<>&&>();
+ MappedType& mref = c[std::move(k)];
+ assert(!cc->unchecked());
+ {
+ Key k2(1);
+ DisableAllocationGuard g;
+ MappedType& mref2 = c[std::move(k2)];
+ assert(&mref == &mref2);
+ }
}
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/map/map.access/index_tuple.pass.cpp b/libcxx/test/std/containers/associative/map/map.access/index_tuple.pass.cpp
index cf75e1ebb570f7b..3f33cfd699151d3 100644
--- a/libcxx/test/std/containers/associative/map/map.access/index_tuple.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.access/index_tuple.pass.cpp
@@ -20,8 +20,8 @@
#include <tuple>
int main(int, char**) {
- std::map<std::tuple<int, int>, std::size_t> m;
- m[std::make_tuple(2, 3)] = 7;
+ std::map<std::tuple<int, int>, std::size_t> m;
+ m[std::make_tuple(2, 3)] = 7;
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/associative/map/map.access/iterator.pass.cpp b/libcxx/test/std/containers/associative/map/map.access/iterator.pass.cpp
index 4589f93fda1e15e..bbad44c8edb3002 100644
--- a/libcxx/test/std/containers/associative/map/map.access/iterator.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.access/iterator.pass.cpp
@@ -32,234 +32,129 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::pair<const int, double> V;
- V ar[] =
- {
- V(1, 1),
- V(1, 1.5),
- V(1, 2),
- V(2, 1),
- V(2, 1.5),
- V(2, 2),
- V(3, 1),
- V(3, 1.5),
- V(3, 2),
- V(4, 1),
- V(4, 1.5),
- V(4, 2),
- V(5, 1),
- V(5, 1.5),
- V(5, 2),
- V(6, 1),
- V(6, 1.5),
- V(6, 2),
- V(7, 1),
- V(7, 1.5),
- V(7, 2),
- V(8, 1),
- V(8, 1.5),
- V(8, 2)
- };
- std::map<int, double> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
- assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
- std::map<int, double>::iterator i;
- i = m.begin();
- std::map<int, double>::const_iterator k = i;
- assert(i == k);
- for (int j = 1; static_cast<std::size_t>(j) <= m.size(); ++j, ++i)
- {
- assert(i->first == j);
- assert(i->second == 1);
- i->second = 2.5;
- assert(i->second == 2.5);
- }
- assert(i == m.end());
- for (int j = m.size(); j >= 1; --j)
- {
- --i;
- assert(i->first == j);
- assert(i->second == 2.5);
- i->second = 1;
- assert(i->second == 1);
- }
- assert(i == m.begin());
+int main(int, char**) {
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] = {V(1, 1), V(1, 1.5), V(1, 2), V(2, 1), V(2, 1.5), V(2, 2), V(3, 1), V(3, 1.5),
+ V(3, 2), V(4, 1), V(4, 1.5), V(4, 2), V(5, 1), V(5, 1.5), V(5, 2), V(6, 1),
+ V(6, 1.5), V(6, 2), V(7, 1), V(7, 1.5), V(7, 2), V(8, 1), V(8, 1.5), V(8, 2)};
+ std::map<int, double> m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
+ std::map<int, double>::iterator i;
+ i = m.begin();
+ std::map<int, double>::const_iterator k = i;
+ assert(i == k);
+ for (int j = 1; static_cast<std::size_t>(j) <= m.size(); ++j, ++i) {
+ assert(i->first == j);
+ assert(i->second == 1);
+ i->second = 2.5;
+ assert(i->second == 2.5);
}
- {
- typedef std::pair<const int, double> V;
- V ar[] =
- {
- V(1, 1),
- V(1, 1.5),
- V(1, 2),
- V(2, 1),
- V(2, 1.5),
- V(2, 2),
- V(3, 1),
- V(3, 1.5),
- V(3, 2),
- V(4, 1),
- V(4, 1.5),
- V(4, 2),
- V(5, 1),
- V(5, 1.5),
- V(5, 2),
- V(6, 1),
- V(6, 1.5),
- V(6, 2),
- V(7, 1),
- V(7, 1.5),
- V(7, 2),
- V(8, 1),
- V(8, 1.5),
- V(8, 2)
- };
- const std::map<int, double> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
- assert(static_cast<std::size_t>(std::distance(m.cbegin(), m.cend())) == m.size());
- assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
- assert(static_cast<std::size_t>(std::distance(m.crbegin(), m.crend())) == m.size());
- std::map<int, double>::const_iterator i;
- i = m.begin();
- for (int j = 1; static_cast<std::size_t>(j) <= m.size(); ++j, ++i)
- {
- assert(i->first == j);
- assert(i->second == 1);
- }
- assert(i == m.end());
- for (int j = m.size(); j >= 1; --j)
- {
- --i;
- assert(i->first == j);
- assert(i->second == 1);
- }
- assert(i == m.begin());
+ assert(i == m.end());
+ for (int j = m.size(); j >= 1; --j) {
+ --i;
+ assert(i->first == j);
+ assert(i->second == 2.5);
+ i->second = 1;
+ assert(i->second == 1);
}
+ assert(i == m.begin());
+ }
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] = {V(1, 1), V(1, 1.5), V(1, 2), V(2, 1), V(2, 1.5), V(2, 2), V(3, 1), V(3, 1.5),
+ V(3, 2), V(4, 1), V(4, 1.5), V(4, 2), V(5, 1), V(5, 1.5), V(5, 2), V(6, 1),
+ V(6, 1.5), V(6, 2), V(7, 1), V(7, 1.5), V(7, 2), V(8, 1), V(8, 1.5), V(8, 2)};
+ const std::map<int, double> m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.cbegin(), m.cend())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.crbegin(), m.crend())) == m.size());
+ std::map<int, double>::const_iterator i;
+ i = m.begin();
+ for (int j = 1; static_cast<std::size_t>(j) <= m.size(); ++j, ++i) {
+ assert(i->first == j);
+ assert(i->second == 1);
+ }
+ assert(i == m.end());
+ for (int j = m.size(); j >= 1; --j) {
+ --i;
+ assert(i->first == j);
+ assert(i->second == 1);
+ }
+ assert(i == m.begin());
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::pair<const int, double> V;
- V ar[] =
- {
- V(1, 1),
- V(1, 1.5),
- V(1, 2),
- V(2, 1),
- V(2, 1.5),
- V(2, 2),
- V(3, 1),
- V(3, 1.5),
- V(3, 2),
- V(4, 1),
- V(4, 1.5),
- V(4, 2),
- V(5, 1),
- V(5, 1.5),
- V(5, 2),
- V(6, 1),
- V(6, 1.5),
- V(6, 2),
- V(7, 1),
- V(7, 1.5),
- V(7, 2),
- V(8, 1),
- V(8, 1.5),
- V(8, 2)
- };
- std::map<int, double, std::less<int>, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
- assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
- std::map<int, double, std::less<int>, min_allocator<V>>::iterator i;
- i = m.begin();
- std::map<int, double, std::less<int>, min_allocator<V>>::const_iterator k = i;
- assert(i == k);
- for (int j = 1; static_cast<std::size_t>(j) <= m.size(); ++j, ++i)
- {
- assert(i->first == j);
- assert(i->second == 1);
- i->second = 2.5;
- assert(i->second == 2.5);
- }
- assert(i == m.end());
- for (int j = m.size(); j >= 1; --j)
- {
- --i;
- assert(i->first == j);
- assert(i->second == 2.5);
- i->second = 1;
- assert(i->second == 1);
- }
- assert(i == m.begin());
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] = {V(1, 1), V(1, 1.5), V(1, 2), V(2, 1), V(2, 1.5), V(2, 2), V(3, 1), V(3, 1.5),
+ V(3, 2), V(4, 1), V(4, 1.5), V(4, 2), V(5, 1), V(5, 1.5), V(5, 2), V(6, 1),
+ V(6, 1.5), V(6, 2), V(7, 1), V(7, 1.5), V(7, 2), V(8, 1), V(8, 1.5), V(8, 2)};
+ std::map<int, double, std::less<int>, min_allocator<V>> m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
+ std::map<int, double, std::less<int>, min_allocator<V>>::iterator i;
+ i = m.begin();
+ std::map<int, double, std::less<int>, min_allocator<V>>::const_iterator k = i;
+ assert(i == k);
+ for (int j = 1; static_cast<std::size_t>(j) <= m.size(); ++j, ++i) {
+ assert(i->first == j);
+ assert(i->second == 1);
+ i->second = 2.5;
+ assert(i->second == 2.5);
+ }
+ assert(i == m.end());
+ for (int j = m.size(); j >= 1; --j) {
+ --i;
+ assert(i->first == j);
+ assert(i->second == 2.5);
+ i->second = 1;
+ assert(i->second == 1);
}
- {
- typedef std::pair<const int, double> V;
- V ar[] =
- {
- V(1, 1),
- V(1, 1.5),
- V(1, 2),
- V(2, 1),
- V(2, 1.5),
- V(2, 2),
- V(3, 1),
- V(3, 1.5),
- V(3, 2),
- V(4, 1),
- V(4, 1.5),
- V(4, 2),
- V(5, 1),
- V(5, 1.5),
- V(5, 2),
- V(6, 1),
- V(6, 1.5),
- V(6, 2),
- V(7, 1),
- V(7, 1.5),
- V(7, 2),
- V(8, 1),
- V(8, 1.5),
- V(8, 2)
- };
- const std::map<int, double, std::less<int>, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
- assert(static_cast<std::size_t>(std::distance(m.cbegin(), m.cend())) == m.size());
- assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
- assert(static_cast<std::size_t>(std::distance(m.crbegin(), m.crend())) == m.size());
- std::map<int, double, std::less<int>, min_allocator<V>>::const_iterator i;
- i = m.begin();
- for (int j = 1; static_cast<std::size_t>(j) <= m.size(); ++j, ++i)
- {
- assert(i->first == j);
- assert(i->second == 1);
- }
- assert(i == m.end());
- for (int j = m.size(); j >= 1; --j)
- {
- --i;
- assert(i->first == j);
- assert(i->second == 1);
- }
- assert(i == m.begin());
+ assert(i == m.begin());
+ }
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] = {V(1, 1), V(1, 1.5), V(1, 2), V(2, 1), V(2, 1.5), V(2, 2), V(3, 1), V(3, 1.5),
+ V(3, 2), V(4, 1), V(4, 1.5), V(4, 2), V(5, 1), V(5, 1.5), V(5, 2), V(6, 1),
+ V(6, 1.5), V(6, 2), V(7, 1), V(7, 1.5), V(7, 2), V(8, 1), V(8, 1.5), V(8, 2)};
+ const std::map<int, double, std::less<int>, min_allocator<V>> m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.cbegin(), m.cend())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.crbegin(), m.crend())) == m.size());
+ std::map<int, double, std::less<int>, min_allocator<V>>::const_iterator i;
+ i = m.begin();
+ for (int j = 1; static_cast<std::size_t>(j) <= m.size(); ++j, ++i) {
+ assert(i->first == j);
+ assert(i->second == 1);
}
+ assert(i == m.end());
+ for (int j = m.size(); j >= 1; --j) {
+ --i;
+ assert(i->first == j);
+ assert(i->second == 1);
+ }
+ assert(i == m.begin());
+ }
#endif
#if TEST_STD_VER > 11
- { // N3644 testing
- typedef std::map<int, double> C;
- C::iterator ii1{}, ii2{};
- C::iterator ii4 = ii1;
- C::const_iterator cii{};
- assert ( ii1 == ii2 );
- assert ( ii1 == ii4 );
+ { // N3644 testing
+ typedef std::map<int, double> C;
+ C::iterator ii1{}, ii2{};
+ C::iterator ii4 = ii1;
+ C::const_iterator cii{};
+ assert(ii1 == ii2);
+ assert(ii1 == ii4);
- assert (!(ii1 != ii2 ));
+ assert(!(ii1 != ii2));
- assert ( (ii1 == cii ));
- assert ( (cii == ii1 ));
- assert (!(ii1 != cii ));
- assert (!(cii != ii1 ));
- }
+ assert((ii1 == cii));
+ assert((cii == ii1));
+ assert(!(ii1 != cii));
+ assert(!(cii != ii1));
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/map/map.access/max_size.pass.cpp b/libcxx/test/std/containers/associative/map/map.access/max_size.pass.cpp
index e10f20359bb18e8..1a5d35c2579d850 100644
--- a/libcxx/test/std/containers/associative/map/map.access/max_size.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.access/max_size.pass.cpp
@@ -20,8 +20,7 @@
#include "test_allocator.h"
#include "test_macros.h"
-int main(int, char**)
-{
+int main(int, char**) {
typedef std::pair<const int, int> KV;
{
typedef limited_allocator<KV, 10> A;
@@ -33,16 +32,14 @@ int main(int, char**)
{
typedef limited_allocator<KV, (std::size_t)-1> A;
typedef std::map<int, int, std::less<int>, A> C;
- const C::size_type max_dist =
- static_cast<C::size_type>(std::numeric_limits<C::
diff erence_type>::max());
+ const C::size_type max_dist = static_cast<C::size_type>(std::numeric_limits<C::
diff erence_type>::max());
C c;
assert(c.max_size() <= max_dist);
LIBCPP_ASSERT(c.max_size() == max_dist);
}
{
typedef std::map<char, int> C;
- const C::size_type max_dist =
- static_cast<C::size_type>(std::numeric_limits<C::
diff erence_type>::max());
+ const C::size_type max_dist = static_cast<C::size_type>(std::numeric_limits<C::
diff erence_type>::max());
C c;
assert(c.max_size() <= max_dist);
assert(c.max_size() <= alloc_max_size(c.get_allocator()));
diff --git a/libcxx/test/std/containers/associative/map/map.access/size.pass.cpp b/libcxx/test/std/containers/associative/map/map.access/size.pass.cpp
index 837f720ec84d4c9..23914f6b8ed1677 100644
--- a/libcxx/test/std/containers/associative/map/map.access/size.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.access/size.pass.cpp
@@ -18,9 +18,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::map<int, double> M;
M m;
assert(m.size() == 0);
@@ -36,9 +35,9 @@ int main(int, char**)
assert(m.size() == 1);
m.erase(m.begin());
assert(m.size() == 0);
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
M m;
assert(m.size() == 0);
@@ -54,7 +53,7 @@ int main(int, char**)
assert(m.size() == 1);
m.erase(m.begin());
assert(m.size() == 0);
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/map/map.cons/alloc.pass.cpp b/libcxx/test/std/containers/associative/map/map.cons/alloc.pass.cpp
index 45e867109f8ef68..52199204d79140b 100644
--- a/libcxx/test/std/containers/associative/map/map.cons/alloc.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.cons/alloc.pass.cpp
@@ -19,33 +19,32 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::less<int> C;
typedef test_allocator<std::pair<const int, double> > A;
std::map<int, double, C, A> m(A(5));
assert(m.empty());
assert(m.begin() == m.end());
assert(m.get_allocator() == A(5));
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::less<int> C;
typedef min_allocator<std::pair<const int, double> > A;
std::map<int, double, C, A> m(A{});
assert(m.empty());
assert(m.begin() == m.end());
assert(m.get_allocator() == A());
- }
- {
+ }
+ {
typedef std::less<int> C;
typedef explicit_allocator<std::pair<const int, double> > A;
std::map<int, double, C, A> m(A{});
assert(m.empty());
assert(m.begin() == m.end());
assert(m.get_allocator() == A());
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/map/map.cons/assign_initializer_list.pass.cpp b/libcxx/test/std/containers/associative/map/map.cons/assign_initializer_list.pass.cpp
index 2a557aa488d106a..f237c9b56deee81 100644
--- a/libcxx/test/std/containers/associative/map/map.cons/assign_initializer_list.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.cons/assign_initializer_list.pass.cpp
@@ -24,55 +24,30 @@
void test_basic() {
{
typedef std::pair<const int, double> V;
- std::map<int, double> m =
- {
- {20, 1},
- };
- m =
- {
- {1, 1},
- {1, 1.5},
- {1, 2},
- {2, 1},
- {2, 1.5},
- {2, 2},
- {3, 1},
- {3, 1.5},
- {3, 2}
- };
+ std::map<int, double> m = {
+ {20, 1},
+ };
+ m = {{1, 1}, {1, 1.5}, {1, 2}, {2, 1}, {2, 1.5}, {2, 2}, {3, 1}, {3, 1.5}, {3, 2}};
assert(m.size() == 3);
assert(std::distance(m.begin(), m.end()) == 3);
assert(*m.begin() == V(1, 1));
assert(*std::next(m.begin()) == V(2, 1));
assert(*std::next(m.begin(), 2) == V(3, 1));
- }
- {
+ }
+ {
typedef std::pair<const int, double> V;
- std::map<int, double, std::less<int>, min_allocator<V>> m =
- {
- {20, 1},
- };
- m =
- {
- {1, 1},
- {1, 1.5},
- {1, 2},
- {2, 1},
- {2, 1.5},
- {2, 2},
- {3, 1},
- {3, 1.5},
- {3, 2}
- };
+ std::map<int, double, std::less<int>, min_allocator<V>> m = {
+ {20, 1},
+ };
+ m = {{1, 1}, {1, 1.5}, {1, 2}, {2, 1}, {2, 1.5}, {2, 2}, {3, 1}, {3, 1.5}, {3, 2}};
assert(m.size() == 3);
assert(std::distance(m.begin(), m.end()) == 3);
assert(*m.begin() == V(1, 1));
assert(*std::next(m.begin()) == V(2, 1));
assert(*std::next(m.begin(), 2) == V(3, 1));
- }
+ }
}
-
void duplicate_keys_test() {
test_allocator_statistics alloc_stats;
typedef std::map<int, int, std::less<int>, test_allocator<std::pair<const int, int> > > Map;
@@ -88,8 +63,7 @@ void duplicate_keys_test() {
LIBCPP_ASSERT(alloc_stats.alloc_count == 0);
}
-int main(int, char**)
-{
+int main(int, char**) {
test_basic();
duplicate_keys_test();
diff --git a/libcxx/test/std/containers/associative/map/map.cons/compare.pass.cpp b/libcxx/test/std/containers/associative/map/map.cons/compare.pass.cpp
index 04702f319771e81..bd27a2f4ddeb9a3 100644
--- a/libcxx/test/std/containers/associative/map/map.cons/compare.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.cons/compare.pass.cpp
@@ -19,23 +19,22 @@
#include "../../../test_compare.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef test_less<int> C;
const std::map<int, double, C> m(C(3));
assert(m.empty());
assert(m.begin() == m.end());
assert(m.key_comp() == C(3));
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef test_less<int> C;
const std::map<int, double, C, min_allocator<std::pair<const int, double>>> m(C(3));
assert(m.empty());
assert(m.begin() == m.end());
assert(m.key_comp() == C(3));
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/map/map.cons/compare_alloc.pass.cpp b/libcxx/test/std/containers/associative/map/map.cons/compare_alloc.pass.cpp
index 9d425e7218d64ca..20f6a08db6a36a3 100644
--- a/libcxx/test/std/containers/associative/map/map.cons/compare_alloc.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.cons/compare_alloc.pass.cpp
@@ -20,9 +20,8 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef test_less<int> C;
typedef test_allocator<std::pair<const int, double> > A;
std::map<int, double, C, A> m(C(4), A(5));
@@ -30,9 +29,9 @@ int main(int, char**)
assert(m.begin() == m.end());
assert(m.key_comp() == C(4));
assert(m.get_allocator() == A(5));
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef test_less<int> C;
typedef min_allocator<std::pair<const int, double> > A;
std::map<int, double, C, A> m(C(4), A());
@@ -40,8 +39,8 @@ int main(int, char**)
assert(m.begin() == m.end());
assert(m.key_comp() == C(4));
assert(m.get_allocator() == A());
- }
- {
+ }
+ {
typedef test_less<int> C;
typedef explicit_allocator<std::pair<const int, double> > A;
std::map<int, double, C, A> m(C(4), A{});
@@ -49,7 +48,7 @@ int main(int, char**)
assert(m.begin() == m.end());
assert(m.key_comp() == C(4));
assert(m.get_allocator() == A{});
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/map/map.cons/compare_copy_constructible.compile.fail.cpp b/libcxx/test/std/containers/associative/map/map.cons/compare_copy_constructible.compile.fail.cpp
index 3c714de40af934b..c81cb880e03aa8e 100644
--- a/libcxx/test/std/containers/associative/map/map.cons/compare_copy_constructible.compile.fail.cpp
+++ b/libcxx/test/std/containers/associative/map/map.cons/compare_copy_constructible.compile.fail.cpp
@@ -15,16 +15,16 @@
template <class T>
struct Comp {
- bool operator () (const T& lhs, const T& rhs) const { return lhs < rhs; }
+ bool operator()(const T& lhs, const T& rhs) const { return lhs < rhs; }
- Comp () {}
-private:
- Comp (const Comp &); // declared but not defined
- };
+ Comp() {}
+private:
+ Comp(const Comp&); // declared but not defined
+};
int main(int, char**) {
- std::map<int, int, Comp<int> > m;
+ std::map<int, int, Comp<int> > m;
return 0;
}
diff --git a/libcxx/test/std/containers/associative/map/map.cons/copy.pass.cpp b/libcxx/test/std/containers/associative/map/map.cons/copy.pass.cpp
index 5899dec8b790e90..e7a69aff0b03658 100644
--- a/libcxx/test/std/containers/associative/map/map.cons/copy.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.cons/copy.pass.cpp
@@ -20,111 +20,107 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::pair<const int, double> V;
- V ar[] =
- {
- V(1, 1),
- V(1, 1.5),
- V(1, 2),
- V(2, 1),
- V(2, 1.5),
- V(2, 2),
- V(3, 1),
- V(3, 1.5),
- V(3, 2),
- };
- typedef test_less<int> C;
- typedef test_allocator<V> A;
- std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(7));
- std::map<int, double, C, A> m = mo;
- assert(m.get_allocator() == A(7));
- assert(m.key_comp() == C(5));
- assert(m.size() == 3);
- assert(std::distance(m.begin(), m.end()) == 3);
- assert(*m.begin() == V(1, 1));
- assert(*std::next(m.begin()) == V(2, 1));
- assert(*std::next(m.begin(), 2) == V(3, 1));
+int main(int, char**) {
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] = {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2),
+ };
+ typedef test_less<int> C;
+ typedef test_allocator<V> A;
+ std::map<int, double, C, A> mo(ar, ar + sizeof(ar) / sizeof(ar[0]), C(5), A(7));
+ std::map<int, double, C, A> m = mo;
+ assert(m.get_allocator() == A(7));
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 3);
+ assert(std::distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == V(1, 1));
+ assert(*std::next(m.begin()) == V(2, 1));
+ assert(*std::next(m.begin(), 2) == V(3, 1));
- assert(mo.get_allocator() == A(7));
- assert(mo.key_comp() == C(5));
- assert(mo.size() == 3);
- assert(std::distance(mo.begin(), mo.end()) == 3);
- assert(*mo.begin() == V(1, 1));
- assert(*std::next(mo.begin()) == V(2, 1));
- assert(*std::next(mo.begin(), 2) == V(3, 1));
- }
+ assert(mo.get_allocator() == A(7));
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 3);
+ assert(std::distance(mo.begin(), mo.end()) == 3);
+ assert(*mo.begin() == V(1, 1));
+ assert(*std::next(mo.begin()) == V(2, 1));
+ assert(*std::next(mo.begin(), 2) == V(3, 1));
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::pair<const int, double> V;
- V ar[] =
- {
- V(1, 1),
- V(1, 1.5),
- V(1, 2),
- V(2, 1),
- V(2, 1.5),
- V(2, 2),
- V(3, 1),
- V(3, 1.5),
- V(3, 2),
- };
- typedef test_less<int> C;
- typedef other_allocator<V> A;
- std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(7));
- std::map<int, double, C, A> m = mo;
- assert(m.get_allocator() == A(-2));
- assert(m.key_comp() == C(5));
- assert(m.size() == 3);
- assert(std::distance(m.begin(), m.end()) == 3);
- assert(*m.begin() == V(1, 1));
- assert(*std::next(m.begin()) == V(2, 1));
- assert(*std::next(m.begin(), 2) == V(3, 1));
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] = {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2),
+ };
+ typedef test_less<int> C;
+ typedef other_allocator<V> A;
+ std::map<int, double, C, A> mo(ar, ar + sizeof(ar) / sizeof(ar[0]), C(5), A(7));
+ std::map<int, double, C, A> m = mo;
+ assert(m.get_allocator() == A(-2));
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 3);
+ assert(std::distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == V(1, 1));
+ assert(*std::next(m.begin()) == V(2, 1));
+ assert(*std::next(m.begin(), 2) == V(3, 1));
- assert(mo.get_allocator() == A(7));
- assert(mo.key_comp() == C(5));
- assert(mo.size() == 3);
- assert(std::distance(mo.begin(), mo.end()) == 3);
- assert(*mo.begin() == V(1, 1));
- assert(*std::next(mo.begin()) == V(2, 1));
- assert(*std::next(mo.begin(), 2) == V(3, 1));
- }
- {
- typedef std::pair<const int, double> V;
- V ar[] =
- {
- V(1, 1),
- V(1, 1.5),
- V(1, 2),
- V(2, 1),
- V(2, 1.5),
- V(2, 2),
- V(3, 1),
- V(3, 1.5),
- V(3, 2),
- };
- typedef test_less<int> C;
- typedef min_allocator<V> A;
- std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
- std::map<int, double, C, A> m = mo;
- assert(m.get_allocator() == A());
- assert(m.key_comp() == C(5));
- assert(m.size() == 3);
- assert(std::distance(m.begin(), m.end()) == 3);
- assert(*m.begin() == V(1, 1));
- assert(*std::next(m.begin()) == V(2, 1));
- assert(*std::next(m.begin(), 2) == V(3, 1));
+ assert(mo.get_allocator() == A(7));
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 3);
+ assert(std::distance(mo.begin(), mo.end()) == 3);
+ assert(*mo.begin() == V(1, 1));
+ assert(*std::next(mo.begin()) == V(2, 1));
+ assert(*std::next(mo.begin(), 2) == V(3, 1));
+ }
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] = {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2),
+ };
+ typedef test_less<int> C;
+ typedef min_allocator<V> A;
+ std::map<int, double, C, A> mo(ar, ar + sizeof(ar) / sizeof(ar[0]), C(5), A());
+ std::map<int, double, C, A> m = mo;
+ assert(m.get_allocator() == A());
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 3);
+ assert(std::distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == V(1, 1));
+ assert(*std::next(m.begin()) == V(2, 1));
+ assert(*std::next(m.begin(), 2) == V(3, 1));
- assert(mo.get_allocator() == A());
- assert(mo.key_comp() == C(5));
- assert(mo.size() == 3);
- assert(std::distance(mo.begin(), mo.end()) == 3);
- assert(*mo.begin() == V(1, 1));
- assert(*std::next(mo.begin()) == V(2, 1));
- assert(*std::next(mo.begin(), 2) == V(3, 1));
- }
+ assert(mo.get_allocator() == A());
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 3);
+ assert(std::distance(mo.begin(), mo.end()) == 3);
+ assert(*mo.begin() == V(1, 1));
+ assert(*std::next(mo.begin()) == V(2, 1));
+ assert(*std::next(mo.begin(), 2) == V(3, 1));
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/map/map.cons/copy_alloc.pass.cpp b/libcxx/test/std/containers/associative/map/map.cons/copy_alloc.pass.cpp
index 72402b1e987b82a..aaf1be867b748d8 100644
--- a/libcxx/test/std/containers/associative/map/map.cons/copy_alloc.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.cons/copy_alloc.pass.cpp
@@ -20,12 +20,10 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::pair<const int, double> V;
- V ar[] =
- {
+ V ar[] = {
V(1, 1),
V(1, 1.5),
V(1, 2),
@@ -38,7 +36,7 @@ int main(int, char**)
};
typedef test_less<int> C;
typedef test_allocator<V> A;
- std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(7));
+ std::map<int, double, C, A> mo(ar, ar + sizeof(ar) / sizeof(ar[0]), C(5), A(7));
std::map<int, double, C, A> m(mo, A(3));
assert(m.get_allocator() == A(3));
assert(m.key_comp() == C(5));
@@ -55,12 +53,11 @@ int main(int, char**)
assert(*mo.begin() == V(1, 1));
assert(*std::next(mo.begin()) == V(2, 1));
assert(*std::next(mo.begin(), 2) == V(3, 1));
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::pair<const int, double> V;
- V ar[] =
- {
+ V ar[] = {
V(1, 1),
V(1, 1.5),
V(1, 2),
@@ -73,7 +70,7 @@ int main(int, char**)
};
typedef test_less<int> C;
typedef min_allocator<V> A;
- std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
+ std::map<int, double, C, A> mo(ar, ar + sizeof(ar) / sizeof(ar[0]), C(5), A());
std::map<int, double, C, A> m(mo, A());
assert(m.get_allocator() == A());
assert(m.key_comp() == C(5));
@@ -90,11 +87,10 @@ int main(int, char**)
assert(*mo.begin() == V(1, 1));
assert(*std::next(mo.begin()) == V(2, 1));
assert(*std::next(mo.begin(), 2) == V(3, 1));
- }
- {
+ }
+ {
typedef std::pair<const int, double> V;
- V ar[] =
- {
+ V ar[] = {
V(1, 1),
V(1, 1.5),
V(1, 2),
@@ -107,7 +103,7 @@ int main(int, char**)
};
typedef test_less<int> C;
typedef explicit_allocator<V> A;
- std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A{});
+ std::map<int, double, C, A> mo(ar, ar + sizeof(ar) / sizeof(ar[0]), C(5), A{});
std::map<int, double, C, A> m(mo, A{});
assert(m.get_allocator() == A());
assert(m.key_comp() == C(5));
@@ -124,7 +120,7 @@ int main(int, char**)
assert(*mo.begin() == V(1, 1));
assert(*std::next(mo.begin()) == V(2, 1));
assert(*std::next(mo.begin(), 2) == V(3, 1));
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/map/map.cons/copy_assign.pass.cpp b/libcxx/test/std/containers/associative/map/map.cons/copy_assign.pass.cpp
index 91e5572bf1213cf..07c8bab2f201d6a 100644
--- a/libcxx/test/std/containers/associative/map/map.cons/copy_assign.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.cons/copy_assign.pass.cpp
@@ -31,317 +31,266 @@ std::vector<int> ca_deallocs;
template <class T>
class counting_allocatorT {
public:
- typedef T value_type;
- int foo{0};
- counting_allocatorT(int f) noexcept : foo(f) {}
+ typedef T value_type;
+ int foo{0};
+ counting_allocatorT(int f) noexcept : foo(f) {}
- using propagate_on_container_copy_assignment = std::true_type;
- template <class U> counting_allocatorT(const counting_allocatorT<U>& other) noexcept {foo = other.foo;}
- template <class U> bool operator==(const counting_allocatorT<U>& other) const noexcept { return foo == other.foo; }
- template <class U> bool operator!=(const counting_allocatorT<U>& other) const noexcept { return foo != other.foo; }
+ using propagate_on_container_copy_assignment = std::true_type;
+ template <class U>
+ counting_allocatorT(const counting_allocatorT<U>& other) noexcept {
+ foo = other.foo;
+ }
+ template <class U>
+ bool operator==(const counting_allocatorT<U>& other) const noexcept {
+ return foo == other.foo;
+ }
+ template <class U>
+ bool operator!=(const counting_allocatorT<U>& other) const noexcept {
+ return foo != other.foo;
+ }
- T* allocate(std::size_t n) const {
- ca_allocs.push_back(foo);
- void * const pv = ::malloc(n * sizeof(T));
- return static_cast<T *>(pv);
- }
- void deallocate(T* p, std::size_t) const noexcept {
- ca_deallocs.push_back(foo);
- free(p);
- }
+ T* allocate(std::size_t n) const {
+ ca_allocs.push_back(foo);
+ void* const pv = ::malloc(n * sizeof(T));
+ return static_cast<T*>(pv);
+ }
+ void deallocate(T* p, std::size_t) const noexcept {
+ ca_deallocs.push_back(foo);
+ free(p);
+ }
};
template <class T>
class counting_allocatorF {
public:
- typedef T value_type;
- int foo{0};
- counting_allocatorF(int f) noexcept : foo(f) {}
+ typedef T value_type;
+ int foo{0};
+ counting_allocatorF(int f) noexcept : foo(f) {}
- using propagate_on_container_copy_assignment = std::false_type;
- template <class U> counting_allocatorF(const counting_allocatorF<U>& other) noexcept {foo = other.foo;}
- template <class U> bool operator==(const counting_allocatorF<U>& other) const noexcept { return foo == other.foo; }
- template <class U> bool operator!=(const counting_allocatorF<U>& other) const noexcept { return foo != other.foo; }
+ using propagate_on_container_copy_assignment = std::false_type;
+ template <class U>
+ counting_allocatorF(const counting_allocatorF<U>& other) noexcept {
+ foo = other.foo;
+ }
+ template <class U>
+ bool operator==(const counting_allocatorF<U>& other) const noexcept {
+ return foo == other.foo;
+ }
+ template <class U>
+ bool operator!=(const counting_allocatorF<U>& other) const noexcept {
+ return foo != other.foo;
+ }
- T* allocate(std::size_t n) const {
- ca_allocs.push_back(foo);
- void * const pv = ::malloc(n * sizeof(T));
- return static_cast<T *>(pv);
- }
- void deallocate(T* p, std::size_t) const noexcept {
- ca_deallocs.push_back(foo);
- free(p);
- }
+ T* allocate(std::size_t n) const {
+ ca_allocs.push_back(foo);
+ void* const pv = ::malloc(n * sizeof(T));
+ return static_cast<T*>(pv);
+ }
+ void deallocate(T* p, std::size_t) const noexcept {
+ ca_deallocs.push_back(foo);
+ free(p);
+ }
};
bool balanced_allocs() {
- std::vector<int> temp1, temp2;
+ std::vector<int> temp1, temp2;
- std::printf("Allocations = %zu, deallocations = %zu\n", ca_allocs.size(),
- ca_deallocs.size());
- if (ca_allocs.size() != ca_deallocs.size())
- return false;
+ std::printf("Allocations = %zu, deallocations = %zu\n", ca_allocs.size(), ca_deallocs.size());
+ if (ca_allocs.size() != ca_deallocs.size())
+ return false;
- temp1 = ca_allocs;
- std::sort(temp1.begin(), temp1.end());
- temp2.clear();
- std::unique_copy(temp1.begin(), temp1.end(), std::back_inserter<std::vector<int>>(temp2));
- std::printf("There were %zu
diff erent allocators\n", temp2.size());
+ temp1 = ca_allocs;
+ std::sort(temp1.begin(), temp1.end());
+ temp2.clear();
+ std::unique_copy(temp1.begin(), temp1.end(), std::back_inserter<std::vector<int>>(temp2));
+ std::printf("There were %zu
diff erent allocators\n", temp2.size());
- for (std::vector<int>::const_iterator it = temp2.begin(); it != temp2.end(); ++it ) {
- std::ptr
diff _t const allocs = std::count(ca_allocs.begin(), ca_allocs.end(), *it);
- std::ptr
diff _t const deallocs = std::count(ca_deallocs.begin(), ca_deallocs.end(), *it);
- std::printf("%d: %td vs %td\n", *it, allocs, deallocs);
- if (allocs != deallocs)
- return false;
- }
+ for (std::vector<int>::const_iterator it = temp2.begin(); it != temp2.end(); ++it) {
+ std::ptr
diff _t const allocs = std::count(ca_allocs.begin(), ca_allocs.end(), *it);
+ std::ptr
diff _t const deallocs = std::count(ca_deallocs.begin(), ca_deallocs.end(), *it);
+ std::printf("%d: %td vs %td\n", *it, allocs, deallocs);
+ if (allocs != deallocs)
+ return false;
+ }
- temp1 = ca_allocs;
- std::sort(temp1.begin(), temp1.end());
- temp2.clear();
- std::unique_copy(temp1.begin(), temp1.end(), std::back_inserter<std::vector<int>>(temp2));
- std::printf("There were %zu
diff erent (de)allocators\n", temp2.size());
+ temp1 = ca_allocs;
+ std::sort(temp1.begin(), temp1.end());
+ temp2.clear();
+ std::unique_copy(temp1.begin(), temp1.end(), std::back_inserter<std::vector<int>>(temp2));
+ std::printf("There were %zu
diff erent (de)allocators\n", temp2.size());
- for (std::vector<int>::const_iterator it = ca_deallocs.begin(); it != ca_deallocs.end(); ++it ) {
- std::ptr
diff _t const allocs = std::count(ca_allocs.begin(), ca_allocs.end(), *it);
- std::ptr
diff _t const deallocs = std::count(ca_deallocs.begin(), ca_deallocs.end(), *it);
- std::printf("%d: %td vs %td\n", *it, allocs, deallocs);
- if (allocs != deallocs)
- return false;
- }
+ for (std::vector<int>::const_iterator it = ca_deallocs.begin(); it != ca_deallocs.end(); ++it) {
+ std::ptr
diff _t const allocs = std::count(ca_allocs.begin(), ca_allocs.end(), *it);
+ std::ptr
diff _t const deallocs = std::count(ca_deallocs.begin(), ca_deallocs.end(), *it);
+ std::printf("%d: %td vs %td\n", *it, allocs, deallocs);
+ if (allocs != deallocs)
+ return false;
+ }
- return true;
+ return true;
}
#endif
-int main(int, char**)
-{
- {
- typedef std::pair<const int, double> V;
- V ar[] =
- {
- V(1, 1),
- V(1, 1.5),
- V(1, 2),
- V(2, 1),
- V(2, 1.5),
- V(2, 2),
- V(3, 1),
- V(3, 1.5),
- V(3, 2)
- };
- typedef test_less<int> C;
- typedef test_allocator<V> A;
- std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(2));
- std::map<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0])/2, C(3), A(7));
- m = mo;
- assert(m.get_allocator() == A(7));
- assert(m.key_comp() == C(5));
- assert(m.size() == 3);
- assert(std::distance(m.begin(), m.end()) == 3);
- assert(*m.begin() == V(1, 1));
- assert(*std::next(m.begin()) == V(2, 1));
- assert(*std::next(m.begin(), 2) == V(3, 1));
+int main(int, char**) {
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] = {V(1, 1), V(1, 1.5), V(1, 2), V(2, 1), V(2, 1.5), V(2, 2), V(3, 1), V(3, 1.5), V(3, 2)};
+ typedef test_less<int> C;
+ typedef test_allocator<V> A;
+ std::map<int, double, C, A> mo(ar, ar + sizeof(ar) / sizeof(ar[0]), C(5), A(2));
+ std::map<int, double, C, A> m(ar, ar + sizeof(ar) / sizeof(ar[0]) / 2, C(3), A(7));
+ m = mo;
+ assert(m.get_allocator() == A(7));
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 3);
+ assert(std::distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == V(1, 1));
+ assert(*std::next(m.begin()) == V(2, 1));
+ assert(*std::next(m.begin(), 2) == V(3, 1));
- assert(mo.get_allocator() == A(2));
- assert(mo.key_comp() == C(5));
- assert(mo.size() == 3);
- assert(std::distance(mo.begin(), mo.end()) == 3);
- assert(*mo.begin() == V(1, 1));
- assert(*std::next(mo.begin()) == V(2, 1));
- assert(*std::next(mo.begin(), 2) == V(3, 1));
- }
- {
- typedef std::pair<const int, double> V;
- const V ar[] =
- {
- V(1, 1),
- V(2, 1),
- V(3, 1),
- };
- std::map<int, double> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- std::map<int, double> *p = &m;
- m = *p;
+ assert(mo.get_allocator() == A(2));
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 3);
+ assert(std::distance(mo.begin(), mo.end()) == 3);
+ assert(*mo.begin() == V(1, 1));
+ assert(*std::next(mo.begin()) == V(2, 1));
+ assert(*std::next(mo.begin(), 2) == V(3, 1));
+ }
+ {
+ typedef std::pair<const int, double> V;
+ const V ar[] = {
+ V(1, 1),
+ V(2, 1),
+ V(3, 1),
+ };
+ std::map<int, double> m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ std::map<int, double>* p = &m;
+ m = *p;
- assert(m.size() == 3);
- assert(std::equal(m.begin(), m.end(), ar));
- }
- {
- typedef std::pair<const int, double> V;
- V ar[] =
- {
- V(1, 1),
- V(1, 1.5),
- V(1, 2),
- V(2, 1),
- V(2, 1.5),
- V(2, 2),
- V(3, 1),
- V(3, 1.5),
- V(3, 2)
- };
- typedef test_less<int> C;
- typedef other_allocator<V> A;
- std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(2));
- std::map<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0])/2, C(3), A(7));
- m = mo;
- assert(m.get_allocator() == A(2));
- assert(m.key_comp() == C(5));
- assert(m.size() == 3);
- assert(std::distance(m.begin(), m.end()) == 3);
- assert(*m.begin() == V(1, 1));
- assert(*std::next(m.begin()) == V(2, 1));
- assert(*std::next(m.begin(), 2) == V(3, 1));
+ assert(m.size() == 3);
+ assert(std::equal(m.begin(), m.end(), ar));
+ }
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] = {V(1, 1), V(1, 1.5), V(1, 2), V(2, 1), V(2, 1.5), V(2, 2), V(3, 1), V(3, 1.5), V(3, 2)};
+ typedef test_less<int> C;
+ typedef other_allocator<V> A;
+ std::map<int, double, C, A> mo(ar, ar + sizeof(ar) / sizeof(ar[0]), C(5), A(2));
+ std::map<int, double, C, A> m(ar, ar + sizeof(ar) / sizeof(ar[0]) / 2, C(3), A(7));
+ m = mo;
+ assert(m.get_allocator() == A(2));
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 3);
+ assert(std::distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == V(1, 1));
+ assert(*std::next(m.begin()) == V(2, 1));
+ assert(*std::next(m.begin(), 2) == V(3, 1));
- assert(mo.get_allocator() == A(2));
- assert(mo.key_comp() == C(5));
- assert(mo.size() == 3);
- assert(std::distance(mo.begin(), mo.end()) == 3);
- assert(*mo.begin() == V(1, 1));
- assert(*std::next(mo.begin()) == V(2, 1));
- assert(*std::next(mo.begin(), 2) == V(3, 1));
- }
+ assert(mo.get_allocator() == A(2));
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 3);
+ assert(std::distance(mo.begin(), mo.end()) == 3);
+ assert(*mo.begin() == V(1, 1));
+ assert(*std::next(mo.begin()) == V(2, 1));
+ assert(*std::next(mo.begin(), 2) == V(3, 1));
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::pair<const int, double> V;
- V ar[] =
- {
- V(1, 1),
- V(1, 1.5),
- V(1, 2),
- V(2, 1),
- V(2, 1.5),
- V(2, 2),
- V(3, 1),
- V(3, 1.5),
- V(3, 2)
- };
- typedef test_less<int> C;
- typedef min_allocator<V> A;
- std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
- std::map<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0])/2, C(3), A());
- m = mo;
- assert(m.get_allocator() == A());
- assert(m.key_comp() == C(5));
- assert(m.size() == 3);
- assert(std::distance(m.begin(), m.end()) == 3);
- assert(*m.begin() == V(1, 1));
- assert(*std::next(m.begin()) == V(2, 1));
- assert(*std::next(m.begin(), 2) == V(3, 1));
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] = {V(1, 1), V(1, 1.5), V(1, 2), V(2, 1), V(2, 1.5), V(2, 2), V(3, 1), V(3, 1.5), V(3, 2)};
+ typedef test_less<int> C;
+ typedef min_allocator<V> A;
+ std::map<int, double, C, A> mo(ar, ar + sizeof(ar) / sizeof(ar[0]), C(5), A());
+ std::map<int, double, C, A> m(ar, ar + sizeof(ar) / sizeof(ar[0]) / 2, C(3), A());
+ m = mo;
+ assert(m.get_allocator() == A());
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 3);
+ assert(std::distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == V(1, 1));
+ assert(*std::next(m.begin()) == V(2, 1));
+ assert(*std::next(m.begin(), 2) == V(3, 1));
- assert(mo.get_allocator() == A());
- assert(mo.key_comp() == C(5));
- assert(mo.size() == 3);
- assert(std::distance(mo.begin(), mo.end()) == 3);
- assert(*mo.begin() == V(1, 1));
- assert(*std::next(mo.begin()) == V(2, 1));
- assert(*std::next(mo.begin(), 2) == V(3, 1));
- }
- {
- typedef std::pair<const int, double> V;
- V ar[] =
- {
- V(1, 1),
- V(1, 1.5),
- V(1, 2),
- V(2, 1),
- V(2, 1.5),
- V(2, 2),
- V(3, 1),
- V(3, 1.5),
- V(3, 2)
- };
- typedef test_less<int> C;
- typedef min_allocator<V> A;
- std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
- std::map<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0])/2, C(3), A());
- m = mo;
- assert(m.get_allocator() == A());
- assert(m.key_comp() == C(5));
- assert(m.size() == 3);
- assert(std::distance(m.begin(), m.end()) == 3);
- assert(*m.begin() == V(1, 1));
- assert(*std::next(m.begin()) == V(2, 1));
- assert(*std::next(m.begin(), 2) == V(3, 1));
+ assert(mo.get_allocator() == A());
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 3);
+ assert(std::distance(mo.begin(), mo.end()) == 3);
+ assert(*mo.begin() == V(1, 1));
+ assert(*std::next(mo.begin()) == V(2, 1));
+ assert(*std::next(mo.begin(), 2) == V(3, 1));
+ }
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] = {V(1, 1), V(1, 1.5), V(1, 2), V(2, 1), V(2, 1.5), V(2, 2), V(3, 1), V(3, 1.5), V(3, 2)};
+ typedef test_less<int> C;
+ typedef min_allocator<V> A;
+ std::map<int, double, C, A> mo(ar, ar + sizeof(ar) / sizeof(ar[0]), C(5), A());
+ std::map<int, double, C, A> m(ar, ar + sizeof(ar) / sizeof(ar[0]) / 2, C(3), A());
+ m = mo;
+ assert(m.get_allocator() == A());
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 3);
+ assert(std::distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == V(1, 1));
+ assert(*std::next(m.begin()) == V(2, 1));
+ assert(*std::next(m.begin(), 2) == V(3, 1));
- assert(mo.get_allocator() == A());
- assert(mo.key_comp() == C(5));
- assert(mo.size() == 3);
- assert(std::distance(mo.begin(), mo.end()) == 3);
- assert(*mo.begin() == V(1, 1));
- assert(*std::next(mo.begin()) == V(2, 1));
- assert(*std::next(mo.begin(), 2) == V(3, 1));
- }
+ assert(mo.get_allocator() == A());
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 3);
+ assert(std::distance(mo.begin(), mo.end()) == 3);
+ assert(*mo.begin() == V(1, 1));
+ assert(*std::next(mo.begin()) == V(2, 1));
+ assert(*std::next(mo.begin(), 2) == V(3, 1));
+ }
- assert(balanced_allocs());
- {
- typedef std::pair<const int, double> V;
- V ar[] =
- {
- V(1, 1),
- V(1, 1.5),
- V(1, 2),
- V(2, 1),
- V(2, 1.5),
- V(2, 2),
- V(3, 1),
- V(3, 1.5),
- V(3, 2)
- };
- typedef test_less<int> C;
- typedef counting_allocatorT<V> A;
- std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(1));
- std::map<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0])/2, C(3), A(2));
- m = mo;
- assert(m.key_comp() == C(5));
- assert(m.size() == 3);
- assert(std::distance(m.begin(), m.end()) == 3);
- assert(*m.begin() == V(1, 1));
- assert(*std::next(m.begin()) == V(2, 1));
- assert(*std::next(m.begin(), 2) == V(3, 1));
+ assert(balanced_allocs());
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] = {V(1, 1), V(1, 1.5), V(1, 2), V(2, 1), V(2, 1.5), V(2, 2), V(3, 1), V(3, 1.5), V(3, 2)};
+ typedef test_less<int> C;
+ typedef counting_allocatorT<V> A;
+ std::map<int, double, C, A> mo(ar, ar + sizeof(ar) / sizeof(ar[0]), C(5), A(1));
+ std::map<int, double, C, A> m(ar, ar + sizeof(ar) / sizeof(ar[0]) / 2, C(3), A(2));
+ m = mo;
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 3);
+ assert(std::distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == V(1, 1));
+ assert(*std::next(m.begin()) == V(2, 1));
+ assert(*std::next(m.begin(), 2) == V(3, 1));
- assert(mo.key_comp() == C(5));
- assert(mo.size() == 3);
- assert(std::distance(mo.begin(), mo.end()) == 3);
- assert(*mo.begin() == V(1, 1));
- assert(*std::next(mo.begin()) == V(2, 1));
- assert(*std::next(mo.begin(), 2) == V(3, 1));
- }
- assert(balanced_allocs());
- {
- typedef std::pair<const int, double> V;
- V ar[] =
- {
- V(1, 1),
- V(1, 1.5),
- V(1, 2),
- V(2, 1),
- V(2, 1.5),
- V(2, 2),
- V(3, 1),
- V(3, 1.5),
- V(3, 2)
- };
- typedef test_less<int> C;
- typedef counting_allocatorF<V> A;
- std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(100));
- std::map<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0])/2, C(3), A(200));
- m = mo;
- assert(m.key_comp() == C(5));
- assert(m.size() == 3);
- assert(std::distance(m.begin(), m.end()) == 3);
- assert(*m.begin() == V(1, 1));
- assert(*std::next(m.begin()) == V(2, 1));
- assert(*std::next(m.begin(), 2) == V(3, 1));
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 3);
+ assert(std::distance(mo.begin(), mo.end()) == 3);
+ assert(*mo.begin() == V(1, 1));
+ assert(*std::next(mo.begin()) == V(2, 1));
+ assert(*std::next(mo.begin(), 2) == V(3, 1));
+ }
+ assert(balanced_allocs());
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] = {V(1, 1), V(1, 1.5), V(1, 2), V(2, 1), V(2, 1.5), V(2, 2), V(3, 1), V(3, 1.5), V(3, 2)};
+ typedef test_less<int> C;
+ typedef counting_allocatorF<V> A;
+ std::map<int, double, C, A> mo(ar, ar + sizeof(ar) / sizeof(ar[0]), C(5), A(100));
+ std::map<int, double, C, A> m(ar, ar + sizeof(ar) / sizeof(ar[0]) / 2, C(3), A(200));
+ m = mo;
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 3);
+ assert(std::distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == V(1, 1));
+ assert(*std::next(m.begin()) == V(2, 1));
+ assert(*std::next(m.begin(), 2) == V(3, 1));
- assert(mo.key_comp() == C(5));
- assert(mo.size() == 3);
- assert(std::distance(mo.begin(), mo.end()) == 3);
- assert(*mo.begin() == V(1, 1));
- assert(*std::next(mo.begin()) == V(2, 1));
- assert(*std::next(mo.begin(), 2) == V(3, 1));
- }
- assert(balanced_allocs());
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 3);
+ assert(std::distance(mo.begin(), mo.end()) == 3);
+ assert(*mo.begin() == V(1, 1));
+ assert(*std::next(mo.begin()) == V(2, 1));
+ assert(*std::next(mo.begin(), 2) == V(3, 1));
+ }
+ assert(balanced_allocs());
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/map/map.cons/deduct.pass.cpp b/libcxx/test/std/containers/associative/map/map.cons/deduct.pass.cpp
index d68e6af2681a54c..c91fe4b23566a17 100644
--- a/libcxx/test/std/containers/associative/map/map.cons/deduct.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.cons/deduct.pass.cpp
@@ -45,114 +45,114 @@
#include "deduction_guides_sfinae_checks.h"
#include "test_allocator.h"
-using P = std::pair<int, long>;
+using P = std::pair<int, long>;
using PC = std::pair<const int, long>;
-int main(int, char**)
-{
- {
- const P arr[] = { {1,1L}, {2,2L}, {1,1L}, {INT_MAX,1L}, {3,1L} };
+int main(int, char**) {
+ {
+ const P arr[] = {{1, 1L}, {2, 2L}, {1, 1L}, {INT_MAX, 1L}, {3, 1L}};
std::map m(std::begin(arr), std::end(arr));
ASSERT_SAME_TYPE(decltype(m), std::map<int, long>);
- const PC expected_m[] = { {1,1L}, {2,2L}, {3,1L}, {INT_MAX,1L} };
+ const PC expected_m[] = {{1, 1L}, {2, 2L}, {3, 1L}, {INT_MAX, 1L}};
assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
- }
+ }
- {
- const P arr[] = { {1,1L}, {2,2L}, {1,1L}, {INT_MAX,1L}, {3,1L} };
+ {
+ const P arr[] = {{1, 1L}, {2, 2L}, {1, 1L}, {INT_MAX, 1L}, {3, 1L}};
std::map m(std::begin(arr), std::end(arr), std::greater<int>());
ASSERT_SAME_TYPE(decltype(m), std::map<int, long, std::greater<int>>);
- const PC expected_m[] = { {INT_MAX,1L}, {3,1L}, {2,2L}, {1,1L} };
+ const PC expected_m[] = {{INT_MAX, 1L}, {3, 1L}, {2, 2L}, {1, 1L}};
assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
- }
+ }
- {
- const P arr[] = { {1,1L}, {2,2L}, {1,1L}, {INT_MAX,1L}, {3,1L} };
+ {
+ const P arr[] = {{1, 1L}, {2, 2L}, {1, 1L}, {INT_MAX, 1L}, {3, 1L}};
std::map m(std::begin(arr), std::end(arr), std::greater<int>(), test_allocator<PC>(0, 42));
ASSERT_SAME_TYPE(decltype(m), std::map<int, long, std::greater<int>, test_allocator<PC>>);
- const PC expected_m[] = { {INT_MAX,1L}, {3,1L}, {2,2L}, {1,1L} };
+ const PC expected_m[] = {{INT_MAX, 1L}, {3, 1L}, {2, 2L}, {1, 1L}};
assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
assert(m.get_allocator().get_id() == 42);
- }
+ }
- {
+ {
std::map<int, long> source;
std::map m(source);
ASSERT_SAME_TYPE(decltype(m), decltype(source));
assert(m.size() == 0);
- }
+ }
- {
+ {
std::map<int, long> source;
- std::map m{source}; // braces instead of parens
+ std::map m{source}; // braces instead of parens
ASSERT_SAME_TYPE(decltype(m), decltype(source));
assert(m.size() == 0);
- }
+ }
- {
+ {
std::map<int, long> source;
std::map m(source, std::map<int, long>::allocator_type());
ASSERT_SAME_TYPE(decltype(m), decltype(source));
assert(m.size() == 0);
- }
+ }
- {
- std::map m{ P{1,1L}, P{2,2L}, P{1,1L}, P{INT_MAX,1L}, P{3,1L} };
+ {
+ std::map m{P{1, 1L}, P{2, 2L}, P{1, 1L}, P{INT_MAX, 1L}, P{3, 1L}};
ASSERT_SAME_TYPE(decltype(m), std::map<int, long>);
- const PC expected_m[] = { {1,1L}, {2,2L}, {3,1L}, {INT_MAX,1L} };
+ const PC expected_m[] = {{1, 1L}, {2, 2L}, {3, 1L}, {INT_MAX, 1L}};
assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
- }
+ }
- {
- std::map m({ P{1,1L}, P{2,2L}, P{1,1L}, P{INT_MAX,1L}, P{3,1L} }, std::greater<int>());
+ {
+ std::map m({P{1, 1L}, P{2, 2L}, P{1, 1L}, P{INT_MAX, 1L}, P{3, 1L}}, std::greater<int>());
ASSERT_SAME_TYPE(decltype(m), std::map<int, long, std::greater<int>>);
- const PC expected_m[] = { {INT_MAX,1L}, {3,1L}, {2,2L}, {1,1L} };
+ const PC expected_m[] = {{INT_MAX, 1L}, {3, 1L}, {2, 2L}, {1, 1L}};
assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
- }
+ }
- {
- std::map m({ P{1,1L}, P{2,2L}, P{1,1L}, P{INT_MAX,1L}, P{3,1L} }, std::greater<int>(), test_allocator<PC>(0, 43));
+ {
+ std::map m(
+ {P{1, 1L}, P{2, 2L}, P{1, 1L}, P{INT_MAX, 1L}, P{3, 1L}}, std::greater<int>(), test_allocator<PC>(0, 43));
ASSERT_SAME_TYPE(decltype(m), std::map<int, long, std::greater<int>, test_allocator<PC>>);
- const PC expected_m[] = { {INT_MAX,1L}, {3,1L}, {2,2L}, {1,1L} };
+ const PC expected_m[] = {{INT_MAX, 1L}, {3, 1L}, {2, 2L}, {1, 1L}};
assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
assert(m.get_allocator().get_id() == 43);
- }
+ }
- {
- const P arr[] = { {1,1L}, {2,2L}, {1,1L}, {INT_MAX,1L}, {3,1L} };
+ {
+ const P arr[] = {{1, 1L}, {2, 2L}, {1, 1L}, {INT_MAX, 1L}, {3, 1L}};
std::map m(std::begin(arr), std::end(arr), test_allocator<PC>(0, 44));
ASSERT_SAME_TYPE(decltype(m), std::map<int, long, std::less<int>, test_allocator<PC>>);
- const PC expected_m[] = { {1,1L}, {2,2L}, {3,1L}, {INT_MAX,1L} };
+ const PC expected_m[] = {{1, 1L}, {2, 2L}, {3, 1L}, {INT_MAX, 1L}};
assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
assert(m.get_allocator().get_id() == 44);
- }
+ }
- {
- std::map m({ P{1,1L}, P{2,2L}, P{1,1L}, P{INT_MAX,1L}, P{3,1L} }, test_allocator<PC>(0, 45));
+ {
+ std::map m({P{1, 1L}, P{2, 2L}, P{1, 1L}, P{INT_MAX, 1L}, P{3, 1L}}, test_allocator<PC>(0, 45));
ASSERT_SAME_TYPE(decltype(m), std::map<int, long, std::less<int>, test_allocator<PC>>);
- const PC expected_m[] = { {1,1L}, {2,2L}, {3,1L}, {INT_MAX,1L} };
+ const PC expected_m[] = {{1, 1L}, {2, 2L}, {3, 1L}, {INT_MAX, 1L}};
assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
assert(m.get_allocator().get_id() == 45);
- }
+ }
- {
+ {
// Examples from LWG3025
std::map m{std::pair{1, 1}, {2, 2}, {3, 3}};
ASSERT_SAME_TYPE(decltype(m), std::map<int, int>);
std::map m2{m.begin(), m.end()};
ASSERT_SAME_TYPE(decltype(m2), std::map<int, int>);
- }
+ }
- {
+ {
// Examples from LWG3531
std::map m1{{std::pair{1, 2}, {3, 4}}, std::less<int>()};
ASSERT_SAME_TYPE(decltype(m1), std::map<int, int>);
@@ -160,38 +160,38 @@ int main(int, char**)
using value_type = std::pair<const int, int>;
std::map m2{{value_type{1, 2}, {3, 4}}, std::less<int>()};
ASSERT_SAME_TYPE(decltype(m2), std::map<int, int>);
- }
+ }
#if TEST_STD_VER >= 23
- {
- using Range = std::array<P, 0>;
- using Comp = std::greater<int>;
- using DefaultComp = std::less<int>;
- using Alloc = test_allocator<PC>;
-
- { // (from_range, range)
- std::map c(std::from_range, Range());
- static_assert(std::is_same_v<decltype(c), std::map<int, long>>);
- }
-
- { // (from_range, range, comp)
- std::map c(std::from_range, Range(), Comp());
- static_assert(std::is_same_v<decltype(c), std::map<int, long, Comp>>);
- }
-
- { // (from_range, range, comp, alloc)
- std::map c(std::from_range, Range(), Comp(), Alloc());
- static_assert(std::is_same_v<decltype(c), std::map<int, long, Comp, Alloc>>);
- }
-
- { // (from_range, range, alloc)
- std::map c(std::from_range, Range(), Alloc());
- static_assert(std::is_same_v<decltype(c), std::map<int, long, DefaultComp, Alloc>>);
- }
+ {
+ using Range = std::array<P, 0>;
+ using Comp = std::greater<int>;
+ using DefaultComp = std::less<int>;
+ using Alloc = test_allocator<PC>;
+
+ { // (from_range, range)
+ std::map c(std::from_range, Range());
+ static_assert(std::is_same_v<decltype(c), std::map<int, long>>);
+ }
+
+ { // (from_range, range, comp)
+ std::map c(std::from_range, Range(), Comp());
+ static_assert(std::is_same_v<decltype(c), std::map<int, long, Comp>>);
+ }
+
+ { // (from_range, range, comp, alloc)
+ std::map c(std::from_range, Range(), Comp(), Alloc());
+ static_assert(std::is_same_v<decltype(c), std::map<int, long, Comp, Alloc>>);
+ }
+
+ { // (from_range, range, alloc)
+ std::map c(std::from_range, Range(), Alloc());
+ static_assert(std::is_same_v<decltype(c), std::map<int, long, DefaultComp, Alloc>>);
}
+ }
#endif
- AssociativeContainerDeductionGuidesSfinaeAway<std::map, std::map<int, long>>();
+ AssociativeContainerDeductionGuidesSfinaeAway<std::map, std::map<int, long>>();
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/associative/map/map.cons/deduct.verify.cpp b/libcxx/test/std/containers/associative/map/map.cons/deduct.verify.cpp
index b314e6fba69644a..c8c0e1e538db260 100644
--- a/libcxx/test/std/containers/associative/map/map.cons/deduct.verify.cpp
+++ b/libcxx/test/std/containers/associative/map/map.cons/deduct.verify.cpp
@@ -32,74 +32,75 @@
#include <type_traits>
struct NotAnAllocator {
- friend bool operator<(NotAnAllocator, NotAnAllocator) { return false; }
+ friend bool operator<(NotAnAllocator, NotAnAllocator) { return false; }
};
-using P = std::pair<int, long>;
+using P = std::pair<int, long>;
using PC = std::pair<const int, long>;
-int main(int, char**)
-{
- {
- // cannot deduce Key and T from nothing
- std::map m; // expected-error-re {{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}map'}}
- }
- {
- // cannot deduce Key and T from just (Compare)
- std::map m(std::less<int>{});
- // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}map'}}
- }
- {
- // cannot deduce Key and T from just (Compare, Allocator)
- std::map m(std::less<int>{}, std::allocator<PC>{});
- // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}map'}}
- }
- {
- // cannot deduce Key and T from just (Allocator)
- std::map m(std::allocator<PC>{});
- // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}map'}}
- }
- {
- // refuse to rebind the allocator if Allocator::value_type is not exactly what we expect
- const P arr[] = { {1,1L}, {2,2L}, {3,3L} };
- std::map m(arr, arr + 3, std::allocator<P>());
- // expected-error-re at map:*{{static assertion failed{{( due to requirement '.*')?}}{{.*}}Allocator::value_type must be same type as value_type}}
- }
- {
- // cannot convert from some arbitrary unrelated type
- NotAnAllocator a;
- std::map m(a); // expected-error-re{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}map'}}
- }
- {
- // cannot deduce that the inner braced things should be std::pair and not something else
- std::map m{ {1,1L}, {2,2L}, {3,3L} };
- // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}map'}}
- }
- {
- // cannot deduce that the inner braced things should be std::pair and not something else
- std::map m({ {1,1L}, {2,2L}, {3,3L} }, std::less<int>());
- // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}map'}}
- }
- {
- // cannot deduce that the inner braced things should be std::pair and not something else
- std::map m({ {1,1L}, {2,2L}, {3,3L} }, std::less<int>(), std::allocator<PC>());
- // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}map'}}
- }
- {
- // cannot deduce that the inner braced things should be std::pair and not something else
- std::map m({ {1,1L}, {2,2L}, {3,3L} }, std::allocator<PC>());
- // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}map'}}
- }
- {
- // since we have parens, not braces, this deliberately does not find the initializer_list constructor
- std::map m(P{1,1L});
- // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}map'}}
- }
- {
- // since we have parens, not braces, this deliberately does not find the initializer_list constructor
- std::map m(PC{1,1L});
- // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}map'}}
- }
+int main(int, char**) {
+ {
+ // cannot deduce Key and T from nothing
+ std::map m;
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}map'}}
+ }
+ {
+ // cannot deduce Key and T from just (Compare)
+ std::map m(std::less<int>{});
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}map'}}
+ }
+ {
+ // cannot deduce Key and T from just (Compare, Allocator)
+ std::map m(std::less<int>{}, std::allocator<PC>{});
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}map'}}
+ }
+ {
+ // cannot deduce Key and T from just (Allocator)
+ std::map m(std::allocator<PC>{});
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}map'}}
+ }
+ {
+ // refuse to rebind the allocator if Allocator::value_type is not exactly what we expect
+ const P arr[] = {{1, 1L}, {2, 2L}, {3, 3L}};
+ std::map m(arr, arr + 3, std::allocator<P>());
+ // expected-error-re at map:*{{static assertion failed{{( due to requirement '.*')?}}{{.*}}Allocator::value_type must be same type as value_type}}
+ }
+ {
+ // cannot convert from some arbitrary unrelated type
+ NotAnAllocator a;
+ std::map m(a);
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}map'}}
+ }
+ {
+ // cannot deduce that the inner braced things should be std::pair and not something else
+ std::map m{{1, 1L}, {2, 2L}, {3, 3L}};
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}map'}}
+ }
+ {
+ // cannot deduce that the inner braced things should be std::pair and not something else
+ std::map m({{1, 1L}, {2, 2L}, {3, 3L}}, std::less<int>());
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}map'}}
+ }
+ {
+ // cannot deduce that the inner braced things should be std::pair and not something else
+ std::map m({{1, 1L}, {2, 2L}, {3, 3L}}, std::less<int>(), std::allocator<PC>());
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}map'}}
+ }
+ {
+ // cannot deduce that the inner braced things should be std::pair and not something else
+ std::map m({{1, 1L}, {2, 2L}, {3, 3L}}, std::allocator<PC>());
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}map'}}
+ }
+ {
+ // since we have parens, not braces, this deliberately does not find the initializer_list constructor
+ std::map m(P{1, 1L});
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}map'}}
+ }
+ {
+ // since we have parens, not braces, this deliberately does not find the initializer_list constructor
+ std::map m(PC{1, 1L});
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}map'}}
+ }
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/associative/map/map.cons/deduct_const.pass.cpp b/libcxx/test/std/containers/associative/map/map.cons/deduct_const.pass.cpp
index 5b36d1e27f74441..dcc2d4510bcb6b5 100644
--- a/libcxx/test/std/containers/associative/map/map.cons/deduct_const.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.cons/deduct_const.pass.cpp
@@ -35,73 +35,73 @@
#include "test_allocator.h"
-using P = std::pair<int, long>;
-using PC = std::pair<const int, long>;
+using P = std::pair<int, long>;
+using PC = std::pair<const int, long>;
using PCC = std::pair<const int, const long>;
-int main(int, char**)
-{
- {
- const PCC arr[] = { {1,1L}, {2,2L}, {1,1L}, {INT_MAX,1L}, {3,1L} };
+int main(int, char**) {
+ {
+ const PCC arr[] = {{1, 1L}, {2, 2L}, {1, 1L}, {INT_MAX, 1L}, {3, 1L}};
std::map m(std::begin(arr), std::end(arr));
ASSERT_SAME_TYPE(decltype(m), std::map<int, const long>);
- const PCC expected_m[] = { {1,1L}, {2,2L}, {3,1L}, {INT_MAX,1L} };
+ const PCC expected_m[] = {{1, 1L}, {2, 2L}, {3, 1L}, {INT_MAX, 1L}};
assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
- }
+ }
- {
- const PCC arr[] = { {1,1L}, {2,2L}, {1,1L}, {INT_MAX,1L}, {3,1L} };
+ {
+ const PCC arr[] = {{1, 1L}, {2, 2L}, {1, 1L}, {INT_MAX, 1L}, {3, 1L}};
std::map m(std::begin(arr), std::end(arr), std::greater<int>());
ASSERT_SAME_TYPE(decltype(m), std::map<int, const long, std::greater<int>>);
- const PCC expected_m[] = { {INT_MAX,1L}, {3,1L}, {2,2L}, {1, 1L} };
+ const PCC expected_m[] = {{INT_MAX, 1L}, {3, 1L}, {2, 2L}, {1, 1L}};
assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
- }
+ }
- {
- const PCC arr[] = { {1,1L}, {2,2L}, {1,1L}, {INT_MAX,1L}, {3,1L} };
+ {
+ const PCC arr[] = {{1, 1L}, {2, 2L}, {1, 1L}, {INT_MAX, 1L}, {3, 1L}};
std::map m(std::begin(arr), std::end(arr), std::greater<int>(), test_allocator<PCC>(0, 42));
ASSERT_SAME_TYPE(decltype(m), std::map<int, const long, std::greater<int>, test_allocator<PCC>>);
- const PCC expected_m[] = { {INT_MAX,1L}, {3,1L}, {2,2L}, {1, 1L} };
+ const PCC expected_m[] = {{INT_MAX, 1L}, {3, 1L}, {2, 2L}, {1, 1L}};
assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
assert(m.get_allocator().get_id() == 42);
- }
+ }
- {
- std::map m{ PC{1,1L}, PC{2,2L}, PC{1,1L}, PC{INT_MAX,1L}, PC{3,1L} };
+ {
+ std::map m{PC{1, 1L}, PC{2, 2L}, PC{1, 1L}, PC{INT_MAX, 1L}, PC{3, 1L}};
ASSERT_SAME_TYPE(decltype(m), std::map<int, long>);
- const PC expected_m[] = { {1, 1L}, {2,2L}, {3,1L}, {INT_MAX,1L} };
+ const PC expected_m[] = {{1, 1L}, {2, 2L}, {3, 1L}, {INT_MAX, 1L}};
assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
- }
+ }
- {
- std::map m({ PC{1,1L}, PC{2,2L}, PC{1,1L}, PC{INT_MAX,1L}, PC{3,1L} }, std::greater<int>());
+ {
+ std::map m({PC{1, 1L}, PC{2, 2L}, PC{1, 1L}, PC{INT_MAX, 1L}, PC{3, 1L}}, std::greater<int>());
ASSERT_SAME_TYPE(decltype(m), std::map<int, long, std::greater<int>>);
- const PC expected_m[] = { {INT_MAX,1L}, {3,1L}, {2,2L}, {1, 1L} };
+ const PC expected_m[] = {{INT_MAX, 1L}, {3, 1L}, {2, 2L}, {1, 1L}};
assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
- }
+ }
- {
- std::map m({ PC{1,1L}, PC{2,2L}, PC{1,1L}, PC{INT_MAX,1L}, PC{3,1L} }, std::greater<int>(), test_allocator<PC>(0, 43));
+ {
+ std::map m(
+ {PC{1, 1L}, PC{2, 2L}, PC{1, 1L}, PC{INT_MAX, 1L}, PC{3, 1L}}, std::greater<int>(), test_allocator<PC>(0, 43));
ASSERT_SAME_TYPE(decltype(m), std::map<int, long, std::greater<int>, test_allocator<PC>>);
- const PC expected_m[] = { {INT_MAX,1L}, {3,1L}, {2,2L}, {1, 1L} };
+ const PC expected_m[] = {{INT_MAX, 1L}, {3, 1L}, {2, 2L}, {1, 1L}};
assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
assert(m.get_allocator().get_id() == 43);
- }
+ }
- {
- std::map m({ PC{1,1L}, PC{2,2L}, PC{1,1L}, PC{INT_MAX,1L}, PC{3,1L} }, test_allocator<PC>(0, 45));
+ {
+ std::map m({PC{1, 1L}, PC{2, 2L}, PC{1, 1L}, PC{INT_MAX, 1L}, PC{3, 1L}}, test_allocator<PC>(0, 45));
ASSERT_SAME_TYPE(decltype(m), std::map<int, long, std::less<int>, test_allocator<PC>>);
- const PC expected_m[] = { {1, 1L}, {2,2L}, {3,1L}, {INT_MAX,1L} };
+ const PC expected_m[] = {{1, 1L}, {2, 2L}, {3, 1L}, {INT_MAX, 1L}};
assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
assert(m.get_allocator().get_id() == 45);
- }
+ }
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/associative/map/map.cons/default.pass.cpp b/libcxx/test/std/containers/associative/map/map.cons/default.pass.cpp
index 55a99d20a53cea9..1b48370387a8f1f 100644
--- a/libcxx/test/std/containers/associative/map/map.cons/default.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.cons/default.pass.cpp
@@ -18,38 +18,37 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
std::map<int, double> m;
assert(m.empty());
assert(m.begin() == m.end());
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> m;
assert(m.empty());
assert(m.begin() == m.end());
- }
- {
+ }
+ {
typedef explicit_allocator<std::pair<const int, double>> A;
- {
- std::map<int, double, std::less<int>, A> m;
- assert(m.empty());
- assert(m.begin() == m.end());
- }
- {
- A a;
- std::map<int, double, std::less<int>, A> m(a);
- assert(m.empty());
- assert(m.begin() == m.end());
- }
+ {
+ std::map<int, double, std::less<int>, A> m;
+ assert(m.empty());
+ assert(m.begin() == m.end());
}
{
+ A a;
+ std::map<int, double, std::less<int>, A> m(a);
+ assert(m.empty());
+ assert(m.begin() == m.end());
+ }
+ }
+ {
std::map<int, double> m = {};
assert(m.empty());
assert(m.begin() == m.end());
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/map/map.cons/default_noexcept.pass.cpp b/libcxx/test/std/containers/associative/map/map.cons/default_noexcept.pass.cpp
index 1139d9fc87ff619..1e43a893d66c1b7 100644
--- a/libcxx/test/std/containers/associative/map/map.cons/default_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.cons/default_noexcept.pass.cpp
@@ -26,34 +26,32 @@
#include "test_allocator.h"
template <class T>
-struct some_comp
-{
- typedef T value_type;
- some_comp();
- bool operator()(const T&, const T&) const { return false; }
+struct some_comp {
+ typedef T value_type;
+ some_comp();
+ bool operator()(const T&, const T&) const { return false; }
};
-int main(int, char**)
-{
- typedef std::pair<const MoveOnly, MoveOnly> V;
+int main(int, char**) {
+ typedef std::pair<const MoveOnly, MoveOnly> V;
#if defined(_LIBCPP_VERSION)
- {
- typedef std::map<MoveOnly, MoveOnly> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
- }
- {
- typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<V>> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
- }
+ {
+ typedef std::map<MoveOnly, MoveOnly> C;
+ static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ }
+ {
+ typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<V>> C;
+ static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ }
#endif // _LIBCPP_VERSION
- {
- typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<V>> C;
- static_assert(!std::is_nothrow_default_constructible<C>::value, "");
- }
- {
- typedef std::map<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
- static_assert(!std::is_nothrow_default_constructible<C>::value, "");
- }
+ {
+ typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<V>> C;
+ static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+ }
+ {
+ typedef std::map<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
+ static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/map/map.cons/dtor_noexcept.pass.cpp b/libcxx/test/std/containers/associative/map/map.cons/dtor_noexcept.pass.cpp
index 7d28e188f819d78..8497b942ad8eb2e 100644
--- a/libcxx/test/std/containers/associative/map/map.cons/dtor_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.cons/dtor_noexcept.pass.cpp
@@ -20,33 +20,31 @@
#include "test_allocator.h"
template <class T>
-struct some_comp
-{
- typedef T value_type;
- ~some_comp() noexcept(false);
- bool operator()(const T&, const T&) const noexcept { return false; }
+struct some_comp {
+ typedef T value_type;
+ ~some_comp() noexcept(false);
+ bool operator()(const T&, const T&) const noexcept { return false; }
};
-int main(int, char**)
-{
- typedef std::pair<const MoveOnly, MoveOnly> V;
- {
- typedef std::map<MoveOnly, MoveOnly> C;
- static_assert(std::is_nothrow_destructible<C>::value, "");
- }
- {
- typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<V>> C;
- static_assert(std::is_nothrow_destructible<C>::value, "");
- }
- {
- typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<V>> C;
- static_assert(std::is_nothrow_destructible<C>::value, "");
- }
+int main(int, char**) {
+ typedef std::pair<const MoveOnly, MoveOnly> V;
+ {
+ typedef std::map<MoveOnly, MoveOnly> C;
+ static_assert(std::is_nothrow_destructible<C>::value, "");
+ }
+ {
+ typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<V>> C;
+ static_assert(std::is_nothrow_destructible<C>::value, "");
+ }
+ {
+ typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<V>> C;
+ static_assert(std::is_nothrow_destructible<C>::value, "");
+ }
#if defined(_LIBCPP_VERSION)
- {
- typedef std::map<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
- static_assert(!std::is_nothrow_destructible<C>::value, "");
- }
+ {
+ typedef std::map<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
+ static_assert(!std::is_nothrow_destructible<C>::value, "");
+ }
#endif // _LIBCPP_VERSION
return 0;
diff --git a/libcxx/test/std/containers/associative/map/map.cons/from_range.pass.cpp b/libcxx/test/std/containers/associative/map/map.cons/from_range.pass.cpp
index f375dbfcf47b2dd..dc06266064a8d39 100644
--- a/libcxx/test/std/containers/associative/map/map.cons/from_range.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.cons/from_range.pass.cpp
@@ -24,13 +24,9 @@
void test_duplicates() {
using T = std::pair<const int, char>;
- std::array input = {
- T{1, 'a'}, T{2, 'a'}, T{3, 'a'}, T{3, 'b'}, T{3, 'c'}, T{2, 'b'}, T{4, 'a'}
- };
- std::array expected = {
- T{1, 'a'}, T{2, 'a'}, T{3, 'a'}, T{4, 'a'}
- };
- auto c = std::map<int, char>(std::from_range, input);
+ std::array input = {T{1, 'a'}, T{2, 'a'}, T{3, 'a'}, T{3, 'b'}, T{3, 'c'}, T{2, 'b'}, T{4, 'a'}};
+ std::array expected = {T{1, 'a'}, T{2, 'a'}, T{3, 'a'}, T{4, 'a'}};
+ auto c = std::map<int, char>(std::from_range, input);
assert(std::ranges::is_permutation(expected, c));
}
diff --git a/libcxx/test/std/containers/associative/map/map.cons/initializer_list.pass.cpp b/libcxx/test/std/containers/associative/map/map.cons/initializer_list.pass.cpp
index 7eebf49c38943ea..b18dc5cf754a0bc 100644
--- a/libcxx/test/std/containers/associative/map/map.cons/initializer_list.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.cons/initializer_list.pass.cpp
@@ -20,48 +20,26 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::pair<const int, double> V;
- std::map<int, double> m =
- {
- {1, 1},
- {1, 1.5},
- {1, 2},
- {2, 1},
- {2, 1.5},
- {2, 2},
- {3, 1},
- {3, 1.5},
- {3, 2}
- };
+ std::map<int, double> m = {{1, 1}, {1, 1.5}, {1, 2}, {2, 1}, {2, 1.5}, {2, 2}, {3, 1}, {3, 1.5}, {3, 2}};
assert(m.size() == 3);
assert(std::distance(m.begin(), m.end()) == 3);
assert(*m.begin() == V(1, 1));
assert(*std::next(m.begin()) == V(2, 1));
assert(*std::next(m.begin(), 2) == V(3, 1));
- }
- {
+ }
+ {
typedef std::pair<const int, double> V;
- std::map<int, double, std::less<int>, min_allocator<V>> m =
- {
- {1, 1},
- {1, 1.5},
- {1, 2},
- {2, 1},
- {2, 1.5},
- {2, 2},
- {3, 1},
- {3, 1.5},
- {3, 2}
- };
+ std::map<int, double, std::less<int>, min_allocator<V>> m = {
+ {1, 1}, {1, 1.5}, {1, 2}, {2, 1}, {2, 1.5}, {2, 2}, {3, 1}, {3, 1.5}, {3, 2}};
assert(m.size() == 3);
assert(std::distance(m.begin(), m.end()) == 3);
assert(*m.begin() == V(1, 1));
assert(*std::next(m.begin()) == V(2, 1));
assert(*std::next(m.begin(), 2) == V(3, 1));
- }
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/map/map.cons/initializer_list_compare.pass.cpp b/libcxx/test/std/containers/associative/map/map.cons/initializer_list_compare.pass.cpp
index 441c96d813e7b2c..301384362bfe7a1 100644
--- a/libcxx/test/std/containers/associative/map/map.cons/initializer_list_compare.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.cons/initializer_list_compare.pass.cpp
@@ -20,50 +20,30 @@
#include "../../../test_compare.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::pair<const int, double> V;
typedef test_less<int> C;
- std::map<int, double, C> m({
- {1, 1},
- {1, 1.5},
- {1, 2},
- {2, 1},
- {2, 1.5},
- {2, 2},
- {3, 1},
- {3, 1.5},
- {3, 2}
- }, C(3));
+ std::map<int, double, C> m({{1, 1}, {1, 1.5}, {1, 2}, {2, 1}, {2, 1.5}, {2, 2}, {3, 1}, {3, 1.5}, {3, 2}}, C(3));
assert(m.size() == 3);
assert(std::distance(m.begin(), m.end()) == 3);
assert(*m.begin() == V(1, 1));
assert(*std::next(m.begin()) == V(2, 1));
assert(*std::next(m.begin(), 2) == V(3, 1));
assert(m.key_comp() == C(3));
- }
- {
+ }
+ {
typedef std::pair<const int, double> V;
typedef test_less<int> C;
- std::map<int, double, C, min_allocator<std::pair<const int, double>>> m({
- {1, 1},
- {1, 1.5},
- {1, 2},
- {2, 1},
- {2, 1.5},
- {2, 2},
- {3, 1},
- {3, 1.5},
- {3, 2}
- }, C(3));
+ std::map<int, double, C, min_allocator<std::pair<const int, double>>> m(
+ {{1, 1}, {1, 1.5}, {1, 2}, {2, 1}, {2, 1.5}, {2, 2}, {3, 1}, {3, 1.5}, {3, 2}}, C(3));
assert(m.size() == 3);
assert(std::distance(m.begin(), m.end()) == 3);
assert(*m.begin() == V(1, 1));
assert(*std::next(m.begin()) == V(2, 1));
assert(*std::next(m.begin(), 2) == V(3, 1));
assert(m.key_comp() == C(3));
- }
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/map/map.cons/initializer_list_compare_alloc.pass.cpp b/libcxx/test/std/containers/associative/map/map.cons/initializer_list_compare_alloc.pass.cpp
index 95ae86e09ab7e6f..da138ebd9ae61ba 100644
--- a/libcxx/test/std/containers/associative/map/map.cons/initializer_list_compare_alloc.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.cons/initializer_list_compare_alloc.pass.cpp
@@ -21,23 +21,13 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::pair<const int, double> V;
typedef test_less<int> C;
typedef test_allocator<std::pair<const int, double> > A;
- std::map<int, double, C, A> m({
- {1, 1},
- {1, 1.5},
- {1, 2},
- {2, 1},
- {2, 1.5},
- {2, 2},
- {3, 1},
- {3, 1.5},
- {3, 2}
- }, C(3), A(6));
+ std::map<int, double, C, A> m(
+ {{1, 1}, {1, 1.5}, {1, 2}, {2, 1}, {2, 1.5}, {2, 2}, {3, 1}, {3, 1.5}, {3, 2}}, C(3), A(6));
assert(m.size() == 3);
assert(std::distance(m.begin(), m.end()) == 3);
assert(*m.begin() == V(1, 1));
@@ -45,22 +35,13 @@ int main(int, char**)
assert(*std::next(m.begin(), 2) == V(3, 1));
assert(m.key_comp() == C(3));
assert(m.get_allocator() == A(6));
- }
- {
+ }
+ {
typedef std::pair<const int, double> V;
typedef test_less<int> C;
typedef min_allocator<std::pair<const int, double> > A;
- std::map<int, double, C, A> m({
- {1, 1},
- {1, 1.5},
- {1, 2},
- {2, 1},
- {2, 1.5},
- {2, 2},
- {3, 1},
- {3, 1.5},
- {3, 2}
- }, C(3), A());
+ std::map<int, double, C, A> m(
+ {{1, 1}, {1, 1.5}, {1, 2}, {2, 1}, {2, 1.5}, {2, 2}, {3, 1}, {3, 1.5}, {3, 2}}, C(3), A());
assert(m.size() == 3);
assert(std::distance(m.begin(), m.end()) == 3);
assert(*m.begin() == V(1, 1));
@@ -68,23 +49,14 @@ int main(int, char**)
assert(*std::next(m.begin(), 2) == V(3, 1));
assert(m.key_comp() == C(3));
assert(m.get_allocator() == A());
- }
- {
+ }
+ {
typedef std::pair<const int, double> V;
typedef min_allocator<V> A;
typedef test_less<int> C;
typedef std::map<int, double, C, A> M;
A a;
- M m ({ {1, 1},
- {1, 1.5},
- {1, 2},
- {2, 1},
- {2, 1.5},
- {2, 2},
- {3, 1},
- {3, 1.5},
- {3, 2}
- }, a);
+ M m({{1, 1}, {1, 1.5}, {1, 2}, {2, 1}, {2, 1.5}, {2, 2}, {3, 1}, {3, 1.5}, {3, 2}}, a);
assert(m.size() == 3);
assert(std::distance(m.begin(), m.end()) == 3);
@@ -92,23 +64,14 @@ int main(int, char**)
assert(*std::next(m.begin()) == V(2, 1));
assert(*std::next(m.begin(), 2) == V(3, 1));
assert(m.get_allocator() == a);
- }
- {
+ }
+ {
typedef std::pair<const int, double> V;
typedef explicit_allocator<V> A;
typedef test_less<int> C;
A a;
- std::map<int, double, C, A> m({
- {1, 1},
- {1, 1.5},
- {1, 2},
- {2, 1},
- {2, 1.5},
- {2, 2},
- {3, 1},
- {3, 1.5},
- {3, 2}
- }, C(3), a);
+ std::map<int, double, C, A> m(
+ {{1, 1}, {1, 1.5}, {1, 2}, {2, 1}, {2, 1.5}, {2, 2}, {3, 1}, {3, 1.5}, {3, 2}}, C(3), a);
assert(m.size() == 3);
assert(std::distance(m.begin(), m.end()) == 3);
assert(*m.begin() == V(1, 1));
@@ -116,7 +79,7 @@ int main(int, char**)
assert(*std::next(m.begin(), 2) == V(3, 1));
assert(m.key_comp() == C(3));
assert(m.get_allocator() == a);
- }
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/map/map.cons/iter_iter.pass.cpp b/libcxx/test/std/containers/associative/map/map.cons/iter_iter.pass.cpp
index c3032e72fe5da2a..c8ed1413c308438 100644
--- a/libcxx/test/std/containers/associative/map/map.cons/iter_iter.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.cons/iter_iter.pass.cpp
@@ -19,12 +19,10 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::pair<const int, double> V;
- V ar[] =
- {
+ V ar[] = {
V(1, 1),
V(1, 1.5),
V(1, 2),
@@ -35,18 +33,17 @@ int main(int, char**)
V(3, 1.5),
V(3, 2),
};
- std::map<int, double> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ std::map<int, double> m(ar, ar + sizeof(ar) / sizeof(ar[0]));
assert(m.size() == 3);
assert(std::distance(m.begin(), m.end()) == 3);
assert(*m.begin() == V(1, 1));
assert(*std::next(m.begin()) == V(2, 1));
assert(*std::next(m.begin(), 2) == V(3, 1));
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::pair<const int, double> V;
- V ar[] =
- {
+ V ar[] = {
V(1, 1),
V(1, 1.5),
V(1, 2),
@@ -57,13 +54,14 @@ int main(int, char**)
V(3, 1.5),
V(3, 2),
};
- std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> m(
+ ar, ar + sizeof(ar) / sizeof(ar[0]));
assert(m.size() == 3);
assert(std::distance(m.begin(), m.end()) == 3);
assert(*m.begin() == V(1, 1));
assert(*std::next(m.begin()) == V(2, 1));
assert(*std::next(m.begin(), 2) == V(3, 1));
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/map/map.cons/iter_iter_comp.pass.cpp b/libcxx/test/std/containers/associative/map/map.cons/iter_iter_comp.pass.cpp
index 7649ede9a3fb08c..f8ecee04a528a9d 100644
--- a/libcxx/test/std/containers/associative/map/map.cons/iter_iter_comp.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.cons/iter_iter_comp.pass.cpp
@@ -20,12 +20,10 @@
#include "../../../test_compare.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::pair<const int, double> V;
- V ar[] =
- {
+ V ar[] = {
V(1, 1),
V(1, 1.5),
V(1, 2),
@@ -37,19 +35,18 @@ int main(int, char**)
V(3, 2),
};
typedef test_less<int> C;
- std::map<int, double, C> m(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5));
+ std::map<int, double, C> m(ar, ar + sizeof(ar) / sizeof(ar[0]), C(5));
assert(m.key_comp() == C(5));
assert(m.size() == 3);
assert(std::distance(m.begin(), m.end()) == 3);
assert(*m.begin() == V(1, 1));
assert(*std::next(m.begin()) == V(2, 1));
assert(*std::next(m.begin(), 2) == V(3, 1));
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::pair<const int, double> V;
- V ar[] =
- {
+ V ar[] = {
V(1, 1),
V(1, 1.5),
V(1, 2),
@@ -61,14 +58,14 @@ int main(int, char**)
V(3, 2),
};
typedef test_less<int> C;
- std::map<int, double, C, min_allocator<std::pair<const int, double>>> m(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5));
+ std::map<int, double, C, min_allocator<std::pair<const int, double>>> m(ar, ar + sizeof(ar) / sizeof(ar[0]), C(5));
assert(m.key_comp() == C(5));
assert(m.size() == 3);
assert(std::distance(m.begin(), m.end()) == 3);
assert(*m.begin() == V(1, 1));
assert(*std::next(m.begin()) == V(2, 1));
assert(*std::next(m.begin(), 2) == V(3, 1));
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/map/map.cons/iter_iter_comp_alloc.pass.cpp b/libcxx/test/std/containers/associative/map/map.cons/iter_iter_comp_alloc.pass.cpp
index e8714346951da4d..862b07bb1173110 100644
--- a/libcxx/test/std/containers/associative/map/map.cons/iter_iter_comp_alloc.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.cons/iter_iter_comp_alloc.pass.cpp
@@ -22,12 +22,10 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::pair<const int, double> V;
- V ar[] =
- {
+ V ar[] = {
V(1, 1),
V(1, 1.5),
V(1, 2),
@@ -40,7 +38,7 @@ int main(int, char**)
};
typedef test_less<int> C;
typedef test_allocator<V> A;
- std::map<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(7));
+ std::map<int, double, C, A> m(ar, ar + sizeof(ar) / sizeof(ar[0]), C(5), A(7));
assert(m.get_allocator() == A(7));
assert(m.key_comp() == C(5));
assert(m.size() == 3);
@@ -48,12 +46,11 @@ int main(int, char**)
assert(*m.begin() == V(1, 1));
assert(*std::next(m.begin()) == V(2, 1));
assert(*std::next(m.begin(), 2) == V(3, 1));
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::pair<const int, double> V;
- V ar[] =
- {
+ V ar[] = {
V(1, 1),
V(1, 1.5),
V(1, 2),
@@ -66,7 +63,7 @@ int main(int, char**)
};
typedef test_less<int> C;
typedef min_allocator<V> A;
- std::map<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
+ std::map<int, double, C, A> m(ar, ar + sizeof(ar) / sizeof(ar[0]), C(5), A());
assert(m.get_allocator() == A());
assert(m.key_comp() == C(5));
assert(m.size() == 3);
@@ -74,12 +71,11 @@ int main(int, char**)
assert(*m.begin() == V(1, 1));
assert(*std::next(m.begin()) == V(2, 1));
assert(*std::next(m.begin(), 2) == V(3, 1));
- }
-#if TEST_STD_VER > 11
- {
+ }
+# if TEST_STD_VER > 11
+ {
typedef std::pair<const int, double> V;
- V ar[] =
- {
+ V ar[] = {
V(1, 1),
V(1, 1.5),
V(1, 2),
@@ -91,33 +87,33 @@ int main(int, char**)
V(3, 2),
};
{
- typedef min_allocator<V> A;
- typedef test_less<int> C;
- A a;
- std::map<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0]), a );
+ typedef min_allocator<V> A;
+ typedef test_less<int> C;
+ A a;
+ std::map<int, double, C, A> m(ar, ar + sizeof(ar) / sizeof(ar[0]), a);
- assert(m.size() == 3);
- assert(std::distance(m.begin(), m.end()) == 3);
- assert(*m.begin() == V(1, 1));
- assert(*std::next(m.begin()) == V(2, 1));
- assert(*std::next(m.begin(), 2) == V(3, 1));
- assert(m.get_allocator() == a);
+ assert(m.size() == 3);
+ assert(std::distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == V(1, 1));
+ assert(*std::next(m.begin()) == V(2, 1));
+ assert(*std::next(m.begin(), 2) == V(3, 1));
+ assert(m.get_allocator() == a);
}
{
- typedef explicit_allocator<V> A;
- typedef test_less<int> C;
- A a;
- std::map<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0]), a );
+ typedef explicit_allocator<V> A;
+ typedef test_less<int> C;
+ A a;
+ std::map<int, double, C, A> m(ar, ar + sizeof(ar) / sizeof(ar[0]), a);
- assert(m.size() == 3);
- assert(std::distance(m.begin(), m.end()) == 3);
- assert(*m.begin() == V(1, 1));
- assert(*std::next(m.begin()) == V(2, 1));
- assert(*std::next(m.begin(), 2) == V(3, 1));
- assert(m.get_allocator() == a);
+ assert(m.size() == 3);
+ assert(std::distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == V(1, 1));
+ assert(*std::next(m.begin()) == V(2, 1));
+ assert(*std::next(m.begin(), 2) == V(3, 1));
+ assert(m.get_allocator() == a);
}
- }
-#endif
+ }
+# endif
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/map/map.cons/move.pass.cpp b/libcxx/test/std/containers/associative/map/map.cons/move.pass.cpp
index 7a883bed0d6e8da..d33ef527c91de5c 100644
--- a/libcxx/test/std/containers/associative/map/map.cons/move.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.cons/move.pass.cpp
@@ -22,101 +22,98 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- typedef std::pair<const int, double> V;
- {
- typedef test_less<int> C;
- typedef test_allocator<V> A;
- std::map<int, double, C, A> mo(C(5), A(7));
- std::map<int, double, C, A> m = std::move(mo);
- assert(m.get_allocator() == A(7));
- assert(m.key_comp() == C(5));
- assert(m.size() == 0);
- assert(std::distance(m.begin(), m.end()) == 0);
+int main(int, char**) {
+ typedef std::pair<const int, double> V;
+ {
+ typedef test_less<int> C;
+ typedef test_allocator<V> A;
+ std::map<int, double, C, A> mo(C(5), A(7));
+ std::map<int, double, C, A> m = std::move(mo);
+ assert(m.get_allocator() == A(7));
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 0);
+ assert(std::distance(m.begin(), m.end()) == 0);
- assert(mo.get_allocator() == A(7));
- assert(mo.get_allocator().get_id() == test_alloc_base::moved_value);
- assert(mo.key_comp() == C(5));
- assert(mo.size() == 0);
- assert(std::distance(mo.begin(), mo.end()) == 0);
- }
- {
- V ar[] =
- {
- V(1, 1),
- V(1, 1.5),
- V(1, 2),
- V(2, 1),
- V(2, 1.5),
- V(2, 2),
- V(3, 1),
- V(3, 1.5),
- V(3, 2),
- };
- typedef test_less<int> C;
- typedef test_allocator<V> A;
- std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(7));
- std::map<int, double, C, A> m = std::move(mo);
- assert(m.get_allocator() == A(7));
- assert(m.key_comp() == C(5));
- assert(m.size() == 3);
- assert(std::distance(m.begin(), m.end()) == 3);
- assert(*m.begin() == V(1, 1));
- assert(*std::next(m.begin()) == V(2, 1));
- assert(*std::next(m.begin(), 2) == V(3, 1));
+ assert(mo.get_allocator() == A(7));
+ assert(mo.get_allocator().get_id() == test_alloc_base::moved_value);
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 0);
+ assert(std::distance(mo.begin(), mo.end()) == 0);
+ }
+ {
+ V ar[] = {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2),
+ };
+ typedef test_less<int> C;
+ typedef test_allocator<V> A;
+ std::map<int, double, C, A> mo(ar, ar + sizeof(ar) / sizeof(ar[0]), C(5), A(7));
+ std::map<int, double, C, A> m = std::move(mo);
+ assert(m.get_allocator() == A(7));
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 3);
+ assert(std::distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == V(1, 1));
+ assert(*std::next(m.begin()) == V(2, 1));
+ assert(*std::next(m.begin(), 2) == V(3, 1));
- assert(mo.get_allocator() == A(7));
- assert(mo.get_allocator().get_id() == test_alloc_base::moved_value);
- assert(mo.key_comp() == C(5));
- assert(mo.size() == 0);
- assert(std::distance(mo.begin(), mo.end()) == 0);
- }
- {
- typedef test_less<int> C;
- typedef min_allocator<V> A;
- std::map<int, double, C, A> mo(C(5), A());
- std::map<int, double, C, A> m = std::move(mo);
- assert(m.get_allocator() == A());
- assert(m.key_comp() == C(5));
- assert(m.size() == 0);
- assert(std::distance(m.begin(), m.end()) == 0);
+ assert(mo.get_allocator() == A(7));
+ assert(mo.get_allocator().get_id() == test_alloc_base::moved_value);
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 0);
+ assert(std::distance(mo.begin(), mo.end()) == 0);
+ }
+ {
+ typedef test_less<int> C;
+ typedef min_allocator<V> A;
+ std::map<int, double, C, A> mo(C(5), A());
+ std::map<int, double, C, A> m = std::move(mo);
+ assert(m.get_allocator() == A());
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 0);
+ assert(std::distance(m.begin(), m.end()) == 0);
- assert(mo.get_allocator() == A());
- assert(mo.key_comp() == C(5));
- assert(mo.size() == 0);
- assert(std::distance(mo.begin(), mo.end()) == 0);
- }
- {
- V ar[] =
- {
- V(1, 1),
- V(1, 1.5),
- V(1, 2),
- V(2, 1),
- V(2, 1.5),
- V(2, 2),
- V(3, 1),
- V(3, 1.5),
- V(3, 2),
- };
- typedef test_less<int> C;
- typedef min_allocator<V> A;
- std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
- std::map<int, double, C, A> m = std::move(mo);
- assert(m.get_allocator() == A());
- assert(m.key_comp() == C(5));
- assert(m.size() == 3);
- assert(std::distance(m.begin(), m.end()) == 3);
- assert(*m.begin() == V(1, 1));
- assert(*std::next(m.begin()) == V(2, 1));
- assert(*std::next(m.begin(), 2) == V(3, 1));
+ assert(mo.get_allocator() == A());
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 0);
+ assert(std::distance(mo.begin(), mo.end()) == 0);
+ }
+ {
+ V ar[] = {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2),
+ };
+ typedef test_less<int> C;
+ typedef min_allocator<V> A;
+ std::map<int, double, C, A> mo(ar, ar + sizeof(ar) / sizeof(ar[0]), C(5), A());
+ std::map<int, double, C, A> m = std::move(mo);
+ assert(m.get_allocator() == A());
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 3);
+ assert(std::distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == V(1, 1));
+ assert(*std::next(m.begin()) == V(2, 1));
+ assert(*std::next(m.begin(), 2) == V(3, 1));
- assert(mo.get_allocator() == A());
- assert(mo.key_comp() == C(5));
- assert(mo.size() == 0);
- assert(std::distance(mo.begin(), mo.end()) == 0);
- }
+ assert(mo.get_allocator() == A());
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 0);
+ assert(std::distance(mo.begin(), mo.end()) == 0);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/map/map.cons/move_alloc.pass.cpp b/libcxx/test/std/containers/associative/map/map.cons/move_alloc.pass.cpp
index 63630164b2e64a5..886a4fa714d894d 100644
--- a/libcxx/test/std/containers/associative/map/map.cons/move_alloc.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.cons/move_alloc.pass.cpp
@@ -25,253 +25,131 @@
#include "min_allocator.h"
#include "Counter.h"
-int main(int, char**)
-{
+int main(int, char**) {
+ {
+ typedef std::pair<MoveOnly, MoveOnly> V;
+ typedef std::pair<const MoveOnly, MoveOnly> VC;
+ typedef test_less<MoveOnly> C;
+ typedef test_allocator<VC> A;
+ typedef std::map<MoveOnly, MoveOnly, C, A> M;
+ typedef std::move_iterator<V*> I;
+ V a1[] = {V(1, 1), V(1, 2), V(1, 3), V(2, 1), V(2, 2), V(2, 3), V(3, 1), V(3, 2), V(3, 3)};
+ M m1(I(a1), I(a1 + sizeof(a1) / sizeof(a1[0])), C(5), A(7));
+ V a2[] = {V(1, 1), V(1, 2), V(1, 3), V(2, 1), V(2, 2), V(2, 3), V(3, 1), V(3, 2), V(3, 3)};
+ M m2(I(a2), I(a2 + sizeof(a2) / sizeof(a2[0])), C(5), A(7));
+ M m3(std::move(m1), A(7));
+ assert(m3 == m2);
+ assert(m3.get_allocator() == A(7));
+ assert(m3.key_comp() == C(5));
+ LIBCPP_ASSERT(m1.empty());
+ }
+ {
+ typedef std::pair<MoveOnly, MoveOnly> V;
+ typedef std::pair<const MoveOnly, MoveOnly> VC;
+ typedef test_less<MoveOnly> C;
+ typedef test_allocator<VC> A;
+ typedef std::map<MoveOnly, MoveOnly, C, A> M;
+ typedef std::move_iterator<V*> I;
+ V a1[] = {V(1, 1), V(1, 2), V(1, 3), V(2, 1), V(2, 2), V(2, 3), V(3, 1), V(3, 2), V(3, 3)};
+ M m1(I(a1), I(a1 + sizeof(a1) / sizeof(a1[0])), C(5), A(7));
+ V a2[] = {V(1, 1), V(1, 2), V(1, 3), V(2, 1), V(2, 2), V(2, 3), V(3, 1), V(3, 2), V(3, 3)};
+ M m2(I(a2), I(a2 + sizeof(a2) / sizeof(a2[0])), C(5), A(7));
+ M m3(std::move(m1), A(5));
+ assert(m3 == m2);
+ assert(m3.get_allocator() == A(5));
+ assert(m3.key_comp() == C(5));
+ LIBCPP_ASSERT(m1.empty());
+ }
+ {
+ typedef std::pair<MoveOnly, MoveOnly> V;
+ typedef std::pair<const MoveOnly, MoveOnly> VC;
+ typedef test_less<MoveOnly> C;
+ typedef other_allocator<VC> A;
+ typedef std::map<MoveOnly, MoveOnly, C, A> M;
+ typedef std::move_iterator<V*> I;
+ V a1[] = {V(1, 1), V(1, 2), V(1, 3), V(2, 1), V(2, 2), V(2, 3), V(3, 1), V(3, 2), V(3, 3)};
+ M m1(I(a1), I(a1 + sizeof(a1) / sizeof(a1[0])), C(5), A(7));
+ V a2[] = {V(1, 1), V(1, 2), V(1, 3), V(2, 1), V(2, 2), V(2, 3), V(3, 1), V(3, 2), V(3, 3)};
+ M m2(I(a2), I(a2 + sizeof(a2) / sizeof(a2[0])), C(5), A(7));
+ M m3(std::move(m1), A(5));
+ assert(m3 == m2);
+ assert(m3.get_allocator() == A(5));
+ assert(m3.key_comp() == C(5));
+ LIBCPP_ASSERT(m1.empty());
+ }
+ {
+ typedef Counter<int> T;
+ typedef std::pair<int, T> V;
+ typedef std::pair<const int, T> VC;
+ typedef test_allocator<VC> A;
+ typedef std::less<int> C;
+ typedef std::map<const int, T, C, A> M;
+ typedef V* I;
+ Counter_base::gConstructed = 0;
{
- typedef std::pair<MoveOnly, MoveOnly> V;
- typedef std::pair<const MoveOnly, MoveOnly> VC;
- typedef test_less<MoveOnly> C;
- typedef test_allocator<VC> A;
- typedef std::map<MoveOnly, MoveOnly, C, A> M;
- typedef std::move_iterator<V*> I;
- V a1[] =
- {
- V(1, 1),
- V(1, 2),
- V(1, 3),
- V(2, 1),
- V(2, 2),
- V(2, 3),
- V(3, 1),
- V(3, 2),
- V(3, 3)
- };
- M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A(7));
- V a2[] =
- {
- V(1, 1),
- V(1, 2),
- V(1, 3),
- V(2, 1),
- V(2, 2),
- V(2, 3),
- V(3, 1),
- V(3, 2),
- V(3, 3)
- };
- M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A(7));
- M m3(std::move(m1), A(7));
- assert(m3 == m2);
- assert(m3.get_allocator() == A(7));
- assert(m3.key_comp() == C(5));
- LIBCPP_ASSERT(m1.empty());
- }
- {
- typedef std::pair<MoveOnly, MoveOnly> V;
- typedef std::pair<const MoveOnly, MoveOnly> VC;
- typedef test_less<MoveOnly> C;
- typedef test_allocator<VC> A;
- typedef std::map<MoveOnly, MoveOnly, C, A> M;
- typedef std::move_iterator<V*> I;
- V a1[] =
- {
- V(1, 1),
- V(1, 2),
- V(1, 3),
- V(2, 1),
- V(2, 2),
- V(2, 3),
- V(3, 1),
- V(3, 2),
- V(3, 3)
- };
- M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A(7));
- V a2[] =
- {
- V(1, 1),
- V(1, 2),
- V(1, 3),
- V(2, 1),
- V(2, 2),
- V(2, 3),
- V(3, 1),
- V(3, 2),
- V(3, 3)
- };
- M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A(7));
- M m3(std::move(m1), A(5));
- assert(m3 == m2);
- assert(m3.get_allocator() == A(5));
- assert(m3.key_comp() == C(5));
- LIBCPP_ASSERT(m1.empty());
- }
- {
- typedef std::pair<MoveOnly, MoveOnly> V;
- typedef std::pair<const MoveOnly, MoveOnly> VC;
- typedef test_less<MoveOnly> C;
- typedef other_allocator<VC> A;
- typedef std::map<MoveOnly, MoveOnly, C, A> M;
- typedef std::move_iterator<V*> I;
- V a1[] =
- {
- V(1, 1),
- V(1, 2),
- V(1, 3),
- V(2, 1),
- V(2, 2),
- V(2, 3),
- V(3, 1),
- V(3, 2),
- V(3, 3)
- };
- M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A(7));
- V a2[] =
- {
- V(1, 1),
- V(1, 2),
- V(1, 3),
- V(2, 1),
- V(2, 2),
- V(2, 3),
- V(3, 1),
- V(3, 2),
- V(3, 3)
- };
- M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A(7));
- M m3(std::move(m1), A(5));
- assert(m3 == m2);
- assert(m3.get_allocator() == A(5));
- assert(m3.key_comp() == C(5));
- LIBCPP_ASSERT(m1.empty());
- }
- {
- typedef Counter<int> T;
- typedef std::pair<int, T> V;
- typedef std::pair<const int, T> VC;
- typedef test_allocator<VC> A;
- typedef std::less<int> C;
- typedef std::map<const int, T, C, A> M;
- typedef V* I;
- Counter_base::gConstructed = 0;
- {
- V a1[] =
- {
- V(1, 1),
- V(1, 2),
- V(1, 3),
- V(2, 1),
- V(2, 2),
- V(2, 3),
- V(3, 1),
- V(3, 2),
- V(3, 3)
- };
- const std::size_t num = sizeof(a1)/sizeof(a1[0]);
- assert(Counter_base::gConstructed == num);
+ V a1[] = {V(1, 1), V(1, 2), V(1, 3), V(2, 1), V(2, 2), V(2, 3), V(3, 1), V(3, 2), V(3, 3)};
+ const std::size_t num = sizeof(a1) / sizeof(a1[0]);
+ assert(Counter_base::gConstructed == num);
- M m1(I(a1), I(a1+num), C(), A());
- assert(Counter_base::gConstructed == num+3);
+ M m1(I(a1), I(a1 + num), C(), A());
+ assert(Counter_base::gConstructed == num + 3);
- M m2(m1);
- assert(m2 == m1);
- assert(Counter_base::gConstructed == num+6);
+ M m2(m1);
+ assert(m2 == m1);
+ assert(Counter_base::gConstructed == num + 6);
- M m3(std::move(m1), A());
- assert(m3 == m2);
- LIBCPP_ASSERT(m1.empty());
- assert(Counter_base::gConstructed >= (int)(num+6));
- assert(Counter_base::gConstructed <= (int)(num+6+m1.size()));
+ M m3(std::move(m1), A());
+ assert(m3 == m2);
+ LIBCPP_ASSERT(m1.empty());
+ assert(Counter_base::gConstructed >= (int)(num + 6));
+ assert(Counter_base::gConstructed <= (int)(num + 6 + m1.size()));
- {
- M m4(std::move(m2), A(5));
- assert(Counter_base::gConstructed >= (int)(num+6));
- assert(Counter_base::gConstructed <= (int)(num+6+m1.size()+m2.size()));
- assert(m4 == m3);
- LIBCPP_ASSERT(m2.empty());
- }
- assert(Counter_base::gConstructed >= (int)(num+3));
- assert(Counter_base::gConstructed <= (int)(num+3+m1.size()+m2.size()));
- }
- assert(Counter_base::gConstructed == 0);
- }
- {
- typedef std::pair<MoveOnly, MoveOnly> V;
- typedef std::pair<const MoveOnly, MoveOnly> VC;
- typedef test_less<MoveOnly> C;
- typedef min_allocator<VC> A;
- typedef std::map<MoveOnly, MoveOnly, C, A> M;
- typedef std::move_iterator<V*> I;
- V a1[] =
- {
- V(1, 1),
- V(1, 2),
- V(1, 3),
- V(2, 1),
- V(2, 2),
- V(2, 3),
- V(3, 1),
- V(3, 2),
- V(3, 3)
- };
- M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A());
- V a2[] =
- {
- V(1, 1),
- V(1, 2),
- V(1, 3),
- V(2, 1),
- V(2, 2),
- V(2, 3),
- V(3, 1),
- V(3, 2),
- V(3, 3)
- };
- M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A());
- M m3(std::move(m1), A());
- assert(m3 == m2);
- assert(m3.get_allocator() == A());
- assert(m3.key_comp() == C(5));
- LIBCPP_ASSERT(m1.empty());
- }
- {
- typedef std::pair<MoveOnly, MoveOnly> V;
- typedef std::pair<const MoveOnly, MoveOnly> VC;
- typedef test_less<MoveOnly> C;
- typedef explicit_allocator<VC> A;
- typedef std::map<MoveOnly, MoveOnly, C, A> M;
- typedef std::move_iterator<V*> I;
- V a1[] =
- {
- V(1, 1),
- V(1, 2),
- V(1, 3),
- V(2, 1),
- V(2, 2),
- V(2, 3),
- V(3, 1),
- V(3, 2),
- V(3, 3)
- };
- M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A{});
- V a2[] =
- {
- V(1, 1),
- V(1, 2),
- V(1, 3),
- V(2, 1),
- V(2, 2),
- V(2, 3),
- V(3, 1),
- V(3, 2),
- V(3, 3)
- };
- M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A{});
- M m3(std::move(m1), A{});
- assert(m3 == m2);
- assert(m3.get_allocator() == A{});
- assert(m3.key_comp() == C(5));
- LIBCPP_ASSERT(m1.empty());
+ {
+ M m4(std::move(m2), A(5));
+ assert(Counter_base::gConstructed >= (int)(num + 6));
+ assert(Counter_base::gConstructed <= (int)(num + 6 + m1.size() + m2.size()));
+ assert(m4 == m3);
+ LIBCPP_ASSERT(m2.empty());
+ }
+ assert(Counter_base::gConstructed >= (int)(num + 3));
+ assert(Counter_base::gConstructed <= (int)(num + 3 + m1.size() + m2.size()));
}
+ assert(Counter_base::gConstructed == 0);
+ }
+ {
+ typedef std::pair<MoveOnly, MoveOnly> V;
+ typedef std::pair<const MoveOnly, MoveOnly> VC;
+ typedef test_less<MoveOnly> C;
+ typedef min_allocator<VC> A;
+ typedef std::map<MoveOnly, MoveOnly, C, A> M;
+ typedef std::move_iterator<V*> I;
+ V a1[] = {V(1, 1), V(1, 2), V(1, 3), V(2, 1), V(2, 2), V(2, 3), V(3, 1), V(3, 2), V(3, 3)};
+ M m1(I(a1), I(a1 + sizeof(a1) / sizeof(a1[0])), C(5), A());
+ V a2[] = {V(1, 1), V(1, 2), V(1, 3), V(2, 1), V(2, 2), V(2, 3), V(3, 1), V(3, 2), V(3, 3)};
+ M m2(I(a2), I(a2 + sizeof(a2) / sizeof(a2[0])), C(5), A());
+ M m3(std::move(m1), A());
+ assert(m3 == m2);
+ assert(m3.get_allocator() == A());
+ assert(m3.key_comp() == C(5));
+ LIBCPP_ASSERT(m1.empty());
+ }
+ {
+ typedef std::pair<MoveOnly, MoveOnly> V;
+ typedef std::pair<const MoveOnly, MoveOnly> VC;
+ typedef test_less<MoveOnly> C;
+ typedef explicit_allocator<VC> A;
+ typedef std::map<MoveOnly, MoveOnly, C, A> M;
+ typedef std::move_iterator<V*> I;
+ V a1[] = {V(1, 1), V(1, 2), V(1, 3), V(2, 1), V(2, 2), V(2, 3), V(3, 1), V(3, 2), V(3, 3)};
+ M m1(I(a1), I(a1 + sizeof(a1) / sizeof(a1[0])), C(5), A{});
+ V a2[] = {V(1, 1), V(1, 2), V(1, 3), V(2, 1), V(2, 2), V(2, 3), V(3, 1), V(3, 2), V(3, 3)};
+ M m2(I(a2), I(a2 + sizeof(a2) / sizeof(a2[0])), C(5), A{});
+ M m3(std::move(m1), A{});
+ assert(m3 == m2);
+ assert(m3.get_allocator() == A{});
+ assert(m3.key_comp() == C(5));
+ LIBCPP_ASSERT(m1.empty());
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/map/map.cons/move_assign.pass.cpp b/libcxx/test/std/containers/associative/map/map.cons/move_assign.pass.cpp
index c19fba5169b10ae..94f991976d6adaf 100644
--- a/libcxx/test/std/containers/associative/map/map.cons/move_assign.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.cons/move_assign.pass.cpp
@@ -23,168 +23,79 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::pair<MoveOnly, MoveOnly> V;
- typedef std::pair<const MoveOnly, MoveOnly> VC;
- typedef test_less<MoveOnly> C;
- typedef test_allocator<VC> A;
- typedef std::map<MoveOnly, MoveOnly, C, A> M;
- typedef std::move_iterator<V*> I;
- V a1[] =
- {
- V(1, 1),
- V(1, 2),
- V(1, 3),
- V(2, 1),
- V(2, 2),
- V(2, 3),
- V(3, 1),
- V(3, 2),
- V(3, 3)
- };
- M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A(7));
- V a2[] =
- {
- V(1, 1),
- V(1, 2),
- V(1, 3),
- V(2, 1),
- V(2, 2),
- V(2, 3),
- V(3, 1),
- V(3, 2),
- V(3, 3)
- };
- M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A(7));
- M m3(C(3), A(7));
- m3 = std::move(m1);
- assert(m3 == m2);
- assert(m3.get_allocator() == A(7));
- assert(m3.key_comp() == C(5));
- assert(m1.empty());
- }
- {
- typedef std::pair<MoveOnly, MoveOnly> V;
- typedef std::pair<const MoveOnly, MoveOnly> VC;
- typedef test_less<MoveOnly> C;
- typedef test_allocator<VC> A;
- typedef std::map<MoveOnly, MoveOnly, C, A> M;
- typedef std::move_iterator<V*> I;
- V a1[] =
- {
- V(1, 1),
- V(1, 2),
- V(1, 3),
- V(2, 1),
- V(2, 2),
- V(2, 3),
- V(3, 1),
- V(3, 2),
- V(3, 3)
- };
- M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A(7));
- V a2[] =
- {
- V(1, 1),
- V(1, 2),
- V(1, 3),
- V(2, 1),
- V(2, 2),
- V(2, 3),
- V(3, 1),
- V(3, 2),
- V(3, 3)
- };
- M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A(7));
- M m3(C(3), A(5));
- m3 = std::move(m1);
- assert(m3 == m2);
- assert(m3.get_allocator() == A(5));
- assert(m3.key_comp() == C(5));
- LIBCPP_ASSERT(m1.empty());
- }
- {
- typedef std::pair<MoveOnly, MoveOnly> V;
- typedef std::pair<const MoveOnly, MoveOnly> VC;
- typedef test_less<MoveOnly> C;
- typedef other_allocator<VC> A;
- typedef std::map<MoveOnly, MoveOnly, C, A> M;
- typedef std::move_iterator<V*> I;
- V a1[] =
- {
- V(1, 1),
- V(1, 2),
- V(1, 3),
- V(2, 1),
- V(2, 2),
- V(2, 3),
- V(3, 1),
- V(3, 2),
- V(3, 3)
- };
- M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A(7));
- V a2[] =
- {
- V(1, 1),
- V(1, 2),
- V(1, 3),
- V(2, 1),
- V(2, 2),
- V(2, 3),
- V(3, 1),
- V(3, 2),
- V(3, 3)
- };
- M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A(7));
- M m3(C(3), A(5));
- m3 = std::move(m1);
- assert(m3 == m2);
- assert(m3.get_allocator() == A(7));
- assert(m3.key_comp() == C(5));
- assert(m1.empty());
- }
- {
- typedef std::pair<MoveOnly, MoveOnly> V;
- typedef std::pair<const MoveOnly, MoveOnly> VC;
- typedef test_less<MoveOnly> C;
- typedef min_allocator<VC> A;
- typedef std::map<MoveOnly, MoveOnly, C, A> M;
- typedef std::move_iterator<V*> I;
- V a1[] =
- {
- V(1, 1),
- V(1, 2),
- V(1, 3),
- V(2, 1),
- V(2, 2),
- V(2, 3),
- V(3, 1),
- V(3, 2),
- V(3, 3)
- };
- M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A());
- V a2[] =
- {
- V(1, 1),
- V(1, 2),
- V(1, 3),
- V(2, 1),
- V(2, 2),
- V(2, 3),
- V(3, 1),
- V(3, 2),
- V(3, 3)
- };
- M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A());
- M m3(C(3), A());
- m3 = std::move(m1);
- assert(m3 == m2);
- assert(m3.get_allocator() == A());
- assert(m3.key_comp() == C(5));
- assert(m1.empty());
- }
+int main(int, char**) {
+ {
+ typedef std::pair<MoveOnly, MoveOnly> V;
+ typedef std::pair<const MoveOnly, MoveOnly> VC;
+ typedef test_less<MoveOnly> C;
+ typedef test_allocator<VC> A;
+ typedef std::map<MoveOnly, MoveOnly, C, A> M;
+ typedef std::move_iterator<V*> I;
+ V a1[] = {V(1, 1), V(1, 2), V(1, 3), V(2, 1), V(2, 2), V(2, 3), V(3, 1), V(3, 2), V(3, 3)};
+ M m1(I(a1), I(a1 + sizeof(a1) / sizeof(a1[0])), C(5), A(7));
+ V a2[] = {V(1, 1), V(1, 2), V(1, 3), V(2, 1), V(2, 2), V(2, 3), V(3, 1), V(3, 2), V(3, 3)};
+ M m2(I(a2), I(a2 + sizeof(a2) / sizeof(a2[0])), C(5), A(7));
+ M m3(C(3), A(7));
+ m3 = std::move(m1);
+ assert(m3 == m2);
+ assert(m3.get_allocator() == A(7));
+ assert(m3.key_comp() == C(5));
+ assert(m1.empty());
+ }
+ {
+ typedef std::pair<MoveOnly, MoveOnly> V;
+ typedef std::pair<const MoveOnly, MoveOnly> VC;
+ typedef test_less<MoveOnly> C;
+ typedef test_allocator<VC> A;
+ typedef std::map<MoveOnly, MoveOnly, C, A> M;
+ typedef std::move_iterator<V*> I;
+ V a1[] = {V(1, 1), V(1, 2), V(1, 3), V(2, 1), V(2, 2), V(2, 3), V(3, 1), V(3, 2), V(3, 3)};
+ M m1(I(a1), I(a1 + sizeof(a1) / sizeof(a1[0])), C(5), A(7));
+ V a2[] = {V(1, 1), V(1, 2), V(1, 3), V(2, 1), V(2, 2), V(2, 3), V(3, 1), V(3, 2), V(3, 3)};
+ M m2(I(a2), I(a2 + sizeof(a2) / sizeof(a2[0])), C(5), A(7));
+ M m3(C(3), A(5));
+ m3 = std::move(m1);
+ assert(m3 == m2);
+ assert(m3.get_allocator() == A(5));
+ assert(m3.key_comp() == C(5));
+ LIBCPP_ASSERT(m1.empty());
+ }
+ {
+ typedef std::pair<MoveOnly, MoveOnly> V;
+ typedef std::pair<const MoveOnly, MoveOnly> VC;
+ typedef test_less<MoveOnly> C;
+ typedef other_allocator<VC> A;
+ typedef std::map<MoveOnly, MoveOnly, C, A> M;
+ typedef std::move_iterator<V*> I;
+ V a1[] = {V(1, 1), V(1, 2), V(1, 3), V(2, 1), V(2, 2), V(2, 3), V(3, 1), V(3, 2), V(3, 3)};
+ M m1(I(a1), I(a1 + sizeof(a1) / sizeof(a1[0])), C(5), A(7));
+ V a2[] = {V(1, 1), V(1, 2), V(1, 3), V(2, 1), V(2, 2), V(2, 3), V(3, 1), V(3, 2), V(3, 3)};
+ M m2(I(a2), I(a2 + sizeof(a2) / sizeof(a2[0])), C(5), A(7));
+ M m3(C(3), A(5));
+ m3 = std::move(m1);
+ assert(m3 == m2);
+ assert(m3.get_allocator() == A(7));
+ assert(m3.key_comp() == C(5));
+ assert(m1.empty());
+ }
+ {
+ typedef std::pair<MoveOnly, MoveOnly> V;
+ typedef std::pair<const MoveOnly, MoveOnly> VC;
+ typedef test_less<MoveOnly> C;
+ typedef min_allocator<VC> A;
+ typedef std::map<MoveOnly, MoveOnly, C, A> M;
+ typedef std::move_iterator<V*> I;
+ V a1[] = {V(1, 1), V(1, 2), V(1, 3), V(2, 1), V(2, 2), V(2, 3), V(3, 1), V(3, 2), V(3, 3)};
+ M m1(I(a1), I(a1 + sizeof(a1) / sizeof(a1[0])), C(5), A());
+ V a2[] = {V(1, 1), V(1, 2), V(1, 3), V(2, 1), V(2, 2), V(2, 3), V(3, 1), V(3, 2), V(3, 3)};
+ M m2(I(a2), I(a2 + sizeof(a2) / sizeof(a2[0])), C(5), A());
+ M m3(C(3), A());
+ m3 = std::move(m1);
+ assert(m3 == m2);
+ assert(m3.get_allocator() == A());
+ assert(m3.key_comp() == C(5));
+ assert(m1.empty());
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/map/map.cons/move_noexcept.pass.cpp b/libcxx/test/std/containers/associative/map/map.cons/move_noexcept.pass.cpp
index 5454d1c750c7852..06316ccf0901a2c 100644
--- a/libcxx/test/std/containers/associative/map/map.cons/move_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.cons/move_noexcept.pass.cpp
@@ -24,34 +24,32 @@
#include "test_allocator.h"
template <class T>
-struct some_comp
-{
- typedef T value_type;
- some_comp(const some_comp&);
- bool operator()(const T&, const T&) const { return false; }
+struct some_comp {
+ typedef T value_type;
+ some_comp(const some_comp&);
+ bool operator()(const T&, const T&) const { return false; }
};
-int main(int, char**)
-{
+int main(int, char**) {
#if defined(_LIBCPP_VERSION)
- typedef std::pair<const MoveOnly, MoveOnly> V;
- {
- typedef std::map<MoveOnly, MoveOnly> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
- }
- {
- typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<V>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
- }
- {
- typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<V>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
- }
+ typedef std::pair<const MoveOnly, MoveOnly> V;
+ {
+ typedef std::map<MoveOnly, MoveOnly> C;
+ static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ }
+ {
+ typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<V>> C;
+ static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ }
+ {
+ typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<V>> C;
+ static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ }
#endif // _LIBCPP_VERSION
- {
- typedef std::map<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
- static_assert(!std::is_nothrow_move_constructible<C>::value, "");
- }
+ {
+ typedef std::map<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
+ static_assert(!std::is_nothrow_move_constructible<C>::value, "");
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/map/map.erasure/erase_if.pass.cpp b/libcxx/test/std/containers/associative/map/map.erasure/erase_if.pass.cpp
index 6dfbbfea848af0f..ccfd800cafde05d 100644
--- a/libcxx/test/std/containers/associative/map/map.erasure/erase_if.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.erasure/erase_if.pass.cpp
@@ -21,12 +21,11 @@
using Init = std::initializer_list<int>;
template <typename M>
-M make (Init vals)
-{
- M ret;
- for (int v : vals)
- ret[static_cast<typename M::key_type>(v)] = static_cast<typename M::mapped_type>(v + 10);
- return ret;
+M make(Init vals) {
+ M ret;
+ for (int v : vals)
+ ret[static_cast<typename M::key_type>(v)] = static_cast<typename M::mapped_type>(v + 10);
+ return ret;
}
template <typename M, typename Pred>
@@ -38,41 +37,39 @@ void test0(Init vals, Pred p, Init expected, std::size_t expected_erased_count)
}
template <typename S>
-void test()
-{
- auto is1 = [](auto v) { return v.first == 1;};
- auto is2 = [](auto v) { return v.first == 2;};
- auto is3 = [](auto v) { return v.first == 3;};
- auto is4 = [](auto v) { return v.first == 4;};
- auto True = [](auto) { return true; };
- auto False = [](auto) { return false; };
+void test() {
+ auto is1 = [](auto v) { return v.first == 1; };
+ auto is2 = [](auto v) { return v.first == 2; };
+ auto is3 = [](auto v) { return v.first == 3; };
+ auto is4 = [](auto v) { return v.first == 4; };
+ auto True = [](auto) { return true; };
+ auto False = [](auto) { return false; };
- test0<S>({}, is1, {}, 0);
+ test0<S>({}, is1, {}, 0);
- test0<S>({1}, is1, {}, 1);
- test0<S>({1}, is2, {1}, 0);
+ test0<S>({1}, is1, {}, 1);
+ test0<S>({1}, is2, {1}, 0);
- test0<S>({1, 2}, is1, {2}, 1);
- test0<S>({1, 2}, is2, {1}, 1);
- test0<S>({1, 2}, is3, {1, 2}, 0);
+ test0<S>({1, 2}, is1, {2}, 1);
+ test0<S>({1, 2}, is2, {1}, 1);
+ test0<S>({1, 2}, is3, {1, 2}, 0);
- test0<S>({1, 2, 3}, is1, {2, 3}, 1);
- test0<S>({1, 2, 3}, is2, {1, 3}, 1);
- test0<S>({1, 2, 3}, is3, {1, 2}, 1);
- test0<S>({1, 2, 3}, is4, {1, 2, 3}, 0);
+ test0<S>({1, 2, 3}, is1, {2, 3}, 1);
+ test0<S>({1, 2, 3}, is2, {1, 3}, 1);
+ test0<S>({1, 2, 3}, is3, {1, 2}, 1);
+ test0<S>({1, 2, 3}, is4, {1, 2, 3}, 0);
- test0<S>({1, 2, 3}, True, {}, 3);
- test0<S>({1, 2, 3}, False, {1, 2, 3}, 0);
+ test0<S>({1, 2, 3}, True, {}, 3);
+ test0<S>({1, 2, 3}, False, {1, 2, 3}, 0);
}
-int main(int, char**)
-{
- test<std::map<int, int>>();
- test<std::map<int, int, std::less<int>, min_allocator<std::pair<const int, int>>>> ();
- test<std::map<int, int, std::less<int>, test_allocator<std::pair<const int, int>>>> ();
+int main(int, char**) {
+ test<std::map<int, int>>();
+ test<std::map<int, int, std::less<int>, min_allocator<std::pair<const int, int>>>>();
+ test<std::map<int, int, std::less<int>, test_allocator<std::pair<const int, int>>>>();
- test<std::map<long, short>>();
- test<std::map<short, double>>();
+ test<std::map<long, short>>();
+ test<std::map<short, double>>();
return 0;
}
diff --git a/libcxx/test/std/containers/associative/map/map.modifiers/clear.pass.cpp b/libcxx/test/std/containers/associative/map/map.modifiers/clear.pass.cpp
index 5c6d00e9f3a8afc..938f22eb880a613 100644
--- a/libcxx/test/std/containers/associative/map/map.modifiers/clear.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.modifiers/clear.pass.cpp
@@ -18,49 +18,46 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::map<int, double> M;
- typedef std::pair<int, double> P;
- P ar[] =
- {
- P(1, 1.5),
- P(2, 2.5),
- P(3, 3.5),
- P(4, 4.5),
- P(5, 5.5),
- P(6, 6.5),
- P(7, 7.5),
- P(8, 8.5),
- };
- M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
- assert(m.size() == 8);
- ASSERT_NOEXCEPT(m.clear());
- m.clear();
- assert(m.size() == 0);
- }
+int main(int, char**) {
+ {
+ typedef std::map<int, double> M;
+ typedef std::pair<int, double> P;
+ P ar[] = {
+ P(1, 1.5),
+ P(2, 2.5),
+ P(3, 3.5),
+ P(4, 4.5),
+ P(5, 5.5),
+ P(6, 6.5),
+ P(7, 7.5),
+ P(8, 8.5),
+ };
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(m.size() == 8);
+ ASSERT_NOEXCEPT(m.clear());
+ m.clear();
+ assert(m.size() == 0);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
- typedef std::pair<int, double> P;
- P ar[] =
- {
- P(1, 1.5),
- P(2, 2.5),
- P(3, 3.5),
- P(4, 4.5),
- P(5, 5.5),
- P(6, 6.5),
- P(7, 7.5),
- P(8, 8.5),
- };
- M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
- assert(m.size() == 8);
- ASSERT_NOEXCEPT(m.clear());
- m.clear();
- assert(m.size() == 0);
- }
+ {
+ typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef std::pair<int, double> P;
+ P ar[] = {
+ P(1, 1.5),
+ P(2, 2.5),
+ P(3, 3.5),
+ P(4, 4.5),
+ P(5, 5.5),
+ P(6, 6.5),
+ P(7, 7.5),
+ P(8, 8.5),
+ };
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(m.size() == 8);
+ ASSERT_NOEXCEPT(m.clear());
+ m.clear();
+ assert(m.size() == 0);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/map/map.modifiers/emplace.pass.cpp b/libcxx/test/std/containers/associative/map/map.modifiers/emplace.pass.cpp
index f57269c3c569811..36b073c2b551e24 100644
--- a/libcxx/test/std/containers/associative/map/map.modifiers/emplace.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.modifiers/emplace.pass.cpp
@@ -24,142 +24,131 @@
#include "DefaultOnly.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::map<int, DefaultOnly> M;
- typedef std::pair<M::iterator, bool> R;
- M m;
- assert(DefaultOnly::count == 0);
- R r = m.emplace();
- assert(r.second);
- assert(r.first == m.begin());
- assert(m.size() == 1);
- assert(m.begin()->first == 0);
- assert(m.begin()->second == DefaultOnly());
- assert(DefaultOnly::count == 1);
- r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1),
- std::forward_as_tuple());
- assert(r.second);
- assert(r.first == std::next(m.begin()));
- assert(m.size() == 2);
- assert(std::next(m.begin())->first == 1);
- assert(std::next(m.begin())->second == DefaultOnly());
- assert(DefaultOnly::count == 2);
- r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1),
- std::forward_as_tuple());
- assert(!r.second);
- assert(r.first == std::next(m.begin()));
- assert(m.size() == 2);
- assert(std::next(m.begin())->first == 1);
- assert(std::next(m.begin())->second == DefaultOnly());
- assert(DefaultOnly::count == 2);
- }
+int main(int, char**) {
+ {
+ typedef std::map<int, DefaultOnly> M;
+ typedef std::pair<M::iterator, bool> R;
+ M m;
assert(DefaultOnly::count == 0);
- {
- typedef std::map<int, Emplaceable> M;
- typedef std::pair<M::iterator, bool> R;
- M m;
- R r = m.emplace(std::piecewise_construct, std::forward_as_tuple(2),
- std::forward_as_tuple());
- assert(r.second);
- assert(r.first == m.begin());
- assert(m.size() == 1);
- assert(m.begin()->first == 2);
- assert(m.begin()->second == Emplaceable());
- r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1),
- std::forward_as_tuple(2, 3.5));
- assert(r.second);
- assert(r.first == m.begin());
- assert(m.size() == 2);
- assert(m.begin()->first == 1);
- assert(m.begin()->second == Emplaceable(2, 3.5));
- r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1),
- std::forward_as_tuple(2, 3.5));
- assert(!r.second);
- assert(r.first == m.begin());
- assert(m.size() == 2);
- assert(m.begin()->first == 1);
- assert(m.begin()->second == Emplaceable(2, 3.5));
- }
- {
- typedef std::map<int, double> M;
- typedef std::pair<M::iterator, bool> R;
- M m;
- R r = m.emplace(M::value_type(2, 3.5));
- assert(r.second);
- assert(r.first == m.begin());
- assert(m.size() == 1);
- assert(m.begin()->first == 2);
- assert(m.begin()->second == 3.5);
- }
- {
- typedef std::map<int, DefaultOnly, std::less<int>, min_allocator<std::pair<const int, DefaultOnly>>> M;
- typedef std::pair<M::iterator, bool> R;
- M m;
- assert(DefaultOnly::count == 0);
- R r = m.emplace();
- assert(r.second);
- assert(r.first == m.begin());
- assert(m.size() == 1);
- assert(m.begin()->first == 0);
- assert(m.begin()->second == DefaultOnly());
- assert(DefaultOnly::count == 1);
- r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1),
- std::forward_as_tuple());
- assert(r.second);
- assert(r.first == std::next(m.begin()));
- assert(m.size() == 2);
- assert(std::next(m.begin())->first == 1);
- assert(std::next(m.begin())->second == DefaultOnly());
- assert(DefaultOnly::count == 2);
- r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1),
- std::forward_as_tuple());
- assert(!r.second);
- assert(r.first == std::next(m.begin()));
- assert(m.size() == 2);
- assert(std::next(m.begin())->first == 1);
- assert(std::next(m.begin())->second == DefaultOnly());
- assert(DefaultOnly::count == 2);
- }
+ R r = m.emplace();
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 0);
+ assert(m.begin()->second == DefaultOnly());
+ assert(DefaultOnly::count == 1);
+ r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple());
+ assert(r.second);
+ assert(r.first == std::next(m.begin()));
+ assert(m.size() == 2);
+ assert(std::next(m.begin())->first == 1);
+ assert(std::next(m.begin())->second == DefaultOnly());
+ assert(DefaultOnly::count == 2);
+ r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple());
+ assert(!r.second);
+ assert(r.first == std::next(m.begin()));
+ assert(m.size() == 2);
+ assert(std::next(m.begin())->first == 1);
+ assert(std::next(m.begin())->second == DefaultOnly());
+ assert(DefaultOnly::count == 2);
+ }
+ assert(DefaultOnly::count == 0);
+ {
+ typedef std::map<int, Emplaceable> M;
+ typedef std::pair<M::iterator, bool> R;
+ M m;
+ R r = m.emplace(std::piecewise_construct, std::forward_as_tuple(2), std::forward_as_tuple());
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == Emplaceable());
+ r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple(2, 3.5));
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 2);
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == Emplaceable(2, 3.5));
+ r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple(2, 3.5));
+ assert(!r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 2);
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == Emplaceable(2, 3.5));
+ }
+ {
+ typedef std::map<int, double> M;
+ typedef std::pair<M::iterator, bool> R;
+ M m;
+ R r = m.emplace(M::value_type(2, 3.5));
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 3.5);
+ }
+ {
+ typedef std::map<int, DefaultOnly, std::less<int>, min_allocator<std::pair<const int, DefaultOnly>>> M;
+ typedef std::pair<M::iterator, bool> R;
+ M m;
assert(DefaultOnly::count == 0);
- {
- typedef std::map<int, Emplaceable, std::less<int>, min_allocator<std::pair<const int, Emplaceable>>> M;
- typedef std::pair<M::iterator, bool> R;
- M m;
- R r = m.emplace(std::piecewise_construct, std::forward_as_tuple(2),
- std::forward_as_tuple());
- assert(r.second);
- assert(r.first == m.begin());
- assert(m.size() == 1);
- assert(m.begin()->first == 2);
- assert(m.begin()->second == Emplaceable());
- r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1),
- std::forward_as_tuple(2, 3.5));
- assert(r.second);
- assert(r.first == m.begin());
- assert(m.size() == 2);
- assert(m.begin()->first == 1);
- assert(m.begin()->second == Emplaceable(2, 3.5));
- r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1),
- std::forward_as_tuple(2, 3.5));
- assert(!r.second);
- assert(r.first == m.begin());
- assert(m.size() == 2);
- assert(m.begin()->first == 1);
- assert(m.begin()->second == Emplaceable(2, 3.5));
- }
- {
- typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
- typedef std::pair<M::iterator, bool> R;
- M m;
- R r = m.emplace(M::value_type(2, 3.5));
- assert(r.second);
- assert(r.first == m.begin());
- assert(m.size() == 1);
- assert(m.begin()->first == 2);
- assert(m.begin()->second == 3.5);
- }
+ R r = m.emplace();
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 0);
+ assert(m.begin()->second == DefaultOnly());
+ assert(DefaultOnly::count == 1);
+ r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple());
+ assert(r.second);
+ assert(r.first == std::next(m.begin()));
+ assert(m.size() == 2);
+ assert(std::next(m.begin())->first == 1);
+ assert(std::next(m.begin())->second == DefaultOnly());
+ assert(DefaultOnly::count == 2);
+ r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple());
+ assert(!r.second);
+ assert(r.first == std::next(m.begin()));
+ assert(m.size() == 2);
+ assert(std::next(m.begin())->first == 1);
+ assert(std::next(m.begin())->second == DefaultOnly());
+ assert(DefaultOnly::count == 2);
+ }
+ assert(DefaultOnly::count == 0);
+ {
+ typedef std::map<int, Emplaceable, std::less<int>, min_allocator<std::pair<const int, Emplaceable>>> M;
+ typedef std::pair<M::iterator, bool> R;
+ M m;
+ R r = m.emplace(std::piecewise_construct, std::forward_as_tuple(2), std::forward_as_tuple());
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == Emplaceable());
+ r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple(2, 3.5));
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 2);
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == Emplaceable(2, 3.5));
+ r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple(2, 3.5));
+ assert(!r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 2);
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == Emplaceable(2, 3.5));
+ }
+ {
+ typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef std::pair<M::iterator, bool> R;
+ M m;
+ R r = m.emplace(M::value_type(2, 3.5));
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 3.5);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/map/map.modifiers/emplace_hint.pass.cpp b/libcxx/test/std/containers/associative/map/map.modifiers/emplace_hint.pass.cpp
index 85353fc43d754c5..56d1c5c2b90ac57 100644
--- a/libcxx/test/std/containers/associative/map/map.modifiers/emplace_hint.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.modifiers/emplace_hint.pass.cpp
@@ -23,138 +23,117 @@
#include "DefaultOnly.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::map<int, DefaultOnly> M;
- typedef M::iterator R;
- M m;
- assert(DefaultOnly::count == 0);
- R r = m.emplace_hint(m.end());
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(m.begin()->first == 0);
- assert(m.begin()->second == DefaultOnly());
- assert(DefaultOnly::count == 1);
- r = m.emplace_hint(m.end(), std::piecewise_construct,
- std::forward_as_tuple(1),
- std::forward_as_tuple());
- assert(r == std::next(m.begin()));
- assert(m.size() == 2);
- assert(std::next(m.begin())->first == 1);
- assert(std::next(m.begin())->second == DefaultOnly());
- assert(DefaultOnly::count == 2);
- r = m.emplace_hint(m.end(), std::piecewise_construct,
- std::forward_as_tuple(1),
- std::forward_as_tuple());
- assert(r == std::next(m.begin()));
- assert(m.size() == 2);
- assert(std::next(m.begin())->first == 1);
- assert(std::next(m.begin())->second == DefaultOnly());
- assert(DefaultOnly::count == 2);
- }
+int main(int, char**) {
+ {
+ typedef std::map<int, DefaultOnly> M;
+ typedef M::iterator R;
+ M m;
assert(DefaultOnly::count == 0);
- {
- typedef std::map<int, Emplaceable> M;
- typedef M::iterator R;
- M m;
- R r = m.emplace_hint(m.end(), std::piecewise_construct,
- std::forward_as_tuple(2),
- std::forward_as_tuple());
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(m.begin()->first == 2);
- assert(m.begin()->second == Emplaceable());
- r = m.emplace_hint(m.end(), std::piecewise_construct,
- std::forward_as_tuple(1),
- std::forward_as_tuple(2, 3.5));
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(m.begin()->first == 1);
- assert(m.begin()->second == Emplaceable(2, 3.5));
- r = m.emplace_hint(m.end(), std::piecewise_construct,
- std::forward_as_tuple(1),
- std::forward_as_tuple(2, 3.5));
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(m.begin()->first == 1);
- assert(m.begin()->second == Emplaceable(2, 3.5));
- }
- {
- typedef std::map<int, double> M;
- typedef M::iterator R;
- M m;
- R r = m.emplace_hint(m.end(), M::value_type(2, 3.5));
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(m.begin()->first == 2);
- assert(m.begin()->second == 3.5);
- }
- {
- typedef std::map<int, DefaultOnly, std::less<int>, min_allocator<std::pair<const int, DefaultOnly>>> M;
- typedef M::iterator R;
- M m;
- assert(DefaultOnly::count == 0);
- R r = m.emplace_hint(m.end());
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(m.begin()->first == 0);
- assert(m.begin()->second == DefaultOnly());
- assert(DefaultOnly::count == 1);
- r = m.emplace_hint(m.end(), std::piecewise_construct,
- std::forward_as_tuple(1),
- std::forward_as_tuple());
- assert(r == std::next(m.begin()));
- assert(m.size() == 2);
- assert(std::next(m.begin())->first == 1);
- assert(std::next(m.begin())->second == DefaultOnly());
- assert(DefaultOnly::count == 2);
- r = m.emplace_hint(m.end(), std::piecewise_construct,
- std::forward_as_tuple(1),
- std::forward_as_tuple());
- assert(r == std::next(m.begin()));
- assert(m.size() == 2);
- assert(std::next(m.begin())->first == 1);
- assert(std::next(m.begin())->second == DefaultOnly());
- assert(DefaultOnly::count == 2);
- }
+ R r = m.emplace_hint(m.end());
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 0);
+ assert(m.begin()->second == DefaultOnly());
+ assert(DefaultOnly::count == 1);
+ r = m.emplace_hint(m.end(), std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple());
+ assert(r == std::next(m.begin()));
+ assert(m.size() == 2);
+ assert(std::next(m.begin())->first == 1);
+ assert(std::next(m.begin())->second == DefaultOnly());
+ assert(DefaultOnly::count == 2);
+ r = m.emplace_hint(m.end(), std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple());
+ assert(r == std::next(m.begin()));
+ assert(m.size() == 2);
+ assert(std::next(m.begin())->first == 1);
+ assert(std::next(m.begin())->second == DefaultOnly());
+ assert(DefaultOnly::count == 2);
+ }
+ assert(DefaultOnly::count == 0);
+ {
+ typedef std::map<int, Emplaceable> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.emplace_hint(m.end(), std::piecewise_construct, std::forward_as_tuple(2), std::forward_as_tuple());
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == Emplaceable());
+ r = m.emplace_hint(m.end(), std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple(2, 3.5));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == Emplaceable(2, 3.5));
+ r = m.emplace_hint(m.end(), std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple(2, 3.5));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == Emplaceable(2, 3.5));
+ }
+ {
+ typedef std::map<int, double> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.emplace_hint(m.end(), M::value_type(2, 3.5));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 3.5);
+ }
+ {
+ typedef std::map<int, DefaultOnly, std::less<int>, min_allocator<std::pair<const int, DefaultOnly>>> M;
+ typedef M::iterator R;
+ M m;
assert(DefaultOnly::count == 0);
- {
- typedef std::map<int, Emplaceable, std::less<int>, min_allocator<std::pair<const int, Emplaceable>>> M;
- typedef M::iterator R;
- M m;
- R r = m.emplace_hint(m.end(), std::piecewise_construct,
- std::forward_as_tuple(2),
- std::forward_as_tuple());
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(m.begin()->first == 2);
- assert(m.begin()->second == Emplaceable());
- r = m.emplace_hint(m.end(), std::piecewise_construct,
- std::forward_as_tuple(1),
- std::forward_as_tuple(2, 3.5));
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(m.begin()->first == 1);
- assert(m.begin()->second == Emplaceable(2, 3.5));
- r = m.emplace_hint(m.end(), std::piecewise_construct,
- std::forward_as_tuple(1),
- std::forward_as_tuple(2, 3.5));
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(m.begin()->first == 1);
- assert(m.begin()->second == Emplaceable(2, 3.5));
- }
- {
- typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
- typedef M::iterator R;
- M m;
- R r = m.emplace_hint(m.end(), M::value_type(2, 3.5));
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(m.begin()->first == 2);
- assert(m.begin()->second == 3.5);
- }
+ R r = m.emplace_hint(m.end());
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 0);
+ assert(m.begin()->second == DefaultOnly());
+ assert(DefaultOnly::count == 1);
+ r = m.emplace_hint(m.end(), std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple());
+ assert(r == std::next(m.begin()));
+ assert(m.size() == 2);
+ assert(std::next(m.begin())->first == 1);
+ assert(std::next(m.begin())->second == DefaultOnly());
+ assert(DefaultOnly::count == 2);
+ r = m.emplace_hint(m.end(), std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple());
+ assert(r == std::next(m.begin()));
+ assert(m.size() == 2);
+ assert(std::next(m.begin())->first == 1);
+ assert(std::next(m.begin())->second == DefaultOnly());
+ assert(DefaultOnly::count == 2);
+ }
+ assert(DefaultOnly::count == 0);
+ {
+ typedef std::map<int, Emplaceable, std::less<int>, min_allocator<std::pair<const int, Emplaceable>>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.emplace_hint(m.end(), std::piecewise_construct, std::forward_as_tuple(2), std::forward_as_tuple());
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == Emplaceable());
+ r = m.emplace_hint(m.end(), std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple(2, 3.5));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == Emplaceable(2, 3.5));
+ r = m.emplace_hint(m.end(), std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple(2, 3.5));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == Emplaceable(2, 3.5));
+ }
+ {
+ typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.emplace_hint(m.end(), M::value_type(2, 3.5));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 3.5);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/map/map.modifiers/erase_iter.pass.cpp b/libcxx/test/std/containers/associative/map/map.modifiers/erase_iter.pass.cpp
index 4486ca65d306e39..9a0cf9bd21ceeec 100644
--- a/libcxx/test/std/containers/associative/map/map.modifiers/erase_iter.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.modifiers/erase_iter.pass.cpp
@@ -18,243 +18,239 @@
#include "test_macros.h"
#include "min_allocator.h"
-struct TemplateConstructor
-{
- template<typename T>
- TemplateConstructor (const T&) {}
+struct TemplateConstructor {
+ template <typename T>
+ TemplateConstructor(const T&) {}
};
bool operator<(const TemplateConstructor&, const TemplateConstructor&) { return false; }
-int main(int, char**)
-{
- {
- typedef std::map<int, double> M;
- typedef std::pair<int, double> P;
- typedef M::iterator I;
- P ar[] =
- {
- P(1, 1.5),
- P(2, 2.5),
- P(3, 3.5),
- P(4, 4.5),
- P(5, 5.5),
- P(6, 6.5),
- P(7, 7.5),
- P(8, 8.5),
- };
- M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
- assert(m.size() == 8);
- I i = m.erase(std::next(m.cbegin(), 3));
- assert(m.size() == 7);
- assert(i == std::next(m.begin(), 3));
- assert(m.begin()->first == 1);
- assert(m.begin()->second == 1.5);
- assert(std::next(m.begin())->first == 2);
- assert(std::next(m.begin())->second == 2.5);
- assert(std::next(m.begin(), 2)->first == 3);
- assert(std::next(m.begin(), 2)->second == 3.5);
- assert(std::next(m.begin(), 3)->first == 5);
- assert(std::next(m.begin(), 3)->second == 5.5);
- assert(std::next(m.begin(), 4)->first == 6);
- assert(std::next(m.begin(), 4)->second == 6.5);
- assert(std::next(m.begin(), 5)->first == 7);
- assert(std::next(m.begin(), 5)->second == 7.5);
- assert(std::next(m.begin(), 6)->first == 8);
- assert(std::next(m.begin(), 6)->second == 8.5);
+int main(int, char**) {
+ {
+ typedef std::map<int, double> M;
+ typedef std::pair<int, double> P;
+ typedef M::iterator I;
+ P ar[] = {
+ P(1, 1.5),
+ P(2, 2.5),
+ P(3, 3.5),
+ P(4, 4.5),
+ P(5, 5.5),
+ P(6, 6.5),
+ P(7, 7.5),
+ P(8, 8.5),
+ };
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(m.size() == 8);
+ I i = m.erase(std::next(m.cbegin(), 3));
+ assert(m.size() == 7);
+ assert(i == std::next(m.begin(), 3));
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == 1.5);
+ assert(std::next(m.begin())->first == 2);
+ assert(std::next(m.begin())->second == 2.5);
+ assert(std::next(m.begin(), 2)->first == 3);
+ assert(std::next(m.begin(), 2)->second == 3.5);
+ assert(std::next(m.begin(), 3)->first == 5);
+ assert(std::next(m.begin(), 3)->second == 5.5);
+ assert(std::next(m.begin(), 4)->first == 6);
+ assert(std::next(m.begin(), 4)->second == 6.5);
+ assert(std::next(m.begin(), 5)->first == 7);
+ assert(std::next(m.begin(), 5)->second == 7.5);
+ assert(std::next(m.begin(), 6)->first == 8);
+ assert(std::next(m.begin(), 6)->second == 8.5);
- i = m.erase(std::next(m.cbegin(), 0));
- assert(m.size() == 6);
- assert(i == m.begin());
- assert(m.begin()->first == 2);
- assert(m.begin()->second == 2.5);
- assert(std::next(m.begin())->first == 3);
- assert(std::next(m.begin())->second == 3.5);
- assert(std::next(m.begin(), 2)->first == 5);
- assert(std::next(m.begin(), 2)->second == 5.5);
- assert(std::next(m.begin(), 3)->first == 6);
- assert(std::next(m.begin(), 3)->second == 6.5);
- assert(std::next(m.begin(), 4)->first == 7);
- assert(std::next(m.begin(), 4)->second == 7.5);
- assert(std::next(m.begin(), 5)->first == 8);
- assert(std::next(m.begin(), 5)->second == 8.5);
+ i = m.erase(std::next(m.cbegin(), 0));
+ assert(m.size() == 6);
+ assert(i == m.begin());
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 2.5);
+ assert(std::next(m.begin())->first == 3);
+ assert(std::next(m.begin())->second == 3.5);
+ assert(std::next(m.begin(), 2)->first == 5);
+ assert(std::next(m.begin(), 2)->second == 5.5);
+ assert(std::next(m.begin(), 3)->first == 6);
+ assert(std::next(m.begin(), 3)->second == 6.5);
+ assert(std::next(m.begin(), 4)->first == 7);
+ assert(std::next(m.begin(), 4)->second == 7.5);
+ assert(std::next(m.begin(), 5)->first == 8);
+ assert(std::next(m.begin(), 5)->second == 8.5);
- i = m.erase(std::next(m.cbegin(), 5));
- assert(m.size() == 5);
- assert(i == m.end());
- assert(m.begin()->first == 2);
- assert(m.begin()->second == 2.5);
- assert(std::next(m.begin())->first == 3);
- assert(std::next(m.begin())->second == 3.5);
- assert(std::next(m.begin(), 2)->first == 5);
- assert(std::next(m.begin(), 2)->second == 5.5);
- assert(std::next(m.begin(), 3)->first == 6);
- assert(std::next(m.begin(), 3)->second == 6.5);
- assert(std::next(m.begin(), 4)->first == 7);
- assert(std::next(m.begin(), 4)->second == 7.5);
+ i = m.erase(std::next(m.cbegin(), 5));
+ assert(m.size() == 5);
+ assert(i == m.end());
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 2.5);
+ assert(std::next(m.begin())->first == 3);
+ assert(std::next(m.begin())->second == 3.5);
+ assert(std::next(m.begin(), 2)->first == 5);
+ assert(std::next(m.begin(), 2)->second == 5.5);
+ assert(std::next(m.begin(), 3)->first == 6);
+ assert(std::next(m.begin(), 3)->second == 6.5);
+ assert(std::next(m.begin(), 4)->first == 7);
+ assert(std::next(m.begin(), 4)->second == 7.5);
- i = m.erase(std::next(m.cbegin(), 1));
- assert(m.size() == 4);
- assert(i == std::next(m.begin()));
- assert(m.begin()->first == 2);
- assert(m.begin()->second == 2.5);
- assert(std::next(m.begin())->first == 5);
- assert(std::next(m.begin())->second == 5.5);
- assert(std::next(m.begin(), 2)->first == 6);
- assert(std::next(m.begin(), 2)->second == 6.5);
- assert(std::next(m.begin(), 3)->first == 7);
- assert(std::next(m.begin(), 3)->second == 7.5);
+ i = m.erase(std::next(m.cbegin(), 1));
+ assert(m.size() == 4);
+ assert(i == std::next(m.begin()));
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 2.5);
+ assert(std::next(m.begin())->first == 5);
+ assert(std::next(m.begin())->second == 5.5);
+ assert(std::next(m.begin(), 2)->first == 6);
+ assert(std::next(m.begin(), 2)->second == 6.5);
+ assert(std::next(m.begin(), 3)->first == 7);
+ assert(std::next(m.begin(), 3)->second == 7.5);
- i = m.erase(std::next(m.cbegin(), 2));
- assert(m.size() == 3);
- assert(i == std::next(m.begin(), 2));
- assert(m.begin()->first == 2);
- assert(m.begin()->second == 2.5);
- assert(std::next(m.begin())->first == 5);
- assert(std::next(m.begin())->second == 5.5);
- assert(std::next(m.begin(), 2)->first == 7);
- assert(std::next(m.begin(), 2)->second == 7.5);
+ i = m.erase(std::next(m.cbegin(), 2));
+ assert(m.size() == 3);
+ assert(i == std::next(m.begin(), 2));
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 2.5);
+ assert(std::next(m.begin())->first == 5);
+ assert(std::next(m.begin())->second == 5.5);
+ assert(std::next(m.begin(), 2)->first == 7);
+ assert(std::next(m.begin(), 2)->second == 7.5);
- i = m.erase(std::next(m.cbegin(), 2));
- assert(m.size() == 2);
- assert(i == std::next(m.begin(), 2));
- assert(m.begin()->first == 2);
- assert(m.begin()->second == 2.5);
- assert(std::next(m.begin())->first == 5);
- assert(std::next(m.begin())->second == 5.5);
+ i = m.erase(std::next(m.cbegin(), 2));
+ assert(m.size() == 2);
+ assert(i == std::next(m.begin(), 2));
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 2.5);
+ assert(std::next(m.begin())->first == 5);
+ assert(std::next(m.begin())->second == 5.5);
- i = m.erase(std::next(m.cbegin(), 0));
- assert(m.size() == 1);
- assert(i == std::next(m.begin(), 0));
- assert(m.begin()->first == 5);
- assert(m.begin()->second == 5.5);
+ i = m.erase(std::next(m.cbegin(), 0));
+ assert(m.size() == 1);
+ assert(i == std::next(m.begin(), 0));
+ assert(m.begin()->first == 5);
+ assert(m.begin()->second == 5.5);
- i = m.erase(m.cbegin());
- assert(m.size() == 0);
- assert(i == m.begin());
- assert(i == m.end());
- }
+ i = m.erase(m.cbegin());
+ assert(m.size() == 0);
+ assert(i == m.begin());
+ assert(i == m.end());
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
- typedef std::pair<int, double> P;
- typedef M::iterator I;
- P ar[] =
- {
- P(1, 1.5),
- P(2, 2.5),
- P(3, 3.5),
- P(4, 4.5),
- P(5, 5.5),
- P(6, 6.5),
- P(7, 7.5),
- P(8, 8.5),
- };
- M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
- assert(m.size() == 8);
- I i = m.erase(std::next(m.cbegin(), 3));
- assert(m.size() == 7);
- assert(i == std::next(m.begin(), 3));
- assert(m.begin()->first == 1);
- assert(m.begin()->second == 1.5);
- assert(std::next(m.begin())->first == 2);
- assert(std::next(m.begin())->second == 2.5);
- assert(std::next(m.begin(), 2)->first == 3);
- assert(std::next(m.begin(), 2)->second == 3.5);
- assert(std::next(m.begin(), 3)->first == 5);
- assert(std::next(m.begin(), 3)->second == 5.5);
- assert(std::next(m.begin(), 4)->first == 6);
- assert(std::next(m.begin(), 4)->second == 6.5);
- assert(std::next(m.begin(), 5)->first == 7);
- assert(std::next(m.begin(), 5)->second == 7.5);
- assert(std::next(m.begin(), 6)->first == 8);
- assert(std::next(m.begin(), 6)->second == 8.5);
+ {
+ typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef std::pair<int, double> P;
+ typedef M::iterator I;
+ P ar[] = {
+ P(1, 1.5),
+ P(2, 2.5),
+ P(3, 3.5),
+ P(4, 4.5),
+ P(5, 5.5),
+ P(6, 6.5),
+ P(7, 7.5),
+ P(8, 8.5),
+ };
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(m.size() == 8);
+ I i = m.erase(std::next(m.cbegin(), 3));
+ assert(m.size() == 7);
+ assert(i == std::next(m.begin(), 3));
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == 1.5);
+ assert(std::next(m.begin())->first == 2);
+ assert(std::next(m.begin())->second == 2.5);
+ assert(std::next(m.begin(), 2)->first == 3);
+ assert(std::next(m.begin(), 2)->second == 3.5);
+ assert(std::next(m.begin(), 3)->first == 5);
+ assert(std::next(m.begin(), 3)->second == 5.5);
+ assert(std::next(m.begin(), 4)->first == 6);
+ assert(std::next(m.begin(), 4)->second == 6.5);
+ assert(std::next(m.begin(), 5)->first == 7);
+ assert(std::next(m.begin(), 5)->second == 7.5);
+ assert(std::next(m.begin(), 6)->first == 8);
+ assert(std::next(m.begin(), 6)->second == 8.5);
- i = m.erase(std::next(m.cbegin(), 0));
- assert(m.size() == 6);
- assert(i == m.begin());
- assert(m.begin()->first == 2);
- assert(m.begin()->second == 2.5);
- assert(std::next(m.begin())->first == 3);
- assert(std::next(m.begin())->second == 3.5);
- assert(std::next(m.begin(), 2)->first == 5);
- assert(std::next(m.begin(), 2)->second == 5.5);
- assert(std::next(m.begin(), 3)->first == 6);
- assert(std::next(m.begin(), 3)->second == 6.5);
- assert(std::next(m.begin(), 4)->first == 7);
- assert(std::next(m.begin(), 4)->second == 7.5);
- assert(std::next(m.begin(), 5)->first == 8);
- assert(std::next(m.begin(), 5)->second == 8.5);
+ i = m.erase(std::next(m.cbegin(), 0));
+ assert(m.size() == 6);
+ assert(i == m.begin());
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 2.5);
+ assert(std::next(m.begin())->first == 3);
+ assert(std::next(m.begin())->second == 3.5);
+ assert(std::next(m.begin(), 2)->first == 5);
+ assert(std::next(m.begin(), 2)->second == 5.5);
+ assert(std::next(m.begin(), 3)->first == 6);
+ assert(std::next(m.begin(), 3)->second == 6.5);
+ assert(std::next(m.begin(), 4)->first == 7);
+ assert(std::next(m.begin(), 4)->second == 7.5);
+ assert(std::next(m.begin(), 5)->first == 8);
+ assert(std::next(m.begin(), 5)->second == 8.5);
- i = m.erase(std::next(m.cbegin(), 5));
- assert(m.size() == 5);
- assert(i == m.end());
- assert(m.begin()->first == 2);
- assert(m.begin()->second == 2.5);
- assert(std::next(m.begin())->first == 3);
- assert(std::next(m.begin())->second == 3.5);
- assert(std::next(m.begin(), 2)->first == 5);
- assert(std::next(m.begin(), 2)->second == 5.5);
- assert(std::next(m.begin(), 3)->first == 6);
- assert(std::next(m.begin(), 3)->second == 6.5);
- assert(std::next(m.begin(), 4)->first == 7);
- assert(std::next(m.begin(), 4)->second == 7.5);
+ i = m.erase(std::next(m.cbegin(), 5));
+ assert(m.size() == 5);
+ assert(i == m.end());
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 2.5);
+ assert(std::next(m.begin())->first == 3);
+ assert(std::next(m.begin())->second == 3.5);
+ assert(std::next(m.begin(), 2)->first == 5);
+ assert(std::next(m.begin(), 2)->second == 5.5);
+ assert(std::next(m.begin(), 3)->first == 6);
+ assert(std::next(m.begin(), 3)->second == 6.5);
+ assert(std::next(m.begin(), 4)->first == 7);
+ assert(std::next(m.begin(), 4)->second == 7.5);
- i = m.erase(std::next(m.cbegin(), 1));
- assert(m.size() == 4);
- assert(i == std::next(m.begin()));
- assert(m.begin()->first == 2);
- assert(m.begin()->second == 2.5);
- assert(std::next(m.begin())->first == 5);
- assert(std::next(m.begin())->second == 5.5);
- assert(std::next(m.begin(), 2)->first == 6);
- assert(std::next(m.begin(), 2)->second == 6.5);
- assert(std::next(m.begin(), 3)->first == 7);
- assert(std::next(m.begin(), 3)->second == 7.5);
+ i = m.erase(std::next(m.cbegin(), 1));
+ assert(m.size() == 4);
+ assert(i == std::next(m.begin()));
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 2.5);
+ assert(std::next(m.begin())->first == 5);
+ assert(std::next(m.begin())->second == 5.5);
+ assert(std::next(m.begin(), 2)->first == 6);
+ assert(std::next(m.begin(), 2)->second == 6.5);
+ assert(std::next(m.begin(), 3)->first == 7);
+ assert(std::next(m.begin(), 3)->second == 7.5);
- i = m.erase(std::next(m.cbegin(), 2));
- assert(m.size() == 3);
- assert(i == std::next(m.begin(), 2));
- assert(m.begin()->first == 2);
- assert(m.begin()->second == 2.5);
- assert(std::next(m.begin())->first == 5);
- assert(std::next(m.begin())->second == 5.5);
- assert(std::next(m.begin(), 2)->first == 7);
- assert(std::next(m.begin(), 2)->second == 7.5);
+ i = m.erase(std::next(m.cbegin(), 2));
+ assert(m.size() == 3);
+ assert(i == std::next(m.begin(), 2));
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 2.5);
+ assert(std::next(m.begin())->first == 5);
+ assert(std::next(m.begin())->second == 5.5);
+ assert(std::next(m.begin(), 2)->first == 7);
+ assert(std::next(m.begin(), 2)->second == 7.5);
- i = m.erase(std::next(m.cbegin(), 2));
- assert(m.size() == 2);
- assert(i == std::next(m.begin(), 2));
- assert(m.begin()->first == 2);
- assert(m.begin()->second == 2.5);
- assert(std::next(m.begin())->first == 5);
- assert(std::next(m.begin())->second == 5.5);
+ i = m.erase(std::next(m.cbegin(), 2));
+ assert(m.size() == 2);
+ assert(i == std::next(m.begin(), 2));
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 2.5);
+ assert(std::next(m.begin())->first == 5);
+ assert(std::next(m.begin())->second == 5.5);
- i = m.erase(std::next(m.cbegin(), 0));
- assert(m.size() == 1);
- assert(i == std::next(m.begin(), 0));
- assert(m.begin()->first == 5);
- assert(m.begin()->second == 5.5);
+ i = m.erase(std::next(m.cbegin(), 0));
+ assert(m.size() == 1);
+ assert(i == std::next(m.begin(), 0));
+ assert(m.begin()->first == 5);
+ assert(m.begin()->second == 5.5);
- i = m.erase(m.cbegin());
- assert(m.size() == 0);
- assert(i == m.begin());
- assert(i == m.end());
- }
+ i = m.erase(m.cbegin());
+ assert(m.size() == 0);
+ assert(i == m.begin());
+ assert(i == m.end());
+ }
#endif
#if TEST_STD_VER >= 14
- {
+ {
// This is LWG #2059
- typedef TemplateConstructor T;
- typedef std::map<T, int> C;
- typedef C::iterator I;
+ typedef TemplateConstructor T;
+ typedef std::map<T, int> C;
+ typedef C::iterator I;
- C c;
- T a{0};
- I it = c.find(a);
- if (it != c.end())
- c.erase(it);
- }
+ C c;
+ T a{0};
+ I it = c.find(a);
+ if (it != c.end())
+ c.erase(it);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/map/map.modifiers/erase_iter_iter.pass.cpp b/libcxx/test/std/containers/associative/map/map.modifiers/erase_iter_iter.pass.cpp
index 0189b1cfa1652fa..671f114951fc404 100644
--- a/libcxx/test/std/containers/associative/map/map.modifiers/erase_iter_iter.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.modifiers/erase_iter_iter.pass.cpp
@@ -18,141 +18,138 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::map<int, double> M;
- typedef std::pair<int, double> P;
- typedef M::iterator I;
- P ar[] =
- {
- P(1, 1.5),
- P(2, 2.5),
- P(3, 3.5),
- P(4, 4.5),
- P(5, 5.5),
- P(6, 6.5),
- P(7, 7.5),
- P(8, 8.5),
- };
- M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
- assert(m.size() == 8);
- I i = m.erase(m.cbegin(), m.cbegin());
- assert(m.size() == 8);
- assert(i == m.begin());
- assert(m.begin()->first == 1);
- assert(m.begin()->second == 1.5);
- assert(std::next(m.begin())->first == 2);
- assert(std::next(m.begin())->second == 2.5);
- assert(std::next(m.begin(), 2)->first == 3);
- assert(std::next(m.begin(), 2)->second == 3.5);
- assert(std::next(m.begin(), 3)->first == 4);
- assert(std::next(m.begin(), 3)->second == 4.5);
- assert(std::next(m.begin(), 4)->first == 5);
- assert(std::next(m.begin(), 4)->second == 5.5);
- assert(std::next(m.begin(), 5)->first == 6);
- assert(std::next(m.begin(), 5)->second == 6.5);
- assert(std::next(m.begin(), 6)->first == 7);
- assert(std::next(m.begin(), 6)->second == 7.5);
- assert(std::next(m.begin(), 7)->first == 8);
- assert(std::next(m.begin(), 7)->second == 8.5);
+int main(int, char**) {
+ {
+ typedef std::map<int, double> M;
+ typedef std::pair<int, double> P;
+ typedef M::iterator I;
+ P ar[] = {
+ P(1, 1.5),
+ P(2, 2.5),
+ P(3, 3.5),
+ P(4, 4.5),
+ P(5, 5.5),
+ P(6, 6.5),
+ P(7, 7.5),
+ P(8, 8.5),
+ };
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(m.size() == 8);
+ I i = m.erase(m.cbegin(), m.cbegin());
+ assert(m.size() == 8);
+ assert(i == m.begin());
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == 1.5);
+ assert(std::next(m.begin())->first == 2);
+ assert(std::next(m.begin())->second == 2.5);
+ assert(std::next(m.begin(), 2)->first == 3);
+ assert(std::next(m.begin(), 2)->second == 3.5);
+ assert(std::next(m.begin(), 3)->first == 4);
+ assert(std::next(m.begin(), 3)->second == 4.5);
+ assert(std::next(m.begin(), 4)->first == 5);
+ assert(std::next(m.begin(), 4)->second == 5.5);
+ assert(std::next(m.begin(), 5)->first == 6);
+ assert(std::next(m.begin(), 5)->second == 6.5);
+ assert(std::next(m.begin(), 6)->first == 7);
+ assert(std::next(m.begin(), 6)->second == 7.5);
+ assert(std::next(m.begin(), 7)->first == 8);
+ assert(std::next(m.begin(), 7)->second == 8.5);
- i = m.erase(m.cbegin(), std::next(m.cbegin(), 2));
- assert(m.size() == 6);
- assert(i == m.begin());
- assert(std::next(m.begin(), 0)->first == 3);
- assert(std::next(m.begin(), 0)->second == 3.5);
- assert(std::next(m.begin(), 1)->first == 4);
- assert(std::next(m.begin(), 1)->second == 4.5);
- assert(std::next(m.begin(), 2)->first == 5);
- assert(std::next(m.begin(), 2)->second == 5.5);
- assert(std::next(m.begin(), 3)->first == 6);
- assert(std::next(m.begin(), 3)->second == 6.5);
- assert(std::next(m.begin(), 4)->first == 7);
- assert(std::next(m.begin(), 4)->second == 7.5);
- assert(std::next(m.begin(), 5)->first == 8);
- assert(std::next(m.begin(), 5)->second == 8.5);
+ i = m.erase(m.cbegin(), std::next(m.cbegin(), 2));
+ assert(m.size() == 6);
+ assert(i == m.begin());
+ assert(std::next(m.begin(), 0)->first == 3);
+ assert(std::next(m.begin(), 0)->second == 3.5);
+ assert(std::next(m.begin(), 1)->first == 4);
+ assert(std::next(m.begin(), 1)->second == 4.5);
+ assert(std::next(m.begin(), 2)->first == 5);
+ assert(std::next(m.begin(), 2)->second == 5.5);
+ assert(std::next(m.begin(), 3)->first == 6);
+ assert(std::next(m.begin(), 3)->second == 6.5);
+ assert(std::next(m.begin(), 4)->first == 7);
+ assert(std::next(m.begin(), 4)->second == 7.5);
+ assert(std::next(m.begin(), 5)->first == 8);
+ assert(std::next(m.begin(), 5)->second == 8.5);
- i = m.erase(std::next(m.cbegin(), 2), std::next(m.cbegin(), 6));
- assert(m.size() == 2);
- assert(i == std::next(m.begin(), 2));
- assert(std::next(m.begin(), 0)->first == 3);
- assert(std::next(m.begin(), 0)->second == 3.5);
- assert(std::next(m.begin(), 1)->first == 4);
- assert(std::next(m.begin(), 1)->second == 4.5);
+ i = m.erase(std::next(m.cbegin(), 2), std::next(m.cbegin(), 6));
+ assert(m.size() == 2);
+ assert(i == std::next(m.begin(), 2));
+ assert(std::next(m.begin(), 0)->first == 3);
+ assert(std::next(m.begin(), 0)->second == 3.5);
+ assert(std::next(m.begin(), 1)->first == 4);
+ assert(std::next(m.begin(), 1)->second == 4.5);
- i = m.erase(m.cbegin(), m.cend());
- assert(m.size() == 0);
- assert(i == m.begin());
- assert(i == m.end());
- }
+ i = m.erase(m.cbegin(), m.cend());
+ assert(m.size() == 0);
+ assert(i == m.begin());
+ assert(i == m.end());
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
- typedef std::pair<int, double> P;
- typedef M::iterator I;
- P ar[] =
- {
- P(1, 1.5),
- P(2, 2.5),
- P(3, 3.5),
- P(4, 4.5),
- P(5, 5.5),
- P(6, 6.5),
- P(7, 7.5),
- P(8, 8.5),
- };
- M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
- assert(m.size() == 8);
- I i = m.erase(m.cbegin(), m.cbegin());
- assert(m.size() == 8);
- assert(i == m.begin());
- assert(m.begin()->first == 1);
- assert(m.begin()->second == 1.5);
- assert(std::next(m.begin())->first == 2);
- assert(std::next(m.begin())->second == 2.5);
- assert(std::next(m.begin(), 2)->first == 3);
- assert(std::next(m.begin(), 2)->second == 3.5);
- assert(std::next(m.begin(), 3)->first == 4);
- assert(std::next(m.begin(), 3)->second == 4.5);
- assert(std::next(m.begin(), 4)->first == 5);
- assert(std::next(m.begin(), 4)->second == 5.5);
- assert(std::next(m.begin(), 5)->first == 6);
- assert(std::next(m.begin(), 5)->second == 6.5);
- assert(std::next(m.begin(), 6)->first == 7);
- assert(std::next(m.begin(), 6)->second == 7.5);
- assert(std::next(m.begin(), 7)->first == 8);
- assert(std::next(m.begin(), 7)->second == 8.5);
+ {
+ typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef std::pair<int, double> P;
+ typedef M::iterator I;
+ P ar[] = {
+ P(1, 1.5),
+ P(2, 2.5),
+ P(3, 3.5),
+ P(4, 4.5),
+ P(5, 5.5),
+ P(6, 6.5),
+ P(7, 7.5),
+ P(8, 8.5),
+ };
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(m.size() == 8);
+ I i = m.erase(m.cbegin(), m.cbegin());
+ assert(m.size() == 8);
+ assert(i == m.begin());
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == 1.5);
+ assert(std::next(m.begin())->first == 2);
+ assert(std::next(m.begin())->second == 2.5);
+ assert(std::next(m.begin(), 2)->first == 3);
+ assert(std::next(m.begin(), 2)->second == 3.5);
+ assert(std::next(m.begin(), 3)->first == 4);
+ assert(std::next(m.begin(), 3)->second == 4.5);
+ assert(std::next(m.begin(), 4)->first == 5);
+ assert(std::next(m.begin(), 4)->second == 5.5);
+ assert(std::next(m.begin(), 5)->first == 6);
+ assert(std::next(m.begin(), 5)->second == 6.5);
+ assert(std::next(m.begin(), 6)->first == 7);
+ assert(std::next(m.begin(), 6)->second == 7.5);
+ assert(std::next(m.begin(), 7)->first == 8);
+ assert(std::next(m.begin(), 7)->second == 8.5);
- i = m.erase(m.cbegin(), std::next(m.cbegin(), 2));
- assert(m.size() == 6);
- assert(i == m.begin());
- assert(std::next(m.begin(), 0)->first == 3);
- assert(std::next(m.begin(), 0)->second == 3.5);
- assert(std::next(m.begin(), 1)->first == 4);
- assert(std::next(m.begin(), 1)->second == 4.5);
- assert(std::next(m.begin(), 2)->first == 5);
- assert(std::next(m.begin(), 2)->second == 5.5);
- assert(std::next(m.begin(), 3)->first == 6);
- assert(std::next(m.begin(), 3)->second == 6.5);
- assert(std::next(m.begin(), 4)->first == 7);
- assert(std::next(m.begin(), 4)->second == 7.5);
- assert(std::next(m.begin(), 5)->first == 8);
- assert(std::next(m.begin(), 5)->second == 8.5);
+ i = m.erase(m.cbegin(), std::next(m.cbegin(), 2));
+ assert(m.size() == 6);
+ assert(i == m.begin());
+ assert(std::next(m.begin(), 0)->first == 3);
+ assert(std::next(m.begin(), 0)->second == 3.5);
+ assert(std::next(m.begin(), 1)->first == 4);
+ assert(std::next(m.begin(), 1)->second == 4.5);
+ assert(std::next(m.begin(), 2)->first == 5);
+ assert(std::next(m.begin(), 2)->second == 5.5);
+ assert(std::next(m.begin(), 3)->first == 6);
+ assert(std::next(m.begin(), 3)->second == 6.5);
+ assert(std::next(m.begin(), 4)->first == 7);
+ assert(std::next(m.begin(), 4)->second == 7.5);
+ assert(std::next(m.begin(), 5)->first == 8);
+ assert(std::next(m.begin(), 5)->second == 8.5);
- i = m.erase(std::next(m.cbegin(), 2), std::next(m.cbegin(), 6));
- assert(m.size() == 2);
- assert(i == std::next(m.begin(), 2));
- assert(std::next(m.begin(), 0)->first == 3);
- assert(std::next(m.begin(), 0)->second == 3.5);
- assert(std::next(m.begin(), 1)->first == 4);
- assert(std::next(m.begin(), 1)->second == 4.5);
+ i = m.erase(std::next(m.cbegin(), 2), std::next(m.cbegin(), 6));
+ assert(m.size() == 2);
+ assert(i == std::next(m.begin(), 2));
+ assert(std::next(m.begin(), 0)->first == 3);
+ assert(std::next(m.begin(), 0)->second == 3.5);
+ assert(std::next(m.begin(), 1)->first == 4);
+ assert(std::next(m.begin(), 1)->second == 4.5);
- i = m.erase(m.cbegin(), m.cend());
- assert(m.size() == 0);
- assert(i == m.begin());
- assert(i == m.end());
- }
+ i = m.erase(m.cbegin(), m.cend());
+ assert(m.size() == 0);
+ assert(i == m.begin());
+ assert(i == m.end());
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/map/map.modifiers/erase_key.pass.cpp b/libcxx/test/std/containers/associative/map/map.modifiers/erase_key.pass.cpp
index 8a2bc9c37128c19..f276467d97029da 100644
--- a/libcxx/test/std/containers/associative/map/map.modifiers/erase_key.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.modifiers/erase_key.pass.cpp
@@ -18,259 +18,256 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::map<int, double> M;
- typedef std::pair<int, double> P;
- typedef M::size_type R;
- P ar[] =
- {
- P(1, 1.5),
- P(2, 2.5),
- P(3, 3.5),
- P(4, 4.5),
- P(5, 5.5),
- P(6, 6.5),
- P(7, 7.5),
- P(8, 8.5),
- };
- M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
- assert(m.size() == 8);
- R s = m.erase(9);
- assert(s == 0);
- assert(m.size() == 8);
- assert(m.begin()->first == 1);
- assert(m.begin()->second == 1.5);
- assert(std::next(m.begin())->first == 2);
- assert(std::next(m.begin())->second == 2.5);
- assert(std::next(m.begin(), 2)->first == 3);
- assert(std::next(m.begin(), 2)->second == 3.5);
- assert(std::next(m.begin(), 3)->first == 4);
- assert(std::next(m.begin(), 3)->second == 4.5);
- assert(std::next(m.begin(), 4)->first == 5);
- assert(std::next(m.begin(), 4)->second == 5.5);
- assert(std::next(m.begin(), 5)->first == 6);
- assert(std::next(m.begin(), 5)->second == 6.5);
- assert(std::next(m.begin(), 6)->first == 7);
- assert(std::next(m.begin(), 6)->second == 7.5);
- assert(std::next(m.begin(), 7)->first == 8);
- assert(std::next(m.begin(), 7)->second == 8.5);
+int main(int, char**) {
+ {
+ typedef std::map<int, double> M;
+ typedef std::pair<int, double> P;
+ typedef M::size_type R;
+ P ar[] = {
+ P(1, 1.5),
+ P(2, 2.5),
+ P(3, 3.5),
+ P(4, 4.5),
+ P(5, 5.5),
+ P(6, 6.5),
+ P(7, 7.5),
+ P(8, 8.5),
+ };
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(m.size() == 8);
+ R s = m.erase(9);
+ assert(s == 0);
+ assert(m.size() == 8);
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == 1.5);
+ assert(std::next(m.begin())->first == 2);
+ assert(std::next(m.begin())->second == 2.5);
+ assert(std::next(m.begin(), 2)->first == 3);
+ assert(std::next(m.begin(), 2)->second == 3.5);
+ assert(std::next(m.begin(), 3)->first == 4);
+ assert(std::next(m.begin(), 3)->second == 4.5);
+ assert(std::next(m.begin(), 4)->first == 5);
+ assert(std::next(m.begin(), 4)->second == 5.5);
+ assert(std::next(m.begin(), 5)->first == 6);
+ assert(std::next(m.begin(), 5)->second == 6.5);
+ assert(std::next(m.begin(), 6)->first == 7);
+ assert(std::next(m.begin(), 6)->second == 7.5);
+ assert(std::next(m.begin(), 7)->first == 8);
+ assert(std::next(m.begin(), 7)->second == 8.5);
- s = m.erase(4);
- assert(m.size() == 7);
- assert(s == 1);
- assert(m.begin()->first == 1);
- assert(m.begin()->second == 1.5);
- assert(std::next(m.begin())->first == 2);
- assert(std::next(m.begin())->second == 2.5);
- assert(std::next(m.begin(), 2)->first == 3);
- assert(std::next(m.begin(), 2)->second == 3.5);
- assert(std::next(m.begin(), 3)->first == 5);
- assert(std::next(m.begin(), 3)->second == 5.5);
- assert(std::next(m.begin(), 4)->first == 6);
- assert(std::next(m.begin(), 4)->second == 6.5);
- assert(std::next(m.begin(), 5)->first == 7);
- assert(std::next(m.begin(), 5)->second == 7.5);
- assert(std::next(m.begin(), 6)->first == 8);
- assert(std::next(m.begin(), 6)->second == 8.5);
+ s = m.erase(4);
+ assert(m.size() == 7);
+ assert(s == 1);
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == 1.5);
+ assert(std::next(m.begin())->first == 2);
+ assert(std::next(m.begin())->second == 2.5);
+ assert(std::next(m.begin(), 2)->first == 3);
+ assert(std::next(m.begin(), 2)->second == 3.5);
+ assert(std::next(m.begin(), 3)->first == 5);
+ assert(std::next(m.begin(), 3)->second == 5.5);
+ assert(std::next(m.begin(), 4)->first == 6);
+ assert(std::next(m.begin(), 4)->second == 6.5);
+ assert(std::next(m.begin(), 5)->first == 7);
+ assert(std::next(m.begin(), 5)->second == 7.5);
+ assert(std::next(m.begin(), 6)->first == 8);
+ assert(std::next(m.begin(), 6)->second == 8.5);
- s = m.erase(1);
- assert(m.size() == 6);
- assert(s == 1);
- assert(m.begin()->first == 2);
- assert(m.begin()->second == 2.5);
- assert(std::next(m.begin())->first == 3);
- assert(std::next(m.begin())->second == 3.5);
- assert(std::next(m.begin(), 2)->first == 5);
- assert(std::next(m.begin(), 2)->second == 5.5);
- assert(std::next(m.begin(), 3)->first == 6);
- assert(std::next(m.begin(), 3)->second == 6.5);
- assert(std::next(m.begin(), 4)->first == 7);
- assert(std::next(m.begin(), 4)->second == 7.5);
- assert(std::next(m.begin(), 5)->first == 8);
- assert(std::next(m.begin(), 5)->second == 8.5);
+ s = m.erase(1);
+ assert(m.size() == 6);
+ assert(s == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 2.5);
+ assert(std::next(m.begin())->first == 3);
+ assert(std::next(m.begin())->second == 3.5);
+ assert(std::next(m.begin(), 2)->first == 5);
+ assert(std::next(m.begin(), 2)->second == 5.5);
+ assert(std::next(m.begin(), 3)->first == 6);
+ assert(std::next(m.begin(), 3)->second == 6.5);
+ assert(std::next(m.begin(), 4)->first == 7);
+ assert(std::next(m.begin(), 4)->second == 7.5);
+ assert(std::next(m.begin(), 5)->first == 8);
+ assert(std::next(m.begin(), 5)->second == 8.5);
- s = m.erase(8);
- assert(m.size() == 5);
- assert(s == 1);
- assert(m.begin()->first == 2);
- assert(m.begin()->second == 2.5);
- assert(std::next(m.begin())->first == 3);
- assert(std::next(m.begin())->second == 3.5);
- assert(std::next(m.begin(), 2)->first == 5);
- assert(std::next(m.begin(), 2)->second == 5.5);
- assert(std::next(m.begin(), 3)->first == 6);
- assert(std::next(m.begin(), 3)->second == 6.5);
- assert(std::next(m.begin(), 4)->first == 7);
- assert(std::next(m.begin(), 4)->second == 7.5);
+ s = m.erase(8);
+ assert(m.size() == 5);
+ assert(s == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 2.5);
+ assert(std::next(m.begin())->first == 3);
+ assert(std::next(m.begin())->second == 3.5);
+ assert(std::next(m.begin(), 2)->first == 5);
+ assert(std::next(m.begin(), 2)->second == 5.5);
+ assert(std::next(m.begin(), 3)->first == 6);
+ assert(std::next(m.begin(), 3)->second == 6.5);
+ assert(std::next(m.begin(), 4)->first == 7);
+ assert(std::next(m.begin(), 4)->second == 7.5);
- s = m.erase(3);
- assert(m.size() == 4);
- assert(s == 1);
- assert(m.begin()->first == 2);
- assert(m.begin()->second == 2.5);
- assert(std::next(m.begin())->first == 5);
- assert(std::next(m.begin())->second == 5.5);
- assert(std::next(m.begin(), 2)->first == 6);
- assert(std::next(m.begin(), 2)->second == 6.5);
- assert(std::next(m.begin(), 3)->first == 7);
- assert(std::next(m.begin(), 3)->second == 7.5);
+ s = m.erase(3);
+ assert(m.size() == 4);
+ assert(s == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 2.5);
+ assert(std::next(m.begin())->first == 5);
+ assert(std::next(m.begin())->second == 5.5);
+ assert(std::next(m.begin(), 2)->first == 6);
+ assert(std::next(m.begin(), 2)->second == 6.5);
+ assert(std::next(m.begin(), 3)->first == 7);
+ assert(std::next(m.begin(), 3)->second == 7.5);
- s = m.erase(6);
- assert(m.size() == 3);
- assert(s == 1);
- assert(m.begin()->first == 2);
- assert(m.begin()->second == 2.5);
- assert(std::next(m.begin())->first == 5);
- assert(std::next(m.begin())->second == 5.5);
- assert(std::next(m.begin(), 2)->first == 7);
- assert(std::next(m.begin(), 2)->second == 7.5);
+ s = m.erase(6);
+ assert(m.size() == 3);
+ assert(s == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 2.5);
+ assert(std::next(m.begin())->first == 5);
+ assert(std::next(m.begin())->second == 5.5);
+ assert(std::next(m.begin(), 2)->first == 7);
+ assert(std::next(m.begin(), 2)->second == 7.5);
- s = m.erase(7);
- assert(m.size() == 2);
- assert(s == 1);
- assert(m.begin()->first == 2);
- assert(m.begin()->second == 2.5);
- assert(std::next(m.begin())->first == 5);
- assert(std::next(m.begin())->second == 5.5);
+ s = m.erase(7);
+ assert(m.size() == 2);
+ assert(s == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 2.5);
+ assert(std::next(m.begin())->first == 5);
+ assert(std::next(m.begin())->second == 5.5);
- s = m.erase(2);
- assert(m.size() == 1);
- assert(s == 1);
- assert(m.begin()->first == 5);
- assert(m.begin()->second == 5.5);
+ s = m.erase(2);
+ assert(m.size() == 1);
+ assert(s == 1);
+ assert(m.begin()->first == 5);
+ assert(m.begin()->second == 5.5);
- s = m.erase(5);
- assert(m.size() == 0);
- assert(s == 1);
- }
+ s = m.erase(5);
+ assert(m.size() == 0);
+ assert(s == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
- typedef std::pair<int, double> P;
- typedef M::size_type R;
- P ar[] =
- {
- P(1, 1.5),
- P(2, 2.5),
- P(3, 3.5),
- P(4, 4.5),
- P(5, 5.5),
- P(6, 6.5),
- P(7, 7.5),
- P(8, 8.5),
- };
- M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
- assert(m.size() == 8);
- R s = m.erase(9);
- assert(s == 0);
- assert(m.size() == 8);
- assert(m.begin()->first == 1);
- assert(m.begin()->second == 1.5);
- assert(std::next(m.begin())->first == 2);
- assert(std::next(m.begin())->second == 2.5);
- assert(std::next(m.begin(), 2)->first == 3);
- assert(std::next(m.begin(), 2)->second == 3.5);
- assert(std::next(m.begin(), 3)->first == 4);
- assert(std::next(m.begin(), 3)->second == 4.5);
- assert(std::next(m.begin(), 4)->first == 5);
- assert(std::next(m.begin(), 4)->second == 5.5);
- assert(std::next(m.begin(), 5)->first == 6);
- assert(std::next(m.begin(), 5)->second == 6.5);
- assert(std::next(m.begin(), 6)->first == 7);
- assert(std::next(m.begin(), 6)->second == 7.5);
- assert(std::next(m.begin(), 7)->first == 8);
- assert(std::next(m.begin(), 7)->second == 8.5);
+ {
+ typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef std::pair<int, double> P;
+ typedef M::size_type R;
+ P ar[] = {
+ P(1, 1.5),
+ P(2, 2.5),
+ P(3, 3.5),
+ P(4, 4.5),
+ P(5, 5.5),
+ P(6, 6.5),
+ P(7, 7.5),
+ P(8, 8.5),
+ };
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(m.size() == 8);
+ R s = m.erase(9);
+ assert(s == 0);
+ assert(m.size() == 8);
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == 1.5);
+ assert(std::next(m.begin())->first == 2);
+ assert(std::next(m.begin())->second == 2.5);
+ assert(std::next(m.begin(), 2)->first == 3);
+ assert(std::next(m.begin(), 2)->second == 3.5);
+ assert(std::next(m.begin(), 3)->first == 4);
+ assert(std::next(m.begin(), 3)->second == 4.5);
+ assert(std::next(m.begin(), 4)->first == 5);
+ assert(std::next(m.begin(), 4)->second == 5.5);
+ assert(std::next(m.begin(), 5)->first == 6);
+ assert(std::next(m.begin(), 5)->second == 6.5);
+ assert(std::next(m.begin(), 6)->first == 7);
+ assert(std::next(m.begin(), 6)->second == 7.5);
+ assert(std::next(m.begin(), 7)->first == 8);
+ assert(std::next(m.begin(), 7)->second == 8.5);
- s = m.erase(4);
- assert(m.size() == 7);
- assert(s == 1);
- assert(m.begin()->first == 1);
- assert(m.begin()->second == 1.5);
- assert(std::next(m.begin())->first == 2);
- assert(std::next(m.begin())->second == 2.5);
- assert(std::next(m.begin(), 2)->first == 3);
- assert(std::next(m.begin(), 2)->second == 3.5);
- assert(std::next(m.begin(), 3)->first == 5);
- assert(std::next(m.begin(), 3)->second == 5.5);
- assert(std::next(m.begin(), 4)->first == 6);
- assert(std::next(m.begin(), 4)->second == 6.5);
- assert(std::next(m.begin(), 5)->first == 7);
- assert(std::next(m.begin(), 5)->second == 7.5);
- assert(std::next(m.begin(), 6)->first == 8);
- assert(std::next(m.begin(), 6)->second == 8.5);
+ s = m.erase(4);
+ assert(m.size() == 7);
+ assert(s == 1);
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == 1.5);
+ assert(std::next(m.begin())->first == 2);
+ assert(std::next(m.begin())->second == 2.5);
+ assert(std::next(m.begin(), 2)->first == 3);
+ assert(std::next(m.begin(), 2)->second == 3.5);
+ assert(std::next(m.begin(), 3)->first == 5);
+ assert(std::next(m.begin(), 3)->second == 5.5);
+ assert(std::next(m.begin(), 4)->first == 6);
+ assert(std::next(m.begin(), 4)->second == 6.5);
+ assert(std::next(m.begin(), 5)->first == 7);
+ assert(std::next(m.begin(), 5)->second == 7.5);
+ assert(std::next(m.begin(), 6)->first == 8);
+ assert(std::next(m.begin(), 6)->second == 8.5);
- s = m.erase(1);
- assert(m.size() == 6);
- assert(s == 1);
- assert(m.begin()->first == 2);
- assert(m.begin()->second == 2.5);
- assert(std::next(m.begin())->first == 3);
- assert(std::next(m.begin())->second == 3.5);
- assert(std::next(m.begin(), 2)->first == 5);
- assert(std::next(m.begin(), 2)->second == 5.5);
- assert(std::next(m.begin(), 3)->first == 6);
- assert(std::next(m.begin(), 3)->second == 6.5);
- assert(std::next(m.begin(), 4)->first == 7);
- assert(std::next(m.begin(), 4)->second == 7.5);
- assert(std::next(m.begin(), 5)->first == 8);
- assert(std::next(m.begin(), 5)->second == 8.5);
+ s = m.erase(1);
+ assert(m.size() == 6);
+ assert(s == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 2.5);
+ assert(std::next(m.begin())->first == 3);
+ assert(std::next(m.begin())->second == 3.5);
+ assert(std::next(m.begin(), 2)->first == 5);
+ assert(std::next(m.begin(), 2)->second == 5.5);
+ assert(std::next(m.begin(), 3)->first == 6);
+ assert(std::next(m.begin(), 3)->second == 6.5);
+ assert(std::next(m.begin(), 4)->first == 7);
+ assert(std::next(m.begin(), 4)->second == 7.5);
+ assert(std::next(m.begin(), 5)->first == 8);
+ assert(std::next(m.begin(), 5)->second == 8.5);
- s = m.erase(8);
- assert(m.size() == 5);
- assert(s == 1);
- assert(m.begin()->first == 2);
- assert(m.begin()->second == 2.5);
- assert(std::next(m.begin())->first == 3);
- assert(std::next(m.begin())->second == 3.5);
- assert(std::next(m.begin(), 2)->first == 5);
- assert(std::next(m.begin(), 2)->second == 5.5);
- assert(std::next(m.begin(), 3)->first == 6);
- assert(std::next(m.begin(), 3)->second == 6.5);
- assert(std::next(m.begin(), 4)->first == 7);
- assert(std::next(m.begin(), 4)->second == 7.5);
+ s = m.erase(8);
+ assert(m.size() == 5);
+ assert(s == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 2.5);
+ assert(std::next(m.begin())->first == 3);
+ assert(std::next(m.begin())->second == 3.5);
+ assert(std::next(m.begin(), 2)->first == 5);
+ assert(std::next(m.begin(), 2)->second == 5.5);
+ assert(std::next(m.begin(), 3)->first == 6);
+ assert(std::next(m.begin(), 3)->second == 6.5);
+ assert(std::next(m.begin(), 4)->first == 7);
+ assert(std::next(m.begin(), 4)->second == 7.5);
- s = m.erase(3);
- assert(m.size() == 4);
- assert(s == 1);
- assert(m.begin()->first == 2);
- assert(m.begin()->second == 2.5);
- assert(std::next(m.begin())->first == 5);
- assert(std::next(m.begin())->second == 5.5);
- assert(std::next(m.begin(), 2)->first == 6);
- assert(std::next(m.begin(), 2)->second == 6.5);
- assert(std::next(m.begin(), 3)->first == 7);
- assert(std::next(m.begin(), 3)->second == 7.5);
+ s = m.erase(3);
+ assert(m.size() == 4);
+ assert(s == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 2.5);
+ assert(std::next(m.begin())->first == 5);
+ assert(std::next(m.begin())->second == 5.5);
+ assert(std::next(m.begin(), 2)->first == 6);
+ assert(std::next(m.begin(), 2)->second == 6.5);
+ assert(std::next(m.begin(), 3)->first == 7);
+ assert(std::next(m.begin(), 3)->second == 7.5);
- s = m.erase(6);
- assert(m.size() == 3);
- assert(s == 1);
- assert(m.begin()->first == 2);
- assert(m.begin()->second == 2.5);
- assert(std::next(m.begin())->first == 5);
- assert(std::next(m.begin())->second == 5.5);
- assert(std::next(m.begin(), 2)->first == 7);
- assert(std::next(m.begin(), 2)->second == 7.5);
+ s = m.erase(6);
+ assert(m.size() == 3);
+ assert(s == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 2.5);
+ assert(std::next(m.begin())->first == 5);
+ assert(std::next(m.begin())->second == 5.5);
+ assert(std::next(m.begin(), 2)->first == 7);
+ assert(std::next(m.begin(), 2)->second == 7.5);
- s = m.erase(7);
- assert(m.size() == 2);
- assert(s == 1);
- assert(m.begin()->first == 2);
- assert(m.begin()->second == 2.5);
- assert(std::next(m.begin())->first == 5);
- assert(std::next(m.begin())->second == 5.5);
+ s = m.erase(7);
+ assert(m.size() == 2);
+ assert(s == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 2.5);
+ assert(std::next(m.begin())->first == 5);
+ assert(std::next(m.begin())->second == 5.5);
- s = m.erase(2);
- assert(m.size() == 1);
- assert(s == 1);
- assert(m.begin()->first == 5);
- assert(m.begin()->second == 5.5);
+ s = m.erase(2);
+ assert(m.size() == 1);
+ assert(s == 1);
+ assert(m.begin()->first == 5);
+ assert(m.begin()->second == 5.5);
- s = m.erase(5);
- assert(m.size() == 0);
- assert(s == 1);
- }
+ s = m.erase(5);
+ assert(m.size() == 0);
+ assert(s == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/map/map.modifiers/extract_iterator.pass.cpp b/libcxx/test/std/containers/associative/map/map.modifiers/extract_iterator.pass.cpp
index 6cdfac774a2c3a8..db360cb8fe7013b 100644
--- a/libcxx/test/std/containers/associative/map/map.modifiers/extract_iterator.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.modifiers/extract_iterator.pass.cpp
@@ -20,50 +20,44 @@
#include "Counter.h"
template <class Container>
-void test(Container& c)
-{
- std::size_t sz = c.size();
-
- auto some_key = c.cbegin()->first;
-
- for (auto first = c.cbegin(); first != c.cend();)
- {
- auto key_value = first->first;
- typename Container::node_type t = c.extract(first++);
- --sz;
- assert(t.key() == key_value);
- t.key() = some_key;
- assert(t.key() == some_key);
- assert(t.get_allocator() == c.get_allocator());
- assert(sz == c.size());
- }
-
- assert(c.size() == 0);
+void test(Container& c) {
+ std::size_t sz = c.size();
+
+ auto some_key = c.cbegin()->first;
+
+ for (auto first = c.cbegin(); first != c.cend();) {
+ auto key_value = first->first;
+ typename Container::node_type t = c.extract(first++);
+ --sz;
+ assert(t.key() == key_value);
+ t.key() = some_key;
+ assert(t.key() == some_key);
+ assert(t.get_allocator() == c.get_allocator());
+ assert(sz == c.size());
+ }
+
+ assert(c.size() == 0);
}
-int main(int, char**)
-{
- {
- using map_type = std::map<int, int>;
- map_type m = {{1,1}, {2,2}, {3,3}, {4,4}, {5,5}, {6,6}};
- test(m);
- }
-
- {
- std::map<Counter<int>, Counter<int>> m =
- {{1,1}, {2,2}, {3,3}, {4,4}, {5,5}, {6,6}};
- assert(Counter_base::gConstructed == 12);
- test(m);
- assert(Counter_base::gConstructed == 0);
- }
-
- {
- using min_alloc_map =
- std::map<int, int, std::less<int>,
- min_allocator<std::pair<const int, int>>>;
- min_alloc_map m = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}};
- test(m);
- }
+int main(int, char**) {
+ {
+ using map_type = std::map<int, int>;
+ map_type m = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}};
+ test(m);
+ }
+
+ {
+ std::map<Counter<int>, Counter<int>> m = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}};
+ assert(Counter_base::gConstructed == 12);
+ test(m);
+ assert(Counter_base::gConstructed == 0);
+ }
+
+ {
+ using min_alloc_map = std::map<int, int, std::less<int>, min_allocator<std::pair<const int, int>>>;
+ min_alloc_map m = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}};
+ test(m);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/map/map.modifiers/extract_key.pass.cpp b/libcxx/test/std/containers/associative/map/map.modifiers/extract_key.pass.cpp
index c0ffa343497e2ec..7ad9558c90c079c 100644
--- a/libcxx/test/std/containers/associative/map/map.modifiers/extract_key.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.modifiers/extract_key.pass.cpp
@@ -20,59 +20,52 @@
#include "Counter.h"
template <class Container, class KeyTypeIter>
-void test(Container& c, KeyTypeIter first, KeyTypeIter last)
-{
- std::size_t sz = c.size();
- assert((std::size_t)std::distance(first, last) == sz);
+void test(Container& c, KeyTypeIter first, KeyTypeIter last) {
+ std::size_t sz = c.size();
+ assert((std::size_t)std::distance(first, last) == sz);
- for (KeyTypeIter copy = first; copy != last; ++copy)
- {
- typename Container::node_type t = c.extract(*copy);
- assert(!t.empty());
- --sz;
- assert(t.key() == *copy);
- t.key() = *first; // We should be able to mutate key.
- assert(t.key() == *first);
- assert(t.get_allocator() == c.get_allocator());
- assert(sz == c.size());
- }
+ for (KeyTypeIter copy = first; copy != last; ++copy) {
+ typename Container::node_type t = c.extract(*copy);
+ assert(!t.empty());
+ --sz;
+ assert(t.key() == *copy);
+ t.key() = *first; // We should be able to mutate key.
+ assert(t.key() == *first);
+ assert(t.get_allocator() == c.get_allocator());
+ assert(sz == c.size());
+ }
- assert(c.size() == 0);
+ assert(c.size() == 0);
- for (KeyTypeIter copy = first; copy != last; ++copy)
- {
- typename Container::node_type t = c.extract(*copy);
- assert(t.empty());
- }
+ for (KeyTypeIter copy = first; copy != last; ++copy) {
+ typename Container::node_type t = c.extract(*copy);
+ assert(t.empty());
+ }
}
-int main(int, char**)
-{
- {
- std::map<int, int> m = {{1,1}, {2,2}, {3,3}, {4,4}, {5,5}, {6,6}};
- int keys[] = {1, 2, 3, 4, 5, 6};
- test(m, std::begin(keys), std::end(keys));
- }
+int main(int, char**) {
+ {
+ std::map<int, int> m = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}};
+ int keys[] = {1, 2, 3, 4, 5, 6};
+ test(m, std::begin(keys), std::end(keys));
+ }
+ {
+ std::map<Counter<int>, Counter<int>> m = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}};
{
- std::map<Counter<int>, Counter<int>> m =
- {{1,1}, {2,2}, {3,3}, {4,4}, {5,5}, {6,6}};
- {
- Counter<int> keys[] = {1, 2, 3, 4, 5, 6};
- assert(Counter_base::gConstructed == 12+6);
- test(m, std::begin(keys), std::end(keys));
- }
- assert(Counter_base::gConstructed == 0);
+ Counter<int> keys[] = {1, 2, 3, 4, 5, 6};
+ assert(Counter_base::gConstructed == 12 + 6);
+ test(m, std::begin(keys), std::end(keys));
}
+ assert(Counter_base::gConstructed == 0);
+ }
- {
- using min_alloc_map =
- std::map<int, int, std::less<int>,
- min_allocator<std::pair<const int, int>>>;
- min_alloc_map m = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}};
- int keys[] = {1, 2, 3, 4, 5, 6};
- test(m, std::begin(keys), std::end(keys));
- }
+ {
+ using min_alloc_map = std::map<int, int, std::less<int>, min_allocator<std::pair<const int, int>>>;
+ min_alloc_map m = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}};
+ int keys[] = {1, 2, 3, 4, 5, 6};
+ test(m, std::begin(keys), std::end(keys));
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/map/map.modifiers/insert_and_emplace_allocator_requirements.pass.cpp b/libcxx/test/std/containers/associative/map/map.modifiers/insert_and_emplace_allocator_requirements.pass.cpp
index fb1251c7fb58cbc..5dfd415e4382e6b 100644
--- a/libcxx/test/std/containers/associative/map/map.modifiers/insert_and_emplace_allocator_requirements.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.modifiers/insert_and_emplace_allocator_requirements.pass.cpp
@@ -22,8 +22,7 @@
#include "container_test_types.h"
#include "../../../map_allocator_requirement_test_templates.h"
-int main(int, char**)
-{
+int main(int, char**) {
testMapInsert<TCT::map<> >();
testMapInsertHint<TCT::map<> >();
testMapEmplace<TCT::map<> >();
diff --git a/libcxx/test/std/containers/associative/map/map.modifiers/insert_cv.pass.cpp b/libcxx/test/std/containers/associative/map/map.modifiers/insert_cv.pass.cpp
index a2436440f194725..e845461cfbf3119 100644
--- a/libcxx/test/std/containers/associative/map/map.modifiers/insert_cv.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.modifiers/insert_cv.pass.cpp
@@ -19,54 +19,52 @@
#include "min_allocator.h"
template <class Container>
-void do_insert_cv_test()
-{
- typedef Container M;
- typedef std::pair<typename M::iterator, bool> R;
- typedef typename M::value_type VT;
- M m;
+void do_insert_cv_test() {
+ typedef Container M;
+ typedef std::pair<typename M::iterator, bool> R;
+ typedef typename M::value_type VT;
+ M m;
- const VT v1(2, 2.5);
- R r = m.insert(v1);
- assert(r.second);
- assert(r.first == m.begin());
- assert(m.size() == 1);
- assert(r.first->first == 2);
- assert(r.first->second == 2.5);
+ const VT v1(2, 2.5);
+ R r = m.insert(v1);
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 1);
+ assert(r.first->first == 2);
+ assert(r.first->second == 2.5);
- const VT v2(1, 1.5);
- r = m.insert(v2);
- assert(r.second);
- assert(r.first == m.begin());
- assert(m.size() == 2);
- assert(r.first->first == 1);
- assert(r.first->second == 1.5);
+ const VT v2(1, 1.5);
+ r = m.insert(v2);
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 2);
+ assert(r.first->first == 1);
+ assert(r.first->second == 1.5);
- const VT v3(3, 3.5);
- r = m.insert(v3);
- assert(r.second);
- assert(r.first == std::prev(m.end()));
- assert(m.size() == 3);
- assert(r.first->first == 3);
- assert(r.first->second == 3.5);
+ const VT v3(3, 3.5);
+ r = m.insert(v3);
+ assert(r.second);
+ assert(r.first == std::prev(m.end()));
+ assert(m.size() == 3);
+ assert(r.first->first == 3);
+ assert(r.first->second == 3.5);
- const VT v4(3, 4.5);
- r = m.insert(v4);
- assert(!r.second);
- assert(r.first == std::prev(m.end()));
- assert(m.size() == 3);
- assert(r.first->first == 3);
- assert(r.first->second == 3.5);
+ const VT v4(3, 4.5);
+ r = m.insert(v4);
+ assert(!r.second);
+ assert(r.first == std::prev(m.end()));
+ assert(m.size() == 3);
+ assert(r.first->first == 3);
+ assert(r.first->second == 3.5);
}
-int main(int, char**)
-{
- do_insert_cv_test<std::map<int, double> >();
+int main(int, char**) {
+ do_insert_cv_test<std::map<int, double> >();
#if TEST_STD_VER >= 11
- {
- typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
- do_insert_cv_test<M>();
- }
+ {
+ typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ do_insert_cv_test<M>();
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/map/map.modifiers/insert_initializer_list.pass.cpp b/libcxx/test/std/containers/associative/map/map.modifiers/insert_initializer_list.pass.cpp
index 313e461560fb94e..1f6e5c6371a115a 100644
--- a/libcxx/test/std/containers/associative/map/map.modifiers/insert_initializer_list.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.modifiers/insert_initializer_list.pass.cpp
@@ -20,52 +20,35 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::pair<const int, double> V;
- std::map<int, double> m =
- {
- {1, 1},
- {1, 1.5},
- {1, 2},
- {3, 1},
- {3, 1.5},
- {3, 2}
- };
+ std::map<int, double> m = {{1, 1}, {1, 1.5}, {1, 2}, {3, 1}, {3, 1.5}, {3, 2}};
m.insert({
- {2, 1},
- {2, 1.5},
- {2, 2},
- });
+ {2, 1},
+ {2, 1.5},
+ {2, 2},
+ });
assert(m.size() == 3);
assert(std::distance(m.begin(), m.end()) == 3);
assert(*m.begin() == V(1, 1));
assert(*std::next(m.begin()) == V(2, 1));
assert(*std::next(m.begin(), 2) == V(3, 1));
- }
- {
+ }
+ {
typedef std::pair<const int, double> V;
- std::map<int, double, std::less<int>, min_allocator<V>> m =
- {
- {1, 1},
- {1, 1.5},
- {1, 2},
- {3, 1},
- {3, 1.5},
- {3, 2}
- };
+ std::map<int, double, std::less<int>, min_allocator<V>> m = {{1, 1}, {1, 1.5}, {1, 2}, {3, 1}, {3, 1.5}, {3, 2}};
m.insert({
- {2, 1},
- {2, 1.5},
- {2, 2},
- });
+ {2, 1},
+ {2, 1.5},
+ {2, 2},
+ });
assert(m.size() == 3);
assert(std::distance(m.begin(), m.end()) == 3);
assert(*m.begin() == V(1, 1));
assert(*std::next(m.begin()) == V(2, 1));
assert(*std::next(m.begin(), 2) == V(3, 1));
- }
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/map/map.modifiers/insert_iter_cv.pass.cpp b/libcxx/test/std/containers/associative/map/map.modifiers/insert_iter_cv.pass.cpp
index 6260fd9d93e9b89..5256ca2c8d45176 100644
--- a/libcxx/test/std/containers/associative/map/map.modifiers/insert_iter_cv.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.modifiers/insert_iter_cv.pass.cpp
@@ -19,50 +19,48 @@
#include "min_allocator.h"
template <class Container>
-void do_insert_iter_cv_test()
-{
- typedef Container M;
- typedef typename M::iterator R;
- typedef typename M::value_type VT;
+void do_insert_iter_cv_test() {
+ typedef Container M;
+ typedef typename M::iterator R;
+ typedef typename M::value_type VT;
- M m;
- const VT v1(2, 2.5);
- R r = m.insert(m.end(), v1);
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(r->first == 2);
- assert(r->second == 2.5);
+ M m;
+ const VT v1(2, 2.5);
+ R r = m.insert(m.end(), v1);
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(r->first == 2);
+ assert(r->second == 2.5);
- const VT v2(1, 1.5);
- r = m.insert(m.end(), v2);
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(r->first == 1);
- assert(r->second == 1.5);
+ const VT v2(1, 1.5);
+ r = m.insert(m.end(), v2);
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(r->first == 1);
+ assert(r->second == 1.5);
- const VT v3(3, 3.5);
- r = m.insert(m.end(), v3);
- assert(r == std::prev(m.end()));
- assert(m.size() == 3);
- assert(r->first == 3);
- assert(r->second == 3.5);
+ const VT v3(3, 3.5);
+ r = m.insert(m.end(), v3);
+ assert(r == std::prev(m.end()));
+ assert(m.size() == 3);
+ assert(r->first == 3);
+ assert(r->second == 3.5);
- const VT v4(3, 4.5);
- r = m.insert(m.end(), v4);
- assert(r == std::prev(m.end()));
- assert(m.size() == 3);
- assert(r->first == 3);
- assert(r->second == 3.5);
+ const VT v4(3, 4.5);
+ r = m.insert(m.end(), v4);
+ assert(r == std::prev(m.end()));
+ assert(m.size() == 3);
+ assert(r->first == 3);
+ assert(r->second == 3.5);
}
-int main(int, char**)
-{
- do_insert_iter_cv_test<std::map<int, double> >();
+int main(int, char**) {
+ do_insert_iter_cv_test<std::map<int, double> >();
#if TEST_STD_VER >= 11
- {
- typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
- do_insert_iter_cv_test<M>();
- }
+ {
+ typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ do_insert_iter_cv_test<M>();
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/map/map.modifiers/insert_iter_iter.pass.cpp b/libcxx/test/std/containers/associative/map/map.modifiers/insert_iter_iter.pass.cpp
index b2b2ad155dd9eb8..0baff65f619384b 100644
--- a/libcxx/test/std/containers/associative/map/map.modifiers/insert_iter_iter.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.modifiers/insert_iter_iter.pass.cpp
@@ -20,59 +20,56 @@
#include "test_iterators.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::map<int, double> M;
- typedef std::pair<int, double> P;
- P ar[] =
- {
- P(1, 1),
- P(1, 1.5),
- P(1, 2),
- P(2, 1),
- P(2, 1.5),
- P(2, 2),
- P(3, 1),
- P(3, 1.5),
- P(3, 2),
- };
- M m;
- m.insert(cpp17_input_iterator<P*>(ar), cpp17_input_iterator<P*>(ar + sizeof(ar)/sizeof(ar[0])));
- assert(m.size() == 3);
- assert(m.begin()->first == 1);
- assert(m.begin()->second == 1);
- assert(std::next(m.begin())->first == 2);
- assert(std::next(m.begin())->second == 1);
- assert(std::next(m.begin(), 2)->first == 3);
- assert(std::next(m.begin(), 2)->second == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::map<int, double> M;
+ typedef std::pair<int, double> P;
+ P ar[] = {
+ P(1, 1),
+ P(1, 1.5),
+ P(1, 2),
+ P(2, 1),
+ P(2, 1.5),
+ P(2, 2),
+ P(3, 1),
+ P(3, 1.5),
+ P(3, 2),
+ };
+ M m;
+ m.insert(cpp17_input_iterator<P*>(ar), cpp17_input_iterator<P*>(ar + sizeof(ar) / sizeof(ar[0])));
+ assert(m.size() == 3);
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == 1);
+ assert(std::next(m.begin())->first == 2);
+ assert(std::next(m.begin())->second == 1);
+ assert(std::next(m.begin(), 2)->first == 3);
+ assert(std::next(m.begin(), 2)->second == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
- typedef std::pair<int, double> P;
- P ar[] =
- {
- P(1, 1),
- P(1, 1.5),
- P(1, 2),
- P(2, 1),
- P(2, 1.5),
- P(2, 2),
- P(3, 1),
- P(3, 1.5),
- P(3, 2),
- };
- M m;
- m.insert(cpp17_input_iterator<P*>(ar), cpp17_input_iterator<P*>(ar + sizeof(ar)/sizeof(ar[0])));
- assert(m.size() == 3);
- assert(m.begin()->first == 1);
- assert(m.begin()->second == 1);
- assert(std::next(m.begin())->first == 2);
- assert(std::next(m.begin())->second == 1);
- assert(std::next(m.begin(), 2)->first == 3);
- assert(std::next(m.begin(), 2)->second == 1);
- }
+ {
+ typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef std::pair<int, double> P;
+ P ar[] = {
+ P(1, 1),
+ P(1, 1.5),
+ P(1, 2),
+ P(2, 1),
+ P(2, 1.5),
+ P(2, 2),
+ P(3, 1),
+ P(3, 1.5),
+ P(3, 2),
+ };
+ M m;
+ m.insert(cpp17_input_iterator<P*>(ar), cpp17_input_iterator<P*>(ar + sizeof(ar) / sizeof(ar[0])));
+ assert(m.size() == 3);
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == 1);
+ assert(std::next(m.begin())->first == 2);
+ assert(std::next(m.begin())->second == 1);
+ assert(std::next(m.begin(), 2)->first == 3);
+ assert(std::next(m.begin(), 2)->second == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/map/map.modifiers/insert_iter_rv.pass.cpp b/libcxx/test/std/containers/associative/map/map.modifiers/insert_iter_rv.pass.cpp
index 443271d5b4739b3..5d72bae39bad1d6 100644
--- a/libcxx/test/std/containers/associative/map/map.modifiers/insert_iter_rv.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.modifiers/insert_iter_rv.pass.cpp
@@ -23,77 +23,74 @@
#include "test_macros.h"
template <class Container, class Pair>
-void do_insert_iter_rv_test()
-{
- typedef Container M;
- typedef Pair P;
- typedef typename M::iterator R;
+void do_insert_iter_rv_test() {
+ typedef Container M;
+ typedef Pair P;
+ typedef typename M::iterator R;
+ M m;
+ R r = m.insert(m.end(), P(2, 2));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(r->first == 2);
+ assert(r->second == 2);
+
+ r = m.insert(m.end(), P(1, 1));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(r->first == 1);
+ assert(r->second == 1);
+
+ r = m.insert(m.end(), P(3, 3));
+ assert(r == std::prev(m.end()));
+ assert(m.size() == 3);
+ assert(r->first == 3);
+ assert(r->second == 3);
+
+ r = m.insert(m.end(), P(3, 4));
+ assert(r == std::prev(m.end()));
+ assert(m.size() == 3);
+ assert(r->first == 3);
+ assert(r->second == 3);
+}
+int main(int, char**) {
+ do_insert_iter_rv_test<std::map<int, MoveOnly>, std::pair<int, MoveOnly>>();
+ do_insert_iter_rv_test<std::map<int, MoveOnly>, std::pair<const int, MoveOnly>>();
+
+ {
+ typedef std::map<int, MoveOnly, std::less<int>, min_allocator<std::pair<const int, MoveOnly>>> M;
+ typedef std::pair<int, MoveOnly> P;
+ typedef std::pair<const int, MoveOnly> CP;
+ do_insert_iter_rv_test<M, P>();
+ do_insert_iter_rv_test<M, CP>();
+ }
+ {
+ typedef std::map<int, MoveOnly> M;
+ typedef M::iterator R;
M m;
- R r = m.insert(m.end(), P(2, 2));
+ R r = m.insert(m.end(), {2, MoveOnly(2)});
assert(r == m.begin());
assert(m.size() == 1);
assert(r->first == 2);
assert(r->second == 2);
- r = m.insert(m.end(), P(1, 1));
+ r = m.insert(m.end(), {1, MoveOnly(1)});
assert(r == m.begin());
assert(m.size() == 2);
assert(r->first == 1);
assert(r->second == 1);
- r = m.insert(m.end(), P(3, 3));
+ r = m.insert(m.end(), {3, MoveOnly(3)});
assert(r == std::prev(m.end()));
assert(m.size() == 3);
assert(r->first == 3);
assert(r->second == 3);
- r = m.insert(m.end(), P(3, 4));
+ r = m.insert(m.end(), {3, MoveOnly(3)});
assert(r == std::prev(m.end()));
assert(m.size() == 3);
assert(r->first == 3);
assert(r->second == 3);
-}
-int main(int, char**)
-{
- do_insert_iter_rv_test<std::map<int, MoveOnly>, std::pair<int, MoveOnly>>();
- do_insert_iter_rv_test<std::map<int, MoveOnly>, std::pair<const int, MoveOnly>>();
-
- {
- typedef std::map<int, MoveOnly, std::less<int>, min_allocator<std::pair<const int, MoveOnly>>> M;
- typedef std::pair<int, MoveOnly> P;
- typedef std::pair<const int, MoveOnly> CP;
- do_insert_iter_rv_test<M, P>();
- do_insert_iter_rv_test<M, CP>();
- }
- {
- typedef std::map<int, MoveOnly> M;
- typedef M::iterator R;
- M m;
- R r = m.insert(m.end(), {2, MoveOnly(2)});
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(r->first == 2);
- assert(r->second == 2);
-
- r = m.insert(m.end(), {1, MoveOnly(1)});
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(r->first == 1);
- assert(r->second == 1);
-
- r = m.insert(m.end(), {3, MoveOnly(3)});
- assert(r == std::prev(m.end()));
- assert(m.size() == 3);
- assert(r->first == 3);
- assert(r->second == 3);
-
- r = m.insert(m.end(), {3, MoveOnly(3)});
- assert(r == std::prev(m.end()));
- assert(m.size() == 3);
- assert(r->first == 3);
- assert(r->second == 3);
- }
-
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/map/map.modifiers/insert_node_type.pass.cpp b/libcxx/test/std/containers/associative/map/map.modifiers/insert_node_type.pass.cpp
index 5d910bc3368beda..1875c3635d9d2b0 100644
--- a/libcxx/test/std/containers/associative/map/map.modifiers/insert_node_type.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.modifiers/insert_node_type.pass.cpp
@@ -43,70 +43,64 @@ void verify_insert_return_type(T&& t) {
template <class Container>
typename Container::node_type
-node_factory(typename Container::key_type const& key,
- typename Container::mapped_type const& mapped)
-{
- static Container c;
- auto p = c.insert({key, mapped});
- assert(p.second);
- return c.extract(p.first);
+node_factory(typename Container::key_type const& key, typename Container::mapped_type const& mapped) {
+ static Container c;
+ auto p = c.insert({key, mapped});
+ assert(p.second);
+ return c.extract(p.first);
}
template <class Container>
-void test(Container& c)
-{
- auto* nf = &node_factory<Container>;
-
- for (int i = 0; i != 10; ++i)
- {
- typename Container::node_type node = nf(i, i + 1);
- assert(!node.empty());
- typename Container::insert_return_type irt = c.insert(std::move(node));
- assert(node.empty());
- assert(irt.inserted);
- assert(irt.node.empty());
- assert(irt.position->first == i && irt.position->second == i + 1);
- verify_insert_return_type<Container>(irt);
- }
-
- assert(c.size() == 10);
-
- { // Insert empty node.
- typename Container::node_type def;
- auto irt = c.insert(std::move(def));
- assert(def.empty());
- assert(!irt.inserted);
- assert(irt.node.empty());
- assert(irt.position == c.end());
- verify_insert_return_type<Container>(irt);
- }
-
- { // Insert duplicate node.
- typename Container::node_type dupl = nf(0, 42);
- auto irt = c.insert(std::move(dupl));
- assert(dupl.empty());
- assert(!irt.inserted);
- assert(!irt.node.empty());
- assert(irt.position == c.find(0));
- assert(irt.node.key() == 0 && irt.node.mapped() == 42);
- verify_insert_return_type<Container>(irt);
- }
-
- assert(c.size() == 10);
-
- for (int i = 0; i != 10; ++i)
- {
- assert(c.count(i) == 1);
- assert(c[i] == i + 1);
- }
+void test(Container& c) {
+ auto* nf = &node_factory<Container>;
+
+ for (int i = 0; i != 10; ++i) {
+ typename Container::node_type node = nf(i, i + 1);
+ assert(!node.empty());
+ typename Container::insert_return_type irt = c.insert(std::move(node));
+ assert(node.empty());
+ assert(irt.inserted);
+ assert(irt.node.empty());
+ assert(irt.position->first == i && irt.position->second == i + 1);
+ verify_insert_return_type<Container>(irt);
+ }
+
+ assert(c.size() == 10);
+
+ { // Insert empty node.
+ typename Container::node_type def;
+ auto irt = c.insert(std::move(def));
+ assert(def.empty());
+ assert(!irt.inserted);
+ assert(irt.node.empty());
+ assert(irt.position == c.end());
+ verify_insert_return_type<Container>(irt);
+ }
+
+ { // Insert duplicate node.
+ typename Container::node_type dupl = nf(0, 42);
+ auto irt = c.insert(std::move(dupl));
+ assert(dupl.empty());
+ assert(!irt.inserted);
+ assert(!irt.node.empty());
+ assert(irt.position == c.find(0));
+ assert(irt.node.key() == 0 && irt.node.mapped() == 42);
+ verify_insert_return_type<Container>(irt);
+ }
+
+ assert(c.size() == 10);
+
+ for (int i = 0; i != 10; ++i) {
+ assert(c.count(i) == 1);
+ assert(c[i] == i + 1);
+ }
}
-int main(int, char**)
-{
- std::map<int, int> m;
- test(m);
- std::map<int, int, std::less<int>, min_allocator<std::pair<const int, int>>> m2;
- test(m2);
+int main(int, char**) {
+ std::map<int, int> m;
+ test(m);
+ std::map<int, int, std::less<int>, min_allocator<std::pair<const int, int>>> m2;
+ test(m2);
return 0;
}
diff --git a/libcxx/test/std/containers/associative/map/map.modifiers/insert_node_type_hint.pass.cpp b/libcxx/test/std/containers/associative/map/map.modifiers/insert_node_type_hint.pass.cpp
index 3ef005480e8c23f..f7db47173bc3be9 100644
--- a/libcxx/test/std/containers/associative/map/map.modifiers/insert_node_type_hint.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.modifiers/insert_node_type_hint.pass.cpp
@@ -20,47 +20,41 @@
template <class Container>
typename Container::node_type
-node_factory(typename Container::key_type const& key,
- typename Container::mapped_type const& mapped)
-{
- static Container c;
- auto p = c.insert({key, mapped});
- assert(p.second);
- return c.extract(p.first);
+node_factory(typename Container::key_type const& key, typename Container::mapped_type const& mapped) {
+ static Container c;
+ auto p = c.insert({key, mapped});
+ assert(p.second);
+ return c.extract(p.first);
}
template <class Container>
-void test(Container& c)
-{
- auto* nf = &node_factory<Container>;
-
- for (int i = 0; i != 10; ++i)
- {
- typename Container::node_type node = nf(i, i + 1);
- assert(!node.empty());
- std::size_t prev = c.size();
- auto it = c.insert(c.end(), std::move(node));
- assert(node.empty());
- assert(prev + 1 == c.size());
- assert(it->first == i);
- assert(it->second == i + 1);
- }
-
- assert(c.size() == 10);
-
- for (int i = 0; i != 10; ++i)
- {
- assert(c.count(i) == 1);
- assert(c[i] == i + 1);
- }
+void test(Container& c) {
+ auto* nf = &node_factory<Container>;
+
+ for (int i = 0; i != 10; ++i) {
+ typename Container::node_type node = nf(i, i + 1);
+ assert(!node.empty());
+ std::size_t prev = c.size();
+ auto it = c.insert(c.end(), std::move(node));
+ assert(node.empty());
+ assert(prev + 1 == c.size());
+ assert(it->first == i);
+ assert(it->second == i + 1);
+ }
+
+ assert(c.size() == 10);
+
+ for (int i = 0; i != 10; ++i) {
+ assert(c.count(i) == 1);
+ assert(c[i] == i + 1);
+ }
}
-int main(int, char**)
-{
- std::map<int, int> m;
- test(m);
- std::map<int, int, std::less<int>, min_allocator<std::pair<const int, int>>> m2;
- test(m2);
+int main(int, char**) {
+ std::map<int, int> m;
+ test(m);
+ std::map<int, int, std::less<int>, min_allocator<std::pair<const int, int>>> m2;
+ test(m2);
return 0;
}
diff --git a/libcxx/test/std/containers/associative/map/map.modifiers/insert_or_assign.pass.cpp b/libcxx/test/std/containers/associative/map/map.modifiers/insert_or_assign.pass.cpp
index b865888eaf79580..8a129b029518007 100644
--- a/libcxx/test/std/containers/associative/map/map.modifiers/insert_or_assign.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.modifiers/insert_or_assign.pass.cpp
@@ -28,262 +28,260 @@
#include "test_macros.h"
-class Moveable
-{
- Moveable(const Moveable&);
- Moveable& operator=(const Moveable&);
+class Moveable {
+ Moveable(const Moveable&);
+ Moveable& operator=(const Moveable&);
+
+ int int_;
+ double double_;
- int int_;
- double double_;
public:
- Moveable() : int_(0), double_(0) {}
- Moveable(int i, double d) : int_(i), double_(d) {}
- Moveable(Moveable&& x)
- : int_(x.int_), double_(x.double_)
- {x.int_ = -1; x.double_ = -1;}
- Moveable& operator=(Moveable&& x)
- {int_ = x.int_; x.int_ = -1;
- double_ = x.double_; x.double_ = -1;
- return *this;
- }
-
- bool operator==(const Moveable& x) const
- {return int_ == x.int_ && double_ == x.double_;}
- bool operator<(const Moveable& x) const
- {return int_ < x.int_ || (int_ == x.int_ && double_ < x.double_);}
-
- int get() const {return int_;}
- bool moved() const {return int_ == -1;}
+ Moveable() : int_(0), double_(0) {}
+ Moveable(int i, double d) : int_(i), double_(d) {}
+ Moveable(Moveable&& x) : int_(x.int_), double_(x.double_) {
+ x.int_ = -1;
+ x.double_ = -1;
+ }
+ Moveable& operator=(Moveable&& x) {
+ int_ = x.int_;
+ x.int_ = -1;
+ double_ = x.double_;
+ x.double_ = -1;
+ return *this;
+ }
+
+ bool operator==(const Moveable& x) const { return int_ == x.int_ && double_ == x.double_; }
+ bool operator<(const Moveable& x) const { return int_ < x.int_ || (int_ == x.int_ && double_ < x.double_); }
+
+ int get() const { return int_; }
+ bool moved() const { return int_ == -1; }
};
-
-int main(int, char**)
-{
- { // pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj);
- typedef std::map<int, Moveable> M;
- typedef std::pair<M::iterator, bool> R;
- M m;
- R r;
- for ( int i = 0; i < 20; i += 2 )
- m.emplace ( i, Moveable(i, (double) i));
- assert(m.size() == 10);
-
- for (int i=0; i < 20; i += 2)
- {
- Moveable mv(i+1, i+1);
- r = m.insert_or_assign(i, std::move(mv));
- assert(m.size() == 10);
- assert(!r.second); // was not inserted
- assert(mv.moved()); // was moved from
- assert(r.first->first == i); // key
- assert(r.first->second.get() == i+1); // value
- }
-
- Moveable mv1(5, 5.0);
- r = m.insert_or_assign(-1, std::move(mv1));
- assert(m.size() == 11);
- assert(r.second); // was inserted
- assert(mv1.moved()); // was moved from
- assert(r.first->first == -1); // key
- assert(r.first->second.get() == 5); // value
-
- Moveable mv2(9, 9.0);
- r = m.insert_or_assign(3, std::move(mv2));
- assert(m.size() == 12);
- assert(r.second); // was inserted
- assert(mv2.moved()); // was moved from
- assert(r.first->first == 3); // key
- assert(r.first->second.get() == 9); // value
-
- Moveable mv3(-1, 5.0);
- r = m.insert_or_assign(117, std::move(mv3));
- assert(m.size() == 13);
- assert(r.second); // was inserted
- assert(mv3.moved()); // was moved from
- assert(r.first->first == 117); // key
- assert(r.first->second.get() == -1); // value
- }
- { // pair<iterator, bool> insert_or_assign(key_type&& k, M&& obj);
- typedef std::map<Moveable, Moveable> M;
- typedef std::pair<M::iterator, bool> R;
- M m;
- R r;
- for ( int i = 0; i < 20; i += 2 )
- m.emplace ( Moveable(i, (double) i), Moveable(i+1, (double) i+1));
- assert(m.size() == 10);
-
- Moveable mvkey1(2, 2.0);
- Moveable mv1(4, 4.0);
- r = m.insert_or_assign(std::move(mvkey1), std::move(mv1));
- assert(m.size() == 10);
- assert(!r.second); // was not inserted
- assert(!mvkey1.moved()); // was not moved from
- assert(mv1.moved()); // was moved from
- assert(r.first->first == mvkey1); // key
- assert(r.first->second.get() == 4); // value
-
- Moveable mvkey2(3, 3.0);
- Moveable mv2(5, 5.0);
- r = m.try_emplace(std::move(mvkey2), std::move(mv2));
- assert(m.size() == 11);
- assert(r.second); // was inserted
- assert(mv2.moved()); // was moved from
- assert(mvkey2.moved()); // was moved from
- assert(r.first->first.get() == 3); // key
- assert(r.first->second.get() == 5); // value
- }
- { // iterator insert_or_assign(const_iterator hint, const key_type& k, M&& obj);
- typedef std::map<int, Moveable> M;
- M m;
- M::iterator r;
- for ( int i = 0; i < 20; i += 2 )
- m.emplace ( i, Moveable(i, (double) i));
- assert(m.size() == 10);
- M::const_iterator it = m.find(2);
-
- Moveable mv1(3, 3.0);
- r = m.insert_or_assign(it, 2, std::move(mv1));
- assert(m.size() == 10);
- assert(mv1.moved()); // was moved from
- assert(r->first == 2); // key
- assert(r->second.get() == 3); // value
-
- Moveable mv2(5, 5.0);
- r = m.insert_or_assign(it, 3, std::move(mv2));
- assert(m.size() == 11);
- assert(mv2.moved()); // was moved from
- assert(r->first == 3); // key
- assert(r->second.get() == 5); // value
-
- // wrong hint: begin()
- Moveable mv3(7, 7.0);
- r = m.insert_or_assign(m.begin(), 4, std::move(mv3));
- assert(m.size() == 11);
- assert(mv3.moved()); // was moved from
- assert(r->first == 4); // key
- assert(r->second.get() == 7); // value
-
- Moveable mv4(9, 9.0);
- r = m.insert_or_assign(m.begin(), 5, std::move(mv4));
- assert(m.size() == 12);
- assert(mv4.moved()); // was moved from
- assert(r->first == 5); // key
- assert(r->second.get() == 9); // value
-
- // wrong hint: end()
- Moveable mv5(11, 11.0);
- r = m.insert_or_assign(m.end(), 6, std::move(mv5));
- assert(m.size() == 12);
- assert(mv5.moved()); // was moved from
- assert(r->first == 6); // key
- assert(r->second.get() == 11); // value
-
- Moveable mv6(13, 13.0);
- r = m.insert_or_assign(m.end(), 7, std::move(mv6));
- assert(m.size() == 13);
- assert(mv6.moved()); // was moved from
- assert(r->first == 7); // key
- assert(r->second.get() == 13); // value
-
- // wrong hint: third element
- Moveable mv7(15, 15.0);
- r = m.insert_or_assign(std::next(m.begin(), 2), 8, std::move(mv7));
- assert(m.size() == 13);
- assert(mv7.moved()); // was moved from
- assert(r->first == 8); // key
- assert(r->second.get() == 15); // value
-
- Moveable mv8(17, 17.0);
- r = m.insert_or_assign(std::next(m.begin(), 2), 9, std::move(mv8));
- assert(m.size() == 14);
- assert(mv8.moved()); // was moved from
- assert(r->first == 9); // key
- assert(r->second.get() == 17); // value
- }
- { // iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj);
- typedef std::map<Moveable, Moveable> M;
- M m;
- M::iterator r;
- for ( int i = 0; i < 20; i += 2 )
- m.emplace ( Moveable(i, (double) i), Moveable(i+1, (double) i+1));
- assert(m.size() == 10);
- M::const_iterator it = std::next(m.cbegin());
-
- Moveable mvkey1(2, 2.0);
- Moveable mv1(4, 4.0);
- r = m.insert_or_assign(it, std::move(mvkey1), std::move(mv1));
- assert(m.size() == 10);
- assert(mv1.moved()); // was moved from
- assert(!mvkey1.moved()); // was not moved from
- assert(r->first == mvkey1); // key
- assert(r->second.get() == 4); // value
-
- Moveable mvkey2(3, 3.0);
- Moveable mv2(5, 5.0);
- r = m.insert_or_assign(it, std::move(mvkey2), std::move(mv2));
- assert(m.size() == 11);
- assert(mv2.moved()); // was moved from
- assert(mvkey2.moved()); // was moved from
- assert(r->first.get() == 3); // key
- assert(r->second.get() == 5); // value
-
- // wrong hint: begin()
- Moveable mvkey3(6, 6.0);
- Moveable mv3(8, 8.0);
- r = m.insert_or_assign(m.begin(), std::move(mvkey3), std::move(mv3));
- assert(m.size() == 11);
- assert(mv3.moved()); // was moved from
- assert(!mvkey3.moved()); // was not moved from
- assert(r->first == mvkey3); // key
- assert(r->second.get() == 8); // value
-
- Moveable mvkey4(7, 7.0);
- Moveable mv4(9, 9.0);
- r = m.insert_or_assign(m.begin(), std::move(mvkey4), std::move(mv4));
- assert(m.size() == 12);
- assert(mv4.moved()); // was moved from
- assert(mvkey4.moved()); // was moved from
- assert(r->first.get() == 7); // key
- assert(r->second.get() == 9); // value
-
- // wrong hint: end()
- Moveable mvkey5(8, 8.0);
- Moveable mv5(10, 10.0);
- r = m.insert_or_assign(m.end(), std::move(mvkey5), std::move(mv5));
- assert(m.size() == 12);
- assert(mv5.moved()); // was moved from
- assert(!mvkey5.moved()); // was not moved from
- assert(r->first == mvkey5); // key
- assert(r->second.get() == 10); // value
-
- Moveable mvkey6(9, 9.0);
- Moveable mv6(11, 11.0);
- r = m.insert_or_assign(m.end(), std::move(mvkey6), std::move(mv6));
- assert(m.size() == 13);
- assert(mv6.moved()); // was moved from
- assert(mvkey6.moved()); // was moved from
- assert(r->first.get() == 9); // key
- assert(r->second.get() == 11); // value
-
- // wrong hint: third element
- Moveable mvkey7(10, 10.0);
- Moveable mv7(12, 12.0);
- r = m.insert_or_assign(std::next(m.begin(), 2), std::move(mvkey7), std::move(mv7));
- assert(m.size() == 13);
- assert(mv7.moved()); // was moved from
- assert(!mvkey7.moved()); // was not moved from
- assert(r->first == mvkey7); // key
- assert(r->second.get() == 12); // value
-
- Moveable mvkey8(11, 11.0);
- Moveable mv8(13, 13.0);
- r = m.insert_or_assign(std::next(m.begin(), 2), std::move(mvkey8), std::move(mv8));
- assert(m.size() == 14);
- assert(mv8.moved()); // was moved from
- assert(mvkey8.moved()); // was moved from
- assert(r->first.get() == 11); // key
- assert(r->second.get() == 13); // value
+int main(int, char**) {
+ { // pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj);
+ typedef std::map<int, Moveable> M;
+ typedef std::pair<M::iterator, bool> R;
+ M m;
+ R r;
+ for (int i = 0; i < 20; i += 2)
+ m.emplace(i, Moveable(i, (double)i));
+ assert(m.size() == 10);
+
+ for (int i = 0; i < 20; i += 2) {
+ Moveable mv(i + 1, i + 1);
+ r = m.insert_or_assign(i, std::move(mv));
+ assert(m.size() == 10);
+ assert(!r.second); // was not inserted
+ assert(mv.moved()); // was moved from
+ assert(r.first->first == i); // key
+ assert(r.first->second.get() == i + 1); // value
}
+ Moveable mv1(5, 5.0);
+ r = m.insert_or_assign(-1, std::move(mv1));
+ assert(m.size() == 11);
+ assert(r.second); // was inserted
+ assert(mv1.moved()); // was moved from
+ assert(r.first->first == -1); // key
+ assert(r.first->second.get() == 5); // value
+
+ Moveable mv2(9, 9.0);
+ r = m.insert_or_assign(3, std::move(mv2));
+ assert(m.size() == 12);
+ assert(r.second); // was inserted
+ assert(mv2.moved()); // was moved from
+ assert(r.first->first == 3); // key
+ assert(r.first->second.get() == 9); // value
+
+ Moveable mv3(-1, 5.0);
+ r = m.insert_or_assign(117, std::move(mv3));
+ assert(m.size() == 13);
+ assert(r.second); // was inserted
+ assert(mv3.moved()); // was moved from
+ assert(r.first->first == 117); // key
+ assert(r.first->second.get() == -1); // value
+ }
+ { // pair<iterator, bool> insert_or_assign(key_type&& k, M&& obj);
+ typedef std::map<Moveable, Moveable> M;
+ typedef std::pair<M::iterator, bool> R;
+ M m;
+ R r;
+ for (int i = 0; i < 20; i += 2)
+ m.emplace(Moveable(i, (double)i), Moveable(i + 1, (double)i + 1));
+ assert(m.size() == 10);
+
+ Moveable mvkey1(2, 2.0);
+ Moveable mv1(4, 4.0);
+ r = m.insert_or_assign(std::move(mvkey1), std::move(mv1));
+ assert(m.size() == 10);
+ assert(!r.second); // was not inserted
+ assert(!mvkey1.moved()); // was not moved from
+ assert(mv1.moved()); // was moved from
+ assert(r.first->first == mvkey1); // key
+ assert(r.first->second.get() == 4); // value
+
+ Moveable mvkey2(3, 3.0);
+ Moveable mv2(5, 5.0);
+ r = m.try_emplace(std::move(mvkey2), std::move(mv2));
+ assert(m.size() == 11);
+ assert(r.second); // was inserted
+ assert(mv2.moved()); // was moved from
+ assert(mvkey2.moved()); // was moved from
+ assert(r.first->first.get() == 3); // key
+ assert(r.first->second.get() == 5); // value
+ }
+ { // iterator insert_or_assign(const_iterator hint, const key_type& k, M&& obj);
+ typedef std::map<int, Moveable> M;
+ M m;
+ M::iterator r;
+ for (int i = 0; i < 20; i += 2)
+ m.emplace(i, Moveable(i, (double)i));
+ assert(m.size() == 10);
+ M::const_iterator it = m.find(2);
+
+ Moveable mv1(3, 3.0);
+ r = m.insert_or_assign(it, 2, std::move(mv1));
+ assert(m.size() == 10);
+ assert(mv1.moved()); // was moved from
+ assert(r->first == 2); // key
+ assert(r->second.get() == 3); // value
+
+ Moveable mv2(5, 5.0);
+ r = m.insert_or_assign(it, 3, std::move(mv2));
+ assert(m.size() == 11);
+ assert(mv2.moved()); // was moved from
+ assert(r->first == 3); // key
+ assert(r->second.get() == 5); // value
+
+ // wrong hint: begin()
+ Moveable mv3(7, 7.0);
+ r = m.insert_or_assign(m.begin(), 4, std::move(mv3));
+ assert(m.size() == 11);
+ assert(mv3.moved()); // was moved from
+ assert(r->first == 4); // key
+ assert(r->second.get() == 7); // value
+
+ Moveable mv4(9, 9.0);
+ r = m.insert_or_assign(m.begin(), 5, std::move(mv4));
+ assert(m.size() == 12);
+ assert(mv4.moved()); // was moved from
+ assert(r->first == 5); // key
+ assert(r->second.get() == 9); // value
+
+ // wrong hint: end()
+ Moveable mv5(11, 11.0);
+ r = m.insert_or_assign(m.end(), 6, std::move(mv5));
+ assert(m.size() == 12);
+ assert(mv5.moved()); // was moved from
+ assert(r->first == 6); // key
+ assert(r->second.get() == 11); // value
+
+ Moveable mv6(13, 13.0);
+ r = m.insert_or_assign(m.end(), 7, std::move(mv6));
+ assert(m.size() == 13);
+ assert(mv6.moved()); // was moved from
+ assert(r->first == 7); // key
+ assert(r->second.get() == 13); // value
+
+ // wrong hint: third element
+ Moveable mv7(15, 15.0);
+ r = m.insert_or_assign(std::next(m.begin(), 2), 8, std::move(mv7));
+ assert(m.size() == 13);
+ assert(mv7.moved()); // was moved from
+ assert(r->first == 8); // key
+ assert(r->second.get() == 15); // value
+
+ Moveable mv8(17, 17.0);
+ r = m.insert_or_assign(std::next(m.begin(), 2), 9, std::move(mv8));
+ assert(m.size() == 14);
+ assert(mv8.moved()); // was moved from
+ assert(r->first == 9); // key
+ assert(r->second.get() == 17); // value
+ }
+ { // iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj);
+ typedef std::map<Moveable, Moveable> M;
+ M m;
+ M::iterator r;
+ for (int i = 0; i < 20; i += 2)
+ m.emplace(Moveable(i, (double)i), Moveable(i + 1, (double)i + 1));
+ assert(m.size() == 10);
+ M::const_iterator it = std::next(m.cbegin());
+
+ Moveable mvkey1(2, 2.0);
+ Moveable mv1(4, 4.0);
+ r = m.insert_or_assign(it, std::move(mvkey1), std::move(mv1));
+ assert(m.size() == 10);
+ assert(mv1.moved()); // was moved from
+ assert(!mvkey1.moved()); // was not moved from
+ assert(r->first == mvkey1); // key
+ assert(r->second.get() == 4); // value
+
+ Moveable mvkey2(3, 3.0);
+ Moveable mv2(5, 5.0);
+ r = m.insert_or_assign(it, std::move(mvkey2), std::move(mv2));
+ assert(m.size() == 11);
+ assert(mv2.moved()); // was moved from
+ assert(mvkey2.moved()); // was moved from
+ assert(r->first.get() == 3); // key
+ assert(r->second.get() == 5); // value
+
+ // wrong hint: begin()
+ Moveable mvkey3(6, 6.0);
+ Moveable mv3(8, 8.0);
+ r = m.insert_or_assign(m.begin(), std::move(mvkey3), std::move(mv3));
+ assert(m.size() == 11);
+ assert(mv3.moved()); // was moved from
+ assert(!mvkey3.moved()); // was not moved from
+ assert(r->first == mvkey3); // key
+ assert(r->second.get() == 8); // value
+
+ Moveable mvkey4(7, 7.0);
+ Moveable mv4(9, 9.0);
+ r = m.insert_or_assign(m.begin(), std::move(mvkey4), std::move(mv4));
+ assert(m.size() == 12);
+ assert(mv4.moved()); // was moved from
+ assert(mvkey4.moved()); // was moved from
+ assert(r->first.get() == 7); // key
+ assert(r->second.get() == 9); // value
+
+ // wrong hint: end()
+ Moveable mvkey5(8, 8.0);
+ Moveable mv5(10, 10.0);
+ r = m.insert_or_assign(m.end(), std::move(mvkey5), std::move(mv5));
+ assert(m.size() == 12);
+ assert(mv5.moved()); // was moved from
+ assert(!mvkey5.moved()); // was not moved from
+ assert(r->first == mvkey5); // key
+ assert(r->second.get() == 10); // value
+
+ Moveable mvkey6(9, 9.0);
+ Moveable mv6(11, 11.0);
+ r = m.insert_or_assign(m.end(), std::move(mvkey6), std::move(mv6));
+ assert(m.size() == 13);
+ assert(mv6.moved()); // was moved from
+ assert(mvkey6.moved()); // was moved from
+ assert(r->first.get() == 9); // key
+ assert(r->second.get() == 11); // value
+
+ // wrong hint: third element
+ Moveable mvkey7(10, 10.0);
+ Moveable mv7(12, 12.0);
+ r = m.insert_or_assign(std::next(m.begin(), 2), std::move(mvkey7), std::move(mv7));
+ assert(m.size() == 13);
+ assert(mv7.moved()); // was moved from
+ assert(!mvkey7.moved()); // was not moved from
+ assert(r->first == mvkey7); // key
+ assert(r->second.get() == 12); // value
+
+ Moveable mvkey8(11, 11.0);
+ Moveable mv8(13, 13.0);
+ r = m.insert_or_assign(std::next(m.begin(), 2), std::move(mvkey8), std::move(mv8));
+ assert(m.size() == 14);
+ assert(mv8.moved()); // was moved from
+ assert(mvkey8.moved()); // was moved from
+ assert(r->first.get() == 11); // key
+ assert(r->second.get() == 13); // value
+ }
+
return 0;
}
diff --git a/libcxx/test/std/containers/associative/map/map.modifiers/insert_range.pass.cpp b/libcxx/test/std/containers/associative/map/map.modifiers/insert_range.pass.cpp
index 0d4b1c960a958e9..95d8897cea28252 100644
--- a/libcxx/test/std/containers/associative/map/map.modifiers/insert_range.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.modifiers/insert_range.pass.cpp
@@ -23,7 +23,7 @@
int main(int, char**) {
// Note: we want to use a pair with non-const elements for input (an assignable type is a lot more convenient) but
// have to use the exact `value_type` of the map (that is, `pair<const K, V>`) for the allocator.
- using Pair = std::pair<int, char>;
+ using Pair = std::pair<int, char>;
using ConstPair = std::pair<const int, char>;
for_all_iterators_and_allocators<ConstPair, const Pair*>([]<class Iter, class Sent, class Alloc>() {
test_map_set_insert_range<std::map<int, char, test_less<int>, Alloc>, Pair, Iter, Sent>();
diff --git a/libcxx/test/std/containers/associative/map/map.modifiers/insert_rv.pass.cpp b/libcxx/test/std/containers/associative/map/map.modifiers/insert_rv.pass.cpp
index afb5bba86fd3ee2..345bfde531cf9f4 100644
--- a/libcxx/test/std/containers/associative/map/map.modifiers/insert_rv.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.modifiers/insert_rv.pass.cpp
@@ -24,85 +24,83 @@
#include "test_macros.h"
template <class Container, class Pair>
-void do_insert_rv_test()
-{
- typedef Container M;
- typedef Pair P;
- typedef std::pair<typename M::iterator, bool> R;
+void do_insert_rv_test() {
+ typedef Container M;
+ typedef Pair P;
+ typedef std::pair<typename M::iterator, bool> R;
+ M m;
+ R r = m.insert(P(2, 2));
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 1);
+ assert(r.first->first == 2);
+ assert(r.first->second == 2);
+
+ r = m.insert(P(1, 1));
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 2);
+ assert(r.first->first == 1);
+ assert(r.first->second == 1);
+
+ r = m.insert(P(3, 3));
+ assert(r.second);
+ assert(r.first == std::prev(m.end()));
+ assert(m.size() == 3);
+ assert(r.first->first == 3);
+ assert(r.first->second == 3);
+
+ r = m.insert(P(3, 3));
+ assert(!r.second);
+ assert(r.first == std::prev(m.end()));
+ assert(m.size() == 3);
+ assert(r.first->first == 3);
+ assert(r.first->second == 3);
+}
+
+int main(int, char**) {
+ do_insert_rv_test<std::map<int, MoveOnly>, std::pair<int, MoveOnly>>();
+ do_insert_rv_test<std::map<int, MoveOnly>, std::pair<const int, MoveOnly>>();
+
+ {
+ typedef std::map<int, MoveOnly, std::less<int>, min_allocator<std::pair<const int, MoveOnly>>> M;
+ typedef std::pair<int, MoveOnly> P;
+ typedef std::pair<const int, MoveOnly> CP;
+ do_insert_rv_test<M, P>();
+ do_insert_rv_test<M, CP>();
+ }
+ {
+ typedef std::map<int, MoveOnly> M;
+ typedef std::pair<M::iterator, bool> R;
M m;
- R r = m.insert(P(2, 2));
+ R r = m.insert({2, MoveOnly(2)});
assert(r.second);
assert(r.first == m.begin());
assert(m.size() == 1);
assert(r.first->first == 2);
assert(r.first->second == 2);
- r = m.insert(P(1, 1));
+ r = m.insert({1, MoveOnly(1)});
assert(r.second);
assert(r.first == m.begin());
assert(m.size() == 2);
assert(r.first->first == 1);
assert(r.first->second == 1);
- r = m.insert(P(3, 3));
+ r = m.insert({3, MoveOnly(3)});
assert(r.second);
assert(r.first == std::prev(m.end()));
assert(m.size() == 3);
assert(r.first->first == 3);
assert(r.first->second == 3);
- r = m.insert(P(3, 3));
+ r = m.insert({3, MoveOnly(3)});
assert(!r.second);
assert(r.first == std::prev(m.end()));
assert(m.size() == 3);
assert(r.first->first == 3);
assert(r.first->second == 3);
-}
-
-int main(int, char**)
-{
- do_insert_rv_test<std::map<int, MoveOnly>, std::pair<int, MoveOnly>>();
- do_insert_rv_test<std::map<int, MoveOnly>, std::pair<const int, MoveOnly>>();
-
- {
- typedef std::map<int, MoveOnly, std::less<int>, min_allocator<std::pair<const int, MoveOnly>>> M;
- typedef std::pair<int, MoveOnly> P;
- typedef std::pair<const int, MoveOnly> CP;
- do_insert_rv_test<M, P>();
- do_insert_rv_test<M, CP>();
- }
- {
- typedef std::map<int, MoveOnly> M;
- typedef std::pair<M::iterator, bool> R;
- M m;
- R r = m.insert({2, MoveOnly(2)});
- assert(r.second);
- assert(r.first == m.begin());
- assert(m.size() == 1);
- assert(r.first->first == 2);
- assert(r.first->second == 2);
-
- r = m.insert({1, MoveOnly(1)});
- assert(r.second);
- assert(r.first == m.begin());
- assert(m.size() == 2);
- assert(r.first->first == 1);
- assert(r.first->second == 1);
-
- r = m.insert({3, MoveOnly(3)});
- assert(r.second);
- assert(r.first == std::prev(m.end()));
- assert(m.size() == 3);
- assert(r.first->first == 3);
- assert(r.first->second == 3);
-
- r = m.insert({3, MoveOnly(3)});
- assert(!r.second);
- assert(r.first == std::prev(m.end()));
- assert(m.size() == 3);
- assert(r.first->first == 3);
- assert(r.first->second == 3);
- }
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/map/map.modifiers/merge.pass.cpp b/libcxx/test/std/containers/associative/map/map.modifiers/merge.pass.cpp
index d760658d54f5fc2..3613acfa18c1dc9 100644
--- a/libcxx/test/std/containers/associative/map/map.modifiers/merge.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.modifiers/merge.pass.cpp
@@ -27,124 +27,113 @@
#include "Counter.h"
template <class Map>
-bool map_equal(const Map& map, Map other)
-{
- return map == other;
+bool map_equal(const Map& map, Map other) {
+ return map == other;
}
#ifndef TEST_HAS_NO_EXCEPTIONS
-struct throw_comparator
-{
- bool& should_throw_;
+struct throw_comparator {
+ bool& should_throw_;
- throw_comparator(bool& should_throw) : should_throw_(should_throw) {}
+ throw_comparator(bool& should_throw) : should_throw_(should_throw) {}
- template <class T>
- bool operator()(const T& lhs, const T& rhs) const
- {
- if (should_throw_)
- throw 0;
- return lhs < rhs;
- }
+ template <class T>
+ bool operator()(const T& lhs, const T& rhs) const {
+ if (should_throw_)
+ throw 0;
+ return lhs < rhs;
+ }
};
#endif
-int main(int, char**)
-{
- {
- std::map<int, int> src{{1, 0}, {3, 0}, {5, 0}};
- std::map<int, int> dst{{2, 0}, {4, 0}, {5, 0}};
- dst.merge(src);
- assert(map_equal(src, {{5,0}}));
- assert(map_equal(dst, {{1, 0}, {2, 0}, {3, 0}, {4, 0}, {5, 0}}));
- }
+int main(int, char**) {
+ {
+ std::map<int, int> src{{1, 0}, {3, 0}, {5, 0}};
+ std::map<int, int> dst{{2, 0}, {4, 0}, {5, 0}};
+ dst.merge(src);
+ assert(map_equal(src, {{5, 0}}));
+ assert(map_equal(dst, {{1, 0}, {2, 0}, {3, 0}, {4, 0}, {5, 0}}));
+ }
#ifndef TEST_HAS_NO_EXCEPTIONS
- {
- bool do_throw = false;
- typedef std::map<Counter<int>, int, throw_comparator> map_type;
- map_type src({{1, 0}, {3, 0}, {5, 0}}, throw_comparator(do_throw));
- map_type dst({{2, 0}, {4, 0}, {5, 0}}, throw_comparator(do_throw));
-
- assert(Counter_base::gConstructed == 6);
-
- do_throw = true;
- try
- {
- dst.merge(src);
- }
- catch (int)
- {
- do_throw = false;
- }
- assert(!do_throw);
- assert(map_equal(src, map_type({{1, 0}, {3, 0}, {5, 0}}, throw_comparator(do_throw))));
- assert(map_equal(dst, map_type({{2, 0}, {4, 0}, {5, 0}}, throw_comparator(do_throw))));
+ {
+ bool do_throw = false;
+ typedef std::map<Counter<int>, int, throw_comparator> map_type;
+ map_type src({{1, 0}, {3, 0}, {5, 0}}, throw_comparator(do_throw));
+ map_type dst({{2, 0}, {4, 0}, {5, 0}}, throw_comparator(do_throw));
+
+ assert(Counter_base::gConstructed == 6);
+
+ do_throw = true;
+ try {
+ dst.merge(src);
+ } catch (int) {
+ do_throw = false;
}
+ assert(!do_throw);
+ assert(map_equal(src, map_type({{1, 0}, {3, 0}, {5, 0}}, throw_comparator(do_throw))));
+ assert(map_equal(dst, map_type({{2, 0}, {4, 0}, {5, 0}}, throw_comparator(do_throw))));
+ }
#endif
- assert(Counter_base::gConstructed == 0);
- struct comparator
- {
- comparator() = default;
+ assert(Counter_base::gConstructed == 0);
+ struct comparator {
+ comparator() = default;
- bool operator()(const Counter<int>& lhs, const Counter<int>& rhs) const
- {
- return lhs < rhs;
- }
- };
- {
- typedef std::map<Counter<int>, int, std::less<Counter<int>>> first_map_type;
- typedef std::map<Counter<int>, int, comparator> second_map_type;
- typedef std::multimap<Counter<int>, int, comparator> third_map_type;
+ bool operator()(const Counter<int>& lhs, const Counter<int>& rhs) const { return lhs < rhs; }
+ };
+ {
+ typedef std::map<Counter<int>, int, std::less<Counter<int>>> first_map_type;
+ typedef std::map<Counter<int>, int, comparator> second_map_type;
+ typedef std::multimap<Counter<int>, int, comparator> third_map_type;
- {
- first_map_type first{{1, 0}, {2, 0}, {3, 0}};
- second_map_type second{{2, 0}, {3, 0}, {4, 0}};
- third_map_type third{{1, 0}, {3, 0}};
+ {
+ first_map_type first{{1, 0}, {2, 0}, {3, 0}};
+ second_map_type second{{2, 0}, {3, 0}, {4, 0}};
+ third_map_type third{{1, 0}, {3, 0}};
- assert(Counter_base::gConstructed == 8);
+ assert(Counter_base::gConstructed == 8);
- first.merge(second);
- first.merge(third);
+ first.merge(second);
+ first.merge(third);
- assert(map_equal(first, {{1, 0}, {2, 0}, {3, 0}, {4, 0}}));
- assert(map_equal(second, {{2, 0}, {3, 0}}));
- assert(map_equal(third, {{1, 0}, {3, 0}}));
+ assert(map_equal(first, {{1, 0}, {2, 0}, {3, 0}, {4, 0}}));
+ assert(map_equal(second, {{2, 0}, {3, 0}}));
+ assert(map_equal(third, {{1, 0}, {3, 0}}));
- assert(Counter_base::gConstructed == 8);
- }
- assert(Counter_base::gConstructed == 0);
- {
- first_map_type first{{1, 0}, {2, 0}, {3, 0}};
- second_map_type second{{2, 0}, {3, 0}, {4, 0}};
- third_map_type third{{1, 0}, {3, 0}};
+ assert(Counter_base::gConstructed == 8);
+ }
+ assert(Counter_base::gConstructed == 0);
+ {
+ first_map_type first{{1, 0}, {2, 0}, {3, 0}};
+ second_map_type second{{2, 0}, {3, 0}, {4, 0}};
+ third_map_type third{{1, 0}, {3, 0}};
- assert(Counter_base::gConstructed == 8);
+ assert(Counter_base::gConstructed == 8);
- first.merge(std::move(second));
- first.merge(std::move(third));
+ first.merge(std::move(second));
+ first.merge(std::move(third));
- assert(map_equal(first, {{1, 0}, {2, 0}, {3, 0}, {4, 0}}));
- assert(map_equal(second, {{2, 0}, {3, 0}}));
- assert(map_equal(third, {{1, 0}, {3, 0}}));
+ assert(map_equal(first, {{1, 0}, {2, 0}, {3, 0}, {4, 0}}));
+ assert(map_equal(second, {{2, 0}, {3, 0}}));
+ assert(map_equal(third, {{1, 0}, {3, 0}}));
- assert(Counter_base::gConstructed == 8);
- }
- assert(Counter_base::gConstructed == 0);
+ assert(Counter_base::gConstructed == 8);
}
assert(Counter_base::gConstructed == 0);
+ }
+ assert(Counter_base::gConstructed == 0);
+ {
+ std::map<int, int> first;
+ {
+ std::map<int, int> second;
+ first.merge(second);
+ first.merge(std::move(second));
+ }
{
- std::map<int, int> first;
- {
- std::map<int, int> second;
- first.merge(second);
- first.merge(std::move(second));
- }
- {
- std::multimap<int, int> second;
- first.merge(second);
- first.merge(std::move(second));
- }
+ std::multimap<int, int> second;
+ first.merge(second);
+ first.merge(std::move(second));
}
- return 0;
+ }
+ return 0;
}
diff --git a/libcxx/test/std/containers/associative/map/map.modifiers/try.emplace.pass.cpp b/libcxx/test/std/containers/associative/map/map.modifiers/try.emplace.pass.cpp
index 3f7a83c2b5418b6..a087704fb4daf36 100644
--- a/libcxx/test/std/containers/associative/map/map.modifiers/try.emplace.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.modifiers/try.emplace.pass.cpp
@@ -28,159 +28,156 @@
#include "test_macros.h"
-class Moveable
-{
- Moveable(const Moveable&);
- Moveable& operator=(const Moveable&);
+class Moveable {
+ Moveable(const Moveable&);
+ Moveable& operator=(const Moveable&);
+
+ int int_;
+ double double_;
- int int_;
- double double_;
public:
- Moveable() : int_(0), double_(0) {}
- Moveable(int i, double d) : int_(i), double_(d) {}
- Moveable(Moveable&& x)
- : int_(x.int_), double_(x.double_)
- {x.int_ = -1; x.double_ = -1;}
- Moveable& operator=(Moveable&& x)
- {int_ = x.int_; x.int_ = -1;
- double_ = x.double_; x.double_ = -1;
- return *this;
- }
-
- bool operator==(const Moveable& x) const
- {return int_ == x.int_ && double_ == x.double_;}
- bool operator<(const Moveable& x) const
- {return int_ < x.int_ || (int_ == x.int_ && double_ < x.double_);}
-
- int get() const {return int_;}
- bool moved() const {return int_ == -1;}
+ Moveable() : int_(0), double_(0) {}
+ Moveable(int i, double d) : int_(i), double_(d) {}
+ Moveable(Moveable&& x) : int_(x.int_), double_(x.double_) {
+ x.int_ = -1;
+ x.double_ = -1;
+ }
+ Moveable& operator=(Moveable&& x) {
+ int_ = x.int_;
+ x.int_ = -1;
+ double_ = x.double_;
+ x.double_ = -1;
+ return *this;
+ }
+
+ bool operator==(const Moveable& x) const { return int_ == x.int_ && double_ == x.double_; }
+ bool operator<(const Moveable& x) const { return int_ < x.int_ || (int_ == x.int_ && double_ < x.double_); }
+
+ int get() const { return int_; }
+ bool moved() const { return int_ == -1; }
};
-
-int main(int, char**)
-{
- { // pair<iterator, bool> try_emplace(const key_type& k, Args&&... args);
- typedef std::map<int, Moveable> M;
- typedef std::pair<M::iterator, bool> R;
- M m;
- R r;
- for (int i = 0; i < 20; i += 2)
- m.emplace (i, Moveable(i, (double) i));
- assert(m.size() == 10);
-
- Moveable mv1(3, 3.0);
- for (int i=0; i < 20; i += 2)
- {
- r = m.try_emplace(i, std::move(mv1));
- assert(m.size() == 10);
- assert(!r.second); // was not inserted
- assert(!mv1.moved()); // was not moved from
- assert(r.first->first == i); // key
- }
-
- r = m.try_emplace(-1, std::move(mv1));
- assert(m.size() == 11);
- assert(r.second); // was inserted
- assert(mv1.moved()); // was moved from
- assert(r.first->first == -1); // key
- assert(r.first->second.get() == 3); // value
-
- Moveable mv2(5, 3.0);
- r = m.try_emplace(5, std::move(mv2));
- assert(m.size() == 12);
- assert(r.second); // was inserted
- assert(mv2.moved()); // was moved from
- assert(r.first->first == 5); // key
- assert(r.first->second.get() == 5); // value
-
- Moveable mv3(-1, 3.0);
- r = m.try_emplace(117, std::move(mv2));
- assert(m.size() == 13);
- assert(r.second); // was inserted
- assert(mv2.moved()); // was moved from
- assert(r.first->first == 117); // key
- assert(r.first->second.get() == -1); // value
+int main(int, char**) {
+ { // pair<iterator, bool> try_emplace(const key_type& k, Args&&... args);
+ typedef std::map<int, Moveable> M;
+ typedef std::pair<M::iterator, bool> R;
+ M m;
+ R r;
+ for (int i = 0; i < 20; i += 2)
+ m.emplace(i, Moveable(i, (double)i));
+ assert(m.size() == 10);
+
+ Moveable mv1(3, 3.0);
+ for (int i = 0; i < 20; i += 2) {
+ r = m.try_emplace(i, std::move(mv1));
+ assert(m.size() == 10);
+ assert(!r.second); // was not inserted
+ assert(!mv1.moved()); // was not moved from
+ assert(r.first->first == i); // key
}
- { // pair<iterator, bool> try_emplace(key_type&& k, Args&&... args);
- typedef std::map<Moveable, Moveable> M;
- typedef std::pair<M::iterator, bool> R;
- M m;
- R r;
- for ( int i = 0; i < 20; i += 2 )
- m.emplace ( Moveable(i, (double) i), Moveable(i+1, (double) i+1));
- assert(m.size() == 10);
-
- Moveable mvkey1(2, 2.0);
- Moveable mv1(4, 4.0);
- r = m.try_emplace(std::move(mvkey1), std::move(mv1));
- assert(m.size() == 10);
- assert(!r.second); // was not inserted
- assert(!mv1.moved()); // was not moved from
- assert(!mvkey1.moved()); // was not moved from
- assert(r.first->first == mvkey1); // key
-
- Moveable mvkey2(3, 3.0);
- r = m.try_emplace(std::move(mvkey2), std::move(mv1));
- assert(m.size() == 11);
- assert(r.second); // was inserted
- assert(mv1.moved()); // was moved from
- assert(mvkey2.moved()); // was moved from
- assert(r.first->first.get() == 3); // key
- assert(r.first->second.get() == 4); // value
+ r = m.try_emplace(-1, std::move(mv1));
+ assert(m.size() == 11);
+ assert(r.second); // was inserted
+ assert(mv1.moved()); // was moved from
+ assert(r.first->first == -1); // key
+ assert(r.first->second.get() == 3); // value
+
+ Moveable mv2(5, 3.0);
+ r = m.try_emplace(5, std::move(mv2));
+ assert(m.size() == 12);
+ assert(r.second); // was inserted
+ assert(mv2.moved()); // was moved from
+ assert(r.first->first == 5); // key
+ assert(r.first->second.get() == 5); // value
+
+ Moveable mv3(-1, 3.0);
+ r = m.try_emplace(117, std::move(mv2));
+ assert(m.size() == 13);
+ assert(r.second); // was inserted
+ assert(mv2.moved()); // was moved from
+ assert(r.first->first == 117); // key
+ assert(r.first->second.get() == -1); // value
+ }
+
+ { // pair<iterator, bool> try_emplace(key_type&& k, Args&&... args);
+ typedef std::map<Moveable, Moveable> M;
+ typedef std::pair<M::iterator, bool> R;
+ M m;
+ R r;
+ for (int i = 0; i < 20; i += 2)
+ m.emplace(Moveable(i, (double)i), Moveable(i + 1, (double)i + 1));
+ assert(m.size() == 10);
+
+ Moveable mvkey1(2, 2.0);
+ Moveable mv1(4, 4.0);
+ r = m.try_emplace(std::move(mvkey1), std::move(mv1));
+ assert(m.size() == 10);
+ assert(!r.second); // was not inserted
+ assert(!mv1.moved()); // was not moved from
+ assert(!mvkey1.moved()); // was not moved from
+ assert(r.first->first == mvkey1); // key
+
+ Moveable mvkey2(3, 3.0);
+ r = m.try_emplace(std::move(mvkey2), std::move(mv1));
+ assert(m.size() == 11);
+ assert(r.second); // was inserted
+ assert(mv1.moved()); // was moved from
+ assert(mvkey2.moved()); // was moved from
+ assert(r.first->first.get() == 3); // key
+ assert(r.first->second.get() == 4); // value
+ }
+
+ { // iterator try_emplace(const_iterator hint, const key_type& k, Args&&... args);
+ typedef std::map<int, Moveable> M;
+ M m;
+ M::iterator r;
+ for (int i = 0; i < 20; i += 2)
+ m.try_emplace(i, Moveable(i, (double)i));
+ assert(m.size() == 10);
+ M::const_iterator it = m.find(2);
+
+ Moveable mv1(3, 3.0);
+ for (int i = 0; i < 20; i += 2) {
+ r = m.try_emplace(it, i, std::move(mv1));
+ assert(m.size() == 10);
+ assert(!mv1.moved()); // was not moved from
+ assert(r->first == i); // key
+ assert(r->second.get() == i); // value
}
- { // iterator try_emplace(const_iterator hint, const key_type& k, Args&&... args);
- typedef std::map<int, Moveable> M;
- M m;
- M::iterator r;
- for ( int i = 0; i < 20; i += 2 )
- m.try_emplace ( i, Moveable(i, (double) i));
- assert(m.size() == 10);
- M::const_iterator it = m.find(2);
-
- Moveable mv1(3, 3.0);
- for (int i=0; i < 20; i += 2)
- {
- r = m.try_emplace(it, i, std::move(mv1));
- assert(m.size() == 10);
- assert(!mv1.moved()); // was not moved from
- assert(r->first == i); // key
- assert(r->second.get() == i); // value
- }
-
- r = m.try_emplace(it, 3, std::move(mv1));
- assert(m.size() == 11);
- assert(mv1.moved()); // was moved from
- assert(r->first == 3); // key
- assert(r->second.get() == 3); // value
- }
-
- { // iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args);
- typedef std::map<Moveable, Moveable> M;
- M m;
- M::iterator r;
- for ( int i = 0; i < 20; i += 2 )
- m.emplace ( Moveable(i, (double) i), Moveable(i+1, (double) i+1));
- assert(m.size() == 10);
- M::const_iterator it = std::next(m.cbegin());
-
- Moveable mvkey1(2, 2.0);
- Moveable mv1(4, 4.0);
- r = m.try_emplace(it, std::move(mvkey1), std::move(mv1));
- assert(m.size() == 10);
- assert(!mv1.moved()); // was not moved from
- assert(!mvkey1.moved()); // was not moved from
- assert(r->first == mvkey1); // key
-
- Moveable mvkey2(3, 3.0);
- r = m.try_emplace(it, std::move(mvkey2), std::move(mv1));
- assert(m.size() == 11);
- assert(mv1.moved()); // was moved from
- assert(mvkey2.moved()); // was moved from
- assert(r->first.get() == 3); // key
- assert(r->second.get() == 4); // value
- }
+ r = m.try_emplace(it, 3, std::move(mv1));
+ assert(m.size() == 11);
+ assert(mv1.moved()); // was moved from
+ assert(r->first == 3); // key
+ assert(r->second.get() == 3); // value
+ }
+
+ { // iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args);
+ typedef std::map<Moveable, Moveable> M;
+ M m;
+ M::iterator r;
+ for (int i = 0; i < 20; i += 2)
+ m.emplace(Moveable(i, (double)i), Moveable(i + 1, (double)i + 1));
+ assert(m.size() == 10);
+ M::const_iterator it = std::next(m.cbegin());
+
+ Moveable mvkey1(2, 2.0);
+ Moveable mv1(4, 4.0);
+ r = m.try_emplace(it, std::move(mvkey1), std::move(mv1));
+ assert(m.size() == 10);
+ assert(!mv1.moved()); // was not moved from
+ assert(!mvkey1.moved()); // was not moved from
+ assert(r->first == mvkey1); // key
+
+ Moveable mvkey2(3, 3.0);
+ r = m.try_emplace(it, std::move(mvkey2), std::move(mv1));
+ assert(m.size() == 11);
+ assert(mv1.moved()); // was moved from
+ assert(mvkey2.moved()); // was moved from
+ assert(r->first.get() == 3); // key
+ assert(r->second.get() == 4); // value
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/map/map.nonmember/op_compare.pass.cpp b/libcxx/test/std/containers/associative/map/map.nonmember/op_compare.pass.cpp
index 21d7669b42631ff..9e376f6a1862b96 100644
--- a/libcxx/test/std/containers/associative/map/map.nonmember/op_compare.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.nonmember/op_compare.pass.cpp
@@ -39,43 +39,43 @@
#include "test_comparisons.h"
int main(int, char**) {
- typedef std::map<int, std::string> map_type;
- typedef map_type::value_type value_type;
- {
- map_type m1, m2;
- m1.insert(value_type(1, "abc"));
- m2.insert(value_type(2, "abc"));
- const map_type& cm1 = m1, cm2 = m2;
- assert(testComparisons(cm1, cm2, false, true));
- }
- {
- map_type m1, m2;
- m1.insert(value_type(1, "abc"));
- m2.insert(value_type(1, "abc"));
- const map_type& cm1 = m1, cm2 = m2;
- assert(testComparisons(cm1, cm2, true, false));
- }
- {
- map_type m1, m2;
- m1.insert(value_type(1, "ab"));
- m2.insert(value_type(1, "abc"));
- const map_type& cm1 = m1, cm2 = m2;
- assert(testComparisons(cm1, cm2, false, true));
- }
- {
- map_type m1, m2;
- m1.insert(value_type(1, "abc"));
- m2.insert(value_type(1, "bcd"));
- const map_type& cm1 = m1, cm2 = m2;
- assert(testComparisons(cm1, cm2, false, true));
- }
- {
- map_type m1, m2;
- m1.insert(value_type(1, "abc"));
- m2.insert(value_type(1, "abc"));
- m2.insert(value_type(2, "abc"));
- const map_type& cm1 = m1, cm2 = m2;
- assert(testComparisons(cm1, cm2, false, true));
- }
- return 0;
+ typedef std::map<int, std::string> map_type;
+ typedef map_type::value_type value_type;
+ {
+ map_type m1, m2;
+ m1.insert(value_type(1, "abc"));
+ m2.insert(value_type(2, "abc"));
+ const map_type &cm1 = m1, cm2 = m2;
+ assert(testComparisons(cm1, cm2, false, true));
+ }
+ {
+ map_type m1, m2;
+ m1.insert(value_type(1, "abc"));
+ m2.insert(value_type(1, "abc"));
+ const map_type &cm1 = m1, cm2 = m2;
+ assert(testComparisons(cm1, cm2, true, false));
+ }
+ {
+ map_type m1, m2;
+ m1.insert(value_type(1, "ab"));
+ m2.insert(value_type(1, "abc"));
+ const map_type &cm1 = m1, cm2 = m2;
+ assert(testComparisons(cm1, cm2, false, true));
+ }
+ {
+ map_type m1, m2;
+ m1.insert(value_type(1, "abc"));
+ m2.insert(value_type(1, "bcd"));
+ const map_type &cm1 = m1, cm2 = m2;
+ assert(testComparisons(cm1, cm2, false, true));
+ }
+ {
+ map_type m1, m2;
+ m1.insert(value_type(1, "abc"));
+ m2.insert(value_type(1, "abc"));
+ m2.insert(value_type(2, "abc"));
+ const map_type &cm1 = m1, cm2 = m2;
+ assert(testComparisons(cm1, cm2, false, true));
+ }
+ return 0;
}
diff --git a/libcxx/test/std/containers/associative/map/map.observers/key_comp.pass.cpp b/libcxx/test/std/containers/associative/map/map.observers/key_comp.pass.cpp
index f44e78fd283edab..f0757ab47ee48c1 100644
--- a/libcxx/test/std/containers/associative/map/map.observers/key_comp.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.observers/key_comp.pass.cpp
@@ -15,16 +15,16 @@
#include <string>
int main(int, char**) {
- typedef std::map<int, std::string> map_type;
+ typedef std::map<int, std::string> map_type;
- map_type m;
- std::pair<map_type::iterator, bool> p1 = m.insert(map_type::value_type(1, "abc"));
- std::pair<map_type::iterator, bool> p2 = m.insert(map_type::value_type(2, "abc"));
+ map_type m;
+ std::pair<map_type::iterator, bool> p1 = m.insert(map_type::value_type(1, "abc"));
+ std::pair<map_type::iterator, bool> p2 = m.insert(map_type::value_type(2, "abc"));
- const map_type& cm = m;
+ const map_type& cm = m;
- assert(cm.key_comp()(p1.first->first, p2.first->first));
- assert(!cm.key_comp()(p2.first->first, p1.first->first));
+ assert(cm.key_comp()(p1.first->first, p2.first->first));
+ assert(!cm.key_comp()(p2.first->first, p1.first->first));
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/associative/map/map.observers/value_comp.pass.cpp b/libcxx/test/std/containers/associative/map/map.observers/value_comp.pass.cpp
index 02b965964983309..edd1cd3c5c2710e 100644
--- a/libcxx/test/std/containers/associative/map/map.observers/value_comp.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.observers/value_comp.pass.cpp
@@ -15,16 +15,16 @@
#include <string>
int main(int, char**) {
- typedef std::map<int, std::string> map_type;
+ typedef std::map<int, std::string> map_type;
- map_type m;
- std::pair<map_type::iterator, bool> p1 = m.insert(map_type::value_type(1, "abc"));
- std::pair<map_type::iterator, bool> p2 = m.insert(map_type::value_type(2, "abc"));
+ map_type m;
+ std::pair<map_type::iterator, bool> p1 = m.insert(map_type::value_type(1, "abc"));
+ std::pair<map_type::iterator, bool> p2 = m.insert(map_type::value_type(2, "abc"));
- const map_type& cm = m;
+ const map_type& cm = m;
- assert(cm.value_comp()(*p1.first, *p2.first));
- assert(!cm.value_comp()(*p2.first, *p1.first));
+ assert(cm.value_comp()(*p1.first, *p2.first));
+ assert(!cm.value_comp()(*p2.first, *p1.first));
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/associative/map/map.ops/contains.pass.cpp b/libcxx/test/std/containers/associative/map/map.ops/contains.pass.cpp
index 4221dc119f66eba..7191d4c5e835dae 100644
--- a/libcxx/test/std/containers/associative/map/map.ops/contains.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.ops/contains.pass.cpp
@@ -17,45 +17,44 @@
template <typename T, typename P, typename B, typename... Pairs>
void test(B bad, Pairs... args) {
- T map;
- P pairs[] = {args...};
+ T map;
+ P pairs[] = {args...};
- for (auto& p : pairs) map.insert(p);
- for (auto& p : pairs) assert(map.contains(p.first));
+ for (auto& p : pairs)
+ map.insert(p);
+ for (auto& p : pairs)
+ assert(map.contains(p.first));
- assert(!map.contains(bad));
+ assert(!map.contains(bad));
}
-struct E { int a = 1; double b = 1; char c = 1; };
-
-int main(int, char**)
-{
- {
- test<std::map<char, int>, std::pair<char, int> >(
- 'e', std::make_pair('a', 10), std::make_pair('b', 11),
- std::make_pair('c', 12), std::make_pair('d', 13));
-
- test<std::map<char, char>, std::pair<char, char> >(
- 'e', std::make_pair('a', 'a'), std::make_pair('b', 'a'),
- std::make_pair('c', 'a'), std::make_pair('d', 'b'));
-
- test<std::map<int, E>, std::pair<int, E> >(
- -1, std::make_pair(1, E{}), std::make_pair(2, E{}),
- std::make_pair(3, E{}), std::make_pair(4, E{}));
- }
- {
- test<std::multimap<char, int>, std::pair<char, int> >(
- 'e', std::make_pair('a', 10), std::make_pair('b', 11),
- std::make_pair('c', 12), std::make_pair('d', 13));
-
- test<std::multimap<char, char>, std::pair<char, char> >(
- 'e', std::make_pair('a', 'a'), std::make_pair('b', 'a'),
- std::make_pair('c', 'a'), std::make_pair('d', 'b'));
-
- test<std::multimap<int, E>, std::pair<int, E> >(
- -1, std::make_pair(1, E{}), std::make_pair(2, E{}),
- std::make_pair(3, E{}), std::make_pair(4, E{}));
- }
-
- return 0;
+struct E {
+ int a = 1;
+ double b = 1;
+ char c = 1;
+};
+
+int main(int, char**) {
+ {
+ test<std::map<char, int>, std::pair<char, int> >(
+ 'e', std::make_pair('a', 10), std::make_pair('b', 11), std::make_pair('c', 12), std::make_pair('d', 13));
+
+ test<std::map<char, char>, std::pair<char, char> >(
+ 'e', std::make_pair('a', 'a'), std::make_pair('b', 'a'), std::make_pair('c', 'a'), std::make_pair('d', 'b'));
+
+ test<std::map<int, E>, std::pair<int, E> >(
+ -1, std::make_pair(1, E{}), std::make_pair(2, E{}), std::make_pair(3, E{}), std::make_pair(4, E{}));
+ }
+ {
+ test<std::multimap<char, int>, std::pair<char, int> >(
+ 'e', std::make_pair('a', 10), std::make_pair('b', 11), std::make_pair('c', 12), std::make_pair('d', 13));
+
+ test<std::multimap<char, char>, std::pair<char, char> >(
+ 'e', std::make_pair('a', 'a'), std::make_pair('b', 'a'), std::make_pair('c', 'a'), std::make_pair('d', 'b'));
+
+ test<std::multimap<int, E>, std::pair<int, E> >(
+ -1, std::make_pair(1, E{}), std::make_pair(2, E{}), std::make_pair(3, E{}), std::make_pair(4, E{}));
+ }
+
+ return 0;
}
diff --git a/libcxx/test/std/containers/associative/map/map.ops/contains_transparent.pass.cpp b/libcxx/test/std/containers/associative/map/map.ops/contains_transparent.pass.cpp
index c5543a6eee3d360..f80f1a2714bfd23 100644
--- a/libcxx/test/std/containers/associative/map/map.ops/contains_transparent.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.ops/contains_transparent.pass.cpp
@@ -18,18 +18,11 @@
struct Comp {
using is_transparent = void;
- bool operator()(const std::pair<int, int>& lhs,
- const std::pair<int, int>& rhs) const {
- return lhs < rhs;
- }
-
- bool operator()(const std::pair<int, int>& lhs, int rhs) const {
- return lhs.first < rhs;
- }
-
- bool operator()(int lhs, const std::pair<int, int>& rhs) const {
- return lhs < rhs.first;
- }
+ bool operator()(const std::pair<int, int>& lhs, const std::pair<int, int>& rhs) const { return lhs < rhs; }
+
+ bool operator()(const std::pair<int, int>& lhs, int rhs) const { return lhs.first < rhs; }
+
+ bool operator()(int lhs, const std::pair<int, int>& rhs) const { return lhs < rhs.first; }
};
template <typename Container>
diff --git a/libcxx/test/std/containers/associative/map/map.ops/count0.pass.cpp b/libcxx/test/std/containers/associative/map/map.ops/count0.pass.cpp
index aa9952337bee521..c7ba765178969a8 100644
--- a/libcxx/test/std/containers/associative/map/map.ops/count0.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.ops/count0.pass.cpp
@@ -18,23 +18,21 @@
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
-
#include <map>
#include <cassert>
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::map<int, double, transparent_less> M;
assert(M().count(C2Int{5}) == 0);
- }
- {
+ }
+ {
typedef std::map<int, double, transparent_less_not_referenceable> M;
assert(M().count(C2Int{5}) == 0);
- }
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/map/map.ops/count1.compile.fail.cpp b/libcxx/test/std/containers/associative/map/map.ops/count1.compile.fail.cpp
index 41463d682926b15..0c9d51edccd34ea 100644
--- a/libcxx/test/std/containers/associative/map/map.ops/count1.compile.fail.cpp
+++ b/libcxx/test/std/containers/associative/map/map.ops/count1.compile.fail.cpp
@@ -18,18 +18,16 @@
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
-
#include <map>
#include <cassert>
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::map<int, double, transparent_less_no_type> M;
TEST_IGNORE_NODISCARD M().count(C2Int{5});
- }
+ }
}
diff --git a/libcxx/test/std/containers/associative/map/map.ops/count2.compile.fail.cpp b/libcxx/test/std/containers/associative/map/map.ops/count2.compile.fail.cpp
index 2e27429c33c8c6e..0cc81b333993030 100644
--- a/libcxx/test/std/containers/associative/map/map.ops/count2.compile.fail.cpp
+++ b/libcxx/test/std/containers/associative/map/map.ops/count2.compile.fail.cpp
@@ -18,18 +18,16 @@
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
-
#include <map>
#include <cassert>
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::map<int, double, transparent_less_private> M;
TEST_IGNORE_NODISCARD M().count(C2Int{5});
- }
+ }
}
diff --git a/libcxx/test/std/containers/associative/map/map.ops/count3.compile.fail.cpp b/libcxx/test/std/containers/associative/map/map.ops/count3.compile.fail.cpp
index 9f60b2d6e0d086e..1c6a4cd3db09525 100644
--- a/libcxx/test/std/containers/associative/map/map.ops/count3.compile.fail.cpp
+++ b/libcxx/test/std/containers/associative/map/map.ops/count3.compile.fail.cpp
@@ -18,18 +18,16 @@
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
-
#include <map>
#include <cassert>
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::map<int, double, transparent_less_not_a_type> M;
TEST_IGNORE_NODISCARD M().count(C2Int{5});
- }
+ }
}
diff --git a/libcxx/test/std/containers/associative/map/map.ops/count_transparent.pass.cpp b/libcxx/test/std/containers/associative/map/map.ops/count_transparent.pass.cpp
index 89686c807ed5d8e..fc097c1dc672c32 100644
--- a/libcxx/test/std/containers/associative/map/map.ops/count_transparent.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.ops/count_transparent.pass.cpp
@@ -22,23 +22,15 @@
struct Comp {
using is_transparent = void;
- bool operator()(const std::pair<int, int> &lhs,
- const std::pair<int, int> &rhs) const {
- return lhs < rhs;
- }
-
- bool operator()(const std::pair<int, int> &lhs, int rhs) const {
- return lhs.first < rhs;
- }
-
- bool operator()(int lhs, const std::pair<int, int> &rhs) const {
- return lhs < rhs.first;
- }
+ bool operator()(const std::pair<int, int>& lhs, const std::pair<int, int>& rhs) const { return lhs < rhs; }
+
+ bool operator()(const std::pair<int, int>& lhs, int rhs) const { return lhs.first < rhs; }
+
+ bool operator()(int lhs, const std::pair<int, int>& rhs) const { return lhs < rhs.first; }
};
int main(int, char**) {
- std::map<std::pair<int, int>, int, Comp> s{
- {{2, 1}, 1}, {{1, 2}, 2}, {{1, 3}, 3}, {{1, 4}, 4}, {{2, 2}, 5}};
+ std::map<std::pair<int, int>, int, Comp> s{{{2, 1}, 1}, {{1, 2}, 2}, {{1, 3}, 3}, {{1, 4}, 4}, {{2, 2}, 5}};
auto cnt = s.count(1);
assert(cnt == 3);
diff --git a/libcxx/test/std/containers/associative/map/map.ops/equal_range.pass.cpp b/libcxx/test/std/containers/associative/map/map.ops/equal_range.pass.cpp
index 00d0866f0237e99..883cd379802e6ec 100644
--- a/libcxx/test/std/containers/associative/map/map.ops/equal_range.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.ops/equal_range.pass.cpp
@@ -21,300 +21,249 @@
#include "private_constructor.h"
#include "is_transparent.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::pair<const int, double> V;
typedef std::map<int, double> M;
{
- typedef std::pair<M::iterator, M::iterator> R;
- V ar[] =
- {
- V(5, 5),
- V(7, 6),
- V(9, 7),
- V(11, 8),
- V(13, 9),
- V(15, 10),
- V(17, 11),
- V(19, 12)
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.equal_range(5);
- assert(r.first == std::next(m.begin(), 0));
- assert(r.second == std::next(m.begin(), 1));
- r = m.equal_range(7);
- assert(r.first == std::next(m.begin(), 1));
- assert(r.second == std::next(m.begin(), 2));
- r = m.equal_range(9);
- assert(r.first == std::next(m.begin(), 2));
- assert(r.second == std::next(m.begin(), 3));
- r = m.equal_range(11);
- assert(r.first == std::next(m.begin(), 3));
- assert(r.second == std::next(m.begin(), 4));
- r = m.equal_range(13);
- assert(r.first == std::next(m.begin(), 4));
- assert(r.second == std::next(m.begin(), 5));
- r = m.equal_range(15);
- assert(r.first == std::next(m.begin(), 5));
- assert(r.second == std::next(m.begin(), 6));
- r = m.equal_range(17);
- assert(r.first == std::next(m.begin(), 6));
- assert(r.second == std::next(m.begin(), 7));
- r = m.equal_range(19);
- assert(r.first == std::next(m.begin(), 7));
- assert(r.second == std::next(m.begin(), 8));
- r = m.equal_range(4);
- assert(r.first == std::next(m.begin(), 0));
- assert(r.second == std::next(m.begin(), 0));
- r = m.equal_range(6);
- assert(r.first == std::next(m.begin(), 1));
- assert(r.second == std::next(m.begin(), 1));
- r = m.equal_range(8);
- assert(r.first == std::next(m.begin(), 2));
- assert(r.second == std::next(m.begin(), 2));
- r = m.equal_range(10);
- assert(r.first == std::next(m.begin(), 3));
- assert(r.second == std::next(m.begin(), 3));
- r = m.equal_range(12);
- assert(r.first == std::next(m.begin(), 4));
- assert(r.second == std::next(m.begin(), 4));
- r = m.equal_range(14);
- assert(r.first == std::next(m.begin(), 5));
- assert(r.second == std::next(m.begin(), 5));
- r = m.equal_range(16);
- assert(r.first == std::next(m.begin(), 6));
- assert(r.second == std::next(m.begin(), 6));
- r = m.equal_range(18);
- assert(r.first == std::next(m.begin(), 7));
- assert(r.second == std::next(m.begin(), 7));
- r = m.equal_range(20);
- assert(r.first == std::next(m.begin(), 8));
- assert(r.second == std::next(m.begin(), 8));
+ typedef std::pair<M::iterator, M::iterator> R;
+ V ar[] = {V(5, 5), V(7, 6), V(9, 7), V(11, 8), V(13, 9), V(15, 10), V(17, 11), V(19, 12)};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.equal_range(5);
+ assert(r.first == std::next(m.begin(), 0));
+ assert(r.second == std::next(m.begin(), 1));
+ r = m.equal_range(7);
+ assert(r.first == std::next(m.begin(), 1));
+ assert(r.second == std::next(m.begin(), 2));
+ r = m.equal_range(9);
+ assert(r.first == std::next(m.begin(), 2));
+ assert(r.second == std::next(m.begin(), 3));
+ r = m.equal_range(11);
+ assert(r.first == std::next(m.begin(), 3));
+ assert(r.second == std::next(m.begin(), 4));
+ r = m.equal_range(13);
+ assert(r.first == std::next(m.begin(), 4));
+ assert(r.second == std::next(m.begin(), 5));
+ r = m.equal_range(15);
+ assert(r.first == std::next(m.begin(), 5));
+ assert(r.second == std::next(m.begin(), 6));
+ r = m.equal_range(17);
+ assert(r.first == std::next(m.begin(), 6));
+ assert(r.second == std::next(m.begin(), 7));
+ r = m.equal_range(19);
+ assert(r.first == std::next(m.begin(), 7));
+ assert(r.second == std::next(m.begin(), 8));
+ r = m.equal_range(4);
+ assert(r.first == std::next(m.begin(), 0));
+ assert(r.second == std::next(m.begin(), 0));
+ r = m.equal_range(6);
+ assert(r.first == std::next(m.begin(), 1));
+ assert(r.second == std::next(m.begin(), 1));
+ r = m.equal_range(8);
+ assert(r.first == std::next(m.begin(), 2));
+ assert(r.second == std::next(m.begin(), 2));
+ r = m.equal_range(10);
+ assert(r.first == std::next(m.begin(), 3));
+ assert(r.second == std::next(m.begin(), 3));
+ r = m.equal_range(12);
+ assert(r.first == std::next(m.begin(), 4));
+ assert(r.second == std::next(m.begin(), 4));
+ r = m.equal_range(14);
+ assert(r.first == std::next(m.begin(), 5));
+ assert(r.second == std::next(m.begin(), 5));
+ r = m.equal_range(16);
+ assert(r.first == std::next(m.begin(), 6));
+ assert(r.second == std::next(m.begin(), 6));
+ r = m.equal_range(18);
+ assert(r.first == std::next(m.begin(), 7));
+ assert(r.second == std::next(m.begin(), 7));
+ r = m.equal_range(20);
+ assert(r.first == std::next(m.begin(), 8));
+ assert(r.second == std::next(m.begin(), 8));
}
{
- typedef std::pair<M::const_iterator, M::const_iterator> R;
- V ar[] =
- {
- V(5, 5),
- V(7, 6),
- V(9, 7),
- V(11, 8),
- V(13, 9),
- V(15, 10),
- V(17, 11),
- V(19, 12)
- };
- const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.equal_range(5);
- assert(r.first == std::next(m.begin(), 0));
- assert(r.second == std::next(m.begin(), 1));
- r = m.equal_range(7);
- assert(r.first == std::next(m.begin(), 1));
- assert(r.second == std::next(m.begin(), 2));
- r = m.equal_range(9);
- assert(r.first == std::next(m.begin(), 2));
- assert(r.second == std::next(m.begin(), 3));
- r = m.equal_range(11);
- assert(r.first == std::next(m.begin(), 3));
- assert(r.second == std::next(m.begin(), 4));
- r = m.equal_range(13);
- assert(r.first == std::next(m.begin(), 4));
- assert(r.second == std::next(m.begin(), 5));
- r = m.equal_range(15);
- assert(r.first == std::next(m.begin(), 5));
- assert(r.second == std::next(m.begin(), 6));
- r = m.equal_range(17);
- assert(r.first == std::next(m.begin(), 6));
- assert(r.second == std::next(m.begin(), 7));
- r = m.equal_range(19);
- assert(r.first == std::next(m.begin(), 7));
- assert(r.second == std::next(m.begin(), 8));
- r = m.equal_range(4);
- assert(r.first == std::next(m.begin(), 0));
- assert(r.second == std::next(m.begin(), 0));
- r = m.equal_range(6);
- assert(r.first == std::next(m.begin(), 1));
- assert(r.second == std::next(m.begin(), 1));
- r = m.equal_range(8);
- assert(r.first == std::next(m.begin(), 2));
- assert(r.second == std::next(m.begin(), 2));
- r = m.equal_range(10);
- assert(r.first == std::next(m.begin(), 3));
- assert(r.second == std::next(m.begin(), 3));
- r = m.equal_range(12);
- assert(r.first == std::next(m.begin(), 4));
- assert(r.second == std::next(m.begin(), 4));
- r = m.equal_range(14);
- assert(r.first == std::next(m.begin(), 5));
- assert(r.second == std::next(m.begin(), 5));
- r = m.equal_range(16);
- assert(r.first == std::next(m.begin(), 6));
- assert(r.second == std::next(m.begin(), 6));
- r = m.equal_range(18);
- assert(r.first == std::next(m.begin(), 7));
- assert(r.second == std::next(m.begin(), 7));
- r = m.equal_range(20);
- assert(r.first == std::next(m.begin(), 8));
- assert(r.second == std::next(m.begin(), 8));
- }
+ typedef std::pair<M::const_iterator, M::const_iterator> R;
+ V ar[] = {V(5, 5), V(7, 6), V(9, 7), V(11, 8), V(13, 9), V(15, 10), V(17, 11), V(19, 12)};
+ const M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.equal_range(5);
+ assert(r.first == std::next(m.begin(), 0));
+ assert(r.second == std::next(m.begin(), 1));
+ r = m.equal_range(7);
+ assert(r.first == std::next(m.begin(), 1));
+ assert(r.second == std::next(m.begin(), 2));
+ r = m.equal_range(9);
+ assert(r.first == std::next(m.begin(), 2));
+ assert(r.second == std::next(m.begin(), 3));
+ r = m.equal_range(11);
+ assert(r.first == std::next(m.begin(), 3));
+ assert(r.second == std::next(m.begin(), 4));
+ r = m.equal_range(13);
+ assert(r.first == std::next(m.begin(), 4));
+ assert(r.second == std::next(m.begin(), 5));
+ r = m.equal_range(15);
+ assert(r.first == std::next(m.begin(), 5));
+ assert(r.second == std::next(m.begin(), 6));
+ r = m.equal_range(17);
+ assert(r.first == std::next(m.begin(), 6));
+ assert(r.second == std::next(m.begin(), 7));
+ r = m.equal_range(19);
+ assert(r.first == std::next(m.begin(), 7));
+ assert(r.second == std::next(m.begin(), 8));
+ r = m.equal_range(4);
+ assert(r.first == std::next(m.begin(), 0));
+ assert(r.second == std::next(m.begin(), 0));
+ r = m.equal_range(6);
+ assert(r.first == std::next(m.begin(), 1));
+ assert(r.second == std::next(m.begin(), 1));
+ r = m.equal_range(8);
+ assert(r.first == std::next(m.begin(), 2));
+ assert(r.second == std::next(m.begin(), 2));
+ r = m.equal_range(10);
+ assert(r.first == std::next(m.begin(), 3));
+ assert(r.second == std::next(m.begin(), 3));
+ r = m.equal_range(12);
+ assert(r.first == std::next(m.begin(), 4));
+ assert(r.second == std::next(m.begin(), 4));
+ r = m.equal_range(14);
+ assert(r.first == std::next(m.begin(), 5));
+ assert(r.second == std::next(m.begin(), 5));
+ r = m.equal_range(16);
+ assert(r.first == std::next(m.begin(), 6));
+ assert(r.second == std::next(m.begin(), 6));
+ r = m.equal_range(18);
+ assert(r.first == std::next(m.begin(), 7));
+ assert(r.second == std::next(m.begin(), 7));
+ r = m.equal_range(20);
+ assert(r.first == std::next(m.begin(), 8));
+ assert(r.second == std::next(m.begin(), 8));
}
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::pair<const int, double> V;
typedef std::map<int, double, std::less<int>, min_allocator<V>> M;
{
- typedef std::pair<M::iterator, M::iterator> R;
- V ar[] =
- {
- V(5, 5),
- V(7, 6),
- V(9, 7),
- V(11, 8),
- V(13, 9),
- V(15, 10),
- V(17, 11),
- V(19, 12)
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.equal_range(5);
- assert(r.first == std::next(m.begin(), 0));
- assert(r.second == std::next(m.begin(), 1));
- r = m.equal_range(7);
- assert(r.first == std::next(m.begin(), 1));
- assert(r.second == std::next(m.begin(), 2));
- r = m.equal_range(9);
- assert(r.first == std::next(m.begin(), 2));
- assert(r.second == std::next(m.begin(), 3));
- r = m.equal_range(11);
- assert(r.first == std::next(m.begin(), 3));
- assert(r.second == std::next(m.begin(), 4));
- r = m.equal_range(13);
- assert(r.first == std::next(m.begin(), 4));
- assert(r.second == std::next(m.begin(), 5));
- r = m.equal_range(15);
- assert(r.first == std::next(m.begin(), 5));
- assert(r.second == std::next(m.begin(), 6));
- r = m.equal_range(17);
- assert(r.first == std::next(m.begin(), 6));
- assert(r.second == std::next(m.begin(), 7));
- r = m.equal_range(19);
- assert(r.first == std::next(m.begin(), 7));
- assert(r.second == std::next(m.begin(), 8));
- r = m.equal_range(4);
- assert(r.first == std::next(m.begin(), 0));
- assert(r.second == std::next(m.begin(), 0));
- r = m.equal_range(6);
- assert(r.first == std::next(m.begin(), 1));
- assert(r.second == std::next(m.begin(), 1));
- r = m.equal_range(8);
- assert(r.first == std::next(m.begin(), 2));
- assert(r.second == std::next(m.begin(), 2));
- r = m.equal_range(10);
- assert(r.first == std::next(m.begin(), 3));
- assert(r.second == std::next(m.begin(), 3));
- r = m.equal_range(12);
- assert(r.first == std::next(m.begin(), 4));
- assert(r.second == std::next(m.begin(), 4));
- r = m.equal_range(14);
- assert(r.first == std::next(m.begin(), 5));
- assert(r.second == std::next(m.begin(), 5));
- r = m.equal_range(16);
- assert(r.first == std::next(m.begin(), 6));
- assert(r.second == std::next(m.begin(), 6));
- r = m.equal_range(18);
- assert(r.first == std::next(m.begin(), 7));
- assert(r.second == std::next(m.begin(), 7));
- r = m.equal_range(20);
- assert(r.first == std::next(m.begin(), 8));
- assert(r.second == std::next(m.begin(), 8));
+ typedef std::pair<M::iterator, M::iterator> R;
+ V ar[] = {V(5, 5), V(7, 6), V(9, 7), V(11, 8), V(13, 9), V(15, 10), V(17, 11), V(19, 12)};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.equal_range(5);
+ assert(r.first == std::next(m.begin(), 0));
+ assert(r.second == std::next(m.begin(), 1));
+ r = m.equal_range(7);
+ assert(r.first == std::next(m.begin(), 1));
+ assert(r.second == std::next(m.begin(), 2));
+ r = m.equal_range(9);
+ assert(r.first == std::next(m.begin(), 2));
+ assert(r.second == std::next(m.begin(), 3));
+ r = m.equal_range(11);
+ assert(r.first == std::next(m.begin(), 3));
+ assert(r.second == std::next(m.begin(), 4));
+ r = m.equal_range(13);
+ assert(r.first == std::next(m.begin(), 4));
+ assert(r.second == std::next(m.begin(), 5));
+ r = m.equal_range(15);
+ assert(r.first == std::next(m.begin(), 5));
+ assert(r.second == std::next(m.begin(), 6));
+ r = m.equal_range(17);
+ assert(r.first == std::next(m.begin(), 6));
+ assert(r.second == std::next(m.begin(), 7));
+ r = m.equal_range(19);
+ assert(r.first == std::next(m.begin(), 7));
+ assert(r.second == std::next(m.begin(), 8));
+ r = m.equal_range(4);
+ assert(r.first == std::next(m.begin(), 0));
+ assert(r.second == std::next(m.begin(), 0));
+ r = m.equal_range(6);
+ assert(r.first == std::next(m.begin(), 1));
+ assert(r.second == std::next(m.begin(), 1));
+ r = m.equal_range(8);
+ assert(r.first == std::next(m.begin(), 2));
+ assert(r.second == std::next(m.begin(), 2));
+ r = m.equal_range(10);
+ assert(r.first == std::next(m.begin(), 3));
+ assert(r.second == std::next(m.begin(), 3));
+ r = m.equal_range(12);
+ assert(r.first == std::next(m.begin(), 4));
+ assert(r.second == std::next(m.begin(), 4));
+ r = m.equal_range(14);
+ assert(r.first == std::next(m.begin(), 5));
+ assert(r.second == std::next(m.begin(), 5));
+ r = m.equal_range(16);
+ assert(r.first == std::next(m.begin(), 6));
+ assert(r.second == std::next(m.begin(), 6));
+ r = m.equal_range(18);
+ assert(r.first == std::next(m.begin(), 7));
+ assert(r.second == std::next(m.begin(), 7));
+ r = m.equal_range(20);
+ assert(r.first == std::next(m.begin(), 8));
+ assert(r.second == std::next(m.begin(), 8));
}
{
- typedef std::pair<M::const_iterator, M::const_iterator> R;
- V ar[] =
- {
- V(5, 5),
- V(7, 6),
- V(9, 7),
- V(11, 8),
- V(13, 9),
- V(15, 10),
- V(17, 11),
- V(19, 12)
- };
- const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.equal_range(5);
- assert(r.first == std::next(m.begin(), 0));
- assert(r.second == std::next(m.begin(), 1));
- r = m.equal_range(7);
- assert(r.first == std::next(m.begin(), 1));
- assert(r.second == std::next(m.begin(), 2));
- r = m.equal_range(9);
- assert(r.first == std::next(m.begin(), 2));
- assert(r.second == std::next(m.begin(), 3));
- r = m.equal_range(11);
- assert(r.first == std::next(m.begin(), 3));
- assert(r.second == std::next(m.begin(), 4));
- r = m.equal_range(13);
- assert(r.first == std::next(m.begin(), 4));
- assert(r.second == std::next(m.begin(), 5));
- r = m.equal_range(15);
- assert(r.first == std::next(m.begin(), 5));
- assert(r.second == std::next(m.begin(), 6));
- r = m.equal_range(17);
- assert(r.first == std::next(m.begin(), 6));
- assert(r.second == std::next(m.begin(), 7));
- r = m.equal_range(19);
- assert(r.first == std::next(m.begin(), 7));
- assert(r.second == std::next(m.begin(), 8));
- r = m.equal_range(4);
- assert(r.first == std::next(m.begin(), 0));
- assert(r.second == std::next(m.begin(), 0));
- r = m.equal_range(6);
- assert(r.first == std::next(m.begin(), 1));
- assert(r.second == std::next(m.begin(), 1));
- r = m.equal_range(8);
- assert(r.first == std::next(m.begin(), 2));
- assert(r.second == std::next(m.begin(), 2));
- r = m.equal_range(10);
- assert(r.first == std::next(m.begin(), 3));
- assert(r.second == std::next(m.begin(), 3));
- r = m.equal_range(12);
- assert(r.first == std::next(m.begin(), 4));
- assert(r.second == std::next(m.begin(), 4));
- r = m.equal_range(14);
- assert(r.first == std::next(m.begin(), 5));
- assert(r.second == std::next(m.begin(), 5));
- r = m.equal_range(16);
- assert(r.first == std::next(m.begin(), 6));
- assert(r.second == std::next(m.begin(), 6));
- r = m.equal_range(18);
- assert(r.first == std::next(m.begin(), 7));
- assert(r.second == std::next(m.begin(), 7));
- r = m.equal_range(20);
- assert(r.first == std::next(m.begin(), 8));
- assert(r.second == std::next(m.begin(), 8));
- }
+ typedef std::pair<M::const_iterator, M::const_iterator> R;
+ V ar[] = {V(5, 5), V(7, 6), V(9, 7), V(11, 8), V(13, 9), V(15, 10), V(17, 11), V(19, 12)};
+ const M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.equal_range(5);
+ assert(r.first == std::next(m.begin(), 0));
+ assert(r.second == std::next(m.begin(), 1));
+ r = m.equal_range(7);
+ assert(r.first == std::next(m.begin(), 1));
+ assert(r.second == std::next(m.begin(), 2));
+ r = m.equal_range(9);
+ assert(r.first == std::next(m.begin(), 2));
+ assert(r.second == std::next(m.begin(), 3));
+ r = m.equal_range(11);
+ assert(r.first == std::next(m.begin(), 3));
+ assert(r.second == std::next(m.begin(), 4));
+ r = m.equal_range(13);
+ assert(r.first == std::next(m.begin(), 4));
+ assert(r.second == std::next(m.begin(), 5));
+ r = m.equal_range(15);
+ assert(r.first == std::next(m.begin(), 5));
+ assert(r.second == std::next(m.begin(), 6));
+ r = m.equal_range(17);
+ assert(r.first == std::next(m.begin(), 6));
+ assert(r.second == std::next(m.begin(), 7));
+ r = m.equal_range(19);
+ assert(r.first == std::next(m.begin(), 7));
+ assert(r.second == std::next(m.begin(), 8));
+ r = m.equal_range(4);
+ assert(r.first == std::next(m.begin(), 0));
+ assert(r.second == std::next(m.begin(), 0));
+ r = m.equal_range(6);
+ assert(r.first == std::next(m.begin(), 1));
+ assert(r.second == std::next(m.begin(), 1));
+ r = m.equal_range(8);
+ assert(r.first == std::next(m.begin(), 2));
+ assert(r.second == std::next(m.begin(), 2));
+ r = m.equal_range(10);
+ assert(r.first == std::next(m.begin(), 3));
+ assert(r.second == std::next(m.begin(), 3));
+ r = m.equal_range(12);
+ assert(r.first == std::next(m.begin(), 4));
+ assert(r.second == std::next(m.begin(), 4));
+ r = m.equal_range(14);
+ assert(r.first == std::next(m.begin(), 5));
+ assert(r.second == std::next(m.begin(), 5));
+ r = m.equal_range(16);
+ assert(r.first == std::next(m.begin(), 6));
+ assert(r.second == std::next(m.begin(), 6));
+ r = m.equal_range(18);
+ assert(r.first == std::next(m.begin(), 7));
+ assert(r.second == std::next(m.begin(), 7));
+ r = m.equal_range(20);
+ assert(r.first == std::next(m.begin(), 8));
+ assert(r.second == std::next(m.begin(), 8));
}
+ }
#endif
#if TEST_STD_VER > 11
- {
+ {
typedef std::pair<const int, double> V;
typedef std::map<int, double, std::less<>> M;
typedef std::pair<M::iterator, M::iterator> R;
- V ar[] =
- {
- V(5, 5),
- V(7, 6),
- V(9, 7),
- V(11, 8),
- V(13, 9),
- V(15, 10),
- V(17, 11),
- V(19, 12)
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ V ar[] = {V(5, 5), V(7, 6), V(9, 7), V(11, 8), V(13, 9), V(15, 10), V(17, 11), V(19, 12)};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
R r = m.equal_range(5);
assert(r.first == std::next(m.begin(), 0));
assert(r.second == std::next(m.begin(), 1));
@@ -418,21 +367,21 @@ int main(int, char**)
r = m.equal_range(C2Int(20));
assert(r.first == std::next(m.begin(), 8));
assert(r.second == std::next(m.begin(), 8));
- }
- {
+ }
+ {
typedef PrivateConstructor PC;
typedef std::map<PC, double, std::less<>> M;
typedef std::pair<M::iterator, M::iterator> R;
M m;
- m [ PC::make(5) ] = 5;
- m [ PC::make(7) ] = 6;
- m [ PC::make(9) ] = 7;
- m [ PC::make(11) ] = 8;
- m [ PC::make(13) ] = 9;
- m [ PC::make(15) ] = 10;
- m [ PC::make(17) ] = 11;
- m [ PC::make(19) ] = 12;
+ m[PC::make(5)] = 5;
+ m[PC::make(7)] = 6;
+ m[PC::make(9)] = 7;
+ m[PC::make(11)] = 8;
+ m[PC::make(13)] = 9;
+ m[PC::make(15)] = 10;
+ m[PC::make(17)] = 11;
+ m[PC::make(19)] = 12;
R r = m.equal_range(5);
assert(r.first == std::next(m.begin(), 0));
@@ -485,7 +434,7 @@ int main(int, char**)
r = m.equal_range(20);
assert(r.first == std::next(m.begin(), 8));
assert(r.second == std::next(m.begin(), 8));
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/map/map.ops/equal_range0.pass.cpp b/libcxx/test/std/containers/associative/map/map.ops/equal_range0.pass.cpp
index 6beb9b2246e29f7..75724bdb387ce20 100644
--- a/libcxx/test/std/containers/associative/map/map.ops/equal_range0.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.ops/equal_range0.pass.cpp
@@ -19,29 +19,27 @@
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
-
#include <map>
#include <cassert>
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::map<int, double, transparent_less> M;
typedef std::pair<typename M::iterator, typename M::iterator> P;
M example;
P result = example.equal_range(C2Int{5});
assert(result.first == result.second);
- }
- {
+ }
+ {
typedef std::map<int, double, transparent_less_not_referenceable> M;
typedef std::pair<typename M::iterator, typename M::iterator> P;
M example;
P result = example.equal_range(C2Int{5});
assert(result.first == result.second);
- }
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/map/map.ops/equal_range1.compile.fail.cpp b/libcxx/test/std/containers/associative/map/map.ops/equal_range1.compile.fail.cpp
index 826d510ad71eaab..d846a58899174e7 100644
--- a/libcxx/test/std/containers/associative/map/map.ops/equal_range1.compile.fail.cpp
+++ b/libcxx/test/std/containers/associative/map/map.ops/equal_range1.compile.fail.cpp
@@ -19,18 +19,16 @@
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
-
#include <map>
#include <cassert>
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::map<int, double, transparent_less_no_type> M;
TEST_IGNORE_NODISCARD M().equal_range(C2Int{5});
- }
+ }
}
diff --git a/libcxx/test/std/containers/associative/map/map.ops/equal_range2.compile.fail.cpp b/libcxx/test/std/containers/associative/map/map.ops/equal_range2.compile.fail.cpp
index 50616cfe8b1c68c..e341b3cb0ee45d7 100644
--- a/libcxx/test/std/containers/associative/map/map.ops/equal_range2.compile.fail.cpp
+++ b/libcxx/test/std/containers/associative/map/map.ops/equal_range2.compile.fail.cpp
@@ -19,18 +19,16 @@
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
-
#include <map>
#include <cassert>
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::map<int, double, transparent_less_private> M;
TEST_IGNORE_NODISCARD M().equal_range(C2Int{5});
- }
+ }
}
diff --git a/libcxx/test/std/containers/associative/map/map.ops/equal_range3.compile.fail.cpp b/libcxx/test/std/containers/associative/map/map.ops/equal_range3.compile.fail.cpp
index b4b58d33dedbb54..f99fc888ff52ac8 100644
--- a/libcxx/test/std/containers/associative/map/map.ops/equal_range3.compile.fail.cpp
+++ b/libcxx/test/std/containers/associative/map/map.ops/equal_range3.compile.fail.cpp
@@ -19,18 +19,16 @@
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
-
#include <map>
#include <cassert>
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::map<int, double, transparent_less_not_a_type> M;
TEST_IGNORE_NODISCARD M().equal_range(C2Int{5});
- }
+ }
}
diff --git a/libcxx/test/std/containers/associative/map/map.ops/equal_range_transparent.pass.cpp b/libcxx/test/std/containers/associative/map/map.ops/equal_range_transparent.pass.cpp
index 10330a134b054eb..2b651468887ea72 100644
--- a/libcxx/test/std/containers/associative/map/map.ops/equal_range_transparent.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.ops/equal_range_transparent.pass.cpp
@@ -25,25 +25,17 @@
struct Comp {
using is_transparent = void;
- bool operator()(const std::pair<int, int> &lhs,
- const std::pair<int, int> &rhs) const {
- return lhs < rhs;
- }
+ bool operator()(const std::pair<int, int>& lhs, const std::pair<int, int>& rhs) const { return lhs < rhs; }
- bool operator()(const std::pair<int, int> &lhs, int rhs) const {
- return lhs.first < rhs;
- }
+ bool operator()(const std::pair<int, int>& lhs, int rhs) const { return lhs.first < rhs; }
- bool operator()(int lhs, const std::pair<int, int> &rhs) const {
- return lhs < rhs.first;
- }
+ bool operator()(int lhs, const std::pair<int, int>& rhs) const { return lhs < rhs.first; }
};
int main(int, char**) {
- std::map<std::pair<int, int>, int, Comp> s{
- {{2, 1}, 1}, {{1, 2}, 2}, {{1, 3}, 3}, {{1, 4}, 4}, {{2, 2}, 5}};
+ std::map<std::pair<int, int>, int, Comp> s{{{2, 1}, 1}, {{1, 2}, 2}, {{1, 3}, 3}, {{1, 4}, 4}, {{2, 2}, 5}};
- auto er = s.equal_range(1);
+ auto er = s.equal_range(1);
long nels = 0;
for (auto it = er.first; it != er.second; it++) {
diff --git a/libcxx/test/std/containers/associative/map/map.ops/find.pass.cpp b/libcxx/test/std/containers/associative/map/map.ops/find.pass.cpp
index 4724162c5e35a57..534d78128407da3 100644
--- a/libcxx/test/std/containers/associative/map/map.ops/find.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.ops/find.pass.cpp
@@ -21,168 +21,117 @@
#include "private_constructor.h"
#include "is_transparent.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::pair<const int, double> V;
typedef std::map<int, double> M;
{
- typedef M::iterator R;
- V ar[] =
- {
- V(5, 5),
- V(6, 6),
- V(7, 7),
- V(8, 8),
- V(9, 9),
- V(10, 10),
- V(11, 11),
- V(12, 12)
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.find(5);
- assert(r == m.begin());
- r = m.find(6);
- assert(r == std::next(m.begin()));
- r = m.find(7);
- assert(r == std::next(m.begin(), 2));
- r = m.find(8);
- assert(r == std::next(m.begin(), 3));
- r = m.find(9);
- assert(r == std::next(m.begin(), 4));
- r = m.find(10);
- assert(r == std::next(m.begin(), 5));
- r = m.find(11);
- assert(r == std::next(m.begin(), 6));
- r = m.find(12);
- assert(r == std::next(m.begin(), 7));
- r = m.find(4);
- assert(r == std::next(m.begin(), 8));
+ typedef M::iterator R;
+ V ar[] = {V(5, 5), V(6, 6), V(7, 7), V(8, 8), V(9, 9), V(10, 10), V(11, 11), V(12, 12)};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.find(5);
+ assert(r == m.begin());
+ r = m.find(6);
+ assert(r == std::next(m.begin()));
+ r = m.find(7);
+ assert(r == std::next(m.begin(), 2));
+ r = m.find(8);
+ assert(r == std::next(m.begin(), 3));
+ r = m.find(9);
+ assert(r == std::next(m.begin(), 4));
+ r = m.find(10);
+ assert(r == std::next(m.begin(), 5));
+ r = m.find(11);
+ assert(r == std::next(m.begin(), 6));
+ r = m.find(12);
+ assert(r == std::next(m.begin(), 7));
+ r = m.find(4);
+ assert(r == std::next(m.begin(), 8));
}
{
- typedef M::const_iterator R;
- V ar[] =
- {
- V(5, 5),
- V(6, 6),
- V(7, 7),
- V(8, 8),
- V(9, 9),
- V(10, 10),
- V(11, 11),
- V(12, 12)
- };
- const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.find(5);
- assert(r == m.begin());
- r = m.find(6);
- assert(r == std::next(m.begin()));
- r = m.find(7);
- assert(r == std::next(m.begin(), 2));
- r = m.find(8);
- assert(r == std::next(m.begin(), 3));
- r = m.find(9);
- assert(r == std::next(m.begin(), 4));
- r = m.find(10);
- assert(r == std::next(m.begin(), 5));
- r = m.find(11);
- assert(r == std::next(m.begin(), 6));
- r = m.find(12);
- assert(r == std::next(m.begin(), 7));
- r = m.find(4);
- assert(r == std::next(m.begin(), 8));
- }
+ typedef M::const_iterator R;
+ V ar[] = {V(5, 5), V(6, 6), V(7, 7), V(8, 8), V(9, 9), V(10, 10), V(11, 11), V(12, 12)};
+ const M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.find(5);
+ assert(r == m.begin());
+ r = m.find(6);
+ assert(r == std::next(m.begin()));
+ r = m.find(7);
+ assert(r == std::next(m.begin(), 2));
+ r = m.find(8);
+ assert(r == std::next(m.begin(), 3));
+ r = m.find(9);
+ assert(r == std::next(m.begin(), 4));
+ r = m.find(10);
+ assert(r == std::next(m.begin(), 5));
+ r = m.find(11);
+ assert(r == std::next(m.begin(), 6));
+ r = m.find(12);
+ assert(r == std::next(m.begin(), 7));
+ r = m.find(4);
+ assert(r == std::next(m.begin(), 8));
}
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::pair<const int, double> V;
typedef std::map<int, double, std::less<int>, min_allocator<V>> M;
{
- typedef M::iterator R;
- V ar[] =
- {
- V(5, 5),
- V(6, 6),
- V(7, 7),
- V(8, 8),
- V(9, 9),
- V(10, 10),
- V(11, 11),
- V(12, 12)
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.find(5);
- assert(r == m.begin());
- r = m.find(6);
- assert(r == std::next(m.begin()));
- r = m.find(7);
- assert(r == std::next(m.begin(), 2));
- r = m.find(8);
- assert(r == std::next(m.begin(), 3));
- r = m.find(9);
- assert(r == std::next(m.begin(), 4));
- r = m.find(10);
- assert(r == std::next(m.begin(), 5));
- r = m.find(11);
- assert(r == std::next(m.begin(), 6));
- r = m.find(12);
- assert(r == std::next(m.begin(), 7));
- r = m.find(4);
- assert(r == std::next(m.begin(), 8));
+ typedef M::iterator R;
+ V ar[] = {V(5, 5), V(6, 6), V(7, 7), V(8, 8), V(9, 9), V(10, 10), V(11, 11), V(12, 12)};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.find(5);
+ assert(r == m.begin());
+ r = m.find(6);
+ assert(r == std::next(m.begin()));
+ r = m.find(7);
+ assert(r == std::next(m.begin(), 2));
+ r = m.find(8);
+ assert(r == std::next(m.begin(), 3));
+ r = m.find(9);
+ assert(r == std::next(m.begin(), 4));
+ r = m.find(10);
+ assert(r == std::next(m.begin(), 5));
+ r = m.find(11);
+ assert(r == std::next(m.begin(), 6));
+ r = m.find(12);
+ assert(r == std::next(m.begin(), 7));
+ r = m.find(4);
+ assert(r == std::next(m.begin(), 8));
}
{
- typedef M::const_iterator R;
- V ar[] =
- {
- V(5, 5),
- V(6, 6),
- V(7, 7),
- V(8, 8),
- V(9, 9),
- V(10, 10),
- V(11, 11),
- V(12, 12)
- };
- const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.find(5);
- assert(r == m.begin());
- r = m.find(6);
- assert(r == std::next(m.begin()));
- r = m.find(7);
- assert(r == std::next(m.begin(), 2));
- r = m.find(8);
- assert(r == std::next(m.begin(), 3));
- r = m.find(9);
- assert(r == std::next(m.begin(), 4));
- r = m.find(10);
- assert(r == std::next(m.begin(), 5));
- r = m.find(11);
- assert(r == std::next(m.begin(), 6));
- r = m.find(12);
- assert(r == std::next(m.begin(), 7));
- r = m.find(4);
- assert(r == std::next(m.begin(), 8));
- }
+ typedef M::const_iterator R;
+ V ar[] = {V(5, 5), V(6, 6), V(7, 7), V(8, 8), V(9, 9), V(10, 10), V(11, 11), V(12, 12)};
+ const M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.find(5);
+ assert(r == m.begin());
+ r = m.find(6);
+ assert(r == std::next(m.begin()));
+ r = m.find(7);
+ assert(r == std::next(m.begin(), 2));
+ r = m.find(8);
+ assert(r == std::next(m.begin(), 3));
+ r = m.find(9);
+ assert(r == std::next(m.begin(), 4));
+ r = m.find(10);
+ assert(r == std::next(m.begin(), 5));
+ r = m.find(11);
+ assert(r == std::next(m.begin(), 6));
+ r = m.find(12);
+ assert(r == std::next(m.begin(), 7));
+ r = m.find(4);
+ assert(r == std::next(m.begin(), 8));
}
+ }
#endif
#if TEST_STD_VER > 11
- {
+ {
typedef std::pair<const int, double> V;
typedef std::map<int, double, std::less<>> M;
typedef M::iterator R;
- V ar[] =
- {
- V(5, 5),
- V(6, 6),
- V(7, 7),
- V(8, 8),
- V(9, 9),
- V(10, 10),
- V(11, 11),
- V(12, 12)
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ V ar[] = {V(5, 5), V(6, 6), V(7, 7), V(8, 8), V(9, 9), V(10, 10), V(11, 11), V(12, 12)};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
R r = m.find(5);
assert(r == m.begin());
r = m.find(6);
@@ -220,22 +169,22 @@ int main(int, char**)
assert(r == std::next(m.begin(), 7));
r = m.find(C2Int(4));
assert(r == std::next(m.begin(), 8));
- }
+ }
- {
+ {
typedef PrivateConstructor PC;
typedef std::map<PC, double, std::less<>> M;
typedef M::iterator R;
M m;
- m [ PC::make(5) ] = 5;
- m [ PC::make(6) ] = 6;
- m [ PC::make(7) ] = 7;
- m [ PC::make(8) ] = 8;
- m [ PC::make(9) ] = 9;
- m [ PC::make(10) ] = 10;
- m [ PC::make(11) ] = 11;
- m [ PC::make(12) ] = 12;
+ m[PC::make(5)] = 5;
+ m[PC::make(6)] = 6;
+ m[PC::make(7)] = 7;
+ m[PC::make(8)] = 8;
+ m[PC::make(9)] = 9;
+ m[PC::make(10)] = 10;
+ m[PC::make(11)] = 11;
+ m[PC::make(12)] = 12;
R r = m.find(5);
assert(r == m.begin());
@@ -255,7 +204,7 @@ int main(int, char**)
assert(r == std::next(m.begin(), 7));
r = m.find(4);
assert(r == std::next(m.begin(), 8));
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/map/map.ops/find0.pass.cpp b/libcxx/test/std/containers/associative/map/map.ops/find0.pass.cpp
index 6017e9b7e849120..9825d6c5879b197 100644
--- a/libcxx/test/std/containers/associative/map/map.ops/find0.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.ops/find0.pass.cpp
@@ -19,25 +19,23 @@
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
-
#include <map>
#include <cassert>
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::map<int, double, transparent_less> M;
M example;
assert(example.find(C2Int{5}) == example.end());
- }
- {
+ }
+ {
typedef std::map<int, double, transparent_less_not_referenceable> M;
M example;
assert(example.find(C2Int{5}) == example.end());
- }
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/map/map.ops/find1.compile.fail.cpp b/libcxx/test/std/containers/associative/map/map.ops/find1.compile.fail.cpp
index 358983d846eb688..b67b3b33b38cc40 100644
--- a/libcxx/test/std/containers/associative/map/map.ops/find1.compile.fail.cpp
+++ b/libcxx/test/std/containers/associative/map/map.ops/find1.compile.fail.cpp
@@ -19,18 +19,16 @@
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
-
#include <map>
#include <cassert>
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::map<int, double, transparent_less_no_type> M;
TEST_IGNORE_NODISCARD M().find(C2Int{5});
- }
+ }
}
diff --git a/libcxx/test/std/containers/associative/map/map.ops/find2.compile.fail.cpp b/libcxx/test/std/containers/associative/map/map.ops/find2.compile.fail.cpp
index 130f2bcd5c696f1..49ded6659a5013e 100644
--- a/libcxx/test/std/containers/associative/map/map.ops/find2.compile.fail.cpp
+++ b/libcxx/test/std/containers/associative/map/map.ops/find2.compile.fail.cpp
@@ -19,18 +19,16 @@
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
-
#include <map>
#include <cassert>
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::map<int, double, transparent_less_private> M;
TEST_IGNORE_NODISCARD M().find(C2Int{5});
- }
+ }
}
diff --git a/libcxx/test/std/containers/associative/map/map.ops/find3.compile.fail.cpp b/libcxx/test/std/containers/associative/map/map.ops/find3.compile.fail.cpp
index 6340de32cd8e913..ba978dde21a76ce 100644
--- a/libcxx/test/std/containers/associative/map/map.ops/find3.compile.fail.cpp
+++ b/libcxx/test/std/containers/associative/map/map.ops/find3.compile.fail.cpp
@@ -19,18 +19,16 @@
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
-
#include <map>
#include <cassert>
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::map<int, double, transparent_less_not_a_type> M;
TEST_IGNORE_NODISCARD M().find(C2Int{5});
- }
+ }
}
diff --git a/libcxx/test/std/containers/associative/map/map.ops/lower_bound.pass.cpp b/libcxx/test/std/containers/associative/map/map.ops/lower_bound.pass.cpp
index 777b98215e59f53..755ad36a3ba4ddb 100644
--- a/libcxx/test/std/containers/associative/map/map.ops/lower_bound.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.ops/lower_bound.pass.cpp
@@ -21,232 +21,181 @@
#include "private_constructor.h"
#include "is_transparent.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::pair<const int, double> V;
typedef std::map<int, double> M;
{
- typedef M::iterator R;
- V ar[] =
- {
- V(5, 5),
- V(7, 6),
- V(9, 7),
- V(11, 8),
- V(13, 9),
- V(15, 10),
- V(17, 11),
- V(19, 12)
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.lower_bound(5);
- assert(r == m.begin());
- r = m.lower_bound(7);
- assert(r == std::next(m.begin()));
- r = m.lower_bound(9);
- assert(r == std::next(m.begin(), 2));
- r = m.lower_bound(11);
- assert(r == std::next(m.begin(), 3));
- r = m.lower_bound(13);
- assert(r == std::next(m.begin(), 4));
- r = m.lower_bound(15);
- assert(r == std::next(m.begin(), 5));
- r = m.lower_bound(17);
- assert(r == std::next(m.begin(), 6));
- r = m.lower_bound(19);
- assert(r == std::next(m.begin(), 7));
- r = m.lower_bound(4);
- assert(r == std::next(m.begin(), 0));
- r = m.lower_bound(6);
- assert(r == std::next(m.begin(), 1));
- r = m.lower_bound(8);
- assert(r == std::next(m.begin(), 2));
- r = m.lower_bound(10);
- assert(r == std::next(m.begin(), 3));
- r = m.lower_bound(12);
- assert(r == std::next(m.begin(), 4));
- r = m.lower_bound(14);
- assert(r == std::next(m.begin(), 5));
- r = m.lower_bound(16);
- assert(r == std::next(m.begin(), 6));
- r = m.lower_bound(18);
- assert(r == std::next(m.begin(), 7));
- r = m.lower_bound(20);
- assert(r == std::next(m.begin(), 8));
+ typedef M::iterator R;
+ V ar[] = {V(5, 5), V(7, 6), V(9, 7), V(11, 8), V(13, 9), V(15, 10), V(17, 11), V(19, 12)};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.lower_bound(5);
+ assert(r == m.begin());
+ r = m.lower_bound(7);
+ assert(r == std::next(m.begin()));
+ r = m.lower_bound(9);
+ assert(r == std::next(m.begin(), 2));
+ r = m.lower_bound(11);
+ assert(r == std::next(m.begin(), 3));
+ r = m.lower_bound(13);
+ assert(r == std::next(m.begin(), 4));
+ r = m.lower_bound(15);
+ assert(r == std::next(m.begin(), 5));
+ r = m.lower_bound(17);
+ assert(r == std::next(m.begin(), 6));
+ r = m.lower_bound(19);
+ assert(r == std::next(m.begin(), 7));
+ r = m.lower_bound(4);
+ assert(r == std::next(m.begin(), 0));
+ r = m.lower_bound(6);
+ assert(r == std::next(m.begin(), 1));
+ r = m.lower_bound(8);
+ assert(r == std::next(m.begin(), 2));
+ r = m.lower_bound(10);
+ assert(r == std::next(m.begin(), 3));
+ r = m.lower_bound(12);
+ assert(r == std::next(m.begin(), 4));
+ r = m.lower_bound(14);
+ assert(r == std::next(m.begin(), 5));
+ r = m.lower_bound(16);
+ assert(r == std::next(m.begin(), 6));
+ r = m.lower_bound(18);
+ assert(r == std::next(m.begin(), 7));
+ r = m.lower_bound(20);
+ assert(r == std::next(m.begin(), 8));
}
{
- typedef M::const_iterator R;
- V ar[] =
- {
- V(5, 5),
- V(7, 6),
- V(9, 7),
- V(11, 8),
- V(13, 9),
- V(15, 10),
- V(17, 11),
- V(19, 12)
- };
- const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.lower_bound(5);
- assert(r == m.begin());
- r = m.lower_bound(7);
- assert(r == std::next(m.begin()));
- r = m.lower_bound(9);
- assert(r == std::next(m.begin(), 2));
- r = m.lower_bound(11);
- assert(r == std::next(m.begin(), 3));
- r = m.lower_bound(13);
- assert(r == std::next(m.begin(), 4));
- r = m.lower_bound(15);
- assert(r == std::next(m.begin(), 5));
- r = m.lower_bound(17);
- assert(r == std::next(m.begin(), 6));
- r = m.lower_bound(19);
- assert(r == std::next(m.begin(), 7));
- r = m.lower_bound(4);
- assert(r == std::next(m.begin(), 0));
- r = m.lower_bound(6);
- assert(r == std::next(m.begin(), 1));
- r = m.lower_bound(8);
- assert(r == std::next(m.begin(), 2));
- r = m.lower_bound(10);
- assert(r == std::next(m.begin(), 3));
- r = m.lower_bound(12);
- assert(r == std::next(m.begin(), 4));
- r = m.lower_bound(14);
- assert(r == std::next(m.begin(), 5));
- r = m.lower_bound(16);
- assert(r == std::next(m.begin(), 6));
- r = m.lower_bound(18);
- assert(r == std::next(m.begin(), 7));
- r = m.lower_bound(20);
- assert(r == std::next(m.begin(), 8));
- }
+ typedef M::const_iterator R;
+ V ar[] = {V(5, 5), V(7, 6), V(9, 7), V(11, 8), V(13, 9), V(15, 10), V(17, 11), V(19, 12)};
+ const M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.lower_bound(5);
+ assert(r == m.begin());
+ r = m.lower_bound(7);
+ assert(r == std::next(m.begin()));
+ r = m.lower_bound(9);
+ assert(r == std::next(m.begin(), 2));
+ r = m.lower_bound(11);
+ assert(r == std::next(m.begin(), 3));
+ r = m.lower_bound(13);
+ assert(r == std::next(m.begin(), 4));
+ r = m.lower_bound(15);
+ assert(r == std::next(m.begin(), 5));
+ r = m.lower_bound(17);
+ assert(r == std::next(m.begin(), 6));
+ r = m.lower_bound(19);
+ assert(r == std::next(m.begin(), 7));
+ r = m.lower_bound(4);
+ assert(r == std::next(m.begin(), 0));
+ r = m.lower_bound(6);
+ assert(r == std::next(m.begin(), 1));
+ r = m.lower_bound(8);
+ assert(r == std::next(m.begin(), 2));
+ r = m.lower_bound(10);
+ assert(r == std::next(m.begin(), 3));
+ r = m.lower_bound(12);
+ assert(r == std::next(m.begin(), 4));
+ r = m.lower_bound(14);
+ assert(r == std::next(m.begin(), 5));
+ r = m.lower_bound(16);
+ assert(r == std::next(m.begin(), 6));
+ r = m.lower_bound(18);
+ assert(r == std::next(m.begin(), 7));
+ r = m.lower_bound(20);
+ assert(r == std::next(m.begin(), 8));
}
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::pair<const int, double> V;
typedef std::map<int, double, std::less<int>, min_allocator<V>> M;
{
- typedef M::iterator R;
- V ar[] =
- {
- V(5, 5),
- V(7, 6),
- V(9, 7),
- V(11, 8),
- V(13, 9),
- V(15, 10),
- V(17, 11),
- V(19, 12)
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.lower_bound(5);
- assert(r == m.begin());
- r = m.lower_bound(7);
- assert(r == std::next(m.begin()));
- r = m.lower_bound(9);
- assert(r == std::next(m.begin(), 2));
- r = m.lower_bound(11);
- assert(r == std::next(m.begin(), 3));
- r = m.lower_bound(13);
- assert(r == std::next(m.begin(), 4));
- r = m.lower_bound(15);
- assert(r == std::next(m.begin(), 5));
- r = m.lower_bound(17);
- assert(r == std::next(m.begin(), 6));
- r = m.lower_bound(19);
- assert(r == std::next(m.begin(), 7));
- r = m.lower_bound(4);
- assert(r == std::next(m.begin(), 0));
- r = m.lower_bound(6);
- assert(r == std::next(m.begin(), 1));
- r = m.lower_bound(8);
- assert(r == std::next(m.begin(), 2));
- r = m.lower_bound(10);
- assert(r == std::next(m.begin(), 3));
- r = m.lower_bound(12);
- assert(r == std::next(m.begin(), 4));
- r = m.lower_bound(14);
- assert(r == std::next(m.begin(), 5));
- r = m.lower_bound(16);
- assert(r == std::next(m.begin(), 6));
- r = m.lower_bound(18);
- assert(r == std::next(m.begin(), 7));
- r = m.lower_bound(20);
- assert(r == std::next(m.begin(), 8));
+ typedef M::iterator R;
+ V ar[] = {V(5, 5), V(7, 6), V(9, 7), V(11, 8), V(13, 9), V(15, 10), V(17, 11), V(19, 12)};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.lower_bound(5);
+ assert(r == m.begin());
+ r = m.lower_bound(7);
+ assert(r == std::next(m.begin()));
+ r = m.lower_bound(9);
+ assert(r == std::next(m.begin(), 2));
+ r = m.lower_bound(11);
+ assert(r == std::next(m.begin(), 3));
+ r = m.lower_bound(13);
+ assert(r == std::next(m.begin(), 4));
+ r = m.lower_bound(15);
+ assert(r == std::next(m.begin(), 5));
+ r = m.lower_bound(17);
+ assert(r == std::next(m.begin(), 6));
+ r = m.lower_bound(19);
+ assert(r == std::next(m.begin(), 7));
+ r = m.lower_bound(4);
+ assert(r == std::next(m.begin(), 0));
+ r = m.lower_bound(6);
+ assert(r == std::next(m.begin(), 1));
+ r = m.lower_bound(8);
+ assert(r == std::next(m.begin(), 2));
+ r = m.lower_bound(10);
+ assert(r == std::next(m.begin(), 3));
+ r = m.lower_bound(12);
+ assert(r == std::next(m.begin(), 4));
+ r = m.lower_bound(14);
+ assert(r == std::next(m.begin(), 5));
+ r = m.lower_bound(16);
+ assert(r == std::next(m.begin(), 6));
+ r = m.lower_bound(18);
+ assert(r == std::next(m.begin(), 7));
+ r = m.lower_bound(20);
+ assert(r == std::next(m.begin(), 8));
}
{
- typedef M::const_iterator R;
- V ar[] =
- {
- V(5, 5),
- V(7, 6),
- V(9, 7),
- V(11, 8),
- V(13, 9),
- V(15, 10),
- V(17, 11),
- V(19, 12)
- };
- const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.lower_bound(5);
- assert(r == m.begin());
- r = m.lower_bound(7);
- assert(r == std::next(m.begin()));
- r = m.lower_bound(9);
- assert(r == std::next(m.begin(), 2));
- r = m.lower_bound(11);
- assert(r == std::next(m.begin(), 3));
- r = m.lower_bound(13);
- assert(r == std::next(m.begin(), 4));
- r = m.lower_bound(15);
- assert(r == std::next(m.begin(), 5));
- r = m.lower_bound(17);
- assert(r == std::next(m.begin(), 6));
- r = m.lower_bound(19);
- assert(r == std::next(m.begin(), 7));
- r = m.lower_bound(4);
- assert(r == std::next(m.begin(), 0));
- r = m.lower_bound(6);
- assert(r == std::next(m.begin(), 1));
- r = m.lower_bound(8);
- assert(r == std::next(m.begin(), 2));
- r = m.lower_bound(10);
- assert(r == std::next(m.begin(), 3));
- r = m.lower_bound(12);
- assert(r == std::next(m.begin(), 4));
- r = m.lower_bound(14);
- assert(r == std::next(m.begin(), 5));
- r = m.lower_bound(16);
- assert(r == std::next(m.begin(), 6));
- r = m.lower_bound(18);
- assert(r == std::next(m.begin(), 7));
- r = m.lower_bound(20);
- assert(r == std::next(m.begin(), 8));
- }
+ typedef M::const_iterator R;
+ V ar[] = {V(5, 5), V(7, 6), V(9, 7), V(11, 8), V(13, 9), V(15, 10), V(17, 11), V(19, 12)};
+ const M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.lower_bound(5);
+ assert(r == m.begin());
+ r = m.lower_bound(7);
+ assert(r == std::next(m.begin()));
+ r = m.lower_bound(9);
+ assert(r == std::next(m.begin(), 2));
+ r = m.lower_bound(11);
+ assert(r == std::next(m.begin(), 3));
+ r = m.lower_bound(13);
+ assert(r == std::next(m.begin(), 4));
+ r = m.lower_bound(15);
+ assert(r == std::next(m.begin(), 5));
+ r = m.lower_bound(17);
+ assert(r == std::next(m.begin(), 6));
+ r = m.lower_bound(19);
+ assert(r == std::next(m.begin(), 7));
+ r = m.lower_bound(4);
+ assert(r == std::next(m.begin(), 0));
+ r = m.lower_bound(6);
+ assert(r == std::next(m.begin(), 1));
+ r = m.lower_bound(8);
+ assert(r == std::next(m.begin(), 2));
+ r = m.lower_bound(10);
+ assert(r == std::next(m.begin(), 3));
+ r = m.lower_bound(12);
+ assert(r == std::next(m.begin(), 4));
+ r = m.lower_bound(14);
+ assert(r == std::next(m.begin(), 5));
+ r = m.lower_bound(16);
+ assert(r == std::next(m.begin(), 6));
+ r = m.lower_bound(18);
+ assert(r == std::next(m.begin(), 7));
+ r = m.lower_bound(20);
+ assert(r == std::next(m.begin(), 8));
}
+ }
#endif
#if TEST_STD_VER > 11
- {
+ {
typedef std::pair<const int, double> V;
- typedef std::map<int, double, std::less <>> M;
+ typedef std::map<int, double, std::less<>> M;
typedef M::iterator R;
- V ar[] =
- {
- V(5, 5),
- V(7, 6),
- V(9, 7),
- V(11, 8),
- V(13, 9),
- V(15, 10),
- V(17, 11),
- V(19, 12)
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ V ar[] = {V(5, 5), V(7, 6), V(9, 7), V(11, 8), V(13, 9), V(15, 10), V(17, 11), V(19, 12)};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
R r = m.lower_bound(5);
assert(r == m.begin());
r = m.lower_bound(7);
@@ -316,22 +265,22 @@ int main(int, char**)
assert(r == std::next(m.begin(), 7));
r = m.lower_bound(C2Int(20));
assert(r == std::next(m.begin(), 8));
- }
+ }
- {
+ {
typedef PrivateConstructor PC;
typedef std::map<PC, double, std::less<>> M;
typedef M::iterator R;
M m;
- m [ PC::make(5) ] = 5;
- m [ PC::make(7) ] = 6;
- m [ PC::make(9) ] = 7;
- m [ PC::make(11) ] = 8;
- m [ PC::make(13) ] = 9;
- m [ PC::make(15) ] = 10;
- m [ PC::make(17) ] = 11;
- m [ PC::make(19) ] = 12;
+ m[PC::make(5)] = 5;
+ m[PC::make(7)] = 6;
+ m[PC::make(9)] = 7;
+ m[PC::make(11)] = 8;
+ m[PC::make(13)] = 9;
+ m[PC::make(15)] = 10;
+ m[PC::make(17)] = 11;
+ m[PC::make(19)] = 12;
R r = m.lower_bound(5);
assert(r == m.begin());
@@ -367,7 +316,7 @@ int main(int, char**)
assert(r == std::next(m.begin(), 7));
r = m.lower_bound(20);
assert(r == std::next(m.begin(), 8));
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/map/map.ops/lower_bound0.pass.cpp b/libcxx/test/std/containers/associative/map/map.ops/lower_bound0.pass.cpp
index 78a42904d8c6263..fe7fe381a86eb90 100644
--- a/libcxx/test/std/containers/associative/map/map.ops/lower_bound0.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.ops/lower_bound0.pass.cpp
@@ -19,25 +19,23 @@
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
-
#include <map>
#include <cassert>
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::map<int, double, transparent_less> M;
M example;
assert(example.lower_bound(C2Int{5}) == example.end());
- }
- {
+ }
+ {
typedef std::map<int, double, transparent_less_not_referenceable> M;
M example;
assert(example.lower_bound(C2Int{5}) == example.end());
- }
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/map/map.ops/lower_bound1.compile.fail.cpp b/libcxx/test/std/containers/associative/map/map.ops/lower_bound1.compile.fail.cpp
index 91ef0befab5b850..e07177b7a6e86ff 100644
--- a/libcxx/test/std/containers/associative/map/map.ops/lower_bound1.compile.fail.cpp
+++ b/libcxx/test/std/containers/associative/map/map.ops/lower_bound1.compile.fail.cpp
@@ -19,18 +19,16 @@
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
-
#include <map>
#include <cassert>
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::map<int, double, transparent_less_no_type> M;
TEST_IGNORE_NODISCARD M().lower_bound(C2Int{5});
- }
+ }
}
diff --git a/libcxx/test/std/containers/associative/map/map.ops/lower_bound2.compile.fail.cpp b/libcxx/test/std/containers/associative/map/map.ops/lower_bound2.compile.fail.cpp
index 7ab8094b098d7af..72dc1a5eb2b3778 100644
--- a/libcxx/test/std/containers/associative/map/map.ops/lower_bound2.compile.fail.cpp
+++ b/libcxx/test/std/containers/associative/map/map.ops/lower_bound2.compile.fail.cpp
@@ -19,18 +19,16 @@
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
-
#include <map>
#include <cassert>
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::map<int, double, transparent_less_private> M;
TEST_IGNORE_NODISCARD M().lower_bound(C2Int{5});
- }
+ }
}
diff --git a/libcxx/test/std/containers/associative/map/map.ops/lower_bound3.compile.fail.cpp b/libcxx/test/std/containers/associative/map/map.ops/lower_bound3.compile.fail.cpp
index 09f7ac4c88001b1..10da1aad25f2927 100644
--- a/libcxx/test/std/containers/associative/map/map.ops/lower_bound3.compile.fail.cpp
+++ b/libcxx/test/std/containers/associative/map/map.ops/lower_bound3.compile.fail.cpp
@@ -25,11 +25,10 @@
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::map<int, double, transparent_less_not_a_type> M;
TEST_IGNORE_NODISCARD M().lower_bound(C2Int{5});
- }
+ }
}
diff --git a/libcxx/test/std/containers/associative/map/map.ops/upper_bound.pass.cpp b/libcxx/test/std/containers/associative/map/map.ops/upper_bound.pass.cpp
index 3bacd76ed684be7..bd967e3dfb742a6 100644
--- a/libcxx/test/std/containers/associative/map/map.ops/upper_bound.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.ops/upper_bound.pass.cpp
@@ -20,231 +20,180 @@
#include "min_allocator.h"
#include "private_constructor.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::pair<const int, double> V;
typedef std::map<int, double> M;
{
- typedef M::iterator R;
- V ar[] =
- {
- V(5, 5),
- V(7, 6),
- V(9, 7),
- V(11, 8),
- V(13, 9),
- V(15, 10),
- V(17, 11),
- V(19, 12)
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.upper_bound(5);
- assert(r == std::next(m.begin(), 1));
- r = m.upper_bound(7);
- assert(r == std::next(m.begin(), 2));
- r = m.upper_bound(9);
- assert(r == std::next(m.begin(), 3));
- r = m.upper_bound(11);
- assert(r == std::next(m.begin(), 4));
- r = m.upper_bound(13);
- assert(r == std::next(m.begin(), 5));
- r = m.upper_bound(15);
- assert(r == std::next(m.begin(), 6));
- r = m.upper_bound(17);
- assert(r == std::next(m.begin(), 7));
- r = m.upper_bound(19);
- assert(r == std::next(m.begin(), 8));
- r = m.upper_bound(4);
- assert(r == std::next(m.begin(), 0));
- r = m.upper_bound(6);
- assert(r == std::next(m.begin(), 1));
- r = m.upper_bound(8);
- assert(r == std::next(m.begin(), 2));
- r = m.upper_bound(10);
- assert(r == std::next(m.begin(), 3));
- r = m.upper_bound(12);
- assert(r == std::next(m.begin(), 4));
- r = m.upper_bound(14);
- assert(r == std::next(m.begin(), 5));
- r = m.upper_bound(16);
- assert(r == std::next(m.begin(), 6));
- r = m.upper_bound(18);
- assert(r == std::next(m.begin(), 7));
- r = m.upper_bound(20);
- assert(r == std::next(m.begin(), 8));
+ typedef M::iterator R;
+ V ar[] = {V(5, 5), V(7, 6), V(9, 7), V(11, 8), V(13, 9), V(15, 10), V(17, 11), V(19, 12)};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.upper_bound(5);
+ assert(r == std::next(m.begin(), 1));
+ r = m.upper_bound(7);
+ assert(r == std::next(m.begin(), 2));
+ r = m.upper_bound(9);
+ assert(r == std::next(m.begin(), 3));
+ r = m.upper_bound(11);
+ assert(r == std::next(m.begin(), 4));
+ r = m.upper_bound(13);
+ assert(r == std::next(m.begin(), 5));
+ r = m.upper_bound(15);
+ assert(r == std::next(m.begin(), 6));
+ r = m.upper_bound(17);
+ assert(r == std::next(m.begin(), 7));
+ r = m.upper_bound(19);
+ assert(r == std::next(m.begin(), 8));
+ r = m.upper_bound(4);
+ assert(r == std::next(m.begin(), 0));
+ r = m.upper_bound(6);
+ assert(r == std::next(m.begin(), 1));
+ r = m.upper_bound(8);
+ assert(r == std::next(m.begin(), 2));
+ r = m.upper_bound(10);
+ assert(r == std::next(m.begin(), 3));
+ r = m.upper_bound(12);
+ assert(r == std::next(m.begin(), 4));
+ r = m.upper_bound(14);
+ assert(r == std::next(m.begin(), 5));
+ r = m.upper_bound(16);
+ assert(r == std::next(m.begin(), 6));
+ r = m.upper_bound(18);
+ assert(r == std::next(m.begin(), 7));
+ r = m.upper_bound(20);
+ assert(r == std::next(m.begin(), 8));
}
{
- typedef M::const_iterator R;
- V ar[] =
- {
- V(5, 5),
- V(7, 6),
- V(9, 7),
- V(11, 8),
- V(13, 9),
- V(15, 10),
- V(17, 11),
- V(19, 12)
- };
- const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.upper_bound(5);
- assert(r == std::next(m.begin(), 1));
- r = m.upper_bound(7);
- assert(r == std::next(m.begin(), 2));
- r = m.upper_bound(9);
- assert(r == std::next(m.begin(), 3));
- r = m.upper_bound(11);
- assert(r == std::next(m.begin(), 4));
- r = m.upper_bound(13);
- assert(r == std::next(m.begin(), 5));
- r = m.upper_bound(15);
- assert(r == std::next(m.begin(), 6));
- r = m.upper_bound(17);
- assert(r == std::next(m.begin(), 7));
- r = m.upper_bound(19);
- assert(r == std::next(m.begin(), 8));
- r = m.upper_bound(4);
- assert(r == std::next(m.begin(), 0));
- r = m.upper_bound(6);
- assert(r == std::next(m.begin(), 1));
- r = m.upper_bound(8);
- assert(r == std::next(m.begin(), 2));
- r = m.upper_bound(10);
- assert(r == std::next(m.begin(), 3));
- r = m.upper_bound(12);
- assert(r == std::next(m.begin(), 4));
- r = m.upper_bound(14);
- assert(r == std::next(m.begin(), 5));
- r = m.upper_bound(16);
- assert(r == std::next(m.begin(), 6));
- r = m.upper_bound(18);
- assert(r == std::next(m.begin(), 7));
- r = m.upper_bound(20);
- assert(r == std::next(m.begin(), 8));
- }
+ typedef M::const_iterator R;
+ V ar[] = {V(5, 5), V(7, 6), V(9, 7), V(11, 8), V(13, 9), V(15, 10), V(17, 11), V(19, 12)};
+ const M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.upper_bound(5);
+ assert(r == std::next(m.begin(), 1));
+ r = m.upper_bound(7);
+ assert(r == std::next(m.begin(), 2));
+ r = m.upper_bound(9);
+ assert(r == std::next(m.begin(), 3));
+ r = m.upper_bound(11);
+ assert(r == std::next(m.begin(), 4));
+ r = m.upper_bound(13);
+ assert(r == std::next(m.begin(), 5));
+ r = m.upper_bound(15);
+ assert(r == std::next(m.begin(), 6));
+ r = m.upper_bound(17);
+ assert(r == std::next(m.begin(), 7));
+ r = m.upper_bound(19);
+ assert(r == std::next(m.begin(), 8));
+ r = m.upper_bound(4);
+ assert(r == std::next(m.begin(), 0));
+ r = m.upper_bound(6);
+ assert(r == std::next(m.begin(), 1));
+ r = m.upper_bound(8);
+ assert(r == std::next(m.begin(), 2));
+ r = m.upper_bound(10);
+ assert(r == std::next(m.begin(), 3));
+ r = m.upper_bound(12);
+ assert(r == std::next(m.begin(), 4));
+ r = m.upper_bound(14);
+ assert(r == std::next(m.begin(), 5));
+ r = m.upper_bound(16);
+ assert(r == std::next(m.begin(), 6));
+ r = m.upper_bound(18);
+ assert(r == std::next(m.begin(), 7));
+ r = m.upper_bound(20);
+ assert(r == std::next(m.begin(), 8));
}
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::pair<const int, double> V;
typedef std::map<int, double, std::less<int>, min_allocator<V>> M;
{
- typedef M::iterator R;
- V ar[] =
- {
- V(5, 5),
- V(7, 6),
- V(9, 7),
- V(11, 8),
- V(13, 9),
- V(15, 10),
- V(17, 11),
- V(19, 12)
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.upper_bound(5);
- assert(r == std::next(m.begin(), 1));
- r = m.upper_bound(7);
- assert(r == std::next(m.begin(), 2));
- r = m.upper_bound(9);
- assert(r == std::next(m.begin(), 3));
- r = m.upper_bound(11);
- assert(r == std::next(m.begin(), 4));
- r = m.upper_bound(13);
- assert(r == std::next(m.begin(), 5));
- r = m.upper_bound(15);
- assert(r == std::next(m.begin(), 6));
- r = m.upper_bound(17);
- assert(r == std::next(m.begin(), 7));
- r = m.upper_bound(19);
- assert(r == std::next(m.begin(), 8));
- r = m.upper_bound(4);
- assert(r == std::next(m.begin(), 0));
- r = m.upper_bound(6);
- assert(r == std::next(m.begin(), 1));
- r = m.upper_bound(8);
- assert(r == std::next(m.begin(), 2));
- r = m.upper_bound(10);
- assert(r == std::next(m.begin(), 3));
- r = m.upper_bound(12);
- assert(r == std::next(m.begin(), 4));
- r = m.upper_bound(14);
- assert(r == std::next(m.begin(), 5));
- r = m.upper_bound(16);
- assert(r == std::next(m.begin(), 6));
- r = m.upper_bound(18);
- assert(r == std::next(m.begin(), 7));
- r = m.upper_bound(20);
- assert(r == std::next(m.begin(), 8));
+ typedef M::iterator R;
+ V ar[] = {V(5, 5), V(7, 6), V(9, 7), V(11, 8), V(13, 9), V(15, 10), V(17, 11), V(19, 12)};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.upper_bound(5);
+ assert(r == std::next(m.begin(), 1));
+ r = m.upper_bound(7);
+ assert(r == std::next(m.begin(), 2));
+ r = m.upper_bound(9);
+ assert(r == std::next(m.begin(), 3));
+ r = m.upper_bound(11);
+ assert(r == std::next(m.begin(), 4));
+ r = m.upper_bound(13);
+ assert(r == std::next(m.begin(), 5));
+ r = m.upper_bound(15);
+ assert(r == std::next(m.begin(), 6));
+ r = m.upper_bound(17);
+ assert(r == std::next(m.begin(), 7));
+ r = m.upper_bound(19);
+ assert(r == std::next(m.begin(), 8));
+ r = m.upper_bound(4);
+ assert(r == std::next(m.begin(), 0));
+ r = m.upper_bound(6);
+ assert(r == std::next(m.begin(), 1));
+ r = m.upper_bound(8);
+ assert(r == std::next(m.begin(), 2));
+ r = m.upper_bound(10);
+ assert(r == std::next(m.begin(), 3));
+ r = m.upper_bound(12);
+ assert(r == std::next(m.begin(), 4));
+ r = m.upper_bound(14);
+ assert(r == std::next(m.begin(), 5));
+ r = m.upper_bound(16);
+ assert(r == std::next(m.begin(), 6));
+ r = m.upper_bound(18);
+ assert(r == std::next(m.begin(), 7));
+ r = m.upper_bound(20);
+ assert(r == std::next(m.begin(), 8));
}
{
- typedef M::const_iterator R;
- V ar[] =
- {
- V(5, 5),
- V(7, 6),
- V(9, 7),
- V(11, 8),
- V(13, 9),
- V(15, 10),
- V(17, 11),
- V(19, 12)
- };
- const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.upper_bound(5);
- assert(r == std::next(m.begin(), 1));
- r = m.upper_bound(7);
- assert(r == std::next(m.begin(), 2));
- r = m.upper_bound(9);
- assert(r == std::next(m.begin(), 3));
- r = m.upper_bound(11);
- assert(r == std::next(m.begin(), 4));
- r = m.upper_bound(13);
- assert(r == std::next(m.begin(), 5));
- r = m.upper_bound(15);
- assert(r == std::next(m.begin(), 6));
- r = m.upper_bound(17);
- assert(r == std::next(m.begin(), 7));
- r = m.upper_bound(19);
- assert(r == std::next(m.begin(), 8));
- r = m.upper_bound(4);
- assert(r == std::next(m.begin(), 0));
- r = m.upper_bound(6);
- assert(r == std::next(m.begin(), 1));
- r = m.upper_bound(8);
- assert(r == std::next(m.begin(), 2));
- r = m.upper_bound(10);
- assert(r == std::next(m.begin(), 3));
- r = m.upper_bound(12);
- assert(r == std::next(m.begin(), 4));
- r = m.upper_bound(14);
- assert(r == std::next(m.begin(), 5));
- r = m.upper_bound(16);
- assert(r == std::next(m.begin(), 6));
- r = m.upper_bound(18);
- assert(r == std::next(m.begin(), 7));
- r = m.upper_bound(20);
- assert(r == std::next(m.begin(), 8));
- }
+ typedef M::const_iterator R;
+ V ar[] = {V(5, 5), V(7, 6), V(9, 7), V(11, 8), V(13, 9), V(15, 10), V(17, 11), V(19, 12)};
+ const M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.upper_bound(5);
+ assert(r == std::next(m.begin(), 1));
+ r = m.upper_bound(7);
+ assert(r == std::next(m.begin(), 2));
+ r = m.upper_bound(9);
+ assert(r == std::next(m.begin(), 3));
+ r = m.upper_bound(11);
+ assert(r == std::next(m.begin(), 4));
+ r = m.upper_bound(13);
+ assert(r == std::next(m.begin(), 5));
+ r = m.upper_bound(15);
+ assert(r == std::next(m.begin(), 6));
+ r = m.upper_bound(17);
+ assert(r == std::next(m.begin(), 7));
+ r = m.upper_bound(19);
+ assert(r == std::next(m.begin(), 8));
+ r = m.upper_bound(4);
+ assert(r == std::next(m.begin(), 0));
+ r = m.upper_bound(6);
+ assert(r == std::next(m.begin(), 1));
+ r = m.upper_bound(8);
+ assert(r == std::next(m.begin(), 2));
+ r = m.upper_bound(10);
+ assert(r == std::next(m.begin(), 3));
+ r = m.upper_bound(12);
+ assert(r == std::next(m.begin(), 4));
+ r = m.upper_bound(14);
+ assert(r == std::next(m.begin(), 5));
+ r = m.upper_bound(16);
+ assert(r == std::next(m.begin(), 6));
+ r = m.upper_bound(18);
+ assert(r == std::next(m.begin(), 7));
+ r = m.upper_bound(20);
+ assert(r == std::next(m.begin(), 8));
}
+ }
#endif
#if TEST_STD_VER > 11
- {
+ {
typedef std::pair<const int, double> V;
typedef std::map<int, double, std::less<>> M;
typedef M::iterator R;
- V ar[] =
- {
- V(5, 5),
- V(7, 6),
- V(9, 7),
- V(11, 8),
- V(13, 9),
- V(15, 10),
- V(17, 11),
- V(19, 12)
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ V ar[] = {V(5, 5), V(7, 6), V(9, 7), V(11, 8), V(13, 9), V(15, 10), V(17, 11), V(19, 12)};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
R r = m.upper_bound(5);
assert(r == std::next(m.begin(), 1));
r = m.upper_bound(7);
@@ -279,22 +228,22 @@ int main(int, char**)
assert(r == std::next(m.begin(), 7));
r = m.upper_bound(20);
assert(r == std::next(m.begin(), 8));
- }
+ }
- {
+ {
typedef PrivateConstructor PC;
typedef std::map<PC, double, std::less<>> M;
typedef M::iterator R;
M m;
- m [ PC::make(5) ] = 5;
- m [ PC::make(7) ] = 6;
- m [ PC::make(9) ] = 7;
- m [ PC::make(11) ] = 8;
- m [ PC::make(13) ] = 9;
- m [ PC::make(15) ] = 10;
- m [ PC::make(17) ] = 11;
- m [ PC::make(19) ] = 12;
+ m[PC::make(5)] = 5;
+ m[PC::make(7)] = 6;
+ m[PC::make(9)] = 7;
+ m[PC::make(11)] = 8;
+ m[PC::make(13)] = 9;
+ m[PC::make(15)] = 10;
+ m[PC::make(17)] = 11;
+ m[PC::make(19)] = 12;
R r = m.upper_bound(5);
assert(r == std::next(m.begin(), 1));
@@ -330,7 +279,7 @@ int main(int, char**)
assert(r == std::next(m.begin(), 7));
r = m.upper_bound(20);
assert(r == std::next(m.begin(), 8));
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/map/map.ops/upper_bound0.pass.cpp b/libcxx/test/std/containers/associative/map/map.ops/upper_bound0.pass.cpp
index 370c7af65cfc8ca..525aa673ea74bf4 100644
--- a/libcxx/test/std/containers/associative/map/map.ops/upper_bound0.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.ops/upper_bound0.pass.cpp
@@ -19,25 +19,23 @@
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
-
#include <map>
#include <cassert>
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::map<int, double, transparent_less> M;
M example;
assert(example.upper_bound(C2Int{5}) == example.end());
- }
- {
+ }
+ {
typedef std::map<int, double, transparent_less_not_referenceable> M;
M example;
assert(example.upper_bound(C2Int{5}) == example.end());
- }
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/map/map.ops/upper_bound1.compile.fail.cpp b/libcxx/test/std/containers/associative/map/map.ops/upper_bound1.compile.fail.cpp
index 92003b60e849ad1..14d69988f70161d 100644
--- a/libcxx/test/std/containers/associative/map/map.ops/upper_bound1.compile.fail.cpp
+++ b/libcxx/test/std/containers/associative/map/map.ops/upper_bound1.compile.fail.cpp
@@ -19,18 +19,16 @@
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
-
#include <map>
#include <cassert>
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::map<int, double, transparent_less_no_type> M;
TEST_IGNORE_NODISCARD M().upper_bound(C2Int{5});
- }
+ }
}
diff --git a/libcxx/test/std/containers/associative/map/map.ops/upper_bound2.compile.fail.cpp b/libcxx/test/std/containers/associative/map/map.ops/upper_bound2.compile.fail.cpp
index e02ef4d05411977..a66536a9d1f9b28 100644
--- a/libcxx/test/std/containers/associative/map/map.ops/upper_bound2.compile.fail.cpp
+++ b/libcxx/test/std/containers/associative/map/map.ops/upper_bound2.compile.fail.cpp
@@ -19,18 +19,16 @@
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
-
#include <map>
#include <cassert>
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::map<int, double, transparent_less_private> M;
TEST_IGNORE_NODISCARD M().upper_bound(C2Int{5});
- }
+ }
}
diff --git a/libcxx/test/std/containers/associative/map/map.ops/upper_bound3.compile.fail.cpp b/libcxx/test/std/containers/associative/map/map.ops/upper_bound3.compile.fail.cpp
index 24aa85905474973..ae6eab124928498 100644
--- a/libcxx/test/std/containers/associative/map/map.ops/upper_bound3.compile.fail.cpp
+++ b/libcxx/test/std/containers/associative/map/map.ops/upper_bound3.compile.fail.cpp
@@ -19,18 +19,16 @@
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
-
#include <map>
#include <cassert>
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::map<int, double, transparent_less_not_a_type> M;
TEST_IGNORE_NODISCARD M().upper_bound(C2Int{5});
- }
+ }
}
diff --git a/libcxx/test/std/containers/associative/map/map.special/member_swap.pass.cpp b/libcxx/test/std/containers/associative/map/map.special/member_swap.pass.cpp
index ddce2225e0c63a2..ffb74f62b88773a 100644
--- a/libcxx/test/std/containers/associative/map/map.special/member_swap.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.special/member_swap.pass.cpp
@@ -18,160 +18,95 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- typedef std::pair<const int, double> V;
- {
+int main(int, char**) {
+ typedef std::pair<const int, double> V;
+ {
typedef std::map<int, double> M;
{
- M m1;
- M m2;
- M m1_save = m1;
- M m2_save = m2;
- m1.swap(m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
+ M m1;
+ M m2;
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
{
- V ar2[] =
- {
- V(5, 5),
- V(6, 6),
- V(7, 7),
- V(8, 8),
- V(9, 9),
- V(10, 10),
- V(11, 11),
- V(12, 12)
- };
- M m1;
- M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
- M m1_save = m1;
- M m2_save = m2;
- m1.swap(m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
+ V ar2[] = {V(5, 5), V(6, 6), V(7, 7), V(8, 8), V(9, 9), V(10, 10), V(11, 11), V(12, 12)};
+ M m1;
+ M m2(ar2, ar2 + sizeof(ar2) / sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
{
- V ar1[] =
- {
- V(1, 1),
- V(2, 2),
- V(3, 3),
- V(4, 4)
- };
- M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
- M m2;
- M m1_save = m1;
- M m2_save = m2;
- m1.swap(m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
+ V ar1[] = {V(1, 1), V(2, 2), V(3, 3), V(4, 4)};
+ M m1(ar1, ar1 + sizeof(ar1) / sizeof(ar1[0]));
+ M m2;
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
{
- V ar1[] =
- {
- V(1, 1),
- V(2, 2),
- V(3, 3),
- V(4, 4)
- };
- V ar2[] =
- {
- V(5, 5),
- V(6, 6),
- V(7, 7),
- V(8, 8),
- V(9, 9),
- V(10, 10),
- V(11, 11),
- V(12, 12)
- };
- M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
- M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
- M m1_save = m1;
- M m2_save = m2;
- m1.swap(m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
- }
+ V ar1[] = {V(1, 1), V(2, 2), V(3, 3), V(4, 4)};
+ V ar2[] = {V(5, 5), V(6, 6), V(7, 7), V(8, 8), V(9, 9), V(10, 10), V(11, 11), V(12, 12)};
+ M m1(ar1, ar1 + sizeof(ar1) / sizeof(ar1[0]));
+ M m2(ar2, ar2 + sizeof(ar2) / sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::map<int, double, std::less<int>, min_allocator<V>> M;
{
- M m1;
- M m2;
- M m1_save = m1;
- M m2_save = m2;
- m1.swap(m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
+ M m1;
+ M m2;
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
{
- V ar2[] =
- {
- V(5, 5),
- V(6, 6),
- V(7, 7),
- V(8, 8),
- V(9, 9),
- V(10, 10),
- V(11, 11),
- V(12, 12)
- };
- M m1;
- M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
- M m1_save = m1;
- M m2_save = m2;
- m1.swap(m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
+ V ar2[] = {V(5, 5), V(6, 6), V(7, 7), V(8, 8), V(9, 9), V(10, 10), V(11, 11), V(12, 12)};
+ M m1;
+ M m2(ar2, ar2 + sizeof(ar2) / sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
{
- V ar1[] =
- {
- V(1, 1),
- V(2, 2),
- V(3, 3),
- V(4, 4)
- };
- M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
- M m2;
- M m1_save = m1;
- M m2_save = m2;
- m1.swap(m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
+ V ar1[] = {V(1, 1), V(2, 2), V(3, 3), V(4, 4)};
+ M m1(ar1, ar1 + sizeof(ar1) / sizeof(ar1[0]));
+ M m2;
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
{
- V ar1[] =
- {
- V(1, 1),
- V(2, 2),
- V(3, 3),
- V(4, 4)
- };
- V ar2[] =
- {
- V(5, 5),
- V(6, 6),
- V(7, 7),
- V(8, 8),
- V(9, 9),
- V(10, 10),
- V(11, 11),
- V(12, 12)
- };
- M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
- M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
- M m1_save = m1;
- M m2_save = m2;
- m1.swap(m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
- }
+ V ar1[] = {V(1, 1), V(2, 2), V(3, 3), V(4, 4)};
+ V ar2[] = {V(5, 5), V(6, 6), V(7, 7), V(8, 8), V(9, 9), V(10, 10), V(11, 11), V(12, 12)};
+ M m1(ar1, ar1 + sizeof(ar1) / sizeof(ar1[0]));
+ M m2(ar2, ar2 + sizeof(ar2) / sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/map/map.special/non_member_swap.pass.cpp b/libcxx/test/std/containers/associative/map/map.special/non_member_swap.pass.cpp
index 18d991c15e4aca7..ba390acd128f5e6 100644
--- a/libcxx/test/std/containers/associative/map/map.special/non_member_swap.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.special/non_member_swap.pass.cpp
@@ -21,262 +21,149 @@
#include "../../../test_compare.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- typedef std::pair<const int, double> V;
- {
+int main(int, char**) {
+ typedef std::pair<const int, double> V;
+ {
typedef std::map<int, double> M;
{
- M m1;
- M m2;
- M m1_save = m1;
- M m2_save = m2;
- swap(m1, m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
- }
- {
- V ar2[] =
- {
- V(5, 5),
- V(6, 6),
- V(7, 7),
- V(8, 8),
- V(9, 9),
- V(10, 10),
- V(11, 11),
- V(12, 12)
- };
- M m1;
- M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
- M m1_save = m1;
- M m2_save = m2;
- swap(m1, m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
- }
- {
- V ar1[] =
- {
- V(1, 1),
- V(2, 2),
- V(3, 3),
- V(4, 4)
- };
- M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
- M m2;
- M m1_save = m1;
- M m2_save = m2;
- swap(m1, m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
+ M m1;
+ M m2;
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
{
- V ar1[] =
- {
- V(1, 1),
- V(2, 2),
- V(3, 3),
- V(4, 4)
- };
- V ar2[] =
- {
- V(5, 5),
- V(6, 6),
- V(7, 7),
- V(8, 8),
- V(9, 9),
- V(10, 10),
- V(11, 11),
- V(12, 12)
- };
- M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
- M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
- M m1_save = m1;
- M m2_save = m2;
- swap(m1, m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
- }
+ V ar2[] = {V(5, 5), V(6, 6), V(7, 7), V(8, 8), V(9, 9), V(10, 10), V(11, 11), V(12, 12)};
+ M m1;
+ M m2(ar2, ar2 + sizeof(ar2) / sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
{
- typedef test_allocator<V> A;
- typedef test_less<int> C;
- typedef std::map<int, double, C, A> M;
- V ar1[] =
- {
- V(1, 1),
- V(2, 2),
- V(3, 3),
- V(4, 4)
- };
- V ar2[] =
- {
- V(5, 5),
- V(6, 6),
- V(7, 7),
- V(8, 8),
- V(9, 9),
- V(10, 10),
- V(11, 11),
- V(12, 12)
- };
- M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A(1, 1));
- M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A(1, 2));
- M m1_save = m1;
- M m2_save = m2;
- swap(m1, m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
- assert(m1.key_comp() == C(2));
- assert(m1.get_allocator().get_id() == 1); // not swapped
- assert(m2.key_comp() == C(1));
- assert(m2.get_allocator().get_id() == 2);
+ V ar1[] = {V(1, 1), V(2, 2), V(3, 3), V(4, 4)};
+ M m1(ar1, ar1 + sizeof(ar1) / sizeof(ar1[0]));
+ M m2;
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
{
- typedef other_allocator<V> A;
- typedef test_less<int> C;
- typedef std::map<int, double, C, A> M;
- V ar1[] =
- {
- V(1, 1),
- V(2, 2),
- V(3, 3),
- V(4, 4)
- };
- V ar2[] =
- {
- V(5, 5),
- V(6, 6),
- V(7, 7),
- V(8, 8),
- V(9, 9),
- V(10, 10),
- V(11, 11),
- V(12, 12)
- };
- M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A(1));
- M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A(2));
- M m1_save = m1;
- M m2_save = m2;
- swap(m1, m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
- assert(m1.key_comp() == C(2));
- assert(m1.get_allocator() == A(2));
- assert(m2.key_comp() == C(1));
- assert(m2.get_allocator() == A(1));
+ V ar1[] = {V(1, 1), V(2, 2), V(3, 3), V(4, 4)};
+ V ar2[] = {V(5, 5), V(6, 6), V(7, 7), V(8, 8), V(9, 9), V(10, 10), V(11, 11), V(12, 12)};
+ M m1(ar1, ar1 + sizeof(ar1) / sizeof(ar1[0]));
+ M m2(ar2, ar2 + sizeof(ar2) / sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
+ }
+ {
+ typedef test_allocator<V> A;
+ typedef test_less<int> C;
+ typedef std::map<int, double, C, A> M;
+ V ar1[] = {V(1, 1), V(2, 2), V(3, 3), V(4, 4)};
+ V ar2[] = {V(5, 5), V(6, 6), V(7, 7), V(8, 8), V(9, 9), V(10, 10), V(11, 11), V(12, 12)};
+ M m1(ar1, ar1 + sizeof(ar1) / sizeof(ar1[0]), C(1), A(1, 1));
+ M m2(ar2, ar2 + sizeof(ar2) / sizeof(ar2[0]), C(2), A(1, 2));
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ assert(m1.key_comp() == C(2));
+ assert(m1.get_allocator().get_id() == 1); // not swapped
+ assert(m2.key_comp() == C(1));
+ assert(m2.get_allocator().get_id() == 2);
+ }
+ {
+ typedef other_allocator<V> A;
+ typedef test_less<int> C;
+ typedef std::map<int, double, C, A> M;
+ V ar1[] = {V(1, 1), V(2, 2), V(3, 3), V(4, 4)};
+ V ar2[] = {V(5, 5), V(6, 6), V(7, 7), V(8, 8), V(9, 9), V(10, 10), V(11, 11), V(12, 12)};
+ M m1(ar1, ar1 + sizeof(ar1) / sizeof(ar1[0]), C(1), A(1));
+ M m2(ar2, ar2 + sizeof(ar2) / sizeof(ar2[0]), C(2), A(2));
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ assert(m1.key_comp() == C(2));
+ assert(m1.get_allocator() == A(2));
+ assert(m2.key_comp() == C(1));
+ assert(m2.get_allocator() == A(1));
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::map<int, double, std::less<int>, min_allocator<V>> M;
{
- M m1;
- M m2;
- M m1_save = m1;
- M m2_save = m2;
- swap(m1, m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
+ M m1;
+ M m2;
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
{
- V ar2[] =
- {
- V(5, 5),
- V(6, 6),
- V(7, 7),
- V(8, 8),
- V(9, 9),
- V(10, 10),
- V(11, 11),
- V(12, 12)
- };
- M m1;
- M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
- M m1_save = m1;
- M m2_save = m2;
- swap(m1, m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
+ V ar2[] = {V(5, 5), V(6, 6), V(7, 7), V(8, 8), V(9, 9), V(10, 10), V(11, 11), V(12, 12)};
+ M m1;
+ M m2(ar2, ar2 + sizeof(ar2) / sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
{
- V ar1[] =
- {
- V(1, 1),
- V(2, 2),
- V(3, 3),
- V(4, 4)
- };
- M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
- M m2;
- M m1_save = m1;
- M m2_save = m2;
- swap(m1, m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
- }
- {
- V ar1[] =
- {
- V(1, 1),
- V(2, 2),
- V(3, 3),
- V(4, 4)
- };
- V ar2[] =
- {
- V(5, 5),
- V(6, 6),
- V(7, 7),
- V(8, 8),
- V(9, 9),
- V(10, 10),
- V(11, 11),
- V(12, 12)
- };
- M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
- M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
- M m1_save = m1;
- M m2_save = m2;
- swap(m1, m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
- }
+ V ar1[] = {V(1, 1), V(2, 2), V(3, 3), V(4, 4)};
+ M m1(ar1, ar1 + sizeof(ar1) / sizeof(ar1[0]));
+ M m2;
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
{
- typedef min_allocator<V> A;
- typedef test_less<int> C;
- typedef std::map<int, double, C, A> M;
- V ar1[] =
- {
- V(1, 1),
- V(2, 2),
- V(3, 3),
- V(4, 4)
- };
- V ar2[] =
- {
- V(5, 5),
- V(6, 6),
- V(7, 7),
- V(8, 8),
- V(9, 9),
- V(10, 10),
- V(11, 11),
- V(12, 12)
- };
- M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A());
- M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A());
- M m1_save = m1;
- M m2_save = m2;
- swap(m1, m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
- assert(m1.key_comp() == C(2));
- assert(m1.get_allocator() == A());
- assert(m2.key_comp() == C(1));
- assert(m2.get_allocator() == A());
+ V ar1[] = {V(1, 1), V(2, 2), V(3, 3), V(4, 4)};
+ V ar2[] = {V(5, 5), V(6, 6), V(7, 7), V(8, 8), V(9, 9), V(10, 10), V(11, 11), V(12, 12)};
+ M m1(ar1, ar1 + sizeof(ar1) / sizeof(ar1[0]));
+ M m2(ar2, ar2 + sizeof(ar2) / sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
+ }
+ {
+ typedef min_allocator<V> A;
+ typedef test_less<int> C;
+ typedef std::map<int, double, C, A> M;
+ V ar1[] = {V(1, 1), V(2, 2), V(3, 3), V(4, 4)};
+ V ar2[] = {V(5, 5), V(6, 6), V(7, 7), V(8, 8), V(9, 9), V(10, 10), V(11, 11), V(12, 12)};
+ M m1(ar1, ar1 + sizeof(ar1) / sizeof(ar1[0]), C(1), A());
+ M m2(ar2, ar2 + sizeof(ar2) / sizeof(ar2[0]), C(2), A());
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ assert(m1.key_comp() == C(2));
+ assert(m1.get_allocator() == A());
+ assert(m2.key_comp() == C(1));
+ assert(m2.get_allocator() == A());
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/map/map.special/swap_noexcept.pass.cpp b/libcxx/test/std/containers/associative/map/map.special/swap_noexcept.pass.cpp
index 96f96f548a3573a..118158fd45ec3e1 100644
--- a/libcxx/test/std/containers/associative/map/map.special/swap_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.special/swap_noexcept.pass.cpp
@@ -29,23 +29,21 @@
#include "test_allocator.h"
template <class T>
-struct some_comp
-{
- typedef T value_type;
+struct some_comp {
+ typedef T value_type;
- some_comp() {}
- some_comp(const some_comp&) {}
- bool operator()(const T&, const T&) const { return false; }
+ some_comp() {}
+ some_comp(const some_comp&) {}
+ bool operator()(const T&, const T&) const { return false; }
};
template <class T>
-struct some_comp2
-{
- typedef T value_type;
+struct some_comp2 {
+ typedef T value_type;
- some_comp2() {}
- some_comp2(const some_comp2&) {}
- bool operator()(const T&, const T&) const { return false; }
+ some_comp2() {}
+ some_comp2(const some_comp2&) {}
+ bool operator()(const T&, const T&) const { return false; }
};
#if TEST_STD_VER >= 14
@@ -54,90 +52,85 @@ void swap(some_comp2<T>&, some_comp2<T>&) noexcept {}
#endif
template <class T>
-struct some_alloc
-{
- typedef T value_type;
+struct some_alloc {
+ typedef T value_type;
- some_alloc() {}
- some_alloc(const some_alloc&);
- void deallocate(void*, unsigned) {}
+ some_alloc() {}
+ some_alloc(const some_alloc&);
+ void deallocate(void*, unsigned) {}
- typedef std::true_type propagate_on_container_swap;
+ typedef std::true_type propagate_on_container_swap;
};
template <class T>
-struct some_alloc2
-{
- typedef T value_type;
+struct some_alloc2 {
+ typedef T value_type;
- some_alloc2() {}
- some_alloc2(const some_alloc2&);
- void deallocate(void*, unsigned) {}
+ some_alloc2() {}
+ some_alloc2(const some_alloc2&);
+ void deallocate(void*, unsigned) {}
- typedef std::false_type propagate_on_container_swap;
- typedef std::true_type is_always_equal;
+ typedef std::false_type propagate_on_container_swap;
+ typedef std::true_type is_always_equal;
};
template <class T>
-struct some_alloc3
-{
- typedef T value_type;
+struct some_alloc3 {
+ typedef T value_type;
- some_alloc3() {}
- some_alloc3(const some_alloc3&);
- void deallocate(void*, unsigned) {}
+ some_alloc3() {}
+ some_alloc3(const some_alloc3&);
+ void deallocate(void*, unsigned) {}
- typedef std::false_type propagate_on_container_swap;
- typedef std::false_type is_always_equal;
+ typedef std::false_type propagate_on_container_swap;
+ typedef std::false_type is_always_equal;
};
-int main(int, char**)
-{
- typedef std::pair<const MoveOnly, MoveOnly> V;
- {
- typedef std::map<MoveOnly, MoveOnly> C;
- static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
+int main(int, char**) {
+ typedef std::pair<const MoveOnly, MoveOnly> V;
+ {
+ typedef std::map<MoveOnly, MoveOnly> C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
#if defined(_LIBCPP_VERSION)
- {
- typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<V>> C;
- static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- {
- typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<V>> C;
- static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
+ {
+ typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<V>> C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
+ {
+ typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<V>> C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
#endif // _LIBCPP_VERSION
- {
- typedef std::map<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
- static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
+ {
+ typedef std::map<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
#if TEST_STD_VER >= 14
- { // POCS allocator, throwable swap for comp
- typedef std::map<MoveOnly, MoveOnly, some_comp <MoveOnly>, some_alloc <V>> C;
+ { // POCS allocator, throwable swap for comp
+ typedef std::map<MoveOnly, MoveOnly, some_comp<MoveOnly>, some_alloc<V>> C;
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- { // always equal allocator, throwable swap for comp
- typedef std::map<MoveOnly, MoveOnly, some_comp <MoveOnly>, some_alloc2<V>> C;
+ }
+ { // always equal allocator, throwable swap for comp
+ typedef std::map<MoveOnly, MoveOnly, some_comp<MoveOnly>, some_alloc2<V>> C;
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- { // POCS allocator, nothrow swap for comp
- typedef std::map<MoveOnly, MoveOnly, some_comp2<MoveOnly>, some_alloc <V>> C;
- static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- { // always equal allocator, nothrow swap for comp
+ }
+ { // POCS allocator, nothrow swap for comp
+ typedef std::map<MoveOnly, MoveOnly, some_comp2<MoveOnly>, some_alloc<V>> C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
+ { // always equal allocator, nothrow swap for comp
typedef std::map<MoveOnly, MoveOnly, some_comp2<MoveOnly>, some_alloc2<V>> C;
- static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
-#if defined(_LIBCPP_VERSION)
- { // NOT always equal allocator, nothrow swap for comp
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
+# if defined(_LIBCPP_VERSION)
+ { // NOT always equal allocator, nothrow swap for comp
typedef std::map<MoveOnly, MoveOnly, some_comp2<MoveOnly>, some_alloc3<V>> C;
- static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
-#endif // _LIBCPP_VERSION
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
+# endif // _LIBCPP_VERSION
#endif
-
return 0;
}
diff --git a/libcxx/test/std/containers/associative/map/map.value_compare/invoke.pass.cpp b/libcxx/test/std/containers/associative/map/map.value_compare/invoke.pass.cpp
index 2cfbb2ad5c2b256..70fa972812cec19 100644
--- a/libcxx/test/std/containers/associative/map/map.value_compare/invoke.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.value_compare/invoke.pass.cpp
@@ -19,29 +19,29 @@
template <typename Map>
struct CallCompMember : Map::value_compare {
- CallCompMember(const typename Map::value_compare& vc) : Map::value_compare(vc) {}
+ CallCompMember(const typename Map::value_compare& vc) : Map::value_compare(vc) {}
- typedef typename Map::value_type value_type;
- bool operator()(const value_type& value1, const value_type& value2) const {
- return this->comp(value1.first, value2.first);
- }
+ typedef typename Map::value_type value_type;
+ bool operator()(const value_type& value1, const value_type& value2) const {
+ return this->comp(value1.first, value2.first);
+ }
};
int main(int, char**) {
- typedef std::map<int, std::string> map_type;
+ typedef std::map<int, std::string> map_type;
- map_type m;
- std::pair<map_type::iterator, bool> p1 = m.insert(map_type::value_type(1, "abc"));
- std::pair<map_type::iterator, bool> p2 = m.insert(map_type::value_type(2, "abc"));
+ map_type m;
+ std::pair<map_type::iterator, bool> p1 = m.insert(map_type::value_type(1, "abc"));
+ std::pair<map_type::iterator, bool> p2 = m.insert(map_type::value_type(2, "abc"));
- const map_type::value_compare vc = m.value_comp();
- CallCompMember<map_type> call_comp = m.value_comp();
+ const map_type::value_compare vc = m.value_comp();
+ CallCompMember<map_type> call_comp = m.value_comp();
- assert(vc(*p1.first, *p2.first));
- assert(call_comp(*p1.first, *p2.first));
+ assert(vc(*p1.first, *p2.first));
+ assert(call_comp(*p1.first, *p2.first));
- assert(!vc(*p2.first, *p1.first));
- assert(!call_comp(*p2.first, *p1.first));
+ assert(!vc(*p2.first, *p1.first));
+ assert(!call_comp(*p2.first, *p1.first));
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/associative/map/map.value_compare/types.pass.cpp b/libcxx/test/std/containers/associative/map/map.value_compare/types.pass.cpp
index 52111ddb3f272fa..89881baf88dca33 100644
--- a/libcxx/test/std/containers/associative/map/map.value_compare/types.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.value_compare/types.pass.cpp
@@ -18,13 +18,13 @@
#include "test_macros.h"
int main(int, char**) {
- typedef std::map<int, std::string> map_type;
- typedef map_type::value_compare value_compare;
- typedef map_type::value_type value_type;
+ typedef std::map<int, std::string> map_type;
+ typedef map_type::value_compare value_compare;
+ typedef map_type::value_type value_type;
- ASSERT_SAME_TYPE(value_compare::result_type, bool);
- ASSERT_SAME_TYPE(value_compare::first_argument_type, value_type);
- ASSERT_SAME_TYPE(value_compare::second_argument_type, value_type);
+ ASSERT_SAME_TYPE(value_compare::result_type, bool);
+ ASSERT_SAME_TYPE(value_compare::first_argument_type, value_type);
+ ASSERT_SAME_TYPE(value_compare::second_argument_type, value_type);
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/associative/map/range_concept_conformance.compile.pass.cpp b/libcxx/test/std/containers/associative/map/range_concept_conformance.compile.pass.cpp
index 4c018ec1b3907cc..4e4f154adaffb49 100644
--- a/libcxx/test/std/containers/associative/map/range_concept_conformance.compile.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/range_concept_conformance.compile.pass.cpp
@@ -17,7 +17,6 @@
using range = std::map<int, int>;
-
static_assert(std::same_as<std::ranges::iterator_t<range>, range::iterator>);
static_assert(std::ranges::common_range<range>);
static_assert(std::ranges::bidirectional_range<range>);
diff --git a/libcxx/test/std/containers/associative/map/types.pass.cpp b/libcxx/test/std/containers/associative/map/types.pass.cpp
index 0cfb7c00e813c47..7832ff3efd3a4d9 100644
--- a/libcxx/test/std/containers/associative/map/types.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/types.pass.cpp
@@ -34,9 +34,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::map<int, double> C;
static_assert((std::is_same<C::key_type, int>::value), "");
static_assert((std::is_same<C::mapped_type, double>::value), "");
@@ -49,9 +48,9 @@ int main(int, char**)
static_assert((std::is_same<C::const_pointer, const std::pair<const int, double>*>::value), "");
static_assert((std::is_same<C::size_type, std::size_t>::value), "");
static_assert((std::is_same<C::
diff erence_type, std::ptr
diff _t>::value), "");
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> C;
static_assert((std::is_same<C::key_type, int>::value), "");
static_assert((std::is_same<C::mapped_type, double>::value), "");
@@ -62,10 +61,10 @@ int main(int, char**)
static_assert((std::is_same<C::const_reference, const std::pair<const int, double>&>::value), "");
static_assert((std::is_same<C::pointer, min_pointer<std::pair<const int, double>>>::value), "");
static_assert((std::is_same<C::const_pointer, min_pointer<const std::pair<const int, double>>>::value), "");
-// min_allocator doesn't have a size_type, so one gets synthesized
+ // min_allocator doesn't have a size_type, so one gets synthesized
static_assert((std::is_same<C::size_type, std::make_unsigned<C::
diff erence_type>::type>::value), "");
static_assert((std::is_same<C::
diff erence_type, std::ptr
diff _t>::value), "");
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/multimap/allocator_mismatch.verify.cpp b/libcxx/test/std/containers/associative/multimap/allocator_mismatch.verify.cpp
index 6fa5f241bb5b843..319f32ddeea2688 100644
--- a/libcxx/test/std/containers/associative/multimap/allocator_mismatch.verify.cpp
+++ b/libcxx/test/std/containers/associative/multimap/allocator_mismatch.verify.cpp
@@ -12,4 +12,4 @@
#include <map>
std::multimap<int, int, std::less<int>, std::allocator<long> > m;
- // expected-error-re@*:* {{static assertion failed{{.*}}Allocator::value_type must be same type as value_type}}
+// expected-error-re@*:* {{static assertion failed{{.*}}Allocator::value_type must be same type as value_type}}
diff --git a/libcxx/test/std/containers/associative/multimap/empty.pass.cpp b/libcxx/test/std/containers/associative/multimap/empty.pass.cpp
index 45a1d76bd83fafd..c183cc385a916ba 100644
--- a/libcxx/test/std/containers/associative/multimap/empty.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/empty.pass.cpp
@@ -18,9 +18,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::multimap<int, double> M;
M m;
assert(m.empty());
@@ -28,9 +27,9 @@ int main(int, char**)
assert(!m.empty());
m.clear();
assert(m.empty());
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
M m;
assert(m.empty());
@@ -38,7 +37,7 @@ int main(int, char**)
assert(!m.empty());
m.clear();
assert(m.empty());
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/multimap/empty.verify.cpp b/libcxx/test/std/containers/associative/multimap/empty.verify.cpp
index 8720497c35fdf0d..2c23a9f38f18bee 100644
--- a/libcxx/test/std/containers/associative/multimap/empty.verify.cpp
+++ b/libcxx/test/std/containers/associative/multimap/empty.verify.cpp
@@ -17,6 +17,6 @@
#include <map>
void f() {
- std::multimap<int, int> c;
- c.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::multimap<int, int> c;
+ c.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}
diff --git a/libcxx/test/std/containers/associative/multimap/get_allocator.pass.cpp b/libcxx/test/std/containers/associative/multimap/get_allocator.pass.cpp
index 41dfaa77c660364..102dd0b5a36cc4b 100644
--- a/libcxx/test/std/containers/associative/multimap/get_allocator.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/get_allocator.pass.cpp
@@ -20,18 +20,17 @@
#include "test_macros.h"
int main(int, char**) {
- typedef std::pair<const int, std::string> ValueType;
- {
- std::allocator<ValueType> alloc;
- const std::multimap<int, std::string> m(alloc);
- assert(m.get_allocator() == alloc);
- }
- {
- other_allocator<ValueType> alloc(1);
- const std::multimap<int, std::string, std::less<int>,
- other_allocator<ValueType> > m(alloc);
- assert(m.get_allocator() == alloc);
- }
+ typedef std::pair<const int, std::string> ValueType;
+ {
+ std::allocator<ValueType> alloc;
+ const std::multimap<int, std::string> m(alloc);
+ assert(m.get_allocator() == alloc);
+ }
+ {
+ other_allocator<ValueType> alloc(1);
+ const std::multimap<int, std::string, std::less<int>, other_allocator<ValueType> > m(alloc);
+ assert(m.get_allocator() == alloc);
+ }
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/associative/multimap/incomplete_type.pass.cpp b/libcxx/test/std/containers/associative/multimap/incomplete_type.pass.cpp
index 6e7c8e770202e0b..05b8abf90e2ecd0 100644
--- a/libcxx/test/std/containers/associative/multimap/incomplete_type.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/incomplete_type.pass.cpp
@@ -16,17 +16,17 @@
#include "test_macros.h"
struct A {
- typedef std::multimap<A, A> Map;
- int data;
- Map m;
- Map::iterator it;
- Map::const_iterator cit;
+ typedef std::multimap<A, A> Map;
+ int data;
+ Map m;
+ Map::iterator it;
+ Map::const_iterator cit;
};
inline bool operator==(A const& L, A const& R) { return &L == &R; }
-inline bool operator<(A const& L, A const& R) { return L.data < R.data; }
+inline bool operator<(A const& L, A const& R) { return L.data < R.data; }
int main(int, char**) {
- A a;
+ A a;
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multimap/iterator.pass.cpp b/libcxx/test/std/containers/associative/multimap/iterator.pass.cpp
index b12645a3eb1af52..ffdc39ff3556377 100644
--- a/libcxx/test/std/containers/associative/multimap/iterator.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/iterator.pass.cpp
@@ -32,242 +32,137 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::pair<const int, double> V;
- V ar[] =
- {
- V(1, 1),
- V(1, 1.5),
- V(1, 2),
- V(2, 1),
- V(2, 1.5),
- V(2, 2),
- V(3, 1),
- V(3, 1.5),
- V(3, 2),
- V(4, 1),
- V(4, 1.5),
- V(4, 2),
- V(5, 1),
- V(5, 1.5),
- V(5, 2),
- V(6, 1),
- V(6, 1.5),
- V(6, 2),
- V(7, 1),
- V(7, 1.5),
- V(7, 2),
- V(8, 1),
- V(8, 1.5),
- V(8, 2)
- };
- std::multimap<int, double> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
- assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
- std::multimap<int, double>::iterator i;
- i = m.begin();
- std::multimap<int, double>::const_iterator k = i;
- assert(i == k);
- for (int j = 1; j <= 8; ++j)
- for (double d = 1; d <= 2; d += .5, ++i)
- {
- assert(i->first == j);
- assert(i->second == d);
- i->second = 2.5;
- assert(i->second == 2.5);
- }
- assert(i == m.end());
- for (int j = 8; j >= 1; --j)
- for (double d = 1; d <= 2; d += .5)
- {
- --i;
- assert(i->first == j);
- assert(i->second == 2.5);
- i->second = d;
- assert(i->second == d);
- }
- assert(i == m.begin());
- }
- {
- typedef std::pair<const int, double> V;
- V ar[] =
- {
- V(1, 1),
- V(1, 1.5),
- V(1, 2),
- V(2, 1),
- V(2, 1.5),
- V(2, 2),
- V(3, 1),
- V(3, 1.5),
- V(3, 2),
- V(4, 1),
- V(4, 1.5),
- V(4, 2),
- V(5, 1),
- V(5, 1.5),
- V(5, 2),
- V(6, 1),
- V(6, 1.5),
- V(6, 2),
- V(7, 1),
- V(7, 1.5),
- V(7, 2),
- V(8, 1),
- V(8, 1.5),
- V(8, 2)
- };
- const std::multimap<int, double> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
- assert(static_cast<std::size_t>(std::distance(m.cbegin(), m.cend())) == m.size());
- assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
- assert(static_cast<std::size_t>(std::distance(m.crbegin(), m.crend())) == m.size());
- std::multimap<int, double>::const_iterator i;
- i = m.begin();
- for (int j = 1; j <= 8; ++j)
- for (double d = 1; d <= 2; d += .5, ++i)
- {
- assert(i->first == j);
- assert(i->second == d);
- }
- assert(i == m.end());
- for (int j = 8; j >= 1; --j)
- for (double d = 2; d >= 1; d -= .5)
- {
- --i;
- assert(i->first == j);
- assert(i->second == d);
- }
- assert(i == m.begin());
- }
+int main(int, char**) {
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] = {V(1, 1), V(1, 1.5), V(1, 2), V(2, 1), V(2, 1.5), V(2, 2), V(3, 1), V(3, 1.5),
+ V(3, 2), V(4, 1), V(4, 1.5), V(4, 2), V(5, 1), V(5, 1.5), V(5, 2), V(6, 1),
+ V(6, 1.5), V(6, 2), V(7, 1), V(7, 1.5), V(7, 2), V(8, 1), V(8, 1.5), V(8, 2)};
+ std::multimap<int, double> m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
+ std::multimap<int, double>::iterator i;
+ i = m.begin();
+ std::multimap<int, double>::const_iterator k = i;
+ assert(i == k);
+ for (int j = 1; j <= 8; ++j)
+ for (double d = 1; d <= 2; d += .5, ++i) {
+ assert(i->first == j);
+ assert(i->second == d);
+ i->second = 2.5;
+ assert(i->second == 2.5);
+ }
+ assert(i == m.end());
+ for (int j = 8; j >= 1; --j)
+ for (double d = 1; d <= 2; d += .5) {
+ --i;
+ assert(i->first == j);
+ assert(i->second == 2.5);
+ i->second = d;
+ assert(i->second == d);
+ }
+ assert(i == m.begin());
+ }
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] = {V(1, 1), V(1, 1.5), V(1, 2), V(2, 1), V(2, 1.5), V(2, 2), V(3, 1), V(3, 1.5),
+ V(3, 2), V(4, 1), V(4, 1.5), V(4, 2), V(5, 1), V(5, 1.5), V(5, 2), V(6, 1),
+ V(6, 1.5), V(6, 2), V(7, 1), V(7, 1.5), V(7, 2), V(8, 1), V(8, 1.5), V(8, 2)};
+ const std::multimap<int, double> m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.cbegin(), m.cend())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.crbegin(), m.crend())) == m.size());
+ std::multimap<int, double>::const_iterator i;
+ i = m.begin();
+ for (int j = 1; j <= 8; ++j)
+ for (double d = 1; d <= 2; d += .5, ++i) {
+ assert(i->first == j);
+ assert(i->second == d);
+ }
+ assert(i == m.end());
+ for (int j = 8; j >= 1; --j)
+ for (double d = 2; d >= 1; d -= .5) {
+ --i;
+ assert(i->first == j);
+ assert(i->second == d);
+ }
+ assert(i == m.begin());
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::pair<const int, double> V;
- V ar[] =
- {
- V(1, 1),
- V(1, 1.5),
- V(1, 2),
- V(2, 1),
- V(2, 1.5),
- V(2, 2),
- V(3, 1),
- V(3, 1.5),
- V(3, 2),
- V(4, 1),
- V(4, 1.5),
- V(4, 2),
- V(5, 1),
- V(5, 1.5),
- V(5, 2),
- V(6, 1),
- V(6, 1.5),
- V(6, 2),
- V(7, 1),
- V(7, 1.5),
- V(7, 2),
- V(8, 1),
- V(8, 1.5),
- V(8, 2)
- };
- std::multimap<int, double, std::less<int>, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
- assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
- std::multimap<int, double, std::less<int>, min_allocator<V>>::iterator i;
- i = m.begin();
- std::multimap<int, double, std::less<int>, min_allocator<V>>::const_iterator k = i;
- assert(i == k);
- for (int j = 1; j <= 8; ++j)
- for (double d = 1; d <= 2; d += .5, ++i)
- {
- assert(i->first == j);
- assert(i->second == d);
- i->second = 2.5;
- assert(i->second == 2.5);
- }
- assert(i == m.end());
- for (int j = 8; j >= 1; --j)
- for (double d = 1; d <= 2; d += .5)
- {
- --i;
- assert(i->first == j);
- assert(i->second == 2.5);
- i->second = d;
- assert(i->second == d);
- }
- assert(i == m.begin());
- }
- {
- typedef std::pair<const int, double> V;
- V ar[] =
- {
- V(1, 1),
- V(1, 1.5),
- V(1, 2),
- V(2, 1),
- V(2, 1.5),
- V(2, 2),
- V(3, 1),
- V(3, 1.5),
- V(3, 2),
- V(4, 1),
- V(4, 1.5),
- V(4, 2),
- V(5, 1),
- V(5, 1.5),
- V(5, 2),
- V(6, 1),
- V(6, 1.5),
- V(6, 2),
- V(7, 1),
- V(7, 1.5),
- V(7, 2),
- V(8, 1),
- V(8, 1.5),
- V(8, 2)
- };
- const std::multimap<int, double, std::less<int>, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
- assert(static_cast<std::size_t>(std::distance(m.cbegin(), m.cend())) == m.size());
- assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
- assert(static_cast<std::size_t>(std::distance(m.crbegin(), m.crend())) == m.size());
- std::multimap<int, double, std::less<int>, min_allocator<V>>::const_iterator i;
- i = m.begin();
- for (int j = 1; j <= 8; ++j)
- for (double d = 1; d <= 2; d += .5, ++i)
- {
- assert(i->first == j);
- assert(i->second == d);
- }
- assert(i == m.end());
- for (int j = 8; j >= 1; --j)
- for (double d = 2; d >= 1; d -= .5)
- {
- --i;
- assert(i->first == j);
- assert(i->second == d);
- }
- assert(i == m.begin());
- }
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] = {V(1, 1), V(1, 1.5), V(1, 2), V(2, 1), V(2, 1.5), V(2, 2), V(3, 1), V(3, 1.5),
+ V(3, 2), V(4, 1), V(4, 1.5), V(4, 2), V(5, 1), V(5, 1.5), V(5, 2), V(6, 1),
+ V(6, 1.5), V(6, 2), V(7, 1), V(7, 1.5), V(7, 2), V(8, 1), V(8, 1.5), V(8, 2)};
+ std::multimap<int, double, std::less<int>, min_allocator<V>> m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
+ std::multimap<int, double, std::less<int>, min_allocator<V>>::iterator i;
+ i = m.begin();
+ std::multimap<int, double, std::less<int>, min_allocator<V>>::const_iterator k = i;
+ assert(i == k);
+ for (int j = 1; j <= 8; ++j)
+ for (double d = 1; d <= 2; d += .5, ++i) {
+ assert(i->first == j);
+ assert(i->second == d);
+ i->second = 2.5;
+ assert(i->second == 2.5);
+ }
+ assert(i == m.end());
+ for (int j = 8; j >= 1; --j)
+ for (double d = 1; d <= 2; d += .5) {
+ --i;
+ assert(i->first == j);
+ assert(i->second == 2.5);
+ i->second = d;
+ assert(i->second == d);
+ }
+ assert(i == m.begin());
+ }
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] = {V(1, 1), V(1, 1.5), V(1, 2), V(2, 1), V(2, 1.5), V(2, 2), V(3, 1), V(3, 1.5),
+ V(3, 2), V(4, 1), V(4, 1.5), V(4, 2), V(5, 1), V(5, 1.5), V(5, 2), V(6, 1),
+ V(6, 1.5), V(6, 2), V(7, 1), V(7, 1.5), V(7, 2), V(8, 1), V(8, 1.5), V(8, 2)};
+ const std::multimap<int, double, std::less<int>, min_allocator<V>> m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.cbegin(), m.cend())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.crbegin(), m.crend())) == m.size());
+ std::multimap<int, double, std::less<int>, min_allocator<V>>::const_iterator i;
+ i = m.begin();
+ for (int j = 1; j <= 8; ++j)
+ for (double d = 1; d <= 2; d += .5, ++i) {
+ assert(i->first == j);
+ assert(i->second == d);
+ }
+ assert(i == m.end());
+ for (int j = 8; j >= 1; --j)
+ for (double d = 2; d >= 1; d -= .5) {
+ --i;
+ assert(i->first == j);
+ assert(i->second == d);
+ }
+ assert(i == m.begin());
+ }
#endif
#if TEST_STD_VER > 11
- { // N3644 testing
- typedef std::multimap<int, double> C;
- C::iterator ii1{}, ii2{};
- C::iterator ii4 = ii1;
- C::const_iterator cii{};
- assert ( ii1 == ii2 );
- assert ( ii1 == ii4 );
+ { // N3644 testing
+ typedef std::multimap<int, double> C;
+ C::iterator ii1{}, ii2{};
+ C::iterator ii4 = ii1;
+ C::const_iterator cii{};
+ assert(ii1 == ii2);
+ assert(ii1 == ii4);
- assert (!(ii1 != ii2 ));
+ assert(!(ii1 != ii2));
- assert ( (ii1 == cii ));
- assert ( (cii == ii1 ));
- assert (!(ii1 != cii ));
- assert (!(cii != ii1 ));
- }
+ assert((ii1 == cii));
+ assert((cii == ii1));
+ assert(!(ii1 != cii));
+ assert(!(cii != ii1));
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/multimap/iterator_concept_conformance.compile.pass.cpp b/libcxx/test/std/containers/associative/multimap/iterator_concept_conformance.compile.pass.cpp
index bce28fc7fbd39c6..b5b6a3cbf09da9b 100644
--- a/libcxx/test/std/containers/associative/multimap/iterator_concept_conformance.compile.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/iterator_concept_conformance.compile.pass.cpp
@@ -14,11 +14,11 @@
#include <iterator>
-using iterator = std::multimap<int, int>::iterator;
-using const_iterator = std::multimap<int, int>::const_iterator;
-using reverse_iterator = std::multimap<int, int>::reverse_iterator;
+using iterator = std::multimap<int, int>::iterator;
+using const_iterator = std::multimap<int, int>::const_iterator;
+using reverse_iterator = std::multimap<int, int>::reverse_iterator;
using const_reverse_iterator = std::multimap<int, int>::const_reverse_iterator;
-using value_type = std::pair<const int, int>;
+using value_type = std::pair<const int, int>;
static_assert(std::bidirectional_iterator<iterator>);
static_assert(!std::random_access_iterator<iterator>);
@@ -31,9 +31,9 @@ static_assert(!std::sized_sentinel_for<iterator, iterator>);
static_assert(!std::sized_sentinel_for<iterator, const_iterator>);
static_assert(!std::sized_sentinel_for<iterator, reverse_iterator>);
static_assert(!std::sized_sentinel_for<iterator, const_reverse_iterator>);
-static_assert( std::indirectly_movable<iterator, std::pair<int, int>*>);
+static_assert(std::indirectly_movable<iterator, std::pair<int, int>*>);
static_assert(!std::indirectly_movable_storable<iterator, std::pair<int, int>*>);
-static_assert( std::indirectly_copyable<iterator, std::pair<int, int>*>);
+static_assert(std::indirectly_copyable<iterator, std::pair<int, int>*>);
static_assert(!std::indirectly_copyable_storable<iterator, std::pair<int, int>*>);
static_assert(!std::indirectly_swappable<iterator, iterator>);
diff --git a/libcxx/test/std/containers/associative/multimap/max_size.pass.cpp b/libcxx/test/std/containers/associative/multimap/max_size.pass.cpp
index f7b8b5e071be9eb..c6208d27336b589 100644
--- a/libcxx/test/std/containers/associative/multimap/max_size.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/max_size.pass.cpp
@@ -20,8 +20,7 @@
#include "test_allocator.h"
#include "test_macros.h"
-int main(int, char**)
-{
+int main(int, char**) {
typedef std::pair<const int, int> KV;
{
typedef limited_allocator<KV, 10> A;
@@ -33,16 +32,14 @@ int main(int, char**)
{
typedef limited_allocator<KV, (std::size_t)-1> A;
typedef std::multimap<int, int, std::less<int>, A> C;
- const C::size_type max_dist =
- static_cast<C::size_type>(std::numeric_limits<C::
diff erence_type>::max());
+ const C::size_type max_dist = static_cast<C::size_type>(std::numeric_limits<C::
diff erence_type>::max());
C c;
assert(c.max_size() <= max_dist);
LIBCPP_ASSERT(c.max_size() == max_dist);
}
{
typedef std::multimap<char, int> C;
- const C::size_type max_dist =
- static_cast<C::size_type>(std::numeric_limits<C::
diff erence_type>::max());
+ const C::size_type max_dist = static_cast<C::size_type>(std::numeric_limits<C::
diff erence_type>::max());
C c;
assert(c.max_size() <= max_dist);
assert(c.max_size() <= alloc_max_size(c.get_allocator()));
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.cons/alloc.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/alloc.pass.cpp
index 4c16350ecdf5cbf..10184633a82de1f 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.cons/alloc.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.cons/alloc.pass.cpp
@@ -19,33 +19,32 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::less<int> C;
typedef test_allocator<std::pair<const int, double> > A;
std::multimap<int, double, C, A> m(A(5));
assert(m.empty());
assert(m.begin() == m.end());
assert(m.get_allocator() == A(5));
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::less<int> C;
typedef min_allocator<std::pair<const int, double> > A;
std::multimap<int, double, C, A> m(A{});
assert(m.empty());
assert(m.begin() == m.end());
assert(m.get_allocator() == A());
- }
- {
+ }
+ {
typedef std::less<int> C;
typedef explicit_allocator<std::pair<const int, double> > A;
std::multimap<int, double, C, A> m(A{});
assert(m.empty());
assert(m.begin() == m.end());
assert(m.get_allocator() == A{});
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.cons/assign_initializer_list.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/assign_initializer_list.pass.cpp
index 7a15d780fd6f4f9..d1de8fab172cff3 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.cons/assign_initializer_list.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.cons/assign_initializer_list.pass.cpp
@@ -20,24 +20,12 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::multimap<int, double> C;
typedef C::value_type V;
C m = {{20, 1}};
- m =
- {
- {1, 1},
- {1, 1.5},
- {1, 2},
- {2, 1},
- {2, 1.5},
- {2, 2},
- {3, 1},
- {3, 1.5},
- {3, 2}
- };
+ m = {{1, 1}, {1, 1.5}, {1, 2}, {2, 1}, {2, 1.5}, {2, 2}, {3, 1}, {3, 1.5}, {3, 2}};
assert(m.size() == 9);
assert(std::distance(m.begin(), m.end()) == 9);
C::const_iterator i = m.cbegin();
@@ -50,23 +38,12 @@ int main(int, char**)
assert(*++i == V(3, 1));
assert(*++i == V(3, 1.5));
assert(*++i == V(3, 2));
- }
- {
+ }
+ {
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> C;
typedef C::value_type V;
C m = {{20, 1}};
- m =
- {
- {1, 1},
- {1, 1.5},
- {1, 2},
- {2, 1},
- {2, 1.5},
- {2, 2},
- {3, 1},
- {3, 1.5},
- {3, 2}
- };
+ m = {{1, 1}, {1, 1.5}, {1, 2}, {2, 1}, {2, 1.5}, {2, 2}, {3, 1}, {3, 1.5}, {3, 2}};
assert(m.size() == 9);
assert(std::distance(m.begin(), m.end()) == 9);
C::const_iterator i = m.cbegin();
@@ -79,7 +56,7 @@ int main(int, char**)
assert(*++i == V(3, 1));
assert(*++i == V(3, 1.5));
assert(*++i == V(3, 2));
- }
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.cons/compare.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/compare.pass.cpp
index ebe1c9d6c72372a..84584a427ead01d 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.cons/compare.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.cons/compare.pass.cpp
@@ -19,23 +19,22 @@
#include "../../../test_compare.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef test_less<int> C;
const std::multimap<int, double, C> m(C(3));
assert(m.empty());
assert(m.begin() == m.end());
assert(m.key_comp() == C(3));
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef test_less<int> C;
const std::multimap<int, double, C, min_allocator<std::pair<const int, double>>> m(C(3));
assert(m.empty());
assert(m.begin() == m.end());
assert(m.key_comp() == C(3));
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.cons/compare_alloc.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/compare_alloc.pass.cpp
index 7bfb93ee1961f02..207e7e271234f38 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.cons/compare_alloc.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.cons/compare_alloc.pass.cpp
@@ -20,9 +20,8 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef test_less<int> C;
typedef test_allocator<std::pair<const int, double> > A;
std::multimap<int, double, C, A> m(C(4), A(5));
@@ -30,9 +29,9 @@ int main(int, char**)
assert(m.begin() == m.end());
assert(m.key_comp() == C(4));
assert(m.get_allocator() == A(5));
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef test_less<int> C;
typedef min_allocator<std::pair<const int, double> > A;
std::multimap<int, double, C, A> m(C(4), A());
@@ -40,8 +39,8 @@ int main(int, char**)
assert(m.begin() == m.end());
assert(m.key_comp() == C(4));
assert(m.get_allocator() == A());
- }
- {
+ }
+ {
typedef test_less<int> C;
typedef explicit_allocator<std::pair<const int, double> > A;
std::multimap<int, double, C, A> m(C(4), A{});
@@ -49,7 +48,7 @@ int main(int, char**)
assert(m.begin() == m.end());
assert(m.key_comp() == C(4));
assert(m.get_allocator() == A{});
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.cons/compare_copy_constructible.compile.fail.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/compare_copy_constructible.compile.fail.cpp
index 23fe479f56cb2ae..adb866a1abdf659 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.cons/compare_copy_constructible.compile.fail.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.cons/compare_copy_constructible.compile.fail.cpp
@@ -15,16 +15,16 @@
template <class T>
struct Comp {
- bool operator () (const T& lhs, const T& rhs) const { return lhs < rhs; }
+ bool operator()(const T& lhs, const T& rhs) const { return lhs < rhs; }
- Comp () {}
-private:
- Comp (const Comp &); // declared but not defined
- };
+ Comp() {}
+private:
+ Comp(const Comp&); // declared but not defined
+};
int main(int, char**) {
- std::multimap<int, int, Comp<int> > m;
+ std::multimap<int, int, Comp<int> > m;
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.cons/copy.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/copy.pass.cpp
index 9e53d9c15de197a..9cffbf8c178508b 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.cons/copy.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.cons/copy.pass.cpp
@@ -20,84 +20,80 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::pair<const int, double> V;
- V ar[] =
- {
- V(1, 1),
- V(1, 1.5),
- V(1, 2),
- V(2, 1),
- V(2, 1.5),
- V(2, 2),
- V(3, 1),
- V(3, 1.5),
- V(3, 2),
- };
- typedef test_less<int> C;
- typedef test_allocator<V> A;
- std::multimap<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(7));
- std::multimap<int, double, C, A> m = mo;
- assert(m == mo);
- assert(m.get_allocator() == A(7));
- assert(m.key_comp() == C(5));
+int main(int, char**) {
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] = {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2),
+ };
+ typedef test_less<int> C;
+ typedef test_allocator<V> A;
+ std::multimap<int, double, C, A> mo(ar, ar + sizeof(ar) / sizeof(ar[0]), C(5), A(7));
+ std::multimap<int, double, C, A> m = mo;
+ assert(m == mo);
+ assert(m.get_allocator() == A(7));
+ assert(m.key_comp() == C(5));
- assert(mo.get_allocator() == A(7));
- assert(mo.key_comp() == C(5));
- }
+ assert(mo.get_allocator() == A(7));
+ assert(mo.key_comp() == C(5));
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::pair<const int, double> V;
- V ar[] =
- {
- V(1, 1),
- V(1, 1.5),
- V(1, 2),
- V(2, 1),
- V(2, 1.5),
- V(2, 2),
- V(3, 1),
- V(3, 1.5),
- V(3, 2),
- };
- typedef test_less<int> C;
- typedef other_allocator<V> A;
- std::multimap<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(7));
- std::multimap<int, double, C, A> m = mo;
- assert(m == mo);
- assert(m.get_allocator() == A(-2));
- assert(m.key_comp() == C(5));
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] = {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2),
+ };
+ typedef test_less<int> C;
+ typedef other_allocator<V> A;
+ std::multimap<int, double, C, A> mo(ar, ar + sizeof(ar) / sizeof(ar[0]), C(5), A(7));
+ std::multimap<int, double, C, A> m = mo;
+ assert(m == mo);
+ assert(m.get_allocator() == A(-2));
+ assert(m.key_comp() == C(5));
- assert(mo.get_allocator() == A(7));
- assert(mo.key_comp() == C(5));
- }
- {
- typedef std::pair<const int, double> V;
- V ar[] =
- {
- V(1, 1),
- V(1, 1.5),
- V(1, 2),
- V(2, 1),
- V(2, 1.5),
- V(2, 2),
- V(3, 1),
- V(3, 1.5),
- V(3, 2),
- };
- typedef test_less<int> C;
- typedef min_allocator<V> A;
- std::multimap<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
- std::multimap<int, double, C, A> m = mo;
- assert(m == mo);
- assert(m.get_allocator() == A());
- assert(m.key_comp() == C(5));
+ assert(mo.get_allocator() == A(7));
+ assert(mo.key_comp() == C(5));
+ }
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] = {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2),
+ };
+ typedef test_less<int> C;
+ typedef min_allocator<V> A;
+ std::multimap<int, double, C, A> mo(ar, ar + sizeof(ar) / sizeof(ar[0]), C(5), A());
+ std::multimap<int, double, C, A> m = mo;
+ assert(m == mo);
+ assert(m.get_allocator() == A());
+ assert(m.key_comp() == C(5));
- assert(mo.get_allocator() == A());
- assert(mo.key_comp() == C(5));
- }
+ assert(mo.get_allocator() == A());
+ assert(mo.key_comp() == C(5));
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.cons/copy_alloc.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/copy_alloc.pass.cpp
index 9ccf7715d267b61..89e6c40aa108ddd 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.cons/copy_alloc.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.cons/copy_alloc.pass.cpp
@@ -20,12 +20,10 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::pair<const int, double> V;
- V ar[] =
- {
+ V ar[] = {
V(1, 1),
V(1, 1.5),
V(1, 2),
@@ -38,7 +36,7 @@ int main(int, char**)
};
typedef test_less<int> C;
typedef test_allocator<V> A;
- std::multimap<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(7));
+ std::multimap<int, double, C, A> mo(ar, ar + sizeof(ar) / sizeof(ar[0]), C(5), A(7));
std::multimap<int, double, C, A> m(mo, A(3));
assert(m == mo);
assert(m.get_allocator() == A(3));
@@ -46,12 +44,11 @@ int main(int, char**)
assert(mo.get_allocator() == A(7));
assert(mo.key_comp() == C(5));
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::pair<const int, double> V;
- V ar[] =
- {
+ V ar[] = {
V(1, 1),
V(1, 1.5),
V(1, 2),
@@ -64,7 +61,7 @@ int main(int, char**)
};
typedef test_less<int> C;
typedef min_allocator<V> A;
- std::multimap<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
+ std::multimap<int, double, C, A> mo(ar, ar + sizeof(ar) / sizeof(ar[0]), C(5), A());
std::multimap<int, double, C, A> m(mo, A());
assert(m == mo);
assert(m.get_allocator() == A());
@@ -72,11 +69,10 @@ int main(int, char**)
assert(mo.get_allocator() == A());
assert(mo.key_comp() == C(5));
- }
- {
+ }
+ {
typedef std::pair<const int, double> V;
- V ar[] =
- {
+ V ar[] = {
V(1, 1),
V(1, 1.5),
V(1, 2),
@@ -89,7 +85,7 @@ int main(int, char**)
};
typedef test_less<int> C;
typedef explicit_allocator<V> A;
- std::multimap<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A{});
+ std::multimap<int, double, C, A> mo(ar, ar + sizeof(ar) / sizeof(ar[0]), C(5), A{});
std::multimap<int, double, C, A> m(mo, A{});
assert(m == mo);
assert(m.get_allocator() == A{});
@@ -97,7 +93,7 @@ int main(int, char**)
assert(mo.get_allocator() == A{});
assert(mo.key_comp() == C(5));
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.cons/copy_assign.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/copy_assign.pass.cpp
index b4ff5e7777b98e7..463403a412aaa3a 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.cons/copy_assign.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.cons/copy_assign.pass.cpp
@@ -20,107 +20,102 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::pair<const int, double> V;
- V ar[] =
- {
- V(1, 1),
- V(1, 1.5),
- V(1, 2),
- V(2, 1),
- V(2, 1.5),
- V(2, 2),
- V(3, 1),
- V(3, 1.5),
- V(3, 2),
- };
- typedef test_less<int> C;
- typedef test_allocator<V> A;
- std::multimap<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(2));
- std::multimap<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0])/2, C(3), A(7));
- m = mo;
- assert(m == mo);
- assert(m.get_allocator() == A(7));
- assert(m.key_comp() == C(5));
+int main(int, char**) {
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] = {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2),
+ };
+ typedef test_less<int> C;
+ typedef test_allocator<V> A;
+ std::multimap<int, double, C, A> mo(ar, ar + sizeof(ar) / sizeof(ar[0]), C(5), A(2));
+ std::multimap<int, double, C, A> m(ar, ar + sizeof(ar) / sizeof(ar[0]) / 2, C(3), A(7));
+ m = mo;
+ assert(m == mo);
+ assert(m.get_allocator() == A(7));
+ assert(m.key_comp() == C(5));
- assert(mo.get_allocator() == A(2));
- assert(mo.key_comp() == C(5));
- }
- {
- typedef std::pair<const int, double> V;
- const V ar[] =
- {
- V(1, 1),
- V(1, 1.5),
- V(1, 2),
- V(2, 1),
- V(2, 1.5),
- V(2, 2),
- V(3, 1),
- V(3, 1.5),
- V(3, 2),
- };
- std::multimap<int, double> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- std::multimap<int, double> *p = &m;
- m = *p;
- assert(m.size() == sizeof(ar)/sizeof(ar[0]));
- assert(std::equal(m.begin(), m.end(), ar));
- }
- {
- typedef std::pair<const int, double> V;
- V ar[] =
- {
- V(1, 1),
- V(1, 1.5),
- V(1, 2),
- V(2, 1),
- V(2, 1.5),
- V(2, 2),
- V(3, 1),
- V(3, 1.5),
- V(3, 2),
- };
- typedef test_less<int> C;
- typedef other_allocator<V> A;
- std::multimap<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(2));
- std::multimap<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0])/2, C(3), A(7));
- m = mo;
- assert(m == mo);
- assert(m.get_allocator() == A(2));
- assert(m.key_comp() == C(5));
+ assert(mo.get_allocator() == A(2));
+ assert(mo.key_comp() == C(5));
+ }
+ {
+ typedef std::pair<const int, double> V;
+ const V ar[] = {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2),
+ };
+ std::multimap<int, double> m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ std::multimap<int, double>* p = &m;
+ m = *p;
+ assert(m.size() == sizeof(ar) / sizeof(ar[0]));
+ assert(std::equal(m.begin(), m.end(), ar));
+ }
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] = {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2),
+ };
+ typedef test_less<int> C;
+ typedef other_allocator<V> A;
+ std::multimap<int, double, C, A> mo(ar, ar + sizeof(ar) / sizeof(ar[0]), C(5), A(2));
+ std::multimap<int, double, C, A> m(ar, ar + sizeof(ar) / sizeof(ar[0]) / 2, C(3), A(7));
+ m = mo;
+ assert(m == mo);
+ assert(m.get_allocator() == A(2));
+ assert(m.key_comp() == C(5));
- assert(mo.get_allocator() == A(2));
- assert(mo.key_comp() == C(5));
- }
+ assert(mo.get_allocator() == A(2));
+ assert(mo.key_comp() == C(5));
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::pair<const int, double> V;
- V ar[] =
- {
- V(1, 1),
- V(1, 1.5),
- V(1, 2),
- V(2, 1),
- V(2, 1.5),
- V(2, 2),
- V(3, 1),
- V(3, 1.5),
- V(3, 2),
- };
- typedef test_less<int> C;
- typedef min_allocator<V> A;
- std::multimap<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
- std::multimap<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0])/2, C(3), A());
- m = mo;
- assert(m == mo);
- assert(m.get_allocator() == A());
- assert(m.key_comp() == C(5));
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] = {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2),
+ };
+ typedef test_less<int> C;
+ typedef min_allocator<V> A;
+ std::multimap<int, double, C, A> mo(ar, ar + sizeof(ar) / sizeof(ar[0]), C(5), A());
+ std::multimap<int, double, C, A> m(ar, ar + sizeof(ar) / sizeof(ar[0]) / 2, C(3), A());
+ m = mo;
+ assert(m == mo);
+ assert(m.get_allocator() == A());
+ assert(m.key_comp() == C(5));
- assert(mo.get_allocator() == A());
- assert(mo.key_comp() == C(5));
- }
+ assert(mo.get_allocator() == A());
+ assert(mo.key_comp() == C(5));
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.cons/deduct.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/deduct.pass.cpp
index 56bc5400b65ab32..2f3db7f0de99277 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.cons/deduct.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.cons/deduct.pass.cpp
@@ -45,114 +45,114 @@
#include "deduction_guides_sfinae_checks.h"
#include "test_allocator.h"
-using P = std::pair<int, long>;
+using P = std::pair<int, long>;
using PC = std::pair<const int, long>;
-int main(int, char**)
-{
- {
- const P arr[] = { {1,1L}, {2,2L}, {1,1L}, {INT_MAX,1L}, {3,1L} };
+int main(int, char**) {
+ {
+ const P arr[] = {{1, 1L}, {2, 2L}, {1, 1L}, {INT_MAX, 1L}, {3, 1L}};
std::multimap m(std::begin(arr), std::end(arr));
ASSERT_SAME_TYPE(decltype(m), std::multimap<int, long>);
- const PC expected_m[] = { {1,1L}, {1,1L}, {2,2L}, {3,1L}, {INT_MAX,1L} };
+ const PC expected_m[] = {{1, 1L}, {1, 1L}, {2, 2L}, {3, 1L}, {INT_MAX, 1L}};
assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
- }
+ }
- {
- const P arr[] = { {1,1L}, {2,2L}, {1,1L}, {INT_MAX,1L}, {3,1L} };
+ {
+ const P arr[] = {{1, 1L}, {2, 2L}, {1, 1L}, {INT_MAX, 1L}, {3, 1L}};
std::multimap m(std::begin(arr), std::end(arr), std::greater<int>());
ASSERT_SAME_TYPE(decltype(m), std::multimap<int, long, std::greater<int>>);
- const PC expected_m[] = { {INT_MAX,1L}, {3,1L}, {2,2L}, {1,1L}, {1,1L} };
+ const PC expected_m[] = {{INT_MAX, 1L}, {3, 1L}, {2, 2L}, {1, 1L}, {1, 1L}};
assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
- }
+ }
- {
- const P arr[] = { {1,1L}, {2,2L}, {1,1L}, {INT_MAX,1L}, {3,1L} };
+ {
+ const P arr[] = {{1, 1L}, {2, 2L}, {1, 1L}, {INT_MAX, 1L}, {3, 1L}};
std::multimap m(std::begin(arr), std::end(arr), std::greater<int>(), test_allocator<PC>(0, 42));
ASSERT_SAME_TYPE(decltype(m), std::multimap<int, long, std::greater<int>, test_allocator<PC>>);
- const PC expected_m[] = { {INT_MAX,1L}, {3,1L}, {2,2L}, {1,1L}, {1,1L} };
+ const PC expected_m[] = {{INT_MAX, 1L}, {3, 1L}, {2, 2L}, {1, 1L}, {1, 1L}};
assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
assert(m.get_allocator().get_id() == 42);
- }
+ }
- {
+ {
std::multimap<int, long> source;
std::multimap m(source);
ASSERT_SAME_TYPE(decltype(m), decltype(source));
assert(m.size() == 0);
- }
+ }
- {
+ {
std::multimap<int, long> source;
- std::multimap m{source}; // braces instead of parens
+ std::multimap m{source}; // braces instead of parens
ASSERT_SAME_TYPE(decltype(m), decltype(source));
assert(m.size() == 0);
- }
+ }
- {
+ {
std::multimap<int, long> source;
std::multimap m(source, std::map<int, long>::allocator_type());
ASSERT_SAME_TYPE(decltype(m), decltype(source));
assert(m.size() == 0);
- }
+ }
- {
- std::multimap m{ P{1,1L}, P{2,2L}, P{1,1L}, P{INT_MAX,1L}, P{3,1L} };
+ {
+ std::multimap m{P{1, 1L}, P{2, 2L}, P{1, 1L}, P{INT_MAX, 1L}, P{3, 1L}};
ASSERT_SAME_TYPE(decltype(m), std::multimap<int, long>);
- const PC expected_m[] = { {1,1L}, {1,1L}, {2,2L}, {3,1L}, {INT_MAX,1L} };
+ const PC expected_m[] = {{1, 1L}, {1, 1L}, {2, 2L}, {3, 1L}, {INT_MAX, 1L}};
assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
- }
+ }
- {
- std::multimap m({ P{1,1L}, P{2,2L}, P{1,1L}, P{INT_MAX,1L}, P{3,1L} }, std::greater<int>());
+ {
+ std::multimap m({P{1, 1L}, P{2, 2L}, P{1, 1L}, P{INT_MAX, 1L}, P{3, 1L}}, std::greater<int>());
ASSERT_SAME_TYPE(decltype(m), std::multimap<int, long, std::greater<int>>);
- const PC expected_m[] = { {INT_MAX,1L}, {3,1L}, {2,2L}, {1,1L}, {1,1L} };
+ const PC expected_m[] = {{INT_MAX, 1L}, {3, 1L}, {2, 2L}, {1, 1L}, {1, 1L}};
assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
- }
+ }
- {
- std::multimap m({ P{1,1L}, P{2,2L}, P{1,1L}, P{INT_MAX,1L}, P{3,1L} }, std::greater<int>(), test_allocator<PC>(0, 43));
+ {
+ std::multimap m(
+ {P{1, 1L}, P{2, 2L}, P{1, 1L}, P{INT_MAX, 1L}, P{3, 1L}}, std::greater<int>(), test_allocator<PC>(0, 43));
ASSERT_SAME_TYPE(decltype(m), std::multimap<int, long, std::greater<int>, test_allocator<PC>>);
- const PC expected_m[] = { {INT_MAX,1L}, {3,1L}, {2,2L}, {1,1L}, {1,1L} };
+ const PC expected_m[] = {{INT_MAX, 1L}, {3, 1L}, {2, 2L}, {1, 1L}, {1, 1L}};
assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
assert(m.get_allocator().get_id() == 43);
- }
+ }
- {
- const P arr[] = { {1,1L}, {2,2L}, {1,1L}, {INT_MAX,1L}, {3,1L} };
+ {
+ const P arr[] = {{1, 1L}, {2, 2L}, {1, 1L}, {INT_MAX, 1L}, {3, 1L}};
std::multimap m(std::begin(arr), std::end(arr), test_allocator<PC>(0, 44));
ASSERT_SAME_TYPE(decltype(m), std::multimap<int, long, std::less<int>, test_allocator<PC>>);
- const PC expected_m[] = { {1,1L}, {1,1L}, {2,2L}, {3,1L}, {INT_MAX,1L} };
+ const PC expected_m[] = {{1, 1L}, {1, 1L}, {2, 2L}, {3, 1L}, {INT_MAX, 1L}};
assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
assert(m.get_allocator().get_id() == 44);
- }
+ }
- {
- std::multimap m({ P{1,1L}, P{2,2L}, P{1,1L}, P{INT_MAX,1L}, P{3,1L} }, test_allocator<PC>(0, 45));
+ {
+ std::multimap m({P{1, 1L}, P{2, 2L}, P{1, 1L}, P{INT_MAX, 1L}, P{3, 1L}}, test_allocator<PC>(0, 45));
ASSERT_SAME_TYPE(decltype(m), std::multimap<int, long, std::less<int>, test_allocator<PC>>);
- const PC expected_m[] = { {1,1L}, {1,1L}, {2,2L}, {3,1L}, {INT_MAX,1L} };
+ const PC expected_m[] = {{1, 1L}, {1, 1L}, {2, 2L}, {3, 1L}, {INT_MAX, 1L}};
assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
assert(m.get_allocator().get_id() == 45);
- }
+ }
- {
+ {
// Examples from LWG3025
std::multimap m{std::pair{1, 1}, {2, 2}, {3, 3}};
ASSERT_SAME_TYPE(decltype(m), std::multimap<int, int>);
std::multimap m2{m.begin(), m.end()};
ASSERT_SAME_TYPE(decltype(m2), std::multimap<int, int>);
- }
+ }
- {
+ {
// Examples from LWG3531
std::multimap m1{{std::pair{1, 2}, {3, 4}}, std::less<int>()};
ASSERT_SAME_TYPE(decltype(m1), std::multimap<int, int>);
@@ -160,38 +160,38 @@ int main(int, char**)
using value_type = std::pair<const int, int>;
std::multimap m2{{value_type{1, 2}, {3, 4}}, std::less<int>()};
ASSERT_SAME_TYPE(decltype(m2), std::multimap<int, int>);
- }
+ }
#if TEST_STD_VER >= 23
- {
- using Range = std::array<P, 0>;
- using Comp = std::greater<int>;
- using DefaultComp = std::less<int>;
- using Alloc = test_allocator<PC>;
-
- { // (from_range, range)
- std::multimap c(std::from_range, Range());
- static_assert(std::is_same_v<decltype(c), std::multimap<int, long>>);
- }
-
- { // (from_range, range, comp)
- std::multimap c(std::from_range, Range(), Comp());
- static_assert(std::is_same_v<decltype(c), std::multimap<int, long, Comp>>);
- }
-
- { // (from_range, range, comp, alloc)
- std::multimap c(std::from_range, Range(), Comp(), Alloc());
- static_assert(std::is_same_v<decltype(c), std::multimap<int, long, Comp, Alloc>>);
- }
-
- { // (from_range, range, alloc)
- std::multimap c(std::from_range, Range(), Alloc());
- static_assert(std::is_same_v<decltype(c), std::multimap<int, long, DefaultComp, Alloc>>);
- }
+ {
+ using Range = std::array<P, 0>;
+ using Comp = std::greater<int>;
+ using DefaultComp = std::less<int>;
+ using Alloc = test_allocator<PC>;
+
+ { // (from_range, range)
+ std::multimap c(std::from_range, Range());
+ static_assert(std::is_same_v<decltype(c), std::multimap<int, long>>);
+ }
+
+ { // (from_range, range, comp)
+ std::multimap c(std::from_range, Range(), Comp());
+ static_assert(std::is_same_v<decltype(c), std::multimap<int, long, Comp>>);
+ }
+
+ { // (from_range, range, comp, alloc)
+ std::multimap c(std::from_range, Range(), Comp(), Alloc());
+ static_assert(std::is_same_v<decltype(c), std::multimap<int, long, Comp, Alloc>>);
+ }
+
+ { // (from_range, range, alloc)
+ std::multimap c(std::from_range, Range(), Alloc());
+ static_assert(std::is_same_v<decltype(c), std::multimap<int, long, DefaultComp, Alloc>>);
}
+ }
#endif
- AssociativeContainerDeductionGuidesSfinaeAway<std::multimap, std::multimap<int, long>>();
+ AssociativeContainerDeductionGuidesSfinaeAway<std::multimap, std::multimap<int, long>>();
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.cons/deduct.verify.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/deduct.verify.cpp
index 795ac192400317f..03ac8ebf9271673 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.cons/deduct.verify.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.cons/deduct.verify.cpp
@@ -32,74 +32,75 @@
#include <type_traits>
struct NotAnAllocator {
- friend bool operator<(NotAnAllocator, NotAnAllocator) { return false; }
+ friend bool operator<(NotAnAllocator, NotAnAllocator) { return false; }
};
-using P = std::pair<int, long>;
+using P = std::pair<int, long>;
using PC = std::pair<const int, long>;
-int main(int, char**)
-{
- {
- // cannot deduce Key and T from nothing
- std::multimap m; // expected-error-re{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}multimap'}}
- }
- {
- // cannot deduce Key and T from just (Compare)
- std::multimap m(std::less<int>{});
- // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}multimap'}}
- }
- {
- // cannot deduce Key and T from just (Compare, Allocator)
- std::multimap m(std::less<int>{}, std::allocator<PC>{});
- // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}multimap'}}
- }
- {
- // cannot deduce Key and T from just (Allocator)
- std::multimap m(std::allocator<PC>{});
- // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}multimap'}}
- }
- {
- // refuse to rebind the allocator if Allocator::value_type is not exactly what we expect
- const P arr[] = { {1,1L}, {2,2L}, {3,3L} };
- std::multimap m(arr, arr + 3, std::allocator<P>());
- // expected-error-re at map:* {{static assertion failed{{( due to requirement '.*')?}}{{.*}}Allocator::value_type must be same type as value_type}}
- }
- {
- // cannot convert from some arbitrary unrelated type
- NotAnAllocator a;
- std::multimap m(a); // expected-error-re{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}multimap'}}
- }
- {
- // cannot deduce that the inner braced things should be std::pair and not something else
- std::multimap m{ {1,1L}, {2,2L}, {3,3L} };
- // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}multimap'}}
- }
- {
- // cannot deduce that the inner braced things should be std::pair and not something else
- std::multimap m({ {1,1L}, {2,2L}, {3,3L} }, std::less<int>());
- // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}multimap'}}
- }
- {
- // cannot deduce that the inner braced things should be std::pair and not something else
- std::multimap m({ {1,1L}, {2,2L}, {3,3L} }, std::less<int>(), std::allocator<PC>());
- // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}multimap'}}
- }
- {
- // cannot deduce that the inner braced things should be std::pair and not something else
- std::multimap m({ {1,1L}, {2,2L}, {3,3L} }, std::allocator<PC>());
- // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}multimap'}}
- }
- {
- // since we have parens, not braces, this deliberately does not find the initializer_list constructor
- std::multimap m(P{1,1L});
- // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}multimap'}}
- }
- {
- // since we have parens, not braces, this deliberately does not find the initializer_list constructor
- std::multimap m(PC{1,1L});
- // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}multimap'}}
- }
+int main(int, char**) {
+ {
+ // cannot deduce Key and T from nothing
+ std::multimap m;
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}multimap'}}
+ }
+ {
+ // cannot deduce Key and T from just (Compare)
+ std::multimap m(std::less<int>{});
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}multimap'}}
+ }
+ {
+ // cannot deduce Key and T from just (Compare, Allocator)
+ std::multimap m(std::less<int>{}, std::allocator<PC>{});
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}multimap'}}
+ }
+ {
+ // cannot deduce Key and T from just (Allocator)
+ std::multimap m(std::allocator<PC>{});
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}multimap'}}
+ }
+ {
+ // refuse to rebind the allocator if Allocator::value_type is not exactly what we expect
+ const P arr[] = {{1, 1L}, {2, 2L}, {3, 3L}};
+ std::multimap m(arr, arr + 3, std::allocator<P>());
+ // expected-error-re at map:* {{static assertion failed{{( due to requirement '.*')?}}{{.*}}Allocator::value_type must be same type as value_type}}
+ }
+ {
+ // cannot convert from some arbitrary unrelated type
+ NotAnAllocator a;
+ std::multimap m(a);
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}multimap'}}
+ }
+ {
+ // cannot deduce that the inner braced things should be std::pair and not something else
+ std::multimap m{{1, 1L}, {2, 2L}, {3, 3L}};
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}multimap'}}
+ }
+ {
+ // cannot deduce that the inner braced things should be std::pair and not something else
+ std::multimap m({{1, 1L}, {2, 2L}, {3, 3L}}, std::less<int>());
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}multimap'}}
+ }
+ {
+ // cannot deduce that the inner braced things should be std::pair and not something else
+ std::multimap m({{1, 1L}, {2, 2L}, {3, 3L}}, std::less<int>(), std::allocator<PC>());
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}multimap'}}
+ }
+ {
+ // cannot deduce that the inner braced things should be std::pair and not something else
+ std::multimap m({{1, 1L}, {2, 2L}, {3, 3L}}, std::allocator<PC>());
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}multimap'}}
+ }
+ {
+ // since we have parens, not braces, this deliberately does not find the initializer_list constructor
+ std::multimap m(P{1, 1L});
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}multimap'}}
+ }
+ {
+ // since we have parens, not braces, this deliberately does not find the initializer_list constructor
+ std::multimap m(PC{1, 1L});
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}multimap'}}
+ }
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.cons/deduct_const.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/deduct_const.pass.cpp
index c8f25dcd1996475..ae1e5622797cda4 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.cons/deduct_const.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.cons/deduct_const.pass.cpp
@@ -35,73 +35,73 @@
#include "test_allocator.h"
-using P = std::pair<int, long>;
-using PC = std::pair<const int, long>;
+using P = std::pair<int, long>;
+using PC = std::pair<const int, long>;
using PCC = std::pair<const int, const long>;
-int main(int, char**)
-{
- {
- const PCC arr[] = { {1,1L}, {2,2L}, {1,1L}, {INT_MAX,1L}, {3,1L} };
+int main(int, char**) {
+ {
+ const PCC arr[] = {{1, 1L}, {2, 2L}, {1, 1L}, {INT_MAX, 1L}, {3, 1L}};
std::multimap m(std::begin(arr), std::end(arr));
ASSERT_SAME_TYPE(decltype(m), std::multimap<int, const long>);
- const PCC expected_m[] = { {1,1L}, {1,1L}, {2,2L}, {3,1L}, {INT_MAX,1L} };
+ const PCC expected_m[] = {{1, 1L}, {1, 1L}, {2, 2L}, {3, 1L}, {INT_MAX, 1L}};
assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
- }
+ }
- {
- const PCC arr[] = { {1,1L}, {2,2L}, {1,1L}, {INT_MAX,1L}, {3,1L} };
+ {
+ const PCC arr[] = {{1, 1L}, {2, 2L}, {1, 1L}, {INT_MAX, 1L}, {3, 1L}};
std::multimap m(std::begin(arr), std::end(arr), std::greater<int>());
ASSERT_SAME_TYPE(decltype(m), std::multimap<int, const long, std::greater<int>>);
- const PCC expected_m[] = { {INT_MAX,1L}, {3,1L}, {2,2L}, {1,1L}, {1,1L} };
+ const PCC expected_m[] = {{INT_MAX, 1L}, {3, 1L}, {2, 2L}, {1, 1L}, {1, 1L}};
assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
- }
+ }
- {
- const PCC arr[] = { {1,1L}, {2,2L}, {1,1L}, {INT_MAX,1L}, {3,1L} };
+ {
+ const PCC arr[] = {{1, 1L}, {2, 2L}, {1, 1L}, {INT_MAX, 1L}, {3, 1L}};
std::multimap m(std::begin(arr), std::end(arr), std::greater<int>(), test_allocator<PCC>(0, 42));
ASSERT_SAME_TYPE(decltype(m), std::multimap<int, const long, std::greater<int>, test_allocator<PCC>>);
- const PCC expected_m[] = { {INT_MAX,1L}, {3,1L}, {2,2L}, {1,1L}, {1,1L} };
+ const PCC expected_m[] = {{INT_MAX, 1L}, {3, 1L}, {2, 2L}, {1, 1L}, {1, 1L}};
assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
assert(m.get_allocator().get_id() == 42);
- }
+ }
- {
- std::multimap m{ PC{1,1L}, PC{2,2L}, PC{1,1L}, PC{INT_MAX,1L}, PC{3,1L} };
+ {
+ std::multimap m{PC{1, 1L}, PC{2, 2L}, PC{1, 1L}, PC{INT_MAX, 1L}, PC{3, 1L}};
ASSERT_SAME_TYPE(decltype(m), std::multimap<int, long>);
- const PC expected_m[] = { {1,1L}, {1,1L}, {2,2L}, {3,1L}, {INT_MAX,1L} };
+ const PC expected_m[] = {{1, 1L}, {1, 1L}, {2, 2L}, {3, 1L}, {INT_MAX, 1L}};
assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
- }
+ }
- {
- std::multimap m({ PC{1,1L}, PC{2,2L}, PC{1,1L}, PC{INT_MAX,1L}, PC{3,1L} }, std::greater<int>());
+ {
+ std::multimap m({PC{1, 1L}, PC{2, 2L}, PC{1, 1L}, PC{INT_MAX, 1L}, PC{3, 1L}}, std::greater<int>());
ASSERT_SAME_TYPE(decltype(m), std::multimap<int, long, std::greater<int>>);
- const PC expected_m[] = { {INT_MAX,1L}, {3,1L}, {2,2L}, {1,1L}, {1,1L} };
+ const PC expected_m[] = {{INT_MAX, 1L}, {3, 1L}, {2, 2L}, {1, 1L}, {1, 1L}};
assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
- }
+ }
- {
- std::multimap m({ PC{1,1L}, PC{2,2L}, PC{1,1L}, PC{INT_MAX,1L}, PC{3,1L} }, std::greater<int>(), test_allocator<PC>(0, 43));
+ {
+ std::multimap m(
+ {PC{1, 1L}, PC{2, 2L}, PC{1, 1L}, PC{INT_MAX, 1L}, PC{3, 1L}}, std::greater<int>(), test_allocator<PC>(0, 43));
ASSERT_SAME_TYPE(decltype(m), std::multimap<int, long, std::greater<int>, test_allocator<PC>>);
- const PC expected_m[] = { {INT_MAX,1L}, {3,1L}, {2,2L}, {1,1L}, {1,1L} };
+ const PC expected_m[] = {{INT_MAX, 1L}, {3, 1L}, {2, 2L}, {1, 1L}, {1, 1L}};
assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
assert(m.get_allocator().get_id() == 43);
- }
+ }
- {
- std::multimap m({ PC{1,1L}, PC{2,2L}, PC{1,1L}, PC{INT_MAX,1L}, PC{3,1L} }, test_allocator<PC>(0, 45));
+ {
+ std::multimap m({PC{1, 1L}, PC{2, 2L}, PC{1, 1L}, PC{INT_MAX, 1L}, PC{3, 1L}}, test_allocator<PC>(0, 45));
ASSERT_SAME_TYPE(decltype(m), std::multimap<int, long, std::less<int>, test_allocator<PC>>);
- const PC expected_m[] = { {1,1L}, {1,1L}, {2,2L}, {3,1L}, {INT_MAX,1L} };
+ const PC expected_m[] = {{1, 1L}, {1, 1L}, {2, 2L}, {3, 1L}, {INT_MAX, 1L}};
assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
assert(m.get_allocator().get_id() == 45);
- }
+ }
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.cons/default.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/default.pass.cpp
index 5248874c2e48db5..f74723b3174f0f5 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.cons/default.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.cons/default.pass.cpp
@@ -18,38 +18,37 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
std::multimap<int, double> m;
assert(m.empty());
assert(m.begin() == m.end());
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> m;
assert(m.empty());
assert(m.begin() == m.end());
- }
- {
+ }
+ {
typedef explicit_allocator<std::pair<const int, double>> A;
- {
- std::multimap<int, double, std::less<int>, A> m;
- assert(m.empty());
- assert(m.begin() == m.end());
- }
- {
- A a;
- std::multimap<int, double, std::less<int>, A> m(a);
- assert(m.empty());
- assert(m.begin() == m.end());
- }
+ {
+ std::multimap<int, double, std::less<int>, A> m;
+ assert(m.empty());
+ assert(m.begin() == m.end());
}
{
+ A a;
+ std::multimap<int, double, std::less<int>, A> m(a);
+ assert(m.empty());
+ assert(m.begin() == m.end());
+ }
+ }
+ {
std::multimap<int, double> m = {};
assert(m.empty());
assert(m.begin() == m.end());
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.cons/default_noexcept.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/default_noexcept.pass.cpp
index 6abc12570762950..b6c4e0336394d17 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.cons/default_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.cons/default_noexcept.pass.cpp
@@ -26,34 +26,32 @@
#include "test_allocator.h"
template <class T>
-struct some_comp
-{
- typedef T value_type;
- some_comp();
- bool operator()(const T&, const T&) const { return false; }
+struct some_comp {
+ typedef T value_type;
+ some_comp();
+ bool operator()(const T&, const T&) const { return false; }
};
-int main(int, char**)
-{
- typedef std::pair<const MoveOnly, MoveOnly> V;
+int main(int, char**) {
+ typedef std::pair<const MoveOnly, MoveOnly> V;
#if defined(_LIBCPP_VERSION)
- {
- typedef std::multimap<MoveOnly, MoveOnly> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
- }
- {
- typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<V>> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
- }
+ {
+ typedef std::multimap<MoveOnly, MoveOnly> C;
+ static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ }
+ {
+ typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<V>> C;
+ static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ }
#endif // _LIBCPP_VERSION
- {
- typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<V>> C;
- static_assert(!std::is_nothrow_default_constructible<C>::value, "");
- }
- {
- typedef std::multimap<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
- static_assert(!std::is_nothrow_default_constructible<C>::value, "");
- }
+ {
+ typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<V>> C;
+ static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+ }
+ {
+ typedef std::multimap<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
+ static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.cons/dtor_noexcept.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/dtor_noexcept.pass.cpp
index 407f9669481582d..62afae92b6902fa 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.cons/dtor_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.cons/dtor_noexcept.pass.cpp
@@ -20,33 +20,31 @@
#include "test_allocator.h"
template <class T>
-struct some_comp
-{
- typedef T value_type;
- ~some_comp() noexcept(false);
- bool operator()(const T&, const T&) const { return false; }
+struct some_comp {
+ typedef T value_type;
+ ~some_comp() noexcept(false);
+ bool operator()(const T&, const T&) const { return false; }
};
-int main(int, char**)
-{
- typedef std::pair<const MoveOnly, MoveOnly> V;
- {
- typedef std::multimap<MoveOnly, MoveOnly> C;
- static_assert(std::is_nothrow_destructible<C>::value, "");
- }
- {
- typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<V>> C;
- static_assert(std::is_nothrow_destructible<C>::value, "");
- }
- {
- typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<V>> C;
- static_assert(std::is_nothrow_destructible<C>::value, "");
- }
+int main(int, char**) {
+ typedef std::pair<const MoveOnly, MoveOnly> V;
+ {
+ typedef std::multimap<MoveOnly, MoveOnly> C;
+ static_assert(std::is_nothrow_destructible<C>::value, "");
+ }
+ {
+ typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<V>> C;
+ static_assert(std::is_nothrow_destructible<C>::value, "");
+ }
+ {
+ typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<V>> C;
+ static_assert(std::is_nothrow_destructible<C>::value, "");
+ }
#if defined(_LIBCPP_VERSION)
- {
- typedef std::multimap<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
- static_assert(!std::is_nothrow_destructible<C>::value, "");
- }
+ {
+ typedef std::multimap<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
+ static_assert(!std::is_nothrow_destructible<C>::value, "");
+ }
#endif // _LIBCPP_VERSION
return 0;
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.cons/from_range.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/from_range.pass.cpp
index b38078c7e82f29b..fd8ca64f1cce612 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.cons/from_range.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.cons/from_range.pass.cpp
@@ -22,11 +22,9 @@
#include "test_macros.h"
void test_duplicates() {
- using T = std::pair<const int, char>;
- std::array input = {
- T{1, 'a'}, T{2, 'a'}, T{3, 'a'}, T{3, 'b'}, T{3, 'c'}, T{2, 'b'}, T{4, 'a'}
- };
- auto c = std::multimap<int, char>(std::from_range, input);
+ using T = std::pair<const int, char>;
+ std::array input = {T{1, 'a'}, T{2, 'a'}, T{3, 'a'}, T{3, 'b'}, T{3, 'c'}, T{2, 'b'}, T{4, 'a'}};
+ auto c = std::multimap<int, char>(std::from_range, input);
assert(std::ranges::is_permutation(input, c));
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.cons/initializer_list.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/initializer_list.pass.cpp
index 1c679778941c226..db91af00359e886 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.cons/initializer_list.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.cons/initializer_list.pass.cpp
@@ -20,23 +20,11 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::multimap<int, double> C;
typedef C::value_type V;
- C m =
- {
- {1, 1},
- {1, 1.5},
- {1, 2},
- {2, 1},
- {2, 1.5},
- {2, 2},
- {3, 1},
- {3, 1.5},
- {3, 2}
- };
+ C m = {{1, 1}, {1, 1.5}, {1, 2}, {2, 1}, {2, 1.5}, {2, 2}, {3, 1}, {3, 1.5}, {3, 2}};
assert(m.size() == 9);
assert(std::distance(m.begin(), m.end()) == 9);
C::const_iterator i = m.cbegin();
@@ -49,22 +37,11 @@ int main(int, char**)
assert(*++i == V(3, 1));
assert(*++i == V(3, 1.5));
assert(*++i == V(3, 2));
- }
- {
+ }
+ {
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> C;
typedef C::value_type V;
- C m =
- {
- {1, 1},
- {1, 1.5},
- {1, 2},
- {2, 1},
- {2, 1.5},
- {2, 2},
- {3, 1},
- {3, 1.5},
- {3, 2}
- };
+ C m = {{1, 1}, {1, 1.5}, {1, 2}, {2, 1}, {2, 1.5}, {2, 2}, {3, 1}, {3, 1.5}, {3, 2}};
assert(m.size() == 9);
assert(std::distance(m.begin(), m.end()) == 9);
C::const_iterator i = m.cbegin();
@@ -77,7 +54,7 @@ int main(int, char**)
assert(*++i == V(3, 1));
assert(*++i == V(3, 1.5));
assert(*++i == V(3, 2));
- }
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare.pass.cpp
index ed8ab93e5289f12..0d346d722635373 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare.pass.cpp
@@ -20,26 +20,12 @@
#include "../../../test_compare.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef test_less<int> Cmp;
typedef std::multimap<int, double, Cmp> C;
typedef C::value_type V;
- C m(
- {
- {1, 1},
- {1, 1.5},
- {1, 2},
- {2, 1},
- {2, 1.5},
- {2, 2},
- {3, 1},
- {3, 1.5},
- {3, 2}
- },
- Cmp(4)
- );
+ C m({{1, 1}, {1, 1.5}, {1, 2}, {2, 1}, {2, 1.5}, {2, 2}, {3, 1}, {3, 1.5}, {3, 2}}, Cmp(4));
assert(m.size() == 9);
assert(std::distance(m.begin(), m.end()) == 9);
C::const_iterator i = m.cbegin();
@@ -53,25 +39,12 @@ int main(int, char**)
assert(*++i == V(3, 1.5));
assert(*++i == V(3, 2));
assert(m.key_comp() == Cmp(4));
- }
- {
+ }
+ {
typedef test_less<int> Cmp;
typedef std::multimap<int, double, Cmp, min_allocator<std::pair<const int, double>>> C;
typedef C::value_type V;
- C m(
- {
- {1, 1},
- {1, 1.5},
- {1, 2},
- {2, 1},
- {2, 1.5},
- {2, 2},
- {3, 1},
- {3, 1.5},
- {3, 2}
- },
- Cmp(4)
- );
+ C m({{1, 1}, {1, 1.5}, {1, 2}, {2, 1}, {2, 1.5}, {2, 2}, {3, 1}, {3, 1.5}, {3, 2}}, Cmp(4));
assert(m.size() == 9);
assert(std::distance(m.begin(), m.end()) == 9);
C::const_iterator i = m.cbegin();
@@ -85,7 +58,7 @@ int main(int, char**)
assert(*++i == V(3, 1.5));
assert(*++i == V(3, 2));
assert(m.key_comp() == Cmp(4));
- }
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare_alloc.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare_alloc.pass.cpp
index 92d6128244c1a8c..493f1bafbc1b7e4 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare_alloc.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare_alloc.pass.cpp
@@ -21,27 +21,13 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef test_less<int> Cmp;
typedef test_allocator<std::pair<const int, double> > A;
typedef std::multimap<int, double, Cmp, A> C;
typedef C::value_type V;
- C m(
- {
- {1, 1},
- {1, 1.5},
- {1, 2},
- {2, 1},
- {2, 1.5},
- {2, 2},
- {3, 1},
- {3, 1.5},
- {3, 2}
- },
- Cmp(4), A(5)
- );
+ C m({{1, 1}, {1, 1.5}, {1, 2}, {2, 1}, {2, 1.5}, {2, 2}, {3, 1}, {3, 1.5}, {3, 2}}, Cmp(4), A(5));
assert(m.size() == 9);
assert(std::distance(m.begin(), m.end()) == 9);
C::const_iterator i = m.cbegin();
@@ -56,26 +42,13 @@ int main(int, char**)
assert(*++i == V(3, 2));
assert(m.key_comp() == Cmp(4));
assert(m.get_allocator() == A(5));
- }
- {
+ }
+ {
typedef test_less<int> Cmp;
typedef min_allocator<std::pair<const int, double> > A;
typedef std::multimap<int, double, Cmp, A> C;
typedef C::value_type V;
- C m(
- {
- {1, 1},
- {1, 1.5},
- {1, 2},
- {2, 1},
- {2, 1.5},
- {2, 2},
- {3, 1},
- {3, 1.5},
- {3, 2}
- },
- Cmp(4), A()
- );
+ C m({{1, 1}, {1, 1.5}, {1, 2}, {2, 1}, {2, 1.5}, {2, 2}, {3, 1}, {3, 1.5}, {3, 2}}, Cmp(4), A());
assert(m.size() == 9);
assert(std::distance(m.begin(), m.end()) == 9);
C::const_iterator i = m.cbegin();
@@ -90,23 +63,14 @@ int main(int, char**)
assert(*++i == V(3, 2));
assert(m.key_comp() == Cmp(4));
assert(m.get_allocator() == A());
- }
- {
+ }
+ {
typedef test_less<int> C;
typedef std::pair<const int, double> V;
typedef min_allocator<V> A;
typedef std::multimap<int, double, C, A> M;
A a;
- M m ({ {1, 1},
- {1, 1.5},
- {1, 2},
- {2, 1},
- {2, 1.5},
- {2, 2},
- {3, 1},
- {3, 1.5},
- {3, 2}
- }, a);
+ M m({{1, 1}, {1, 1.5}, {1, 2}, {2, 1}, {2, 1.5}, {2, 2}, {3, 1}, {3, 1.5}, {3, 2}}, a);
assert(m.size() == 9);
assert(std::distance(m.begin(), m.end()) == 9);
@@ -121,26 +85,13 @@ int main(int, char**)
assert(*++i == V(3, 1.5));
assert(*++i == V(3, 2));
assert(m.get_allocator() == a);
- }
- {
+ }
+ {
typedef test_less<int> Cmp;
typedef explicit_allocator<std::pair<const int, double> > A;
typedef std::multimap<int, double, Cmp, A> C;
typedef C::value_type V;
- C m(
- {
- {1, 1},
- {1, 1.5},
- {1, 2},
- {2, 1},
- {2, 1.5},
- {2, 2},
- {3, 1},
- {3, 1.5},
- {3, 2}
- },
- Cmp(4), A{}
- );
+ C m({{1, 1}, {1, 1.5}, {1, 2}, {2, 1}, {2, 1.5}, {2, 2}, {3, 1}, {3, 1.5}, {3, 2}}, Cmp(4), A{});
assert(m.size() == 9);
assert(std::distance(m.begin(), m.end()) == 9);
C::const_iterator i = m.cbegin();
@@ -155,7 +106,7 @@ int main(int, char**)
assert(*++i == V(3, 2));
assert(m.key_comp() == Cmp(4));
assert(m.get_allocator() == A{});
- }
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.cons/iter_iter.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/iter_iter.pass.cpp
index 92ebc56f160ddd1..55542914f9a0178 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.cons/iter_iter.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.cons/iter_iter.pass.cpp
@@ -19,12 +19,10 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::pair<const int, double> V;
- V ar[] =
- {
+ V ar[] = {
V(1, 1),
V(1, 1.5),
V(1, 2),
@@ -35,7 +33,7 @@ int main(int, char**)
V(3, 1.5),
V(3, 2),
};
- std::multimap<int, double> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ std::multimap<int, double> m(ar, ar + sizeof(ar) / sizeof(ar[0]));
assert(m.size() == 9);
assert(std::distance(m.begin(), m.end()) == 9);
assert(*m.begin() == V(1, 1));
@@ -47,12 +45,11 @@ int main(int, char**)
assert(*std::next(m.begin(), 6) == V(3, 1));
assert(*std::next(m.begin(), 7) == V(3, 1.5));
assert(*std::next(m.begin(), 8) == V(3, 2));
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::pair<const int, double> V;
- V ar[] =
- {
+ V ar[] = {
V(1, 1),
V(1, 1.5),
V(1, 2),
@@ -63,7 +60,7 @@ int main(int, char**)
V(3, 1.5),
V(3, 2),
};
- std::multimap<int, double, std::less<int>, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ std::multimap<int, double, std::less<int>, min_allocator<V>> m(ar, ar + sizeof(ar) / sizeof(ar[0]));
assert(m.size() == 9);
assert(std::distance(m.begin(), m.end()) == 9);
assert(*m.begin() == V(1, 1));
@@ -75,12 +72,11 @@ int main(int, char**)
assert(*std::next(m.begin(), 6) == V(3, 1));
assert(*std::next(m.begin(), 7) == V(3, 1.5));
assert(*std::next(m.begin(), 8) == V(3, 2));
- }
-#if TEST_STD_VER > 11
- {
+ }
+# if TEST_STD_VER > 11
+ {
typedef std::pair<const int, double> V;
- V ar[] =
- {
+ V ar[] = {
V(1, 1),
V(1, 1.5),
V(1, 2),
@@ -93,7 +89,7 @@ int main(int, char**)
};
typedef min_allocator<std::pair<const int, double>> A;
A a;
- std::multimap<int, double, std::less<int>, A> m(ar, ar+sizeof(ar)/sizeof(ar[0]), a);
+ std::multimap<int, double, std::less<int>, A> m(ar, ar + sizeof(ar) / sizeof(ar[0]), a);
assert(m.size() == 9);
assert(std::distance(m.begin(), m.end()) == 9);
assert(*m.begin() == V(1, 1));
@@ -106,8 +102,8 @@ int main(int, char**)
assert(*std::next(m.begin(), 7) == V(3, 1.5));
assert(*std::next(m.begin(), 8) == V(3, 2));
assert(m.get_allocator() == a);
- }
-#endif
+ }
+# endif
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.cons/iter_iter_comp.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/iter_iter_comp.pass.cpp
index d50df29796ea4c1..128d54a3d6b4ed4 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.cons/iter_iter_comp.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.cons/iter_iter_comp.pass.cpp
@@ -21,12 +21,10 @@
#include "../../../test_compare.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::pair<const int, double> V;
- V ar[] =
- {
+ V ar[] = {
V(1, 1),
V(1, 1.5),
V(1, 2),
@@ -38,7 +36,7 @@ int main(int, char**)
V(3, 2),
};
typedef test_less<int> C;
- std::multimap<int, double, C> m(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5));
+ std::multimap<int, double, C> m(ar, ar + sizeof(ar) / sizeof(ar[0]), C(5));
assert(m.key_comp() == C(5));
assert(m.size() == 9);
assert(std::distance(m.begin(), m.end()) == 9);
@@ -51,12 +49,11 @@ int main(int, char**)
assert(*std::next(m.begin(), 6) == V(3, 1));
assert(*std::next(m.begin(), 7) == V(3, 1.5));
assert(*std::next(m.begin(), 8) == V(3, 2));
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::pair<const int, double> V;
- V ar[] =
- {
+ V ar[] = {
V(1, 1),
V(1, 1.5),
V(1, 2),
@@ -68,7 +65,7 @@ int main(int, char**)
V(3, 2),
};
typedef test_less<int> C;
- std::multimap<int, double, C, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5));
+ std::multimap<int, double, C, min_allocator<V>> m(ar, ar + sizeof(ar) / sizeof(ar[0]), C(5));
assert(m.key_comp() == C(5));
assert(m.size() == 9);
assert(std::distance(m.begin(), m.end()) == 9);
@@ -81,7 +78,7 @@ int main(int, char**)
assert(*std::next(m.begin(), 6) == V(3, 1));
assert(*std::next(m.begin(), 7) == V(3, 1.5));
assert(*std::next(m.begin(), 8) == V(3, 2));
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.cons/iter_iter_comp_alloc.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/iter_iter_comp_alloc.pass.cpp
index 0d0f0b57ed48556..68d658c2edf85f9 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.cons/iter_iter_comp_alloc.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.cons/iter_iter_comp_alloc.pass.cpp
@@ -22,12 +22,10 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::pair<const int, double> V;
- V ar[] =
- {
+ V ar[] = {
V(1, 1),
V(1, 1.5),
V(1, 2),
@@ -40,7 +38,7 @@ int main(int, char**)
};
typedef test_less<int> C;
typedef test_allocator<V> A;
- std::multimap<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(7));
+ std::multimap<int, double, C, A> m(ar, ar + sizeof(ar) / sizeof(ar[0]), C(5), A(7));
assert(m.get_allocator() == A(7));
assert(m.key_comp() == C(5));
assert(m.size() == 9);
@@ -54,12 +52,11 @@ int main(int, char**)
assert(*std::next(m.begin(), 6) == V(3, 1));
assert(*std::next(m.begin(), 7) == V(3, 1.5));
assert(*std::next(m.begin(), 8) == V(3, 2));
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::pair<const int, double> V;
- V ar[] =
- {
+ V ar[] = {
V(1, 1),
V(1, 1.5),
V(1, 2),
@@ -72,7 +69,7 @@ int main(int, char**)
};
typedef test_less<int> C;
typedef min_allocator<V> A;
- std::multimap<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
+ std::multimap<int, double, C, A> m(ar, ar + sizeof(ar) / sizeof(ar[0]), C(5), A());
assert(m.get_allocator() == A());
assert(m.key_comp() == C(5));
assert(m.size() == 9);
@@ -86,11 +83,10 @@ int main(int, char**)
assert(*std::next(m.begin(), 6) == V(3, 1));
assert(*std::next(m.begin(), 7) == V(3, 1.5));
assert(*std::next(m.begin(), 8) == V(3, 2));
- }
- {
+ }
+ {
typedef std::pair<const int, double> V;
- V ar[] =
- {
+ V ar[] = {
V(1, 1),
V(1, 1.5),
V(1, 2),
@@ -103,7 +99,7 @@ int main(int, char**)
};
typedef test_less<int> C;
typedef explicit_allocator<V> A;
- std::multimap<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A{});
+ std::multimap<int, double, C, A> m(ar, ar + sizeof(ar) / sizeof(ar[0]), C(5), A{});
assert(m.get_allocator() == A{});
assert(m.key_comp() == C(5));
assert(m.size() == 9);
@@ -117,7 +113,7 @@ int main(int, char**)
assert(*std::next(m.begin(), 6) == V(3, 1));
assert(*std::next(m.begin(), 7) == V(3, 1.5));
assert(*std::next(m.begin(), 8) == V(3, 2));
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.cons/move.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/move.pass.cpp
index 8227b81f0c05c54..d229c6f7d5f491b 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.cons/move.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.cons/move.pass.cpp
@@ -22,113 +22,110 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- typedef std::pair<const int, double> V;
- {
- typedef test_less<int> C;
- typedef test_allocator<V> A;
- std::multimap<int, double, C, A> mo(C(5), A(7));
- std::multimap<int, double, C, A> m = std::move(mo);
- assert(m.get_allocator() == A(7));
- assert(m.key_comp() == C(5));
- assert(m.size() == 0);
- assert(std::distance(m.begin(), m.end()) == 0);
+int main(int, char**) {
+ typedef std::pair<const int, double> V;
+ {
+ typedef test_less<int> C;
+ typedef test_allocator<V> A;
+ std::multimap<int, double, C, A> mo(C(5), A(7));
+ std::multimap<int, double, C, A> m = std::move(mo);
+ assert(m.get_allocator() == A(7));
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 0);
+ assert(std::distance(m.begin(), m.end()) == 0);
- assert(mo.get_allocator() == A(7));
- assert(mo.get_allocator().get_id() == test_alloc_base::moved_value);
- assert(mo.key_comp() == C(5));
- assert(mo.size() == 0);
- assert(std::distance(mo.begin(), mo.end()) == 0);
- }
- {
- V ar[] =
- {
- V(1, 1),
- V(1, 1.5),
- V(1, 2),
- V(2, 1),
- V(2, 1.5),
- V(2, 2),
- V(3, 1),
- V(3, 1.5),
- V(3, 2),
- };
- typedef test_less<int> C;
- typedef test_allocator<V> A;
- std::multimap<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(7));
- std::multimap<int, double, C, A> m = std::move(mo);
- assert(m.get_allocator() == A(7));
- assert(m.key_comp() == C(5));
- assert(m.size() == 9);
- assert(std::distance(m.begin(), m.end()) == 9);
- assert(*m.begin() == V(1, 1));
- assert(*std::next(m.begin()) == V(1, 1.5));
- assert(*std::next(m.begin(), 2) == V(1, 2));
- assert(*std::next(m.begin(), 3) == V(2, 1));
- assert(*std::next(m.begin(), 4) == V(2, 1.5));
- assert(*std::next(m.begin(), 5) == V(2, 2));
- assert(*std::next(m.begin(), 6) == V(3, 1));
- assert(*std::next(m.begin(), 7) == V(3, 1.5));
- assert(*std::next(m.begin(), 8) == V(3, 2));
+ assert(mo.get_allocator() == A(7));
+ assert(mo.get_allocator().get_id() == test_alloc_base::moved_value);
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 0);
+ assert(std::distance(mo.begin(), mo.end()) == 0);
+ }
+ {
+ V ar[] = {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2),
+ };
+ typedef test_less<int> C;
+ typedef test_allocator<V> A;
+ std::multimap<int, double, C, A> mo(ar, ar + sizeof(ar) / sizeof(ar[0]), C(5), A(7));
+ std::multimap<int, double, C, A> m = std::move(mo);
+ assert(m.get_allocator() == A(7));
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 9);
+ assert(std::distance(m.begin(), m.end()) == 9);
+ assert(*m.begin() == V(1, 1));
+ assert(*std::next(m.begin()) == V(1, 1.5));
+ assert(*std::next(m.begin(), 2) == V(1, 2));
+ assert(*std::next(m.begin(), 3) == V(2, 1));
+ assert(*std::next(m.begin(), 4) == V(2, 1.5));
+ assert(*std::next(m.begin(), 5) == V(2, 2));
+ assert(*std::next(m.begin(), 6) == V(3, 1));
+ assert(*std::next(m.begin(), 7) == V(3, 1.5));
+ assert(*std::next(m.begin(), 8) == V(3, 2));
- assert(mo.get_allocator() == A(7));
- assert(mo.get_allocator().get_id() == test_alloc_base::moved_value);
- assert(mo.key_comp() == C(5));
- assert(mo.size() == 0);
- assert(std::distance(mo.begin(), mo.end()) == 0);
- }
- {
- typedef test_less<int> C;
- typedef min_allocator<V> A;
- std::multimap<int, double, C, A> mo(C(5), A());
- std::multimap<int, double, C, A> m = std::move(mo);
- assert(m.get_allocator() == A());
- assert(m.key_comp() == C(5));
- assert(m.size() == 0);
- assert(std::distance(m.begin(), m.end()) == 0);
+ assert(mo.get_allocator() == A(7));
+ assert(mo.get_allocator().get_id() == test_alloc_base::moved_value);
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 0);
+ assert(std::distance(mo.begin(), mo.end()) == 0);
+ }
+ {
+ typedef test_less<int> C;
+ typedef min_allocator<V> A;
+ std::multimap<int, double, C, A> mo(C(5), A());
+ std::multimap<int, double, C, A> m = std::move(mo);
+ assert(m.get_allocator() == A());
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 0);
+ assert(std::distance(m.begin(), m.end()) == 0);
- assert(mo.get_allocator() == A());
- assert(mo.key_comp() == C(5));
- assert(mo.size() == 0);
- assert(std::distance(mo.begin(), mo.end()) == 0);
- }
- {
- V ar[] =
- {
- V(1, 1),
- V(1, 1.5),
- V(1, 2),
- V(2, 1),
- V(2, 1.5),
- V(2, 2),
- V(3, 1),
- V(3, 1.5),
- V(3, 2),
- };
- typedef test_less<int> C;
- typedef min_allocator<V> A;
- std::multimap<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
- std::multimap<int, double, C, A> m = std::move(mo);
- assert(m.get_allocator() == A());
- assert(m.key_comp() == C(5));
- assert(m.size() == 9);
- assert(std::distance(m.begin(), m.end()) == 9);
- assert(*m.begin() == V(1, 1));
- assert(*std::next(m.begin()) == V(1, 1.5));
- assert(*std::next(m.begin(), 2) == V(1, 2));
- assert(*std::next(m.begin(), 3) == V(2, 1));
- assert(*std::next(m.begin(), 4) == V(2, 1.5));
- assert(*std::next(m.begin(), 5) == V(2, 2));
- assert(*std::next(m.begin(), 6) == V(3, 1));
- assert(*std::next(m.begin(), 7) == V(3, 1.5));
- assert(*std::next(m.begin(), 8) == V(3, 2));
+ assert(mo.get_allocator() == A());
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 0);
+ assert(std::distance(mo.begin(), mo.end()) == 0);
+ }
+ {
+ V ar[] = {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2),
+ };
+ typedef test_less<int> C;
+ typedef min_allocator<V> A;
+ std::multimap<int, double, C, A> mo(ar, ar + sizeof(ar) / sizeof(ar[0]), C(5), A());
+ std::multimap<int, double, C, A> m = std::move(mo);
+ assert(m.get_allocator() == A());
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 9);
+ assert(std::distance(m.begin(), m.end()) == 9);
+ assert(*m.begin() == V(1, 1));
+ assert(*std::next(m.begin()) == V(1, 1.5));
+ assert(*std::next(m.begin(), 2) == V(1, 2));
+ assert(*std::next(m.begin(), 3) == V(2, 1));
+ assert(*std::next(m.begin(), 4) == V(2, 1.5));
+ assert(*std::next(m.begin(), 5) == V(2, 2));
+ assert(*std::next(m.begin(), 6) == V(3, 1));
+ assert(*std::next(m.begin(), 7) == V(3, 1.5));
+ assert(*std::next(m.begin(), 8) == V(3, 2));
- assert(mo.get_allocator() == A());
- assert(mo.key_comp() == C(5));
- assert(mo.size() == 0);
- assert(std::distance(mo.begin(), mo.end()) == 0);
- }
+ assert(mo.get_allocator() == A());
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 0);
+ assert(std::distance(mo.begin(), mo.end()) == 0);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.cons/move_alloc.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/move_alloc.pass.cpp
index e246842ea7d4e7c..31ff8ff792566e0 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.cons/move_alloc.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.cons/move_alloc.pass.cpp
@@ -24,253 +24,131 @@
#include "min_allocator.h"
#include "Counter.h"
-int main(int, char**)
-{
+int main(int, char**) {
+ {
+ typedef std::pair<MoveOnly, MoveOnly> V;
+ typedef std::pair<const MoveOnly, MoveOnly> VC;
+ typedef test_less<MoveOnly> C;
+ typedef test_allocator<VC> A;
+ typedef std::multimap<MoveOnly, MoveOnly, C, A> M;
+ typedef std::move_iterator<V*> I;
+ V a1[] = {V(1, 1), V(1, 2), V(1, 3), V(2, 1), V(2, 2), V(2, 3), V(3, 1), V(3, 2), V(3, 3)};
+ M m1(I(a1), I(a1 + sizeof(a1) / sizeof(a1[0])), C(5), A(7));
+ V a2[] = {V(1, 1), V(1, 2), V(1, 3), V(2, 1), V(2, 2), V(2, 3), V(3, 1), V(3, 2), V(3, 3)};
+ M m2(I(a2), I(a2 + sizeof(a2) / sizeof(a2[0])), C(5), A(7));
+ M m3(std::move(m1), A(7));
+ assert(m3 == m2);
+ assert(m3.get_allocator() == A(7));
+ assert(m3.key_comp() == C(5));
+ LIBCPP_ASSERT(m1.empty());
+ }
+ {
+ typedef std::pair<MoveOnly, MoveOnly> V;
+ typedef std::pair<const MoveOnly, MoveOnly> VC;
+ typedef test_less<MoveOnly> C;
+ typedef test_allocator<VC> A;
+ typedef std::multimap<MoveOnly, MoveOnly, C, A> M;
+ typedef std::move_iterator<V*> I;
+ V a1[] = {V(1, 1), V(1, 2), V(1, 3), V(2, 1), V(2, 2), V(2, 3), V(3, 1), V(3, 2), V(3, 3)};
+ M m1(I(a1), I(a1 + sizeof(a1) / sizeof(a1[0])), C(5), A(7));
+ V a2[] = {V(1, 1), V(1, 2), V(1, 3), V(2, 1), V(2, 2), V(2, 3), V(3, 1), V(3, 2), V(3, 3)};
+ M m2(I(a2), I(a2 + sizeof(a2) / sizeof(a2[0])), C(5), A(7));
+ M m3(std::move(m1), A(5));
+ assert(m3 == m2);
+ assert(m3.get_allocator() == A(5));
+ assert(m3.key_comp() == C(5));
+ LIBCPP_ASSERT(m1.empty());
+ }
+ {
+ typedef std::pair<MoveOnly, MoveOnly> V;
+ typedef std::pair<const MoveOnly, MoveOnly> VC;
+ typedef test_less<MoveOnly> C;
+ typedef other_allocator<VC> A;
+ typedef std::multimap<MoveOnly, MoveOnly, C, A> M;
+ typedef std::move_iterator<V*> I;
+ V a1[] = {V(1, 1), V(1, 2), V(1, 3), V(2, 1), V(2, 2), V(2, 3), V(3, 1), V(3, 2), V(3, 3)};
+ M m1(I(a1), I(a1 + sizeof(a1) / sizeof(a1[0])), C(5), A(7));
+ V a2[] = {V(1, 1), V(1, 2), V(1, 3), V(2, 1), V(2, 2), V(2, 3), V(3, 1), V(3, 2), V(3, 3)};
+ M m2(I(a2), I(a2 + sizeof(a2) / sizeof(a2[0])), C(5), A(7));
+ M m3(std::move(m1), A(5));
+ assert(m3 == m2);
+ assert(m3.get_allocator() == A(5));
+ assert(m3.key_comp() == C(5));
+ LIBCPP_ASSERT(m1.empty());
+ }
+ {
+ typedef Counter<int> T;
+ typedef std::pair<int, T> V;
+ typedef std::pair<const int, T> VC;
+ typedef test_allocator<VC> A;
+ typedef std::less<int> C;
+ typedef std::multimap<const int, T, C, A> M;
+ typedef V* I;
+ Counter_base::gConstructed = 0;
{
- typedef std::pair<MoveOnly, MoveOnly> V;
- typedef std::pair<const MoveOnly, MoveOnly> VC;
- typedef test_less<MoveOnly> C;
- typedef test_allocator<VC> A;
- typedef std::multimap<MoveOnly, MoveOnly, C, A> M;
- typedef std::move_iterator<V*> I;
- V a1[] =
- {
- V(1, 1),
- V(1, 2),
- V(1, 3),
- V(2, 1),
- V(2, 2),
- V(2, 3),
- V(3, 1),
- V(3, 2),
- V(3, 3)
- };
- M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A(7));
- V a2[] =
- {
- V(1, 1),
- V(1, 2),
- V(1, 3),
- V(2, 1),
- V(2, 2),
- V(2, 3),
- V(3, 1),
- V(3, 2),
- V(3, 3)
- };
- M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A(7));
- M m3(std::move(m1), A(7));
- assert(m3 == m2);
- assert(m3.get_allocator() == A(7));
- assert(m3.key_comp() == C(5));
- LIBCPP_ASSERT(m1.empty());
- }
- {
- typedef std::pair<MoveOnly, MoveOnly> V;
- typedef std::pair<const MoveOnly, MoveOnly> VC;
- typedef test_less<MoveOnly> C;
- typedef test_allocator<VC> A;
- typedef std::multimap<MoveOnly, MoveOnly, C, A> M;
- typedef std::move_iterator<V*> I;
- V a1[] =
- {
- V(1, 1),
- V(1, 2),
- V(1, 3),
- V(2, 1),
- V(2, 2),
- V(2, 3),
- V(3, 1),
- V(3, 2),
- V(3, 3)
- };
- M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A(7));
- V a2[] =
- {
- V(1, 1),
- V(1, 2),
- V(1, 3),
- V(2, 1),
- V(2, 2),
- V(2, 3),
- V(3, 1),
- V(3, 2),
- V(3, 3)
- };
- M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A(7));
- M m3(std::move(m1), A(5));
- assert(m3 == m2);
- assert(m3.get_allocator() == A(5));
- assert(m3.key_comp() == C(5));
- LIBCPP_ASSERT(m1.empty());
- }
- {
- typedef std::pair<MoveOnly, MoveOnly> V;
- typedef std::pair<const MoveOnly, MoveOnly> VC;
- typedef test_less<MoveOnly> C;
- typedef other_allocator<VC> A;
- typedef std::multimap<MoveOnly, MoveOnly, C, A> M;
- typedef std::move_iterator<V*> I;
- V a1[] =
- {
- V(1, 1),
- V(1, 2),
- V(1, 3),
- V(2, 1),
- V(2, 2),
- V(2, 3),
- V(3, 1),
- V(3, 2),
- V(3, 3)
- };
- M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A(7));
- V a2[] =
- {
- V(1, 1),
- V(1, 2),
- V(1, 3),
- V(2, 1),
- V(2, 2),
- V(2, 3),
- V(3, 1),
- V(3, 2),
- V(3, 3)
- };
- M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A(7));
- M m3(std::move(m1), A(5));
- assert(m3 == m2);
- assert(m3.get_allocator() == A(5));
- assert(m3.key_comp() == C(5));
- LIBCPP_ASSERT(m1.empty());
- }
- {
- typedef Counter<int> T;
- typedef std::pair<int, T> V;
- typedef std::pair<const int, T> VC;
- typedef test_allocator<VC> A;
- typedef std::less<int> C;
- typedef std::multimap<const int, T, C, A> M;
- typedef V* I;
- Counter_base::gConstructed = 0;
- {
- V a1[] =
- {
- V(1, 1),
- V(1, 2),
- V(1, 3),
- V(2, 1),
- V(2, 2),
- V(2, 3),
- V(3, 1),
- V(3, 2),
- V(3, 3)
- };
- const std::size_t num = sizeof(a1)/sizeof(a1[0]);
- assert(Counter_base::gConstructed == num);
+ V a1[] = {V(1, 1), V(1, 2), V(1, 3), V(2, 1), V(2, 2), V(2, 3), V(3, 1), V(3, 2), V(3, 3)};
+ const std::size_t num = sizeof(a1) / sizeof(a1[0]);
+ assert(Counter_base::gConstructed == num);
- M m1(I(a1), I(a1+num), C(), A());
- assert(Counter_base::gConstructed == 2*num);
+ M m1(I(a1), I(a1 + num), C(), A());
+ assert(Counter_base::gConstructed == 2 * num);
- M m2(m1);
- assert(m2 == m1);
- assert(Counter_base::gConstructed == 3*num);
+ M m2(m1);
+ assert(m2 == m1);
+ assert(Counter_base::gConstructed == 3 * num);
- M m3(std::move(m1), A());
- assert(m3 == m2);
- LIBCPP_ASSERT(m1.empty());
- assert(Counter_base::gConstructed >= (int)(3*num));
- assert(Counter_base::gConstructed <= (int)(4*num));
+ M m3(std::move(m1), A());
+ assert(m3 == m2);
+ LIBCPP_ASSERT(m1.empty());
+ assert(Counter_base::gConstructed >= (int)(3 * num));
+ assert(Counter_base::gConstructed <= (int)(4 * num));
- {
- M m4(std::move(m2), A(5));
- assert(Counter_base::gConstructed >= (int)(3*num));
- assert(Counter_base::gConstructed <= (int)(5*num));
- assert(m4 == m3);
- LIBCPP_ASSERT(m2.empty());
- }
- assert(Counter_base::gConstructed >= (int)(2*num));
- assert(Counter_base::gConstructed <= (int)(4*num));
- }
- assert(Counter_base::gConstructed == 0);
- }
- {
- typedef std::pair<MoveOnly, MoveOnly> V;
- typedef std::pair<const MoveOnly, MoveOnly> VC;
- typedef test_less<MoveOnly> C;
- typedef min_allocator<VC> A;
- typedef std::multimap<MoveOnly, MoveOnly, C, A> M;
- typedef std::move_iterator<V*> I;
- V a1[] =
- {
- V(1, 1),
- V(1, 2),
- V(1, 3),
- V(2, 1),
- V(2, 2),
- V(2, 3),
- V(3, 1),
- V(3, 2),
- V(3, 3)
- };
- M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A());
- V a2[] =
- {
- V(1, 1),
- V(1, 2),
- V(1, 3),
- V(2, 1),
- V(2, 2),
- V(2, 3),
- V(3, 1),
- V(3, 2),
- V(3, 3)
- };
- M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A());
- M m3(std::move(m1), A());
- assert(m3 == m2);
- assert(m3.get_allocator() == A());
- assert(m3.key_comp() == C(5));
- LIBCPP_ASSERT(m1.empty());
- }
- {
- typedef std::pair<MoveOnly, MoveOnly> V;
- typedef std::pair<const MoveOnly, MoveOnly> VC;
- typedef test_less<MoveOnly> C;
- typedef explicit_allocator<VC> A;
- typedef std::multimap<MoveOnly, MoveOnly, C, A> M;
- typedef std::move_iterator<V*> I;
- V a1[] =
- {
- V(1, 1),
- V(1, 2),
- V(1, 3),
- V(2, 1),
- V(2, 2),
- V(2, 3),
- V(3, 1),
- V(3, 2),
- V(3, 3)
- };
- M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A{});
- V a2[] =
- {
- V(1, 1),
- V(1, 2),
- V(1, 3),
- V(2, 1),
- V(2, 2),
- V(2, 3),
- V(3, 1),
- V(3, 2),
- V(3, 3)
- };
- M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A{});
- M m3(std::move(m1), A{});
- assert(m3 == m2);
- assert(m3.get_allocator() == A{});
- assert(m3.key_comp() == C(5));
- LIBCPP_ASSERT(m1.empty());
+ {
+ M m4(std::move(m2), A(5));
+ assert(Counter_base::gConstructed >= (int)(3 * num));
+ assert(Counter_base::gConstructed <= (int)(5 * num));
+ assert(m4 == m3);
+ LIBCPP_ASSERT(m2.empty());
+ }
+ assert(Counter_base::gConstructed >= (int)(2 * num));
+ assert(Counter_base::gConstructed <= (int)(4 * num));
}
+ assert(Counter_base::gConstructed == 0);
+ }
+ {
+ typedef std::pair<MoveOnly, MoveOnly> V;
+ typedef std::pair<const MoveOnly, MoveOnly> VC;
+ typedef test_less<MoveOnly> C;
+ typedef min_allocator<VC> A;
+ typedef std::multimap<MoveOnly, MoveOnly, C, A> M;
+ typedef std::move_iterator<V*> I;
+ V a1[] = {V(1, 1), V(1, 2), V(1, 3), V(2, 1), V(2, 2), V(2, 3), V(3, 1), V(3, 2), V(3, 3)};
+ M m1(I(a1), I(a1 + sizeof(a1) / sizeof(a1[0])), C(5), A());
+ V a2[] = {V(1, 1), V(1, 2), V(1, 3), V(2, 1), V(2, 2), V(2, 3), V(3, 1), V(3, 2), V(3, 3)};
+ M m2(I(a2), I(a2 + sizeof(a2) / sizeof(a2[0])), C(5), A());
+ M m3(std::move(m1), A());
+ assert(m3 == m2);
+ assert(m3.get_allocator() == A());
+ assert(m3.key_comp() == C(5));
+ LIBCPP_ASSERT(m1.empty());
+ }
+ {
+ typedef std::pair<MoveOnly, MoveOnly> V;
+ typedef std::pair<const MoveOnly, MoveOnly> VC;
+ typedef test_less<MoveOnly> C;
+ typedef explicit_allocator<VC> A;
+ typedef std::multimap<MoveOnly, MoveOnly, C, A> M;
+ typedef std::move_iterator<V*> I;
+ V a1[] = {V(1, 1), V(1, 2), V(1, 3), V(2, 1), V(2, 2), V(2, 3), V(3, 1), V(3, 2), V(3, 3)};
+ M m1(I(a1), I(a1 + sizeof(a1) / sizeof(a1[0])), C(5), A{});
+ V a2[] = {V(1, 1), V(1, 2), V(1, 3), V(2, 1), V(2, 2), V(2, 3), V(3, 1), V(3, 2), V(3, 3)};
+ M m2(I(a2), I(a2 + sizeof(a2) / sizeof(a2[0])), C(5), A{});
+ M m3(std::move(m1), A{});
+ assert(m3 == m2);
+ assert(m3.get_allocator() == A{});
+ assert(m3.key_comp() == C(5));
+ LIBCPP_ASSERT(m1.empty());
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.cons/move_assign.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/move_assign.pass.cpp
index f0a54b0d7cc65e2..bbf766eec3e4036 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.cons/move_assign.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.cons/move_assign.pass.cpp
@@ -23,168 +23,79 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::pair<MoveOnly, MoveOnly> V;
- typedef std::pair<const MoveOnly, MoveOnly> VC;
- typedef test_less<MoveOnly> C;
- typedef test_allocator<VC> A;
- typedef std::multimap<MoveOnly, MoveOnly, C, A> M;
- typedef std::move_iterator<V*> I;
- V a1[] =
- {
- V(1, 1),
- V(1, 2),
- V(1, 3),
- V(2, 1),
- V(2, 2),
- V(2, 3),
- V(3, 1),
- V(3, 2),
- V(3, 3)
- };
- M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A(7));
- V a2[] =
- {
- V(1, 1),
- V(1, 2),
- V(1, 3),
- V(2, 1),
- V(2, 2),
- V(2, 3),
- V(3, 1),
- V(3, 2),
- V(3, 3)
- };
- M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A(7));
- M m3(C(3), A(7));
- m3 = std::move(m1);
- assert(m3 == m2);
- assert(m3.get_allocator() == A(7));
- assert(m3.key_comp() == C(5));
- assert(m1.empty());
- }
- {
- typedef std::pair<MoveOnly, MoveOnly> V;
- typedef std::pair<const MoveOnly, MoveOnly> VC;
- typedef test_less<MoveOnly> C;
- typedef test_allocator<VC> A;
- typedef std::multimap<MoveOnly, MoveOnly, C, A> M;
- typedef std::move_iterator<V*> I;
- V a1[] =
- {
- V(1, 1),
- V(1, 2),
- V(1, 3),
- V(2, 1),
- V(2, 2),
- V(2, 3),
- V(3, 1),
- V(3, 2),
- V(3, 3)
- };
- M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A(7));
- V a2[] =
- {
- V(1, 1),
- V(1, 2),
- V(1, 3),
- V(2, 1),
- V(2, 2),
- V(2, 3),
- V(3, 1),
- V(3, 2),
- V(3, 3)
- };
- M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A(7));
- M m3(C(3), A(5));
- m3 = std::move(m1);
- assert(m3 == m2);
- assert(m3.get_allocator() == A(5));
- assert(m3.key_comp() == C(5));
- LIBCPP_ASSERT(m1.empty());
- }
- {
- typedef std::pair<MoveOnly, MoveOnly> V;
- typedef std::pair<const MoveOnly, MoveOnly> VC;
- typedef test_less<MoveOnly> C;
- typedef other_allocator<VC> A;
- typedef std::multimap<MoveOnly, MoveOnly, C, A> M;
- typedef std::move_iterator<V*> I;
- V a1[] =
- {
- V(1, 1),
- V(1, 2),
- V(1, 3),
- V(2, 1),
- V(2, 2),
- V(2, 3),
- V(3, 1),
- V(3, 2),
- V(3, 3)
- };
- M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A(7));
- V a2[] =
- {
- V(1, 1),
- V(1, 2),
- V(1, 3),
- V(2, 1),
- V(2, 2),
- V(2, 3),
- V(3, 1),
- V(3, 2),
- V(3, 3)
- };
- M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A(7));
- M m3(C(3), A(5));
- m3 = std::move(m1);
- assert(m3 == m2);
- assert(m3.get_allocator() == A(7));
- assert(m3.key_comp() == C(5));
- assert(m1.empty());
- }
- {
- typedef std::pair<MoveOnly, MoveOnly> V;
- typedef std::pair<const MoveOnly, MoveOnly> VC;
- typedef test_less<MoveOnly> C;
- typedef min_allocator<VC> A;
- typedef std::multimap<MoveOnly, MoveOnly, C, A> M;
- typedef std::move_iterator<V*> I;
- V a1[] =
- {
- V(1, 1),
- V(1, 2),
- V(1, 3),
- V(2, 1),
- V(2, 2),
- V(2, 3),
- V(3, 1),
- V(3, 2),
- V(3, 3)
- };
- M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A());
- V a2[] =
- {
- V(1, 1),
- V(1, 2),
- V(1, 3),
- V(2, 1),
- V(2, 2),
- V(2, 3),
- V(3, 1),
- V(3, 2),
- V(3, 3)
- };
- M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A());
- M m3(C(3), A());
- m3 = std::move(m1);
- assert(m3 == m2);
- assert(m3.get_allocator() == A());
- assert(m3.key_comp() == C(5));
- assert(m1.empty());
- }
+int main(int, char**) {
+ {
+ typedef std::pair<MoveOnly, MoveOnly> V;
+ typedef std::pair<const MoveOnly, MoveOnly> VC;
+ typedef test_less<MoveOnly> C;
+ typedef test_allocator<VC> A;
+ typedef std::multimap<MoveOnly, MoveOnly, C, A> M;
+ typedef std::move_iterator<V*> I;
+ V a1[] = {V(1, 1), V(1, 2), V(1, 3), V(2, 1), V(2, 2), V(2, 3), V(3, 1), V(3, 2), V(3, 3)};
+ M m1(I(a1), I(a1 + sizeof(a1) / sizeof(a1[0])), C(5), A(7));
+ V a2[] = {V(1, 1), V(1, 2), V(1, 3), V(2, 1), V(2, 2), V(2, 3), V(3, 1), V(3, 2), V(3, 3)};
+ M m2(I(a2), I(a2 + sizeof(a2) / sizeof(a2[0])), C(5), A(7));
+ M m3(C(3), A(7));
+ m3 = std::move(m1);
+ assert(m3 == m2);
+ assert(m3.get_allocator() == A(7));
+ assert(m3.key_comp() == C(5));
+ assert(m1.empty());
+ }
+ {
+ typedef std::pair<MoveOnly, MoveOnly> V;
+ typedef std::pair<const MoveOnly, MoveOnly> VC;
+ typedef test_less<MoveOnly> C;
+ typedef test_allocator<VC> A;
+ typedef std::multimap<MoveOnly, MoveOnly, C, A> M;
+ typedef std::move_iterator<V*> I;
+ V a1[] = {V(1, 1), V(1, 2), V(1, 3), V(2, 1), V(2, 2), V(2, 3), V(3, 1), V(3, 2), V(3, 3)};
+ M m1(I(a1), I(a1 + sizeof(a1) / sizeof(a1[0])), C(5), A(7));
+ V a2[] = {V(1, 1), V(1, 2), V(1, 3), V(2, 1), V(2, 2), V(2, 3), V(3, 1), V(3, 2), V(3, 3)};
+ M m2(I(a2), I(a2 + sizeof(a2) / sizeof(a2[0])), C(5), A(7));
+ M m3(C(3), A(5));
+ m3 = std::move(m1);
+ assert(m3 == m2);
+ assert(m3.get_allocator() == A(5));
+ assert(m3.key_comp() == C(5));
+ LIBCPP_ASSERT(m1.empty());
+ }
+ {
+ typedef std::pair<MoveOnly, MoveOnly> V;
+ typedef std::pair<const MoveOnly, MoveOnly> VC;
+ typedef test_less<MoveOnly> C;
+ typedef other_allocator<VC> A;
+ typedef std::multimap<MoveOnly, MoveOnly, C, A> M;
+ typedef std::move_iterator<V*> I;
+ V a1[] = {V(1, 1), V(1, 2), V(1, 3), V(2, 1), V(2, 2), V(2, 3), V(3, 1), V(3, 2), V(3, 3)};
+ M m1(I(a1), I(a1 + sizeof(a1) / sizeof(a1[0])), C(5), A(7));
+ V a2[] = {V(1, 1), V(1, 2), V(1, 3), V(2, 1), V(2, 2), V(2, 3), V(3, 1), V(3, 2), V(3, 3)};
+ M m2(I(a2), I(a2 + sizeof(a2) / sizeof(a2[0])), C(5), A(7));
+ M m3(C(3), A(5));
+ m3 = std::move(m1);
+ assert(m3 == m2);
+ assert(m3.get_allocator() == A(7));
+ assert(m3.key_comp() == C(5));
+ assert(m1.empty());
+ }
+ {
+ typedef std::pair<MoveOnly, MoveOnly> V;
+ typedef std::pair<const MoveOnly, MoveOnly> VC;
+ typedef test_less<MoveOnly> C;
+ typedef min_allocator<VC> A;
+ typedef std::multimap<MoveOnly, MoveOnly, C, A> M;
+ typedef std::move_iterator<V*> I;
+ V a1[] = {V(1, 1), V(1, 2), V(1, 3), V(2, 1), V(2, 2), V(2, 3), V(3, 1), V(3, 2), V(3, 3)};
+ M m1(I(a1), I(a1 + sizeof(a1) / sizeof(a1[0])), C(5), A());
+ V a2[] = {V(1, 1), V(1, 2), V(1, 3), V(2, 1), V(2, 2), V(2, 3), V(3, 1), V(3, 2), V(3, 3)};
+ M m2(I(a2), I(a2 + sizeof(a2) / sizeof(a2[0])), C(5), A());
+ M m3(C(3), A());
+ m3 = std::move(m1);
+ assert(m3 == m2);
+ assert(m3.get_allocator() == A());
+ assert(m3.key_comp() == C(5));
+ assert(m1.empty());
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.cons/move_noexcept.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/move_noexcept.pass.cpp
index e31348e67ca2f4f..2af0324575d9c13 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.cons/move_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.cons/move_noexcept.pass.cpp
@@ -24,34 +24,32 @@
#include "test_allocator.h"
template <class T>
-struct some_comp
-{
- typedef T value_type;
- some_comp(const some_comp&);
- bool operator()(const T&, const T&) const { return false; }
+struct some_comp {
+ typedef T value_type;
+ some_comp(const some_comp&);
+ bool operator()(const T&, const T&) const { return false; }
};
-int main(int, char**)
-{
+int main(int, char**) {
#if defined(_LIBCPP_VERSION)
- typedef std::pair<const MoveOnly, MoveOnly> V;
- {
- typedef std::multimap<MoveOnly, MoveOnly> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
- }
- {
- typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<V>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
- }
- {
- typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<V>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
- }
+ typedef std::pair<const MoveOnly, MoveOnly> V;
+ {
+ typedef std::multimap<MoveOnly, MoveOnly> C;
+ static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ }
+ {
+ typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<V>> C;
+ static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ }
+ {
+ typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<V>> C;
+ static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ }
#endif // _LIBCPP_VERSION
- {
- typedef std::multimap<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
- static_assert(!std::is_nothrow_move_constructible<C>::value, "");
- }
+ {
+ typedef std::multimap<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
+ static_assert(!std::is_nothrow_move_constructible<C>::value, "");
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.erasure/erase_if.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.erasure/erase_if.pass.cpp
index 89ab932f47b00c8..4391bb36f741ff9 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.erasure/erase_if.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.erasure/erase_if.pass.cpp
@@ -21,12 +21,11 @@
using Init = std::initializer_list<int>;
template <typename M>
-M make (Init vals)
-{
- M ret;
- for (int v : vals)
- ret.emplace(static_cast<typename M::key_type>(v), static_cast<typename M::mapped_type>(v + 10));
- return ret;
+M make(Init vals) {
+ M ret;
+ for (int v : vals)
+ ret.emplace(static_cast<typename M::key_type>(v), static_cast<typename M::mapped_type>(v + 10));
+ return ret;
}
template <typename M, typename Pred>
@@ -38,52 +37,50 @@ void test0(Init vals, Pred p, Init expected, std::size_t expected_erased_count)
}
template <typename S>
-void test()
-{
- auto is1 = [](auto v) { return v.first == 1;};
- auto is2 = [](auto v) { return v.first == 2;};
- auto is3 = [](auto v) { return v.first == 3;};
- auto is4 = [](auto v) { return v.first == 4;};
- auto True = [](auto) { return true; };
- auto False = [](auto) { return false; };
-
- test0<S>({}, is1, {}, 0);
-
- test0<S>({1}, is1, {}, 1);
- test0<S>({1}, is2, {1}, 0);
-
- test0<S>({1, 2}, is1, {2}, 1);
- test0<S>({1, 2}, is2, {1}, 1);
- test0<S>({1, 2}, is3, {1, 2}, 0);
- test0<S>({1, 1}, is1, {}, 2);
- test0<S>({1, 1}, is3, {1, 1}, 0);
-
- test0<S>({1, 2, 3}, is1, {2, 3}, 1);
- test0<S>({1, 2, 3}, is2, {1, 3}, 1);
- test0<S>({1, 2, 3}, is3, {1, 2}, 1);
- test0<S>({1, 2, 3}, is4, {1, 2, 3}, 0);
-
- test0<S>({1, 1, 1}, is1, {}, 3);
- test0<S>({1, 1, 1}, is2, {1, 1, 1}, 0);
- test0<S>({1, 1, 2}, is1, {2}, 2);
- test0<S>({1, 1, 2}, is2, {1, 1}, 1);
- test0<S>({1, 1, 2}, is3, {1, 1, 2}, 0);
- test0<S>({1, 2, 2}, is1, {2, 2}, 1);
- test0<S>({1, 2, 2}, is2, {1}, 2);
- test0<S>({1, 2, 2}, is3, {1, 2, 2}, 0);
-
- test0<S>({1, 2, 3}, True, {}, 3);
- test0<S>({1, 2, 3}, False, {1, 2, 3}, 0);
+void test() {
+ auto is1 = [](auto v) { return v.first == 1; };
+ auto is2 = [](auto v) { return v.first == 2; };
+ auto is3 = [](auto v) { return v.first == 3; };
+ auto is4 = [](auto v) { return v.first == 4; };
+ auto True = [](auto) { return true; };
+ auto False = [](auto) { return false; };
+
+ test0<S>({}, is1, {}, 0);
+
+ test0<S>({1}, is1, {}, 1);
+ test0<S>({1}, is2, {1}, 0);
+
+ test0<S>({1, 2}, is1, {2}, 1);
+ test0<S>({1, 2}, is2, {1}, 1);
+ test0<S>({1, 2}, is3, {1, 2}, 0);
+ test0<S>({1, 1}, is1, {}, 2);
+ test0<S>({1, 1}, is3, {1, 1}, 0);
+
+ test0<S>({1, 2, 3}, is1, {2, 3}, 1);
+ test0<S>({1, 2, 3}, is2, {1, 3}, 1);
+ test0<S>({1, 2, 3}, is3, {1, 2}, 1);
+ test0<S>({1, 2, 3}, is4, {1, 2, 3}, 0);
+
+ test0<S>({1, 1, 1}, is1, {}, 3);
+ test0<S>({1, 1, 1}, is2, {1, 1, 1}, 0);
+ test0<S>({1, 1, 2}, is1, {2}, 2);
+ test0<S>({1, 1, 2}, is2, {1, 1}, 1);
+ test0<S>({1, 1, 2}, is3, {1, 1, 2}, 0);
+ test0<S>({1, 2, 2}, is1, {2, 2}, 1);
+ test0<S>({1, 2, 2}, is2, {1}, 2);
+ test0<S>({1, 2, 2}, is3, {1, 2, 2}, 0);
+
+ test0<S>({1, 2, 3}, True, {}, 3);
+ test0<S>({1, 2, 3}, False, {1, 2, 3}, 0);
}
-int main(int, char**)
-{
- test<std::multimap<int, int>>();
- test<std::multimap<int, int, std::less<int>, min_allocator<std::pair<const int, int>>>> ();
- test<std::multimap<int, int, std::less<int>, test_allocator<std::pair<const int, int>>>> ();
+int main(int, char**) {
+ test<std::multimap<int, int>>();
+ test<std::multimap<int, int, std::less<int>, min_allocator<std::pair<const int, int>>>>();
+ test<std::multimap<int, int, std::less<int>, test_allocator<std::pair<const int, int>>>>();
- test<std::multimap<long, short>>();
- test<std::multimap<short, double>>();
+ test<std::multimap<long, short>>();
+ test<std::multimap<short, double>>();
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/clear.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/clear.pass.cpp
index d05a13b5f191e34..08dfcea99cf5b12 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/clear.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/clear.pass.cpp
@@ -18,49 +18,46 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::multimap<int, double> M;
- typedef std::pair<int, double> P;
- P ar[] =
- {
- P(1, 1.5),
- P(2, 2.5),
- P(3, 3.5),
- P(4, 4.5),
- P(5, 5.5),
- P(6, 6.5),
- P(7, 7.5),
- P(8, 8.5),
- };
- M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
- assert(m.size() == 8);
- ASSERT_NOEXCEPT(m.clear());
- m.clear();
- assert(m.size() == 0);
- }
+int main(int, char**) {
+ {
+ typedef std::multimap<int, double> M;
+ typedef std::pair<int, double> P;
+ P ar[] = {
+ P(1, 1.5),
+ P(2, 2.5),
+ P(3, 3.5),
+ P(4, 4.5),
+ P(5, 5.5),
+ P(6, 6.5),
+ P(7, 7.5),
+ P(8, 8.5),
+ };
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(m.size() == 8);
+ ASSERT_NOEXCEPT(m.clear());
+ m.clear();
+ assert(m.size() == 0);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
- typedef std::pair<int, double> P;
- P ar[] =
- {
- P(1, 1.5),
- P(2, 2.5),
- P(3, 3.5),
- P(4, 4.5),
- P(5, 5.5),
- P(6, 6.5),
- P(7, 7.5),
- P(8, 8.5),
- };
- M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
- assert(m.size() == 8);
- ASSERT_NOEXCEPT(m.clear());
- m.clear();
- assert(m.size() == 0);
- }
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef std::pair<int, double> P;
+ P ar[] = {
+ P(1, 1.5),
+ P(2, 2.5),
+ P(3, 3.5),
+ P(4, 4.5),
+ P(5, 5.5),
+ P(6, 6.5),
+ P(7, 7.5),
+ P(8, 8.5),
+ };
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(m.size() == 8);
+ ASSERT_NOEXCEPT(m.clear());
+ m.clear();
+ assert(m.size() == 0);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/emplace.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/emplace.pass.cpp
index 03c1b0441baa4a2..9a7526c16adf7b7 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/emplace.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/emplace.pass.cpp
@@ -23,128 +23,117 @@
#include "DefaultOnly.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::multimap<int, DefaultOnly> M;
- typedef M::iterator R;
- M m;
- assert(DefaultOnly::count == 0);
- R r = m.emplace();
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(m.begin()->first == 0);
- assert(m.begin()->second == DefaultOnly());
- assert(DefaultOnly::count == 1);
- r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1),
- std::forward_as_tuple());
- assert(r == std::next(m.begin()));
- assert(m.size() == 2);
- assert(std::next(m.begin())->first == 1);
- assert(std::next(m.begin())->second == DefaultOnly());
- assert(DefaultOnly::count == 2);
- r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1),
- std::forward_as_tuple());
- assert(r == std::next(m.begin(), 2));
- assert(m.size() == 3);
- assert(std::next(m.begin(), 2)->first == 1);
- assert(std::next(m.begin(), 2)->second == DefaultOnly());
- assert(DefaultOnly::count == 3);
- }
+int main(int, char**) {
+ {
+ typedef std::multimap<int, DefaultOnly> M;
+ typedef M::iterator R;
+ M m;
assert(DefaultOnly::count == 0);
- {
- typedef std::multimap<int, Emplaceable> M;
- typedef M::iterator R;
- M m;
- R r = m.emplace(std::piecewise_construct, std::forward_as_tuple(2),
- std::forward_as_tuple());
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(m.begin()->first == 2);
- assert(m.begin()->second == Emplaceable());
- r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1),
- std::forward_as_tuple(2, 3.5));
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(m.begin()->first == 1);
- assert(m.begin()->second == Emplaceable(2, 3.5));
- r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1),
- std::forward_as_tuple(3, 3.5));
- assert(r == std::next(m.begin()));
- assert(m.size() == 3);
- assert(r->first == 1);
- assert(r->second == Emplaceable(3, 3.5));
- }
- {
- typedef std::multimap<int, double> M;
- typedef M::iterator R;
- M m;
- R r = m.emplace(M::value_type(2, 3.5));
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(m.begin()->first == 2);
- assert(m.begin()->second == 3.5);
- }
- {
- typedef std::multimap<int, DefaultOnly, std::less<int>, min_allocator<std::pair<const int, DefaultOnly>>> M;
- typedef M::iterator R;
- M m;
- assert(DefaultOnly::count == 0);
- R r = m.emplace();
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(m.begin()->first == 0);
- assert(m.begin()->second == DefaultOnly());
- assert(DefaultOnly::count == 1);
- r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1),
- std::forward_as_tuple());
- assert(r == std::next(m.begin()));
- assert(m.size() == 2);
- assert(std::next(m.begin())->first == 1);
- assert(std::next(m.begin())->second == DefaultOnly());
- assert(DefaultOnly::count == 2);
- r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1),
- std::forward_as_tuple());
- assert(r == std::next(m.begin(), 2));
- assert(m.size() == 3);
- assert(std::next(m.begin(), 2)->first == 1);
- assert(std::next(m.begin(), 2)->second == DefaultOnly());
- assert(DefaultOnly::count == 3);
- }
+ R r = m.emplace();
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 0);
+ assert(m.begin()->second == DefaultOnly());
+ assert(DefaultOnly::count == 1);
+ r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple());
+ assert(r == std::next(m.begin()));
+ assert(m.size() == 2);
+ assert(std::next(m.begin())->first == 1);
+ assert(std::next(m.begin())->second == DefaultOnly());
+ assert(DefaultOnly::count == 2);
+ r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple());
+ assert(r == std::next(m.begin(), 2));
+ assert(m.size() == 3);
+ assert(std::next(m.begin(), 2)->first == 1);
+ assert(std::next(m.begin(), 2)->second == DefaultOnly());
+ assert(DefaultOnly::count == 3);
+ }
+ assert(DefaultOnly::count == 0);
+ {
+ typedef std::multimap<int, Emplaceable> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.emplace(std::piecewise_construct, std::forward_as_tuple(2), std::forward_as_tuple());
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == Emplaceable());
+ r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple(2, 3.5));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == Emplaceable(2, 3.5));
+ r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple(3, 3.5));
+ assert(r == std::next(m.begin()));
+ assert(m.size() == 3);
+ assert(r->first == 1);
+ assert(r->second == Emplaceable(3, 3.5));
+ }
+ {
+ typedef std::multimap<int, double> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.emplace(M::value_type(2, 3.5));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 3.5);
+ }
+ {
+ typedef std::multimap<int, DefaultOnly, std::less<int>, min_allocator<std::pair<const int, DefaultOnly>>> M;
+ typedef M::iterator R;
+ M m;
assert(DefaultOnly::count == 0);
- {
- typedef std::multimap<int, Emplaceable, std::less<int>, min_allocator<std::pair<const int, Emplaceable>>> M;
- typedef M::iterator R;
- M m;
- R r = m.emplace(std::piecewise_construct, std::forward_as_tuple(2),
- std::forward_as_tuple());
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(m.begin()->first == 2);
- assert(m.begin()->second == Emplaceable());
- r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1),
- std::forward_as_tuple(2, 3.5));
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(m.begin()->first == 1);
- assert(m.begin()->second == Emplaceable(2, 3.5));
- r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1),
- std::forward_as_tuple(3, 3.5));
- assert(r == std::next(m.begin()));
- assert(m.size() == 3);
- assert(r->first == 1);
- assert(r->second == Emplaceable(3, 3.5));
- }
- {
- typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
- typedef M::iterator R;
- M m;
- R r = m.emplace(M::value_type(2, 3.5));
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(m.begin()->first == 2);
- assert(m.begin()->second == 3.5);
- }
+ R r = m.emplace();
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 0);
+ assert(m.begin()->second == DefaultOnly());
+ assert(DefaultOnly::count == 1);
+ r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple());
+ assert(r == std::next(m.begin()));
+ assert(m.size() == 2);
+ assert(std::next(m.begin())->first == 1);
+ assert(std::next(m.begin())->second == DefaultOnly());
+ assert(DefaultOnly::count == 2);
+ r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple());
+ assert(r == std::next(m.begin(), 2));
+ assert(m.size() == 3);
+ assert(std::next(m.begin(), 2)->first == 1);
+ assert(std::next(m.begin(), 2)->second == DefaultOnly());
+ assert(DefaultOnly::count == 3);
+ }
+ assert(DefaultOnly::count == 0);
+ {
+ typedef std::multimap<int, Emplaceable, std::less<int>, min_allocator<std::pair<const int, Emplaceable>>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.emplace(std::piecewise_construct, std::forward_as_tuple(2), std::forward_as_tuple());
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == Emplaceable());
+ r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple(2, 3.5));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == Emplaceable(2, 3.5));
+ r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple(3, 3.5));
+ assert(r == std::next(m.begin()));
+ assert(m.size() == 3);
+ assert(r->first == 1);
+ assert(r->second == Emplaceable(3, 3.5));
+ }
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.emplace(M::value_type(2, 3.5));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 3.5);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/emplace_hint.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/emplace_hint.pass.cpp
index ac8aae1444e1cee..8b9081082bb23b1 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/emplace_hint.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/emplace_hint.pass.cpp
@@ -23,138 +23,117 @@
#include "DefaultOnly.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::multimap<int, DefaultOnly> M;
- typedef M::iterator R;
- M m;
- assert(DefaultOnly::count == 0);
- R r = m.emplace_hint(m.cend());
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(m.begin()->first == 0);
- assert(m.begin()->second == DefaultOnly());
- assert(DefaultOnly::count == 1);
- r = m.emplace_hint(m.cend(), std::piecewise_construct,
- std::forward_as_tuple(1),
- std::forward_as_tuple());
- assert(r == std::next(m.begin()));
- assert(m.size() == 2);
- assert(std::next(m.begin())->first == 1);
- assert(std::next(m.begin())->second == DefaultOnly());
- assert(DefaultOnly::count == 2);
- r = m.emplace_hint(m.cend(), std::piecewise_construct,
- std::forward_as_tuple(1),
- std::forward_as_tuple());
- assert(r == std::next(m.begin(), 2));
- assert(m.size() == 3);
- assert(std::next(m.begin(), 2)->first == 1);
- assert(std::next(m.begin(), 2)->second == DefaultOnly());
- assert(DefaultOnly::count == 3);
- }
+int main(int, char**) {
+ {
+ typedef std::multimap<int, DefaultOnly> M;
+ typedef M::iterator R;
+ M m;
assert(DefaultOnly::count == 0);
- {
- typedef std::multimap<int, Emplaceable> M;
- typedef M::iterator R;
- M m;
- R r = m.emplace_hint(m.cend(), std::piecewise_construct,
- std::forward_as_tuple(2),
- std::forward_as_tuple());
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(m.begin()->first == 2);
- assert(m.begin()->second == Emplaceable());
- r = m.emplace_hint(m.cbegin(), std::piecewise_construct,
- std::forward_as_tuple(1),
- std::forward_as_tuple(2, 3.5));
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(m.begin()->first == 1);
- assert(m.begin()->second == Emplaceable(2, 3.5));
- r = m.emplace_hint(m.cbegin(), std::piecewise_construct,
- std::forward_as_tuple(1),
- std::forward_as_tuple(3, 3.5));
- assert(r == m.begin());
- assert(m.size() == 3);
- assert(r->first == 1);
- assert(r->second == Emplaceable(3, 3.5));
- }
- {
- typedef std::multimap<int, double> M;
- typedef M::iterator R;
- M m;
- R r = m.emplace_hint(m.cend(), M::value_type(2, 3.5));
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(m.begin()->first == 2);
- assert(m.begin()->second == 3.5);
- }
- {
- typedef std::multimap<int, DefaultOnly, std::less<int>, min_allocator<std::pair<const int, DefaultOnly>>> M;
- typedef M::iterator R;
- M m;
- assert(DefaultOnly::count == 0);
- R r = m.emplace_hint(m.cend());
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(m.begin()->first == 0);
- assert(m.begin()->second == DefaultOnly());
- assert(DefaultOnly::count == 1);
- r = m.emplace_hint(m.cend(), std::piecewise_construct,
- std::forward_as_tuple(1),
- std::forward_as_tuple());
- assert(r == std::next(m.begin()));
- assert(m.size() == 2);
- assert(std::next(m.begin())->first == 1);
- assert(std::next(m.begin())->second == DefaultOnly());
- assert(DefaultOnly::count == 2);
- r = m.emplace_hint(m.cend(), std::piecewise_construct,
- std::forward_as_tuple(1),
- std::forward_as_tuple());
- assert(r == std::next(m.begin(), 2));
- assert(m.size() == 3);
- assert(std::next(m.begin(), 2)->first == 1);
- assert(std::next(m.begin(), 2)->second == DefaultOnly());
- assert(DefaultOnly::count == 3);
- }
+ R r = m.emplace_hint(m.cend());
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 0);
+ assert(m.begin()->second == DefaultOnly());
+ assert(DefaultOnly::count == 1);
+ r = m.emplace_hint(m.cend(), std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple());
+ assert(r == std::next(m.begin()));
+ assert(m.size() == 2);
+ assert(std::next(m.begin())->first == 1);
+ assert(std::next(m.begin())->second == DefaultOnly());
+ assert(DefaultOnly::count == 2);
+ r = m.emplace_hint(m.cend(), std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple());
+ assert(r == std::next(m.begin(), 2));
+ assert(m.size() == 3);
+ assert(std::next(m.begin(), 2)->first == 1);
+ assert(std::next(m.begin(), 2)->second == DefaultOnly());
+ assert(DefaultOnly::count == 3);
+ }
+ assert(DefaultOnly::count == 0);
+ {
+ typedef std::multimap<int, Emplaceable> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.emplace_hint(m.cend(), std::piecewise_construct, std::forward_as_tuple(2), std::forward_as_tuple());
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == Emplaceable());
+ r = m.emplace_hint(m.cbegin(), std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple(2, 3.5));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == Emplaceable(2, 3.5));
+ r = m.emplace_hint(m.cbegin(), std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple(3, 3.5));
+ assert(r == m.begin());
+ assert(m.size() == 3);
+ assert(r->first == 1);
+ assert(r->second == Emplaceable(3, 3.5));
+ }
+ {
+ typedef std::multimap<int, double> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.emplace_hint(m.cend(), M::value_type(2, 3.5));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 3.5);
+ }
+ {
+ typedef std::multimap<int, DefaultOnly, std::less<int>, min_allocator<std::pair<const int, DefaultOnly>>> M;
+ typedef M::iterator R;
+ M m;
assert(DefaultOnly::count == 0);
- {
- typedef std::multimap<int, Emplaceable, std::less<int>, min_allocator<std::pair<const int, Emplaceable>>> M;
- typedef M::iterator R;
- M m;
- R r = m.emplace_hint(m.cend(), std::piecewise_construct,
- std::forward_as_tuple(2),
- std::forward_as_tuple());
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(m.begin()->first == 2);
- assert(m.begin()->second == Emplaceable());
- r = m.emplace_hint(m.cbegin(), std::piecewise_construct,
- std::forward_as_tuple(1),
- std::forward_as_tuple(2, 3.5));
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(m.begin()->first == 1);
- assert(m.begin()->second == Emplaceable(2, 3.5));
- r = m.emplace_hint(m.cbegin(), std::piecewise_construct,
- std::forward_as_tuple(1),
- std::forward_as_tuple(3, 3.5));
- assert(r == m.begin());
- assert(m.size() == 3);
- assert(r->first == 1);
- assert(r->second == Emplaceable(3, 3.5));
- }
- {
- typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
- typedef M::iterator R;
- M m;
- R r = m.emplace_hint(m.cend(), M::value_type(2, 3.5));
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(m.begin()->first == 2);
- assert(m.begin()->second == 3.5);
- }
+ R r = m.emplace_hint(m.cend());
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 0);
+ assert(m.begin()->second == DefaultOnly());
+ assert(DefaultOnly::count == 1);
+ r = m.emplace_hint(m.cend(), std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple());
+ assert(r == std::next(m.begin()));
+ assert(m.size() == 2);
+ assert(std::next(m.begin())->first == 1);
+ assert(std::next(m.begin())->second == DefaultOnly());
+ assert(DefaultOnly::count == 2);
+ r = m.emplace_hint(m.cend(), std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple());
+ assert(r == std::next(m.begin(), 2));
+ assert(m.size() == 3);
+ assert(std::next(m.begin(), 2)->first == 1);
+ assert(std::next(m.begin(), 2)->second == DefaultOnly());
+ assert(DefaultOnly::count == 3);
+ }
+ assert(DefaultOnly::count == 0);
+ {
+ typedef std::multimap<int, Emplaceable, std::less<int>, min_allocator<std::pair<const int, Emplaceable>>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.emplace_hint(m.cend(), std::piecewise_construct, std::forward_as_tuple(2), std::forward_as_tuple());
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == Emplaceable());
+ r = m.emplace_hint(m.cbegin(), std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple(2, 3.5));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == Emplaceable(2, 3.5));
+ r = m.emplace_hint(m.cbegin(), std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple(3, 3.5));
+ assert(r == m.begin());
+ assert(m.size() == 3);
+ assert(r->first == 1);
+ assert(r->second == Emplaceable(3, 3.5));
+ }
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.emplace_hint(m.cend(), M::value_type(2, 3.5));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 3.5);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/erase_iter.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/erase_iter.pass.cpp
index d958f617d11321e..67e957e9e3a722b 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/erase_iter.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/erase_iter.pass.cpp
@@ -18,285 +18,281 @@
#include "test_macros.h"
#include "min_allocator.h"
-struct TemplateConstructor
-{
- template<typename T>
- TemplateConstructor (const T&) {}
+struct TemplateConstructor {
+ template <typename T>
+ TemplateConstructor(const T&) {}
};
bool operator<(const TemplateConstructor&, const TemplateConstructor&) { return false; }
-int main(int, char**)
-{
- {
- typedef std::multimap<int, double> M;
- typedef std::pair<int, double> P;
- typedef M::iterator I;
- P ar[] =
- {
- P(1, 1),
- P(1, 1.5),
- P(1, 2),
- P(2, 1),
- P(2, 1.5),
- P(2, 2),
- P(3, 1),
- P(3, 1.5),
- P(3, 2),
- };
- M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
- assert(m.size() == 9);
- I i = m.erase(std::next(m.cbegin(), 3));
- assert(m.size() == 8);
- assert(i == std::next(m.begin(), 3));
- assert(m.begin()->first == 1);
- assert(m.begin()->second == 1);
- assert(std::next(m.begin())->first == 1);
- assert(std::next(m.begin())->second == 1.5);
- assert(std::next(m.begin(), 2)->first == 1);
- assert(std::next(m.begin(), 2)->second == 2);
- assert(std::next(m.begin(), 3)->first == 2);
- assert(std::next(m.begin(), 3)->second == 1.5);
- assert(std::next(m.begin(), 4)->first == 2);
- assert(std::next(m.begin(), 4)->second == 2);
- assert(std::next(m.begin(), 5)->first == 3);
- assert(std::next(m.begin(), 5)->second == 1);
- assert(std::next(m.begin(), 6)->first == 3);
- assert(std::next(m.begin(), 6)->second == 1.5);
- assert(std::next(m.begin(), 7)->first == 3);
- assert(std::next(m.begin(), 7)->second == 2);
+int main(int, char**) {
+ {
+ typedef std::multimap<int, double> M;
+ typedef std::pair<int, double> P;
+ typedef M::iterator I;
+ P ar[] = {
+ P(1, 1),
+ P(1, 1.5),
+ P(1, 2),
+ P(2, 1),
+ P(2, 1.5),
+ P(2, 2),
+ P(3, 1),
+ P(3, 1.5),
+ P(3, 2),
+ };
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(m.size() == 9);
+ I i = m.erase(std::next(m.cbegin(), 3));
+ assert(m.size() == 8);
+ assert(i == std::next(m.begin(), 3));
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == 1);
+ assert(std::next(m.begin())->first == 1);
+ assert(std::next(m.begin())->second == 1.5);
+ assert(std::next(m.begin(), 2)->first == 1);
+ assert(std::next(m.begin(), 2)->second == 2);
+ assert(std::next(m.begin(), 3)->first == 2);
+ assert(std::next(m.begin(), 3)->second == 1.5);
+ assert(std::next(m.begin(), 4)->first == 2);
+ assert(std::next(m.begin(), 4)->second == 2);
+ assert(std::next(m.begin(), 5)->first == 3);
+ assert(std::next(m.begin(), 5)->second == 1);
+ assert(std::next(m.begin(), 6)->first == 3);
+ assert(std::next(m.begin(), 6)->second == 1.5);
+ assert(std::next(m.begin(), 7)->first == 3);
+ assert(std::next(m.begin(), 7)->second == 2);
- i = m.erase(std::next(m.cbegin(), 0));
- assert(m.size() == 7);
- assert(i == m.begin());
- assert(std::next(m.begin(), 0)->first == 1);
- assert(std::next(m.begin(), 0)->second == 1.5);
- assert(std::next(m.begin(), 1)->first == 1);
- assert(std::next(m.begin(), 1)->second == 2);
- assert(std::next(m.begin(), 2)->first == 2);
- assert(std::next(m.begin(), 2)->second == 1.5);
- assert(std::next(m.begin(), 3)->first == 2);
- assert(std::next(m.begin(), 3)->second == 2);
- assert(std::next(m.begin(), 4)->first == 3);
- assert(std::next(m.begin(), 4)->second == 1);
- assert(std::next(m.begin(), 5)->first == 3);
- assert(std::next(m.begin(), 5)->second == 1.5);
- assert(std::next(m.begin(), 6)->first == 3);
- assert(std::next(m.begin(), 6)->second == 2);
+ i = m.erase(std::next(m.cbegin(), 0));
+ assert(m.size() == 7);
+ assert(i == m.begin());
+ assert(std::next(m.begin(), 0)->first == 1);
+ assert(std::next(m.begin(), 0)->second == 1.5);
+ assert(std::next(m.begin(), 1)->first == 1);
+ assert(std::next(m.begin(), 1)->second == 2);
+ assert(std::next(m.begin(), 2)->first == 2);
+ assert(std::next(m.begin(), 2)->second == 1.5);
+ assert(std::next(m.begin(), 3)->first == 2);
+ assert(std::next(m.begin(), 3)->second == 2);
+ assert(std::next(m.begin(), 4)->first == 3);
+ assert(std::next(m.begin(), 4)->second == 1);
+ assert(std::next(m.begin(), 5)->first == 3);
+ assert(std::next(m.begin(), 5)->second == 1.5);
+ assert(std::next(m.begin(), 6)->first == 3);
+ assert(std::next(m.begin(), 6)->second == 2);
- i = m.erase(std::next(m.cbegin(), 5));
- assert(m.size() == 6);
- assert(i == std::prev(m.end()));
- assert(std::next(m.begin(), 0)->first == 1);
- assert(std::next(m.begin(), 0)->second == 1.5);
- assert(std::next(m.begin(), 1)->first == 1);
- assert(std::next(m.begin(), 1)->second == 2);
- assert(std::next(m.begin(), 2)->first == 2);
- assert(std::next(m.begin(), 2)->second == 1.5);
- assert(std::next(m.begin(), 3)->first == 2);
- assert(std::next(m.begin(), 3)->second == 2);
- assert(std::next(m.begin(), 4)->first == 3);
- assert(std::next(m.begin(), 4)->second == 1);
- assert(std::next(m.begin(), 5)->first == 3);
- assert(std::next(m.begin(), 5)->second == 2);
+ i = m.erase(std::next(m.cbegin(), 5));
+ assert(m.size() == 6);
+ assert(i == std::prev(m.end()));
+ assert(std::next(m.begin(), 0)->first == 1);
+ assert(std::next(m.begin(), 0)->second == 1.5);
+ assert(std::next(m.begin(), 1)->first == 1);
+ assert(std::next(m.begin(), 1)->second == 2);
+ assert(std::next(m.begin(), 2)->first == 2);
+ assert(std::next(m.begin(), 2)->second == 1.5);
+ assert(std::next(m.begin(), 3)->first == 2);
+ assert(std::next(m.begin(), 3)->second == 2);
+ assert(std::next(m.begin(), 4)->first == 3);
+ assert(std::next(m.begin(), 4)->second == 1);
+ assert(std::next(m.begin(), 5)->first == 3);
+ assert(std::next(m.begin(), 5)->second == 2);
- i = m.erase(std::next(m.cbegin(), 1));
- assert(m.size() == 5);
- assert(i == std::next(m.begin()));
- assert(std::next(m.begin(), 0)->first == 1);
- assert(std::next(m.begin(), 0)->second == 1.5);
- assert(std::next(m.begin(), 1)->first == 2);
- assert(std::next(m.begin(), 1)->second == 1.5);
- assert(std::next(m.begin(), 2)->first == 2);
- assert(std::next(m.begin(), 2)->second == 2);
- assert(std::next(m.begin(), 3)->first == 3);
- assert(std::next(m.begin(), 3)->second == 1);
- assert(std::next(m.begin(), 4)->first == 3);
- assert(std::next(m.begin(), 4)->second == 2);
+ i = m.erase(std::next(m.cbegin(), 1));
+ assert(m.size() == 5);
+ assert(i == std::next(m.begin()));
+ assert(std::next(m.begin(), 0)->first == 1);
+ assert(std::next(m.begin(), 0)->second == 1.5);
+ assert(std::next(m.begin(), 1)->first == 2);
+ assert(std::next(m.begin(), 1)->second == 1.5);
+ assert(std::next(m.begin(), 2)->first == 2);
+ assert(std::next(m.begin(), 2)->second == 2);
+ assert(std::next(m.begin(), 3)->first == 3);
+ assert(std::next(m.begin(), 3)->second == 1);
+ assert(std::next(m.begin(), 4)->first == 3);
+ assert(std::next(m.begin(), 4)->second == 2);
- i = m.erase(std::next(m.cbegin(), 2));
- assert(m.size() == 4);
- assert(i == std::next(m.begin(), 2));
- assert(std::next(m.begin(), 0)->first == 1);
- assert(std::next(m.begin(), 0)->second == 1.5);
- assert(std::next(m.begin(), 1)->first == 2);
- assert(std::next(m.begin(), 1)->second == 1.5);
- assert(std::next(m.begin(), 2)->first == 3);
- assert(std::next(m.begin(), 2)->second == 1);
- assert(std::next(m.begin(), 3)->first == 3);
- assert(std::next(m.begin(), 3)->second == 2);
+ i = m.erase(std::next(m.cbegin(), 2));
+ assert(m.size() == 4);
+ assert(i == std::next(m.begin(), 2));
+ assert(std::next(m.begin(), 0)->first == 1);
+ assert(std::next(m.begin(), 0)->second == 1.5);
+ assert(std::next(m.begin(), 1)->first == 2);
+ assert(std::next(m.begin(), 1)->second == 1.5);
+ assert(std::next(m.begin(), 2)->first == 3);
+ assert(std::next(m.begin(), 2)->second == 1);
+ assert(std::next(m.begin(), 3)->first == 3);
+ assert(std::next(m.begin(), 3)->second == 2);
- i = m.erase(std::next(m.cbegin(), 2));
- assert(m.size() == 3);
- assert(i == std::next(m.begin(), 2));
- assert(std::next(m.begin(), 0)->first == 1);
- assert(std::next(m.begin(), 0)->second == 1.5);
- assert(std::next(m.begin(), 1)->first == 2);
- assert(std::next(m.begin(), 1)->second == 1.5);
- assert(std::next(m.begin(), 2)->first == 3);
- assert(std::next(m.begin(), 2)->second == 2);
+ i = m.erase(std::next(m.cbegin(), 2));
+ assert(m.size() == 3);
+ assert(i == std::next(m.begin(), 2));
+ assert(std::next(m.begin(), 0)->first == 1);
+ assert(std::next(m.begin(), 0)->second == 1.5);
+ assert(std::next(m.begin(), 1)->first == 2);
+ assert(std::next(m.begin(), 1)->second == 1.5);
+ assert(std::next(m.begin(), 2)->first == 3);
+ assert(std::next(m.begin(), 2)->second == 2);
- i = m.erase(std::next(m.cbegin(), 0));
- assert(m.size() == 2);
- assert(i == std::next(m.begin(), 0));
- assert(std::next(m.begin(), 0)->first == 2);
- assert(std::next(m.begin(), 0)->second == 1.5);
- assert(std::next(m.begin(), 1)->first == 3);
- assert(std::next(m.begin(), 1)->second == 2);
+ i = m.erase(std::next(m.cbegin(), 0));
+ assert(m.size() == 2);
+ assert(i == std::next(m.begin(), 0));
+ assert(std::next(m.begin(), 0)->first == 2);
+ assert(std::next(m.begin(), 0)->second == 1.5);
+ assert(std::next(m.begin(), 1)->first == 3);
+ assert(std::next(m.begin(), 1)->second == 2);
- i = m.erase(std::next(m.cbegin(), 1));
- assert(m.size() == 1);
- assert(i == m.end());
- assert(std::next(m.begin(), 0)->first == 2);
- assert(std::next(m.begin(), 0)->second == 1.5);
+ i = m.erase(std::next(m.cbegin(), 1));
+ assert(m.size() == 1);
+ assert(i == m.end());
+ assert(std::next(m.begin(), 0)->first == 2);
+ assert(std::next(m.begin(), 0)->second == 1.5);
- i = m.erase(m.cbegin());
- assert(m.size() == 0);
- assert(i == m.begin());
- assert(i == m.end());
- }
+ i = m.erase(m.cbegin());
+ assert(m.size() == 0);
+ assert(i == m.begin());
+ assert(i == m.end());
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
- typedef std::pair<int, double> P;
- typedef M::iterator I;
- P ar[] =
- {
- P(1, 1),
- P(1, 1.5),
- P(1, 2),
- P(2, 1),
- P(2, 1.5),
- P(2, 2),
- P(3, 1),
- P(3, 1.5),
- P(3, 2),
- };
- M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
- assert(m.size() == 9);
- I i = m.erase(std::next(m.cbegin(), 3));
- assert(m.size() == 8);
- assert(i == std::next(m.begin(), 3));
- assert(m.begin()->first == 1);
- assert(m.begin()->second == 1);
- assert(std::next(m.begin())->first == 1);
- assert(std::next(m.begin())->second == 1.5);
- assert(std::next(m.begin(), 2)->first == 1);
- assert(std::next(m.begin(), 2)->second == 2);
- assert(std::next(m.begin(), 3)->first == 2);
- assert(std::next(m.begin(), 3)->second == 1.5);
- assert(std::next(m.begin(), 4)->first == 2);
- assert(std::next(m.begin(), 4)->second == 2);
- assert(std::next(m.begin(), 5)->first == 3);
- assert(std::next(m.begin(), 5)->second == 1);
- assert(std::next(m.begin(), 6)->first == 3);
- assert(std::next(m.begin(), 6)->second == 1.5);
- assert(std::next(m.begin(), 7)->first == 3);
- assert(std::next(m.begin(), 7)->second == 2);
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef std::pair<int, double> P;
+ typedef M::iterator I;
+ P ar[] = {
+ P(1, 1),
+ P(1, 1.5),
+ P(1, 2),
+ P(2, 1),
+ P(2, 1.5),
+ P(2, 2),
+ P(3, 1),
+ P(3, 1.5),
+ P(3, 2),
+ };
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(m.size() == 9);
+ I i = m.erase(std::next(m.cbegin(), 3));
+ assert(m.size() == 8);
+ assert(i == std::next(m.begin(), 3));
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == 1);
+ assert(std::next(m.begin())->first == 1);
+ assert(std::next(m.begin())->second == 1.5);
+ assert(std::next(m.begin(), 2)->first == 1);
+ assert(std::next(m.begin(), 2)->second == 2);
+ assert(std::next(m.begin(), 3)->first == 2);
+ assert(std::next(m.begin(), 3)->second == 1.5);
+ assert(std::next(m.begin(), 4)->first == 2);
+ assert(std::next(m.begin(), 4)->second == 2);
+ assert(std::next(m.begin(), 5)->first == 3);
+ assert(std::next(m.begin(), 5)->second == 1);
+ assert(std::next(m.begin(), 6)->first == 3);
+ assert(std::next(m.begin(), 6)->second == 1.5);
+ assert(std::next(m.begin(), 7)->first == 3);
+ assert(std::next(m.begin(), 7)->second == 2);
- i = m.erase(std::next(m.cbegin(), 0));
- assert(m.size() == 7);
- assert(i == m.begin());
- assert(std::next(m.begin(), 0)->first == 1);
- assert(std::next(m.begin(), 0)->second == 1.5);
- assert(std::next(m.begin(), 1)->first == 1);
- assert(std::next(m.begin(), 1)->second == 2);
- assert(std::next(m.begin(), 2)->first == 2);
- assert(std::next(m.begin(), 2)->second == 1.5);
- assert(std::next(m.begin(), 3)->first == 2);
- assert(std::next(m.begin(), 3)->second == 2);
- assert(std::next(m.begin(), 4)->first == 3);
- assert(std::next(m.begin(), 4)->second == 1);
- assert(std::next(m.begin(), 5)->first == 3);
- assert(std::next(m.begin(), 5)->second == 1.5);
- assert(std::next(m.begin(), 6)->first == 3);
- assert(std::next(m.begin(), 6)->second == 2);
+ i = m.erase(std::next(m.cbegin(), 0));
+ assert(m.size() == 7);
+ assert(i == m.begin());
+ assert(std::next(m.begin(), 0)->first == 1);
+ assert(std::next(m.begin(), 0)->second == 1.5);
+ assert(std::next(m.begin(), 1)->first == 1);
+ assert(std::next(m.begin(), 1)->second == 2);
+ assert(std::next(m.begin(), 2)->first == 2);
+ assert(std::next(m.begin(), 2)->second == 1.5);
+ assert(std::next(m.begin(), 3)->first == 2);
+ assert(std::next(m.begin(), 3)->second == 2);
+ assert(std::next(m.begin(), 4)->first == 3);
+ assert(std::next(m.begin(), 4)->second == 1);
+ assert(std::next(m.begin(), 5)->first == 3);
+ assert(std::next(m.begin(), 5)->second == 1.5);
+ assert(std::next(m.begin(), 6)->first == 3);
+ assert(std::next(m.begin(), 6)->second == 2);
- i = m.erase(std::next(m.cbegin(), 5));
- assert(m.size() == 6);
- assert(i == std::prev(m.end()));
- assert(std::next(m.begin(), 0)->first == 1);
- assert(std::next(m.begin(), 0)->second == 1.5);
- assert(std::next(m.begin(), 1)->first == 1);
- assert(std::next(m.begin(), 1)->second == 2);
- assert(std::next(m.begin(), 2)->first == 2);
- assert(std::next(m.begin(), 2)->second == 1.5);
- assert(std::next(m.begin(), 3)->first == 2);
- assert(std::next(m.begin(), 3)->second == 2);
- assert(std::next(m.begin(), 4)->first == 3);
- assert(std::next(m.begin(), 4)->second == 1);
- assert(std::next(m.begin(), 5)->first == 3);
- assert(std::next(m.begin(), 5)->second == 2);
+ i = m.erase(std::next(m.cbegin(), 5));
+ assert(m.size() == 6);
+ assert(i == std::prev(m.end()));
+ assert(std::next(m.begin(), 0)->first == 1);
+ assert(std::next(m.begin(), 0)->second == 1.5);
+ assert(std::next(m.begin(), 1)->first == 1);
+ assert(std::next(m.begin(), 1)->second == 2);
+ assert(std::next(m.begin(), 2)->first == 2);
+ assert(std::next(m.begin(), 2)->second == 1.5);
+ assert(std::next(m.begin(), 3)->first == 2);
+ assert(std::next(m.begin(), 3)->second == 2);
+ assert(std::next(m.begin(), 4)->first == 3);
+ assert(std::next(m.begin(), 4)->second == 1);
+ assert(std::next(m.begin(), 5)->first == 3);
+ assert(std::next(m.begin(), 5)->second == 2);
- i = m.erase(std::next(m.cbegin(), 1));
- assert(m.size() == 5);
- assert(i == std::next(m.begin()));
- assert(std::next(m.begin(), 0)->first == 1);
- assert(std::next(m.begin(), 0)->second == 1.5);
- assert(std::next(m.begin(), 1)->first == 2);
- assert(std::next(m.begin(), 1)->second == 1.5);
- assert(std::next(m.begin(), 2)->first == 2);
- assert(std::next(m.begin(), 2)->second == 2);
- assert(std::next(m.begin(), 3)->first == 3);
- assert(std::next(m.begin(), 3)->second == 1);
- assert(std::next(m.begin(), 4)->first == 3);
- assert(std::next(m.begin(), 4)->second == 2);
+ i = m.erase(std::next(m.cbegin(), 1));
+ assert(m.size() == 5);
+ assert(i == std::next(m.begin()));
+ assert(std::next(m.begin(), 0)->first == 1);
+ assert(std::next(m.begin(), 0)->second == 1.5);
+ assert(std::next(m.begin(), 1)->first == 2);
+ assert(std::next(m.begin(), 1)->second == 1.5);
+ assert(std::next(m.begin(), 2)->first == 2);
+ assert(std::next(m.begin(), 2)->second == 2);
+ assert(std::next(m.begin(), 3)->first == 3);
+ assert(std::next(m.begin(), 3)->second == 1);
+ assert(std::next(m.begin(), 4)->first == 3);
+ assert(std::next(m.begin(), 4)->second == 2);
- i = m.erase(std::next(m.cbegin(), 2));
- assert(m.size() == 4);
- assert(i == std::next(m.begin(), 2));
- assert(std::next(m.begin(), 0)->first == 1);
- assert(std::next(m.begin(), 0)->second == 1.5);
- assert(std::next(m.begin(), 1)->first == 2);
- assert(std::next(m.begin(), 1)->second == 1.5);
- assert(std::next(m.begin(), 2)->first == 3);
- assert(std::next(m.begin(), 2)->second == 1);
- assert(std::next(m.begin(), 3)->first == 3);
- assert(std::next(m.begin(), 3)->second == 2);
+ i = m.erase(std::next(m.cbegin(), 2));
+ assert(m.size() == 4);
+ assert(i == std::next(m.begin(), 2));
+ assert(std::next(m.begin(), 0)->first == 1);
+ assert(std::next(m.begin(), 0)->second == 1.5);
+ assert(std::next(m.begin(), 1)->first == 2);
+ assert(std::next(m.begin(), 1)->second == 1.5);
+ assert(std::next(m.begin(), 2)->first == 3);
+ assert(std::next(m.begin(), 2)->second == 1);
+ assert(std::next(m.begin(), 3)->first == 3);
+ assert(std::next(m.begin(), 3)->second == 2);
- i = m.erase(std::next(m.cbegin(), 2));
- assert(m.size() == 3);
- assert(i == std::next(m.begin(), 2));
- assert(std::next(m.begin(), 0)->first == 1);
- assert(std::next(m.begin(), 0)->second == 1.5);
- assert(std::next(m.begin(), 1)->first == 2);
- assert(std::next(m.begin(), 1)->second == 1.5);
- assert(std::next(m.begin(), 2)->first == 3);
- assert(std::next(m.begin(), 2)->second == 2);
+ i = m.erase(std::next(m.cbegin(), 2));
+ assert(m.size() == 3);
+ assert(i == std::next(m.begin(), 2));
+ assert(std::next(m.begin(), 0)->first == 1);
+ assert(std::next(m.begin(), 0)->second == 1.5);
+ assert(std::next(m.begin(), 1)->first == 2);
+ assert(std::next(m.begin(), 1)->second == 1.5);
+ assert(std::next(m.begin(), 2)->first == 3);
+ assert(std::next(m.begin(), 2)->second == 2);
- i = m.erase(std::next(m.cbegin(), 0));
- assert(m.size() == 2);
- assert(i == std::next(m.begin(), 0));
- assert(std::next(m.begin(), 0)->first == 2);
- assert(std::next(m.begin(), 0)->second == 1.5);
- assert(std::next(m.begin(), 1)->first == 3);
- assert(std::next(m.begin(), 1)->second == 2);
+ i = m.erase(std::next(m.cbegin(), 0));
+ assert(m.size() == 2);
+ assert(i == std::next(m.begin(), 0));
+ assert(std::next(m.begin(), 0)->first == 2);
+ assert(std::next(m.begin(), 0)->second == 1.5);
+ assert(std::next(m.begin(), 1)->first == 3);
+ assert(std::next(m.begin(), 1)->second == 2);
- i = m.erase(std::next(m.cbegin(), 1));
- assert(m.size() == 1);
- assert(i == m.end());
- assert(std::next(m.begin(), 0)->first == 2);
- assert(std::next(m.begin(), 0)->second == 1.5);
+ i = m.erase(std::next(m.cbegin(), 1));
+ assert(m.size() == 1);
+ assert(i == m.end());
+ assert(std::next(m.begin(), 0)->first == 2);
+ assert(std::next(m.begin(), 0)->second == 1.5);
- i = m.erase(m.cbegin());
- assert(m.size() == 0);
- assert(i == m.begin());
- assert(i == m.end());
- }
+ i = m.erase(m.cbegin());
+ assert(m.size() == 0);
+ assert(i == m.begin());
+ assert(i == m.end());
+ }
#endif
#if TEST_STD_VER >= 14
- {
+ {
// This is LWG #2059
- typedef TemplateConstructor T;
- typedef std::multimap<T, int> C;
- typedef C::iterator I;
+ typedef TemplateConstructor T;
+ typedef std::multimap<T, int> C;
+ typedef C::iterator I;
- C c;
- T a{0};
- I it = c.find(a);
- if (it != c.end())
- c.erase(it);
- }
+ C c;
+ T a{0};
+ I it = c.find(a);
+ if (it != c.end())
+ c.erase(it);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/erase_iter_iter.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/erase_iter_iter.pass.cpp
index 68a8f2e35ac65b9..22a34a19d9897c4 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/erase_iter_iter.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/erase_iter_iter.pass.cpp
@@ -18,141 +18,138 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::multimap<int, double> M;
- typedef std::pair<int, double> P;
- typedef M::iterator I;
- P ar[] =
- {
- P(1, 1.5),
- P(2, 2.5),
- P(3, 3.5),
- P(4, 4.5),
- P(5, 5.5),
- P(6, 6.5),
- P(7, 7.5),
- P(8, 8.5),
- };
- M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
- assert(m.size() == 8);
- I i = m.erase(m.cbegin(), m.cbegin());
- assert(m.size() == 8);
- assert(i == m.begin());
- assert(m.begin()->first == 1);
- assert(m.begin()->second == 1.5);
- assert(std::next(m.begin())->first == 2);
- assert(std::next(m.begin())->second == 2.5);
- assert(std::next(m.begin(), 2)->first == 3);
- assert(std::next(m.begin(), 2)->second == 3.5);
- assert(std::next(m.begin(), 3)->first == 4);
- assert(std::next(m.begin(), 3)->second == 4.5);
- assert(std::next(m.begin(), 4)->first == 5);
- assert(std::next(m.begin(), 4)->second == 5.5);
- assert(std::next(m.begin(), 5)->first == 6);
- assert(std::next(m.begin(), 5)->second == 6.5);
- assert(std::next(m.begin(), 6)->first == 7);
- assert(std::next(m.begin(), 6)->second == 7.5);
- assert(std::next(m.begin(), 7)->first == 8);
- assert(std::next(m.begin(), 7)->second == 8.5);
+int main(int, char**) {
+ {
+ typedef std::multimap<int, double> M;
+ typedef std::pair<int, double> P;
+ typedef M::iterator I;
+ P ar[] = {
+ P(1, 1.5),
+ P(2, 2.5),
+ P(3, 3.5),
+ P(4, 4.5),
+ P(5, 5.5),
+ P(6, 6.5),
+ P(7, 7.5),
+ P(8, 8.5),
+ };
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(m.size() == 8);
+ I i = m.erase(m.cbegin(), m.cbegin());
+ assert(m.size() == 8);
+ assert(i == m.begin());
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == 1.5);
+ assert(std::next(m.begin())->first == 2);
+ assert(std::next(m.begin())->second == 2.5);
+ assert(std::next(m.begin(), 2)->first == 3);
+ assert(std::next(m.begin(), 2)->second == 3.5);
+ assert(std::next(m.begin(), 3)->first == 4);
+ assert(std::next(m.begin(), 3)->second == 4.5);
+ assert(std::next(m.begin(), 4)->first == 5);
+ assert(std::next(m.begin(), 4)->second == 5.5);
+ assert(std::next(m.begin(), 5)->first == 6);
+ assert(std::next(m.begin(), 5)->second == 6.5);
+ assert(std::next(m.begin(), 6)->first == 7);
+ assert(std::next(m.begin(), 6)->second == 7.5);
+ assert(std::next(m.begin(), 7)->first == 8);
+ assert(std::next(m.begin(), 7)->second == 8.5);
- i = m.erase(m.cbegin(), std::next(m.cbegin(), 2));
- assert(m.size() == 6);
- assert(i == m.begin());
- assert(std::next(m.begin(), 0)->first == 3);
- assert(std::next(m.begin(), 0)->second == 3.5);
- assert(std::next(m.begin(), 1)->first == 4);
- assert(std::next(m.begin(), 1)->second == 4.5);
- assert(std::next(m.begin(), 2)->first == 5);
- assert(std::next(m.begin(), 2)->second == 5.5);
- assert(std::next(m.begin(), 3)->first == 6);
- assert(std::next(m.begin(), 3)->second == 6.5);
- assert(std::next(m.begin(), 4)->first == 7);
- assert(std::next(m.begin(), 4)->second == 7.5);
- assert(std::next(m.begin(), 5)->first == 8);
- assert(std::next(m.begin(), 5)->second == 8.5);
+ i = m.erase(m.cbegin(), std::next(m.cbegin(), 2));
+ assert(m.size() == 6);
+ assert(i == m.begin());
+ assert(std::next(m.begin(), 0)->first == 3);
+ assert(std::next(m.begin(), 0)->second == 3.5);
+ assert(std::next(m.begin(), 1)->first == 4);
+ assert(std::next(m.begin(), 1)->second == 4.5);
+ assert(std::next(m.begin(), 2)->first == 5);
+ assert(std::next(m.begin(), 2)->second == 5.5);
+ assert(std::next(m.begin(), 3)->first == 6);
+ assert(std::next(m.begin(), 3)->second == 6.5);
+ assert(std::next(m.begin(), 4)->first == 7);
+ assert(std::next(m.begin(), 4)->second == 7.5);
+ assert(std::next(m.begin(), 5)->first == 8);
+ assert(std::next(m.begin(), 5)->second == 8.5);
- i = m.erase(std::next(m.cbegin(), 2), std::next(m.cbegin(), 6));
- assert(m.size() == 2);
- assert(i == std::next(m.begin(), 2));
- assert(std::next(m.begin(), 0)->first == 3);
- assert(std::next(m.begin(), 0)->second == 3.5);
- assert(std::next(m.begin(), 1)->first == 4);
- assert(std::next(m.begin(), 1)->second == 4.5);
+ i = m.erase(std::next(m.cbegin(), 2), std::next(m.cbegin(), 6));
+ assert(m.size() == 2);
+ assert(i == std::next(m.begin(), 2));
+ assert(std::next(m.begin(), 0)->first == 3);
+ assert(std::next(m.begin(), 0)->second == 3.5);
+ assert(std::next(m.begin(), 1)->first == 4);
+ assert(std::next(m.begin(), 1)->second == 4.5);
- i = m.erase(m.cbegin(), m.cend());
- assert(m.size() == 0);
- assert(i == m.begin());
- assert(i == m.end());
- }
+ i = m.erase(m.cbegin(), m.cend());
+ assert(m.size() == 0);
+ assert(i == m.begin());
+ assert(i == m.end());
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
- typedef std::pair<int, double> P;
- typedef M::iterator I;
- P ar[] =
- {
- P(1, 1.5),
- P(2, 2.5),
- P(3, 3.5),
- P(4, 4.5),
- P(5, 5.5),
- P(6, 6.5),
- P(7, 7.5),
- P(8, 8.5),
- };
- M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
- assert(m.size() == 8);
- I i = m.erase(m.cbegin(), m.cbegin());
- assert(m.size() == 8);
- assert(i == m.begin());
- assert(m.begin()->first == 1);
- assert(m.begin()->second == 1.5);
- assert(std::next(m.begin())->first == 2);
- assert(std::next(m.begin())->second == 2.5);
- assert(std::next(m.begin(), 2)->first == 3);
- assert(std::next(m.begin(), 2)->second == 3.5);
- assert(std::next(m.begin(), 3)->first == 4);
- assert(std::next(m.begin(), 3)->second == 4.5);
- assert(std::next(m.begin(), 4)->first == 5);
- assert(std::next(m.begin(), 4)->second == 5.5);
- assert(std::next(m.begin(), 5)->first == 6);
- assert(std::next(m.begin(), 5)->second == 6.5);
- assert(std::next(m.begin(), 6)->first == 7);
- assert(std::next(m.begin(), 6)->second == 7.5);
- assert(std::next(m.begin(), 7)->first == 8);
- assert(std::next(m.begin(), 7)->second == 8.5);
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef std::pair<int, double> P;
+ typedef M::iterator I;
+ P ar[] = {
+ P(1, 1.5),
+ P(2, 2.5),
+ P(3, 3.5),
+ P(4, 4.5),
+ P(5, 5.5),
+ P(6, 6.5),
+ P(7, 7.5),
+ P(8, 8.5),
+ };
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(m.size() == 8);
+ I i = m.erase(m.cbegin(), m.cbegin());
+ assert(m.size() == 8);
+ assert(i == m.begin());
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == 1.5);
+ assert(std::next(m.begin())->first == 2);
+ assert(std::next(m.begin())->second == 2.5);
+ assert(std::next(m.begin(), 2)->first == 3);
+ assert(std::next(m.begin(), 2)->second == 3.5);
+ assert(std::next(m.begin(), 3)->first == 4);
+ assert(std::next(m.begin(), 3)->second == 4.5);
+ assert(std::next(m.begin(), 4)->first == 5);
+ assert(std::next(m.begin(), 4)->second == 5.5);
+ assert(std::next(m.begin(), 5)->first == 6);
+ assert(std::next(m.begin(), 5)->second == 6.5);
+ assert(std::next(m.begin(), 6)->first == 7);
+ assert(std::next(m.begin(), 6)->second == 7.5);
+ assert(std::next(m.begin(), 7)->first == 8);
+ assert(std::next(m.begin(), 7)->second == 8.5);
- i = m.erase(m.cbegin(), std::next(m.cbegin(), 2));
- assert(m.size() == 6);
- assert(i == m.begin());
- assert(std::next(m.begin(), 0)->first == 3);
- assert(std::next(m.begin(), 0)->second == 3.5);
- assert(std::next(m.begin(), 1)->first == 4);
- assert(std::next(m.begin(), 1)->second == 4.5);
- assert(std::next(m.begin(), 2)->first == 5);
- assert(std::next(m.begin(), 2)->second == 5.5);
- assert(std::next(m.begin(), 3)->first == 6);
- assert(std::next(m.begin(), 3)->second == 6.5);
- assert(std::next(m.begin(), 4)->first == 7);
- assert(std::next(m.begin(), 4)->second == 7.5);
- assert(std::next(m.begin(), 5)->first == 8);
- assert(std::next(m.begin(), 5)->second == 8.5);
+ i = m.erase(m.cbegin(), std::next(m.cbegin(), 2));
+ assert(m.size() == 6);
+ assert(i == m.begin());
+ assert(std::next(m.begin(), 0)->first == 3);
+ assert(std::next(m.begin(), 0)->second == 3.5);
+ assert(std::next(m.begin(), 1)->first == 4);
+ assert(std::next(m.begin(), 1)->second == 4.5);
+ assert(std::next(m.begin(), 2)->first == 5);
+ assert(std::next(m.begin(), 2)->second == 5.5);
+ assert(std::next(m.begin(), 3)->first == 6);
+ assert(std::next(m.begin(), 3)->second == 6.5);
+ assert(std::next(m.begin(), 4)->first == 7);
+ assert(std::next(m.begin(), 4)->second == 7.5);
+ assert(std::next(m.begin(), 5)->first == 8);
+ assert(std::next(m.begin(), 5)->second == 8.5);
- i = m.erase(std::next(m.cbegin(), 2), std::next(m.cbegin(), 6));
- assert(m.size() == 2);
- assert(i == std::next(m.begin(), 2));
- assert(std::next(m.begin(), 0)->first == 3);
- assert(std::next(m.begin(), 0)->second == 3.5);
- assert(std::next(m.begin(), 1)->first == 4);
- assert(std::next(m.begin(), 1)->second == 4.5);
+ i = m.erase(std::next(m.cbegin(), 2), std::next(m.cbegin(), 6));
+ assert(m.size() == 2);
+ assert(i == std::next(m.begin(), 2));
+ assert(std::next(m.begin(), 0)->first == 3);
+ assert(std::next(m.begin(), 0)->second == 3.5);
+ assert(std::next(m.begin(), 1)->first == 4);
+ assert(std::next(m.begin(), 1)->second == 4.5);
- i = m.erase(m.cbegin(), m.cend());
- assert(m.size() == 0);
- assert(i == m.begin());
- assert(i == m.end());
- }
+ i = m.erase(m.cbegin(), m.cend());
+ assert(m.size() == 0);
+ assert(i == m.begin());
+ assert(i == m.end());
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/erase_key.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/erase_key.pass.cpp
index f00436db264c95b..1dde462f096a1f7 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/erase_key.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/erase_key.pass.cpp
@@ -18,137 +18,134 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::multimap<int, double> M;
- typedef std::pair<int, double> P;
- typedef M::size_type I;
- P ar[] =
- {
- P(1, 1),
- P(1, 1.5),
- P(1, 2),
- P(2, 1),
- P(2, 1.5),
- P(2, 2),
- P(3, 1),
- P(3, 1.5),
- P(3, 2),
- };
- M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
- assert(m.size() == 9);
- I i = m.erase(2);
- assert(m.size() == 6);
- assert(i == 3);
- assert(std::next(m.begin(), 0)->first == 1);
- assert(std::next(m.begin(), 0)->second == 1);
- assert(std::next(m.begin(), 1)->first == 1);
- assert(std::next(m.begin(), 1)->second == 1.5);
- assert(std::next(m.begin(), 2)->first == 1);
- assert(std::next(m.begin(), 2)->second == 2);
- assert(std::next(m.begin(), 3)->first == 3);
- assert(std::next(m.begin(), 3)->second == 1);
- assert(std::next(m.begin(), 4)->first == 3);
- assert(std::next(m.begin(), 4)->second == 1.5);
- assert(std::next(m.begin(), 5)->first == 3);
- assert(std::next(m.begin(), 5)->second == 2);
+int main(int, char**) {
+ {
+ typedef std::multimap<int, double> M;
+ typedef std::pair<int, double> P;
+ typedef M::size_type I;
+ P ar[] = {
+ P(1, 1),
+ P(1, 1.5),
+ P(1, 2),
+ P(2, 1),
+ P(2, 1.5),
+ P(2, 2),
+ P(3, 1),
+ P(3, 1.5),
+ P(3, 2),
+ };
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(m.size() == 9);
+ I i = m.erase(2);
+ assert(m.size() == 6);
+ assert(i == 3);
+ assert(std::next(m.begin(), 0)->first == 1);
+ assert(std::next(m.begin(), 0)->second == 1);
+ assert(std::next(m.begin(), 1)->first == 1);
+ assert(std::next(m.begin(), 1)->second == 1.5);
+ assert(std::next(m.begin(), 2)->first == 1);
+ assert(std::next(m.begin(), 2)->second == 2);
+ assert(std::next(m.begin(), 3)->first == 3);
+ assert(std::next(m.begin(), 3)->second == 1);
+ assert(std::next(m.begin(), 4)->first == 3);
+ assert(std::next(m.begin(), 4)->second == 1.5);
+ assert(std::next(m.begin(), 5)->first == 3);
+ assert(std::next(m.begin(), 5)->second == 2);
- i = m.erase(2);
- assert(m.size() == 6);
- assert(i == 0);
- assert(std::next(m.begin(), 0)->first == 1);
- assert(std::next(m.begin(), 0)->second == 1);
- assert(std::next(m.begin(), 1)->first == 1);
- assert(std::next(m.begin(), 1)->second == 1.5);
- assert(std::next(m.begin(), 2)->first == 1);
- assert(std::next(m.begin(), 2)->second == 2);
- assert(std::next(m.begin(), 3)->first == 3);
- assert(std::next(m.begin(), 3)->second == 1);
- assert(std::next(m.begin(), 4)->first == 3);
- assert(std::next(m.begin(), 4)->second == 1.5);
- assert(std::next(m.begin(), 5)->first == 3);
- assert(std::next(m.begin(), 5)->second == 2);
+ i = m.erase(2);
+ assert(m.size() == 6);
+ assert(i == 0);
+ assert(std::next(m.begin(), 0)->first == 1);
+ assert(std::next(m.begin(), 0)->second == 1);
+ assert(std::next(m.begin(), 1)->first == 1);
+ assert(std::next(m.begin(), 1)->second == 1.5);
+ assert(std::next(m.begin(), 2)->first == 1);
+ assert(std::next(m.begin(), 2)->second == 2);
+ assert(std::next(m.begin(), 3)->first == 3);
+ assert(std::next(m.begin(), 3)->second == 1);
+ assert(std::next(m.begin(), 4)->first == 3);
+ assert(std::next(m.begin(), 4)->second == 1.5);
+ assert(std::next(m.begin(), 5)->first == 3);
+ assert(std::next(m.begin(), 5)->second == 2);
- i = m.erase(3);
- assert(i == 3);
- assert(m.size() == 3);
- assert(std::next(m.begin(), 0)->first == 1);
- assert(std::next(m.begin(), 0)->second == 1);
- assert(std::next(m.begin(), 1)->first == 1);
- assert(std::next(m.begin(), 1)->second == 1.5);
- assert(std::next(m.begin(), 2)->first == 1);
- assert(std::next(m.begin(), 2)->second == 2);
+ i = m.erase(3);
+ assert(i == 3);
+ assert(m.size() == 3);
+ assert(std::next(m.begin(), 0)->first == 1);
+ assert(std::next(m.begin(), 0)->second == 1);
+ assert(std::next(m.begin(), 1)->first == 1);
+ assert(std::next(m.begin(), 1)->second == 1.5);
+ assert(std::next(m.begin(), 2)->first == 1);
+ assert(std::next(m.begin(), 2)->second == 2);
- i = m.erase(1);
- assert(m.size() == 0);
- assert(i == 3);
- }
+ i = m.erase(1);
+ assert(m.size() == 0);
+ assert(i == 3);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
- typedef std::pair<int, double> P;
- typedef M::size_type I;
- P ar[] =
- {
- P(1, 1),
- P(1, 1.5),
- P(1, 2),
- P(2, 1),
- P(2, 1.5),
- P(2, 2),
- P(3, 1),
- P(3, 1.5),
- P(3, 2),
- };
- M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
- assert(m.size() == 9);
- I i = m.erase(2);
- assert(m.size() == 6);
- assert(i == 3);
- assert(std::next(m.begin(), 0)->first == 1);
- assert(std::next(m.begin(), 0)->second == 1);
- assert(std::next(m.begin(), 1)->first == 1);
- assert(std::next(m.begin(), 1)->second == 1.5);
- assert(std::next(m.begin(), 2)->first == 1);
- assert(std::next(m.begin(), 2)->second == 2);
- assert(std::next(m.begin(), 3)->first == 3);
- assert(std::next(m.begin(), 3)->second == 1);
- assert(std::next(m.begin(), 4)->first == 3);
- assert(std::next(m.begin(), 4)->second == 1.5);
- assert(std::next(m.begin(), 5)->first == 3);
- assert(std::next(m.begin(), 5)->second == 2);
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef std::pair<int, double> P;
+ typedef M::size_type I;
+ P ar[] = {
+ P(1, 1),
+ P(1, 1.5),
+ P(1, 2),
+ P(2, 1),
+ P(2, 1.5),
+ P(2, 2),
+ P(3, 1),
+ P(3, 1.5),
+ P(3, 2),
+ };
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(m.size() == 9);
+ I i = m.erase(2);
+ assert(m.size() == 6);
+ assert(i == 3);
+ assert(std::next(m.begin(), 0)->first == 1);
+ assert(std::next(m.begin(), 0)->second == 1);
+ assert(std::next(m.begin(), 1)->first == 1);
+ assert(std::next(m.begin(), 1)->second == 1.5);
+ assert(std::next(m.begin(), 2)->first == 1);
+ assert(std::next(m.begin(), 2)->second == 2);
+ assert(std::next(m.begin(), 3)->first == 3);
+ assert(std::next(m.begin(), 3)->second == 1);
+ assert(std::next(m.begin(), 4)->first == 3);
+ assert(std::next(m.begin(), 4)->second == 1.5);
+ assert(std::next(m.begin(), 5)->first == 3);
+ assert(std::next(m.begin(), 5)->second == 2);
- i = m.erase(2);
- assert(m.size() == 6);
- assert(i == 0);
- assert(std::next(m.begin(), 0)->first == 1);
- assert(std::next(m.begin(), 0)->second == 1);
- assert(std::next(m.begin(), 1)->first == 1);
- assert(std::next(m.begin(), 1)->second == 1.5);
- assert(std::next(m.begin(), 2)->first == 1);
- assert(std::next(m.begin(), 2)->second == 2);
- assert(std::next(m.begin(), 3)->first == 3);
- assert(std::next(m.begin(), 3)->second == 1);
- assert(std::next(m.begin(), 4)->first == 3);
- assert(std::next(m.begin(), 4)->second == 1.5);
- assert(std::next(m.begin(), 5)->first == 3);
- assert(std::next(m.begin(), 5)->second == 2);
+ i = m.erase(2);
+ assert(m.size() == 6);
+ assert(i == 0);
+ assert(std::next(m.begin(), 0)->first == 1);
+ assert(std::next(m.begin(), 0)->second == 1);
+ assert(std::next(m.begin(), 1)->first == 1);
+ assert(std::next(m.begin(), 1)->second == 1.5);
+ assert(std::next(m.begin(), 2)->first == 1);
+ assert(std::next(m.begin(), 2)->second == 2);
+ assert(std::next(m.begin(), 3)->first == 3);
+ assert(std::next(m.begin(), 3)->second == 1);
+ assert(std::next(m.begin(), 4)->first == 3);
+ assert(std::next(m.begin(), 4)->second == 1.5);
+ assert(std::next(m.begin(), 5)->first == 3);
+ assert(std::next(m.begin(), 5)->second == 2);
- i = m.erase(3);
- assert(i == 3);
- assert(m.size() == 3);
- assert(std::next(m.begin(), 0)->first == 1);
- assert(std::next(m.begin(), 0)->second == 1);
- assert(std::next(m.begin(), 1)->first == 1);
- assert(std::next(m.begin(), 1)->second == 1.5);
- assert(std::next(m.begin(), 2)->first == 1);
- assert(std::next(m.begin(), 2)->second == 2);
+ i = m.erase(3);
+ assert(i == 3);
+ assert(m.size() == 3);
+ assert(std::next(m.begin(), 0)->first == 1);
+ assert(std::next(m.begin(), 0)->second == 1);
+ assert(std::next(m.begin(), 1)->first == 1);
+ assert(std::next(m.begin(), 1)->second == 1.5);
+ assert(std::next(m.begin(), 2)->first == 1);
+ assert(std::next(m.begin(), 2)->second == 2);
- i = m.erase(1);
- assert(m.size() == 0);
- assert(i == 3);
- }
+ i = m.erase(1);
+ assert(m.size() == 0);
+ assert(i == 3);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/extract_iterator.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/extract_iterator.pass.cpp
index c4751d81ec95387..85beba3015e56bb 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/extract_iterator.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/extract_iterator.pass.cpp
@@ -20,50 +20,44 @@
#include "Counter.h"
template <class Container>
-void test(Container& c)
-{
- std::size_t sz = c.size();
-
- auto some_key = c.cbegin()->first;
-
- for (auto first = c.cbegin(); first != c.cend();)
- {
- auto key_value = first->first;
- typename Container::node_type t = c.extract(first++);
- --sz;
- assert(t.key() == key_value);
- t.key() = some_key;
- assert(t.key() == some_key);
- assert(t.get_allocator() == c.get_allocator());
- assert(sz == c.size());
- }
-
- assert(c.size() == 0);
+void test(Container& c) {
+ std::size_t sz = c.size();
+
+ auto some_key = c.cbegin()->first;
+
+ for (auto first = c.cbegin(); first != c.cend();) {
+ auto key_value = first->first;
+ typename Container::node_type t = c.extract(first++);
+ --sz;
+ assert(t.key() == key_value);
+ t.key() = some_key;
+ assert(t.key() == some_key);
+ assert(t.get_allocator() == c.get_allocator());
+ assert(sz == c.size());
+ }
+
+ assert(c.size() == 0);
}
-int main(int, char**)
-{
- {
- using map_type = std::multimap<int, int>;
- map_type m = {{1,1}, {2,2}, {3,3}, {4,4}, {5,5}, {6,6}};
- test(m);
- }
-
- {
- std::multimap<Counter<int>, Counter<int>> m =
- {{1,1}, {2,2}, {3,3}, {4,4}, {5,5}, {6,6}};
- assert(Counter_base::gConstructed == 12);
- test(m);
- assert(Counter_base::gConstructed == 0);
- }
-
- {
- using min_alloc_map =
- std::multimap<int, int, std::less<int>,
- min_allocator<std::pair<const int, int>>>;
- min_alloc_map m = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}};
- test(m);
- }
+int main(int, char**) {
+ {
+ using map_type = std::multimap<int, int>;
+ map_type m = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}};
+ test(m);
+ }
+
+ {
+ std::multimap<Counter<int>, Counter<int>> m = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}};
+ assert(Counter_base::gConstructed == 12);
+ test(m);
+ assert(Counter_base::gConstructed == 0);
+ }
+
+ {
+ using min_alloc_map = std::multimap<int, int, std::less<int>, min_allocator<std::pair<const int, int>>>;
+ min_alloc_map m = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}};
+ test(m);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/extract_key.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/extract_key.pass.cpp
index b558f4e3f1207dc..b3027b3b0f727cb 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/extract_key.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/extract_key.pass.cpp
@@ -20,59 +20,52 @@
#include "Counter.h"
template <class Container, class KeyTypeIter>
-void test(Container& c, KeyTypeIter first, KeyTypeIter last)
-{
- std::size_t sz = c.size();
- assert((std::size_t)std::distance(first, last) == sz);
+void test(Container& c, KeyTypeIter first, KeyTypeIter last) {
+ std::size_t sz = c.size();
+ assert((std::size_t)std::distance(first, last) == sz);
- for (KeyTypeIter copy = first; copy != last; ++copy)
- {
- typename Container::node_type t = c.extract(*copy);
- assert(!t.empty());
- --sz;
- assert(t.key() == *copy);
- t.key() = *first; // We should be able to mutate key.
- assert(t.key() == *first);
- assert(t.get_allocator() == c.get_allocator());
- assert(sz == c.size());
- }
+ for (KeyTypeIter copy = first; copy != last; ++copy) {
+ typename Container::node_type t = c.extract(*copy);
+ assert(!t.empty());
+ --sz;
+ assert(t.key() == *copy);
+ t.key() = *first; // We should be able to mutate key.
+ assert(t.key() == *first);
+ assert(t.get_allocator() == c.get_allocator());
+ assert(sz == c.size());
+ }
- assert(c.size() == 0);
+ assert(c.size() == 0);
- for (KeyTypeIter copy = first; copy != last; ++copy)
- {
- typename Container::node_type t = c.extract(*copy);
- assert(t.empty());
- }
+ for (KeyTypeIter copy = first; copy != last; ++copy) {
+ typename Container::node_type t = c.extract(*copy);
+ assert(t.empty());
+ }
}
-int main(int, char**)
-{
- {
- std::multimap<int, int> m = {{1,1}, {2,2}, {3,3}, {4,4}, {5,5}, {6,6}};
- int keys[] = {1, 2, 3, 4, 5, 6};
- test(m, std::begin(keys), std::end(keys));
- }
+int main(int, char**) {
+ {
+ std::multimap<int, int> m = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}};
+ int keys[] = {1, 2, 3, 4, 5, 6};
+ test(m, std::begin(keys), std::end(keys));
+ }
+ {
+ std::multimap<Counter<int>, Counter<int>> m = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}};
{
- std::multimap<Counter<int>, Counter<int>> m =
- {{1,1}, {2,2}, {3,3}, {4,4}, {5,5}, {6,6}};
- {
- Counter<int> keys[] = {1, 2, 3, 4, 5, 6};
- assert(Counter_base::gConstructed == 12+6);
- test(m, std::begin(keys), std::end(keys));
- }
- assert(Counter_base::gConstructed == 0);
+ Counter<int> keys[] = {1, 2, 3, 4, 5, 6};
+ assert(Counter_base::gConstructed == 12 + 6);
+ test(m, std::begin(keys), std::end(keys));
}
+ assert(Counter_base::gConstructed == 0);
+ }
- {
- using min_alloc_map =
- std::multimap<int, int, std::less<int>,
- min_allocator<std::pair<const int, int>>>;
- min_alloc_map m = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}};
- int keys[] = {1, 2, 3, 4, 5, 6};
- test(m, std::begin(keys), std::end(keys));
- }
+ {
+ using min_alloc_map = std::multimap<int, int, std::less<int>, min_allocator<std::pair<const int, int>>>;
+ min_alloc_map m = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}};
+ int keys[] = {1, 2, 3, 4, 5, 6};
+ test(m, std::begin(keys), std::end(keys));
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_allocator_requirements.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_allocator_requirements.pass.cpp
index 446e3529adb7dc7..68767d002d0ca71 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_allocator_requirements.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_allocator_requirements.pass.cpp
@@ -20,9 +20,7 @@
#include "container_test_types.h"
#include "../../../map_allocator_requirement_test_templates.h"
-
-int main(int, char**)
-{
+int main(int, char**) {
testMultimapInsert<TCT::multimap<> >();
testMultimapInsertHint<TCT::multimap<> >();
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_cv.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_cv.pass.cpp
index f34016303fbe615..a6869a73e1e048d 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_cv.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_cv.pass.cpp
@@ -20,50 +20,49 @@
template <class Container>
void do_insert_test() {
- typedef Container M;
- typedef typename M::iterator R;
- typedef typename M::value_type VT;
- M m;
- const VT v1(2, 2.5);
- R r = m.insert(v1);
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(r->first == 2);
- assert(r->second == 2.5);
+ typedef Container M;
+ typedef typename M::iterator R;
+ typedef typename M::value_type VT;
+ M m;
+ const VT v1(2, 2.5);
+ R r = m.insert(v1);
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(r->first == 2);
+ assert(r->second == 2.5);
- const VT v2(1, 1.5);
- r = m.insert(v2);
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(r->first == 1);
- assert(r->second == 1.5);
+ const VT v2(1, 1.5);
+ r = m.insert(v2);
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(r->first == 1);
+ assert(r->second == 1.5);
- const VT v3(3, 3.5);
- r = m.insert(v3);
- assert(r == std::prev(m.end()));
- assert(m.size() == 3);
- assert(r->first == 3);
- assert(r->second == 3.5);
+ const VT v3(3, 3.5);
+ r = m.insert(v3);
+ assert(r == std::prev(m.end()));
+ assert(m.size() == 3);
+ assert(r->first == 3);
+ assert(r->second == 3.5);
- const VT v4(3, 3.5);
- r = m.insert(v4);
- assert(r == std::prev(m.end()));
- assert(m.size() == 4);
- assert(r->first == 3);
- assert(r->second == 3.5);
+ const VT v4(3, 3.5);
+ r = m.insert(v4);
+ assert(r == std::prev(m.end()));
+ assert(m.size() == 4);
+ assert(r->first == 3);
+ assert(r->second == 3.5);
}
-int main(int, char**)
-{
- {
- typedef std::multimap<int, double> Container;
- do_insert_test<Container>();
- }
+int main(int, char**) {
+ {
+ typedef std::multimap<int, double> Container;
+ do_insert_test<Container>();
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> Container;
- do_insert_test<Container>();
- }
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> Container;
+ do_insert_test<Container>();
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_initializer_list.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_initializer_list.pass.cpp
index d5ef12a1f394ff5..a8f40aa2b09e4e1 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_initializer_list.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_initializer_list.pass.cpp
@@ -20,27 +20,16 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::multimap<int, double> C;
typedef C::value_type V;
- C m =
- {
- {1, 1},
- {1, 2},
- {2, 1},
- {2, 2},
- {3, 1},
- {3, 2}
- };
- m.insert(
- {
- {1, 1.5},
- {2, 1.5},
- {3, 1.5},
- }
- );
+ C m = {{1, 1}, {1, 2}, {2, 1}, {2, 2}, {3, 1}, {3, 2}};
+ m.insert({
+ {1, 1.5},
+ {2, 1.5},
+ {3, 1.5},
+ });
assert(m.size() == 9);
assert(std::distance(m.begin(), m.end()) == 9);
C::const_iterator i = m.cbegin();
@@ -53,26 +42,16 @@ int main(int, char**)
assert(*++i == V(3, 1));
assert(*++i == V(3, 2));
assert(*++i == V(3, 1.5));
- }
- {
+ }
+ {
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> C;
typedef C::value_type V;
- C m =
- {
- {1, 1},
- {1, 2},
- {2, 1},
- {2, 2},
- {3, 1},
- {3, 2}
- };
- m.insert(
- {
- {1, 1.5},
- {2, 1.5},
- {3, 1.5},
- }
- );
+ C m = {{1, 1}, {1, 2}, {2, 1}, {2, 2}, {3, 1}, {3, 2}};
+ m.insert({
+ {1, 1.5},
+ {2, 1.5},
+ {3, 1.5},
+ });
assert(m.size() == 9);
assert(std::distance(m.begin(), m.end()) == 9);
C::const_iterator i = m.cbegin();
@@ -85,7 +64,7 @@ int main(int, char**)
assert(*++i == V(3, 1));
assert(*++i == V(3, 2));
assert(*++i == V(3, 1.5));
- }
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_cv.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_cv.pass.cpp
index 81529600ca0af17..ef47d841775d3cd 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_cv.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_cv.pass.cpp
@@ -19,49 +19,47 @@
#include "min_allocator.h"
template <class Container>
-void do_insert_hint_test()
-{
- typedef Container M;
- typedef typename M::iterator R;
- typedef typename M::value_type VT;
- M m;
- const VT v1(2, 2.5);
- R r = m.insert(m.end(), v1);
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(r->first == 2);
- assert(r->second == 2.5);
+void do_insert_hint_test() {
+ typedef Container M;
+ typedef typename M::iterator R;
+ typedef typename M::value_type VT;
+ M m;
+ const VT v1(2, 2.5);
+ R r = m.insert(m.end(), v1);
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(r->first == 2);
+ assert(r->second == 2.5);
- const VT v2(1, 1.5);
- r = m.insert(m.end(), v2);
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(r->first == 1);
- assert(r->second == 1.5);
+ const VT v2(1, 1.5);
+ r = m.insert(m.end(), v2);
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(r->first == 1);
+ assert(r->second == 1.5);
- const VT v3(3, 3.5);
- r = m.insert(m.end(), v3);
- assert(r == std::prev(m.end()));
- assert(m.size() == 3);
- assert(r->first == 3);
- assert(r->second == 3.5);
+ const VT v3(3, 3.5);
+ r = m.insert(m.end(), v3);
+ assert(r == std::prev(m.end()));
+ assert(m.size() == 3);
+ assert(r->first == 3);
+ assert(r->second == 3.5);
- const VT v4(3, 4.5);
- r = m.insert(std::prev(m.end()), v4);
- assert(r == std::prev(m.end(), 2));
- assert(m.size() == 4);
- assert(r->first == 3);
- assert(r->second == 4.5);
+ const VT v4(3, 4.5);
+ r = m.insert(std::prev(m.end()), v4);
+ assert(r == std::prev(m.end(), 2));
+ assert(m.size() == 4);
+ assert(r->first == 3);
+ assert(r->second == 4.5);
}
-int main(int, char**)
-{
- do_insert_hint_test<std::multimap<int, double> >();
+int main(int, char**) {
+ do_insert_hint_test<std::multimap<int, double> >();
#if TEST_STD_VER >= 11
- {
- typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
- do_insert_hint_test<M>();
- }
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ do_insert_hint_test<M>();
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_iter.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_iter.pass.cpp
index 585f45a9bb852db..12df31e9dd6e7e7 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_iter.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_iter.pass.cpp
@@ -20,83 +20,80 @@
#include "test_iterators.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::multimap<int, double> M;
- typedef std::pair<int, double> P;
- P ar[] =
- {
- P(1, 1),
- P(1, 1.5),
- P(1, 2),
- P(2, 1),
- P(2, 1.5),
- P(2, 2),
- P(3, 1),
- P(3, 1.5),
- P(3, 2),
- };
- M m;
- m.insert(cpp17_input_iterator<P*>(ar), cpp17_input_iterator<P*>(ar + sizeof(ar)/sizeof(ar[0])));
- assert(m.size() == 9);
- assert(m.begin()->first == 1);
- assert(m.begin()->second == 1);
- assert(std::next(m.begin())->first == 1);
- assert(std::next(m.begin())->second == 1.5);
- assert(std::next(m.begin(), 2)->first == 1);
- assert(std::next(m.begin(), 2)->second == 2);
- assert(std::next(m.begin(), 3)->first == 2);
- assert(std::next(m.begin(), 3)->second == 1);
- assert(std::next(m.begin(), 4)->first == 2);
- assert(std::next(m.begin(), 4)->second == 1.5);
- assert(std::next(m.begin(), 5)->first == 2);
- assert(std::next(m.begin(), 5)->second == 2);
- assert(std::next(m.begin(), 6)->first == 3);
- assert(std::next(m.begin(), 6)->second == 1);
- assert(std::next(m.begin(), 7)->first == 3);
- assert(std::next(m.begin(), 7)->second == 1.5);
- assert(std::next(m.begin(), 8)->first == 3);
- assert(std::next(m.begin(), 8)->second == 2);
- }
+int main(int, char**) {
+ {
+ typedef std::multimap<int, double> M;
+ typedef std::pair<int, double> P;
+ P ar[] = {
+ P(1, 1),
+ P(1, 1.5),
+ P(1, 2),
+ P(2, 1),
+ P(2, 1.5),
+ P(2, 2),
+ P(3, 1),
+ P(3, 1.5),
+ P(3, 2),
+ };
+ M m;
+ m.insert(cpp17_input_iterator<P*>(ar), cpp17_input_iterator<P*>(ar + sizeof(ar) / sizeof(ar[0])));
+ assert(m.size() == 9);
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == 1);
+ assert(std::next(m.begin())->first == 1);
+ assert(std::next(m.begin())->second == 1.5);
+ assert(std::next(m.begin(), 2)->first == 1);
+ assert(std::next(m.begin(), 2)->second == 2);
+ assert(std::next(m.begin(), 3)->first == 2);
+ assert(std::next(m.begin(), 3)->second == 1);
+ assert(std::next(m.begin(), 4)->first == 2);
+ assert(std::next(m.begin(), 4)->second == 1.5);
+ assert(std::next(m.begin(), 5)->first == 2);
+ assert(std::next(m.begin(), 5)->second == 2);
+ assert(std::next(m.begin(), 6)->first == 3);
+ assert(std::next(m.begin(), 6)->second == 1);
+ assert(std::next(m.begin(), 7)->first == 3);
+ assert(std::next(m.begin(), 7)->second == 1.5);
+ assert(std::next(m.begin(), 8)->first == 3);
+ assert(std::next(m.begin(), 8)->second == 2);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
- typedef std::pair<int, double> P;
- P ar[] =
- {
- P(1, 1),
- P(1, 1.5),
- P(1, 2),
- P(2, 1),
- P(2, 1.5),
- P(2, 2),
- P(3, 1),
- P(3, 1.5),
- P(3, 2),
- };
- M m;
- m.insert(cpp17_input_iterator<P*>(ar), cpp17_input_iterator<P*>(ar + sizeof(ar)/sizeof(ar[0])));
- assert(m.size() == 9);
- assert(m.begin()->first == 1);
- assert(m.begin()->second == 1);
- assert(std::next(m.begin())->first == 1);
- assert(std::next(m.begin())->second == 1.5);
- assert(std::next(m.begin(), 2)->first == 1);
- assert(std::next(m.begin(), 2)->second == 2);
- assert(std::next(m.begin(), 3)->first == 2);
- assert(std::next(m.begin(), 3)->second == 1);
- assert(std::next(m.begin(), 4)->first == 2);
- assert(std::next(m.begin(), 4)->second == 1.5);
- assert(std::next(m.begin(), 5)->first == 2);
- assert(std::next(m.begin(), 5)->second == 2);
- assert(std::next(m.begin(), 6)->first == 3);
- assert(std::next(m.begin(), 6)->second == 1);
- assert(std::next(m.begin(), 7)->first == 3);
- assert(std::next(m.begin(), 7)->second == 1.5);
- assert(std::next(m.begin(), 8)->first == 3);
- assert(std::next(m.begin(), 8)->second == 2);
- }
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef std::pair<int, double> P;
+ P ar[] = {
+ P(1, 1),
+ P(1, 1.5),
+ P(1, 2),
+ P(2, 1),
+ P(2, 1.5),
+ P(2, 2),
+ P(3, 1),
+ P(3, 1.5),
+ P(3, 2),
+ };
+ M m;
+ m.insert(cpp17_input_iterator<P*>(ar), cpp17_input_iterator<P*>(ar + sizeof(ar) / sizeof(ar[0])));
+ assert(m.size() == 9);
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == 1);
+ assert(std::next(m.begin())->first == 1);
+ assert(std::next(m.begin())->second == 1.5);
+ assert(std::next(m.begin(), 2)->first == 1);
+ assert(std::next(m.begin(), 2)->second == 2);
+ assert(std::next(m.begin(), 3)->first == 2);
+ assert(std::next(m.begin(), 3)->second == 1);
+ assert(std::next(m.begin(), 4)->first == 2);
+ assert(std::next(m.begin(), 4)->second == 1.5);
+ assert(std::next(m.begin(), 5)->first == 2);
+ assert(std::next(m.begin(), 5)->second == 2);
+ assert(std::next(m.begin(), 6)->first == 3);
+ assert(std::next(m.begin(), 6)->second == 1);
+ assert(std::next(m.begin(), 7)->first == 3);
+ assert(std::next(m.begin(), 7)->second == 1.5);
+ assert(std::next(m.begin(), 8)->first == 3);
+ assert(std::next(m.begin(), 8)->second == 2);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_rv.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_rv.pass.cpp
index bd90b3c9ba32f43..a56f237eb63ac53 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_rv.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_rv.pass.cpp
@@ -23,78 +23,75 @@
#include "test_macros.h"
template <class Container, class Pair>
-void do_insert_rv_test()
-{
- typedef Container M;
- typedef Pair P;
- typedef typename M::iterator R;
+void do_insert_rv_test() {
+ typedef Container M;
+ typedef Pair P;
+ typedef typename M::iterator R;
+ M m;
+ R r = m.insert(m.cend(), P(2, 2));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(r->first == 2);
+ assert(r->second == 2);
+
+ r = m.insert(m.cend(), P(1, 1));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(r->first == 1);
+ assert(r->second == 1);
+
+ r = m.insert(m.cend(), P(3, 3));
+ assert(r == std::prev(m.end()));
+ assert(m.size() == 3);
+ assert(r->first == 3);
+ assert(r->second == 3);
+
+ r = m.insert(m.cend(), P(3, 2));
+ assert(r == std::prev(m.end()));
+ assert(m.size() == 4);
+ assert(r->first == 3);
+ assert(r->second == 2);
+}
+
+int main(int, char**) {
+ do_insert_rv_test<std::multimap<int, MoveOnly>, std::pair<int, MoveOnly> >();
+ do_insert_rv_test<std::multimap<int, MoveOnly>, std::pair<const int, MoveOnly> >();
+
+ {
+ typedef std::multimap<int, MoveOnly, std::less<int>, min_allocator<std::pair<const int, MoveOnly>>> M;
+ typedef std::pair<int, MoveOnly> P;
+ typedef std::pair<const int, MoveOnly> CP;
+ do_insert_rv_test<M, P>();
+ do_insert_rv_test<M, CP>();
+ }
+ {
+ typedef std::multimap<int, MoveOnly> M;
+ typedef M::iterator R;
M m;
- R r = m.insert(m.cend(), P(2, 2));
+ R r = m.insert(m.cend(), {2, MoveOnly(2)});
assert(r == m.begin());
assert(m.size() == 1);
assert(r->first == 2);
assert(r->second == 2);
- r = m.insert(m.cend(), P(1, 1));
+ r = m.insert(m.cend(), {1, MoveOnly(1)});
assert(r == m.begin());
assert(m.size() == 2);
assert(r->first == 1);
assert(r->second == 1);
- r = m.insert(m.cend(), P(3, 3));
+ r = m.insert(m.cend(), {3, MoveOnly(3)});
assert(r == std::prev(m.end()));
assert(m.size() == 3);
assert(r->first == 3);
assert(r->second == 3);
- r = m.insert(m.cend(), P(3, 2));
+ r = m.insert(m.cend(), {3, MoveOnly(2)});
assert(r == std::prev(m.end()));
assert(m.size() == 4);
assert(r->first == 3);
assert(r->second == 2);
-}
-
-int main(int, char**)
-{
- do_insert_rv_test<std::multimap<int, MoveOnly>, std::pair<int, MoveOnly> >();
- do_insert_rv_test<std::multimap<int, MoveOnly>, std::pair<const int, MoveOnly> >();
-
- {
- typedef std::multimap<int, MoveOnly, std::less<int>, min_allocator<std::pair<const int, MoveOnly>>> M;
- typedef std::pair<int, MoveOnly> P;
- typedef std::pair<const int, MoveOnly> CP;
- do_insert_rv_test<M, P>();
- do_insert_rv_test<M, CP>();
-
- }
- {
- typedef std::multimap<int, MoveOnly> M;
- typedef M::iterator R;
- M m;
- R r = m.insert(m.cend(), {2, MoveOnly(2)});
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(r->first == 2);
- assert(r->second == 2);
-
- r = m.insert(m.cend(), {1, MoveOnly(1)});
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(r->first == 1);
- assert(r->second == 1);
-
- r = m.insert(m.cend(), {3, MoveOnly(3)});
- assert(r == std::prev(m.end()));
- assert(m.size() == 3);
- assert(r->first == 3);
- assert(r->second == 3);
-
- r = m.insert(m.cend(), {3, MoveOnly(2)});
- assert(r == std::prev(m.end()));
- assert(m.size() == 4);
- assert(r->first == 3);
- assert(r->second == 2);
- }
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_node_type.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_node_type.pass.cpp
index 8334bbef5c95879..a488bc6617ccbe7 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_node_type.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_node_type.pass.cpp
@@ -21,60 +21,54 @@
template <class Container>
typename Container::node_type
-node_factory(typename Container::key_type const& key,
- typename Container::mapped_type const& mapped)
-{
- static Container c;
- auto it = c.insert({key, mapped});
- return c.extract(it);
+node_factory(typename Container::key_type const& key, typename Container::mapped_type const& mapped) {
+ static Container c;
+ auto it = c.insert({key, mapped});
+ return c.extract(it);
}
template <class Container>
-void test(Container& c)
-{
- auto* nf = &node_factory<Container>;
+void test(Container& c) {
+ auto* nf = &node_factory<Container>;
- for (int i = 0; i != 10; ++i)
- {
- typename Container::node_type node = nf(i, i + 1);
- assert(!node.empty());
- typename Container::iterator it = c.insert(std::move(node));
- assert(node.empty());
- assert(it == c.find(i) && it != c.end());
- }
+ for (int i = 0; i != 10; ++i) {
+ typename Container::node_type node = nf(i, i + 1);
+ assert(!node.empty());
+ typename Container::iterator it = c.insert(std::move(node));
+ assert(node.empty());
+ assert(it == c.find(i) && it != c.end());
+ }
- assert(c.size() == 10);
+ assert(c.size() == 10);
- { // Insert empty node.
- typename Container::node_type def;
- auto it = c.insert(std::move(def));
- assert(def.empty());
- assert(it == c.end());
- }
+ { // Insert empty node.
+ typename Container::node_type def;
+ auto it = c.insert(std::move(def));
+ assert(def.empty());
+ assert(it == c.end());
+ }
- { // Insert duplicate node.
- typename Container::node_type dupl = nf(0, 42);
- auto it = c.insert(std::move(dupl));
- assert(dupl.empty());
- assert(it != c.end());
- assert(it->second == 42);
- }
+ { // Insert duplicate node.
+ typename Container::node_type dupl = nf(0, 42);
+ auto it = c.insert(std::move(dupl));
+ assert(dupl.empty());
+ assert(it != c.end());
+ assert(it->second == 42);
+ }
- assert(c.size() == 11);
- assert(c.count(0) == 2);
- for (int i = 1; i != 10; ++i)
- {
- assert(c.count(i) == 1);
- assert(c.find(i)->second == i + 1);
- }
+ assert(c.size() == 11);
+ assert(c.count(0) == 2);
+ for (int i = 1; i != 10; ++i) {
+ assert(c.count(i) == 1);
+ assert(c.find(i)->second == i + 1);
+ }
}
-int main(int, char**)
-{
- std::multimap<int, int> m;
- test(m);
- std::multimap<int, int, std::less<int>, min_allocator<std::pair<const int, int>>> m2;
- test(m2);
+int main(int, char**) {
+ std::multimap<int, int> m;
+ test(m);
+ std::multimap<int, int, std::less<int>, min_allocator<std::pair<const int, int>>> m2;
+ test(m2);
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_node_type_hint.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_node_type_hint.pass.cpp
index 68e6b8b795f9d17..7e855801045b857 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_node_type_hint.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_node_type_hint.pass.cpp
@@ -20,47 +20,41 @@
template <class Container>
typename Container::node_type
-node_factory(typename Container::key_type const& key,
- typename Container::mapped_type const& mapped)
-{
- static Container c;
- auto it = c.insert({key, mapped});
- return c.extract(it);
+node_factory(typename Container::key_type const& key, typename Container::mapped_type const& mapped) {
+ static Container c;
+ auto it = c.insert({key, mapped});
+ return c.extract(it);
}
template <class Container>
-void test(Container& c)
-{
- auto* nf = &node_factory<Container>;
-
- for (int i = 0; i != 10; ++i)
- {
- typename Container::node_type node = nf(i, i + 1);
- assert(!node.empty());
- std::size_t prev = c.size();
- auto it = c.insert(c.end(), std::move(node));
- assert(node.empty());
- assert(prev + 1 == c.size());
- assert(it == c.find(i));
- assert(it->first == i);
- assert(it->second == i + 1);
- }
-
- assert(c.size() == 10);
-
- for (int i = 0; i != 10; ++i)
- {
- assert(c.count(i) == 1);
- assert(c.find(i)->second == i + 1);
- }
+void test(Container& c) {
+ auto* nf = &node_factory<Container>;
+
+ for (int i = 0; i != 10; ++i) {
+ typename Container::node_type node = nf(i, i + 1);
+ assert(!node.empty());
+ std::size_t prev = c.size();
+ auto it = c.insert(c.end(), std::move(node));
+ assert(node.empty());
+ assert(prev + 1 == c.size());
+ assert(it == c.find(i));
+ assert(it->first == i);
+ assert(it->second == i + 1);
+ }
+
+ assert(c.size() == 10);
+
+ for (int i = 0; i != 10; ++i) {
+ assert(c.count(i) == 1);
+ assert(c.find(i)->second == i + 1);
+ }
}
-int main(int, char**)
-{
- std::multimap<int, int> m;
- test(m);
- std::multimap<int, int, std::less<int>, min_allocator<std::pair<const int, int>>> m2;
- test(m2);
+int main(int, char**) {
+ std::multimap<int, int> m;
+ test(m);
+ std::multimap<int, int, std::less<int>, min_allocator<std::pair<const int, int>>> m2;
+ test(m2);
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_range.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_range.pass.cpp
index a804cbf0cf20661..efd257a4f2c0e76 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_range.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_range.pass.cpp
@@ -23,10 +23,11 @@
int main(int, char**) {
// Note: we want to use a pair with non-const elements for input (an assignable type is a lot more convenient) but
// have to use the exact `value_type` of the map (that is, `pair<const K, V>`) for the allocator.
- using Pair = std::pair<int, char>;
+ using Pair = std::pair<int, char>;
using ConstPair = std::pair<const int, char>;
for_all_iterators_and_allocators<ConstPair, const Pair*>([]<class Iter, class Sent, class Alloc>() {
- test_map_set_insert_range<std::multimap<int, char, test_less<int>, Alloc>, Pair, Iter, Sent>(/*allow_duplicates=*/true);
+ test_map_set_insert_range<std::multimap<int, char, test_less<int>, Alloc>, Pair, Iter, Sent>(
+ /*allow_duplicates=*/true);
});
static_assert(test_map_constraints_insert_range<std::multimap, int, int, char, double>());
@@ -38,4 +39,3 @@ int main(int, char**) {
return 0;
}
-
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_rv.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_rv.pass.cpp
index 7933d69d2e3f0b2..bf32b996e18360f 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_rv.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_rv.pass.cpp
@@ -23,72 +23,70 @@
#include "test_macros.h"
template <class Container>
-void do_insert_rv_test()
-{
+void do_insert_rv_test() {
+ typedef std::multimap<int, MoveOnly> M;
+ typedef typename M::iterator R;
+ typedef typename M::value_type VT;
+ M m;
+ R r = m.insert(VT(2, 2));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(r->first == 2);
+ assert(r->second == 2);
+
+ r = m.insert(VT(1, 1));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(r->first == 1);
+ assert(r->second == 1);
+
+ r = m.insert(VT(3, 3));
+ assert(r == std::prev(m.end()));
+ assert(m.size() == 3);
+ assert(r->first == 3);
+ assert(r->second == 3);
+
+ r = m.insert(VT(3, 3));
+ assert(r == std::prev(m.end()));
+ assert(m.size() == 4);
+ assert(r->first == 3);
+ assert(r->second == 3);
+}
+
+int main(int, char**) {
+ do_insert_rv_test<std::multimap<int, MoveOnly>>();
+ {
+ typedef std::multimap<int, MoveOnly, std::less<int>, min_allocator<std::pair<const int, MoveOnly>>> M;
+ do_insert_rv_test<M>();
+ }
+ {
typedef std::multimap<int, MoveOnly> M;
- typedef typename M::iterator R;
- typedef typename M::value_type VT;
+ typedef M::iterator R;
M m;
- R r = m.insert(VT(2, 2));
+ R r = m.insert({2, MoveOnly(2)});
assert(r == m.begin());
assert(m.size() == 1);
assert(r->first == 2);
assert(r->second == 2);
- r = m.insert(VT(1, 1));
+ r = m.insert({1, MoveOnly(1)});
assert(r == m.begin());
assert(m.size() == 2);
assert(r->first == 1);
assert(r->second == 1);
- r = m.insert(VT(3, 3));
+ r = m.insert({3, MoveOnly(3)});
assert(r == std::prev(m.end()));
assert(m.size() == 3);
assert(r->first == 3);
assert(r->second == 3);
- r = m.insert(VT(3, 3));
+ r = m.insert({3, MoveOnly(3)});
assert(r == std::prev(m.end()));
assert(m.size() == 4);
assert(r->first == 3);
assert(r->second == 3);
-}
-
-int main(int, char**)
-{
- do_insert_rv_test<std::multimap<int, MoveOnly>>();
- {
- typedef std::multimap<int, MoveOnly, std::less<int>, min_allocator<std::pair<const int, MoveOnly>>> M;
- do_insert_rv_test<M>();
- }
- {
- typedef std::multimap<int, MoveOnly> M;
- typedef M::iterator R;
- M m;
- R r = m.insert({2, MoveOnly(2)});
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(r->first == 2);
- assert(r->second == 2);
-
- r = m.insert({1, MoveOnly(1)});
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(r->first == 1);
- assert(r->second == 1);
-
- r = m.insert({3, MoveOnly(3)});
- assert(r == std::prev(m.end()));
- assert(m.size() == 3);
- assert(r->first == 3);
- assert(r->second == 3);
-
- r = m.insert({3, MoveOnly(3)});
- assert(r == std::prev(m.end()));
- assert(m.size() == 4);
- assert(r->first == 3);
- assert(r->second == 3);
- }
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/merge.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/merge.pass.cpp
index 078932b1106c752..d7952763ca9bb81 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/merge.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/merge.pass.cpp
@@ -27,124 +27,113 @@
#include "Counter.h"
template <class Map>
-bool map_equal(const Map& map, Map other)
-{
- return map == other;
+bool map_equal(const Map& map, Map other) {
+ return map == other;
}
#ifndef TEST_HAS_NO_EXCEPTIONS
-struct throw_comparator
-{
- bool& should_throw_;
+struct throw_comparator {
+ bool& should_throw_;
- throw_comparator(bool& should_throw) : should_throw_(should_throw) {}
+ throw_comparator(bool& should_throw) : should_throw_(should_throw) {}
- template <class T>
- bool operator()(const T& lhs, const T& rhs) const
- {
- if (should_throw_)
- throw 0;
- return lhs < rhs;
- }
+ template <class T>
+ bool operator()(const T& lhs, const T& rhs) const {
+ if (should_throw_)
+ throw 0;
+ return lhs < rhs;
+ }
};
#endif
-int main(int, char**)
-{
- {
- std::multimap<int, int> src{{1, 0}, {3, 0}, {5, 0}};
- std::multimap<int, int> dst{{2, 0}, {4, 0}, {5, 0}};
- dst.merge(src);
- assert(map_equal(src, {}));
- assert(map_equal(dst, {{1, 0}, {2, 0}, {3, 0}, {4, 0}, {5, 0}, {5, 0}}));
- }
+int main(int, char**) {
+ {
+ std::multimap<int, int> src{{1, 0}, {3, 0}, {5, 0}};
+ std::multimap<int, int> dst{{2, 0}, {4, 0}, {5, 0}};
+ dst.merge(src);
+ assert(map_equal(src, {}));
+ assert(map_equal(dst, {{1, 0}, {2, 0}, {3, 0}, {4, 0}, {5, 0}, {5, 0}}));
+ }
#ifndef TEST_HAS_NO_EXCEPTIONS
- {
- bool do_throw = false;
- typedef std::multimap<Counter<int>, int, throw_comparator> map_type;
- map_type src({{1, 0}, {3, 0}, {5, 0}}, throw_comparator(do_throw));
- map_type dst({{2, 0}, {4, 0}, {5, 0}}, throw_comparator(do_throw));
-
- assert(Counter_base::gConstructed == 6);
-
- do_throw = true;
- try
- {
- dst.merge(src);
- }
- catch (int)
- {
- do_throw = false;
- }
- assert(!do_throw);
- assert(map_equal(src, map_type({{1, 0}, {3, 0}, {5, 0}}, throw_comparator(do_throw))));
- assert(map_equal(dst, map_type({{2, 0}, {4, 0}, {5, 0}}, throw_comparator(do_throw))));
+ {
+ bool do_throw = false;
+ typedef std::multimap<Counter<int>, int, throw_comparator> map_type;
+ map_type src({{1, 0}, {3, 0}, {5, 0}}, throw_comparator(do_throw));
+ map_type dst({{2, 0}, {4, 0}, {5, 0}}, throw_comparator(do_throw));
+
+ assert(Counter_base::gConstructed == 6);
+
+ do_throw = true;
+ try {
+ dst.merge(src);
+ } catch (int) {
+ do_throw = false;
}
+ assert(!do_throw);
+ assert(map_equal(src, map_type({{1, 0}, {3, 0}, {5, 0}}, throw_comparator(do_throw))));
+ assert(map_equal(dst, map_type({{2, 0}, {4, 0}, {5, 0}}, throw_comparator(do_throw))));
+ }
#endif
- assert(Counter_base::gConstructed == 0);
- struct comparator
- {
- comparator() = default;
+ assert(Counter_base::gConstructed == 0);
+ struct comparator {
+ comparator() = default;
- bool operator()(const Counter<int>& lhs, const Counter<int>& rhs) const
- {
- return lhs < rhs;
- }
- };
- {
- typedef std::multimap<Counter<int>, int, std::less<Counter<int>>> first_map_type;
- typedef std::multimap<Counter<int>, int, comparator> second_map_type;
- typedef std::map<Counter<int>, int, comparator> third_map_type;
+ bool operator()(const Counter<int>& lhs, const Counter<int>& rhs) const { return lhs < rhs; }
+ };
+ {
+ typedef std::multimap<Counter<int>, int, std::less<Counter<int>>> first_map_type;
+ typedef std::multimap<Counter<int>, int, comparator> second_map_type;
+ typedef std::map<Counter<int>, int, comparator> third_map_type;
- {
- first_map_type first{{1, 0}, {2, 0}, {3, 0}};
- second_map_type second{{2, 0}, {3, 0}, {4, 0}};
- third_map_type third{{1, 0}, {3, 0}};
+ {
+ first_map_type first{{1, 0}, {2, 0}, {3, 0}};
+ second_map_type second{{2, 0}, {3, 0}, {4, 0}};
+ third_map_type third{{1, 0}, {3, 0}};
- assert(Counter_base::gConstructed == 8);
+ assert(Counter_base::gConstructed == 8);
- first.merge(second);
- first.merge(third);
+ first.merge(second);
+ first.merge(third);
- assert(map_equal(first, {{1, 0}, {1, 0}, {2, 0}, {2, 0}, {3, 0}, {3, 0}, {3, 0}, {4, 0}}));
- assert(map_equal(second, {}));
- assert(map_equal(third, {}));
+ assert(map_equal(first, {{1, 0}, {1, 0}, {2, 0}, {2, 0}, {3, 0}, {3, 0}, {3, 0}, {4, 0}}));
+ assert(map_equal(second, {}));
+ assert(map_equal(third, {}));
- assert(Counter_base::gConstructed == 8);
- }
- assert(Counter_base::gConstructed == 0);
- {
- first_map_type first{{1, 0}, {2, 0}, {3, 0}};
- second_map_type second{{2, 0}, {3, 0}, {4, 0}};
- third_map_type third{{1, 0}, {3, 0}};
+ assert(Counter_base::gConstructed == 8);
+ }
+ assert(Counter_base::gConstructed == 0);
+ {
+ first_map_type first{{1, 0}, {2, 0}, {3, 0}};
+ second_map_type second{{2, 0}, {3, 0}, {4, 0}};
+ third_map_type third{{1, 0}, {3, 0}};
- assert(Counter_base::gConstructed == 8);
+ assert(Counter_base::gConstructed == 8);
- first.merge(std::move(second));
- first.merge(std::move(third));
+ first.merge(std::move(second));
+ first.merge(std::move(third));
- assert(map_equal(first, {{1, 0}, {1, 0}, {2, 0}, {2, 0}, {3, 0}, {3, 0}, {3, 0}, {4, 0}}));
- assert(map_equal(second, {}));
- assert(map_equal(third, {}));
+ assert(map_equal(first, {{1, 0}, {1, 0}, {2, 0}, {2, 0}, {3, 0}, {3, 0}, {3, 0}, {4, 0}}));
+ assert(map_equal(second, {}));
+ assert(map_equal(third, {}));
- assert(Counter_base::gConstructed == 8);
- }
- assert(Counter_base::gConstructed == 0);
+ assert(Counter_base::gConstructed == 8);
}
assert(Counter_base::gConstructed == 0);
+ }
+ assert(Counter_base::gConstructed == 0);
+ {
+ std::multimap<int, int> first;
+ {
+ std::multimap<int, int> second;
+ first.merge(second);
+ first.merge(std::move(second));
+ }
{
- std::multimap<int, int> first;
- {
- std::multimap<int, int> second;
- first.merge(second);
- first.merge(std::move(second));
- }
- {
- std::multimap<int, int> second;
- first.merge(second);
- first.merge(std::move(second));
- }
+ std::multimap<int, int> second;
+ first.merge(second);
+ first.merge(std::move(second));
}
- return 0;
+ }
+ return 0;
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.nonmember/op_compare.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.nonmember/op_compare.pass.cpp
index be2143c68be7d19..fe5f401e19b5cd5 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.nonmember/op_compare.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.nonmember/op_compare.pass.cpp
@@ -39,52 +39,52 @@
#include "test_comparisons.h"
int main(int, char**) {
- typedef std::multimap<int, std::string> map_type;
- typedef map_type::value_type value_type;
- {
- map_type m1, m2;
- m1.insert(value_type(1, "abc"));
- m2.insert(value_type(2, "abc"));
- const map_type& cm1 = m1, cm2 = m2;
- assert(testComparisons(cm1, cm2, false, true));
- }
- {
- map_type m1, m2;
- m1.insert(value_type(1, "abc"));
- m2.insert(value_type(1, "abc"));
- const map_type& cm1 = m1, cm2 = m2;
- assert(testComparisons(cm1, cm2, true, false));
- }
- {
- map_type m1, m2;
- m1.insert(value_type(1, "ab"));
- m2.insert(value_type(1, "abc"));
- const map_type& cm1 = m1, cm2 = m2;
- assert(testComparisons(cm1, cm2, false, true));
- }
- {
- map_type m1, m2;
- m1.insert(value_type(1, "abc"));
- m2.insert(value_type(1, "bcd"));
- const map_type& cm1 = m1, cm2 = m2;
- assert(testComparisons(cm1, cm2, false, true));
- }
- {
- map_type m1, m2;
- m1.insert(value_type(1, "abc"));
- m2.insert(value_type(1, "abc"));
- m2.insert(value_type(2, "abc"));
- const map_type& cm1 = m1, cm2 = m2;
- assert(testComparisons(cm1, cm2, false, true));
- }
- {
- map_type m1, m2;
- m1.insert(value_type(1, "abc"));
- m2.insert(value_type(1, "abc"));
- m2.insert(value_type(1, "abc"));
- m2.insert(value_type(1, "bcd"));
- const map_type& cm1 = m1, cm2 = m2;
- assert(testComparisons(cm1, cm2, false, true));
- }
- return 0;
+ typedef std::multimap<int, std::string> map_type;
+ typedef map_type::value_type value_type;
+ {
+ map_type m1, m2;
+ m1.insert(value_type(1, "abc"));
+ m2.insert(value_type(2, "abc"));
+ const map_type &cm1 = m1, cm2 = m2;
+ assert(testComparisons(cm1, cm2, false, true));
+ }
+ {
+ map_type m1, m2;
+ m1.insert(value_type(1, "abc"));
+ m2.insert(value_type(1, "abc"));
+ const map_type &cm1 = m1, cm2 = m2;
+ assert(testComparisons(cm1, cm2, true, false));
+ }
+ {
+ map_type m1, m2;
+ m1.insert(value_type(1, "ab"));
+ m2.insert(value_type(1, "abc"));
+ const map_type &cm1 = m1, cm2 = m2;
+ assert(testComparisons(cm1, cm2, false, true));
+ }
+ {
+ map_type m1, m2;
+ m1.insert(value_type(1, "abc"));
+ m2.insert(value_type(1, "bcd"));
+ const map_type &cm1 = m1, cm2 = m2;
+ assert(testComparisons(cm1, cm2, false, true));
+ }
+ {
+ map_type m1, m2;
+ m1.insert(value_type(1, "abc"));
+ m2.insert(value_type(1, "abc"));
+ m2.insert(value_type(2, "abc"));
+ const map_type &cm1 = m1, cm2 = m2;
+ assert(testComparisons(cm1, cm2, false, true));
+ }
+ {
+ map_type m1, m2;
+ m1.insert(value_type(1, "abc"));
+ m2.insert(value_type(1, "abc"));
+ m2.insert(value_type(1, "abc"));
+ m2.insert(value_type(1, "bcd"));
+ const map_type &cm1 = m1, cm2 = m2;
+ assert(testComparisons(cm1, cm2, false, true));
+ }
+ return 0;
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.observers/key_comp.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.observers/key_comp.pass.cpp
index cc6b18c1b0e01ed..29cdecd6fef48fb 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.observers/key_comp.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.observers/key_comp.pass.cpp
@@ -15,16 +15,16 @@
#include <string>
int main(int, char**) {
- typedef std::multimap<int, std::string> map_type;
+ typedef std::multimap<int, std::string> map_type;
- map_type m;
- map_type::iterator i1 = m.insert(map_type::value_type(1, "abc"));
- map_type::iterator i2 = m.insert(map_type::value_type(2, "abc"));
+ map_type m;
+ map_type::iterator i1 = m.insert(map_type::value_type(1, "abc"));
+ map_type::iterator i2 = m.insert(map_type::value_type(2, "abc"));
- const map_type& cm = m;
+ const map_type& cm = m;
- assert(cm.key_comp()(i1->first, i2->first));
- assert(!cm.key_comp()(i2->first, i1->first));
+ assert(cm.key_comp()(i1->first, i2->first));
+ assert(!cm.key_comp()(i2->first, i1->first));
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.observers/value_comp.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.observers/value_comp.pass.cpp
index 3b9ed80598c4614..542ed6d71c8d177 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.observers/value_comp.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.observers/value_comp.pass.cpp
@@ -15,16 +15,16 @@
#include <string>
int main(int, char**) {
- typedef std::multimap<int, std::string> map_type;
+ typedef std::multimap<int, std::string> map_type;
- map_type m;
- map_type::iterator i1 = m.insert(map_type::value_type(1, "abc"));
- map_type::iterator i2 = m.insert(map_type::value_type(2, "abc"));
+ map_type m;
+ map_type::iterator i1 = m.insert(map_type::value_type(1, "abc"));
+ map_type::iterator i2 = m.insert(map_type::value_type(2, "abc"));
- const map_type& cm = m;
+ const map_type& cm = m;
- assert(cm.value_comp()(*i1, *i2));
- assert(!cm.value_comp()(*i2, *i1));
+ assert(cm.value_comp()(*i1, *i2));
+ assert(!cm.value_comp()(*i2, *i1));
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.ops/count.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/count.pass.cpp
index 40b855b11e96f26..8dfda74577e35ad 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.ops/count.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.ops/count.pass.cpp
@@ -20,95 +20,61 @@
#include "private_constructor.h"
#include "is_transparent.h"
-int main(int, char**)
-{
- typedef std::pair<const int, double> V;
- {
+int main(int, char**) {
+ typedef std::pair<const int, double> V;
+ {
typedef std::multimap<int, double> M;
{
- typedef M::size_type R;
- V ar[] =
- {
- V(5, 1),
- V(5, 2),
- V(5, 3),
- V(7, 1),
- V(7, 2),
- V(7, 3),
- V(9, 1),
- V(9, 2),
- V(9, 3)
- };
- const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.count(4);
- assert(r == 0);
- r = m.count(5);
- assert(r == 3);
- r = m.count(6);
- assert(r == 0);
- r = m.count(7);
- assert(r == 3);
- r = m.count(8);
- assert(r == 0);
- r = m.count(9);
- assert(r == 3);
- r = m.count(10);
- assert(r == 0);
- }
+ typedef M::size_type R;
+ V ar[] = {V(5, 1), V(5, 2), V(5, 3), V(7, 1), V(7, 2), V(7, 3), V(9, 1), V(9, 2), V(9, 3)};
+ const M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.count(4);
+ assert(r == 0);
+ r = m.count(5);
+ assert(r == 3);
+ r = m.count(6);
+ assert(r == 0);
+ r = m.count(7);
+ assert(r == 3);
+ r = m.count(8);
+ assert(r == 0);
+ r = m.count(9);
+ assert(r == 3);
+ r = m.count(10);
+ assert(r == 0);
}
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
{
- typedef M::size_type R;
- V ar[] =
- {
- V(5, 1),
- V(5, 2),
- V(5, 3),
- V(7, 1),
- V(7, 2),
- V(7, 3),
- V(9, 1),
- V(9, 2),
- V(9, 3)
- };
- const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.count(4);
- assert(r == 0);
- r = m.count(5);
- assert(r == 3);
- r = m.count(6);
- assert(r == 0);
- r = m.count(7);
- assert(r == 3);
- r = m.count(8);
- assert(r == 0);
- r = m.count(9);
- assert(r == 3);
- r = m.count(10);
- assert(r == 0);
- }
+ typedef M::size_type R;
+ V ar[] = {V(5, 1), V(5, 2), V(5, 3), V(7, 1), V(7, 2), V(7, 3), V(9, 1), V(9, 2), V(9, 3)};
+ const M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.count(4);
+ assert(r == 0);
+ r = m.count(5);
+ assert(r == 3);
+ r = m.count(6);
+ assert(r == 0);
+ r = m.count(7);
+ assert(r == 3);
+ r = m.count(8);
+ assert(r == 0);
+ r = m.count(9);
+ assert(r == 3);
+ r = m.count(10);
+ assert(r == 0);
}
+ }
#endif
#if TEST_STD_VER > 11
- {
+ {
typedef std::multimap<int, double, std::less<>> M;
typedef M::size_type R;
- V ar[] =
- {
- V(5, 1),
- V(5, 2),
- V(5, 3),
- V(7, 1),
- V(7, 2),
- V(7, 3),
- V(9, 1),
- V(9, 2),
- V(9, 3)
- };
- const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ V ar[] = {V(5, 1), V(5, 2), V(5, 3), V(7, 1), V(7, 2), V(7, 3), V(9, 1), V(9, 2), V(9, 3)};
+ const M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
R r = m.count(4);
assert(r == 0);
r = m.count(5);
@@ -138,23 +104,23 @@ int main(int, char**)
assert(r == 3);
r = m.count(C2Int(10));
assert(r == 0);
- }
+ }
- {
+ {
typedef PrivateConstructor PC;
typedef std::multimap<PC, double, std::less<>> M;
typedef M::size_type R;
M m;
- m.insert ( std::make_pair<PC, double> ( PC::make(5), 1 ));
- m.insert ( std::make_pair<PC, double> ( PC::make(5), 2 ));
- m.insert ( std::make_pair<PC, double> ( PC::make(5), 3 ));
- m.insert ( std::make_pair<PC, double> ( PC::make(7), 1 ));
- m.insert ( std::make_pair<PC, double> ( PC::make(7), 2 ));
- m.insert ( std::make_pair<PC, double> ( PC::make(7), 3 ));
- m.insert ( std::make_pair<PC, double> ( PC::make(9), 1 ));
- m.insert ( std::make_pair<PC, double> ( PC::make(9), 2 ));
- m.insert ( std::make_pair<PC, double> ( PC::make(9), 3 ));
+ m.insert(std::make_pair<PC, double>(PC::make(5), 1));
+ m.insert(std::make_pair<PC, double>(PC::make(5), 2));
+ m.insert(std::make_pair<PC, double>(PC::make(5), 3));
+ m.insert(std::make_pair<PC, double>(PC::make(7), 1));
+ m.insert(std::make_pair<PC, double>(PC::make(7), 2));
+ m.insert(std::make_pair<PC, double>(PC::make(7), 3));
+ m.insert(std::make_pair<PC, double>(PC::make(9), 1));
+ m.insert(std::make_pair<PC, double>(PC::make(9), 2));
+ m.insert(std::make_pair<PC, double>(PC::make(9), 3));
R r = m.count(4);
assert(r == 0);
@@ -170,7 +136,7 @@ int main(int, char**)
assert(r == 3);
r = m.count(10);
assert(r == 0);
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.ops/count0.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/count0.pass.cpp
index bb220d553d513ff..233d1a11e1d6ce7 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.ops/count0.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.ops/count0.pass.cpp
@@ -18,23 +18,21 @@
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
-
#include <map>
#include <cassert>
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::multimap<int, double, transparent_less> M;
assert(M().count(C2Int{5}) == 0);
- }
- {
+ }
+ {
typedef std::multimap<int, double, transparent_less_not_referenceable> M;
assert(M().count(C2Int{5}) == 0);
- }
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.ops/count1.compile.fail.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/count1.compile.fail.cpp
index 46231adfdf7d164..48b7cee7b0132ad 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.ops/count1.compile.fail.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.ops/count1.compile.fail.cpp
@@ -18,16 +18,14 @@
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
-
#include <map>
#include <cassert>
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**)
-{
- typedef std::multimap<int, double, transparent_less_no_type> M;
+int main(int, char**) {
+ typedef std::multimap<int, double, transparent_less_no_type> M;
- TEST_IGNORE_NODISCARD M().count(C2Int{5});
+ TEST_IGNORE_NODISCARD M().count(C2Int{5});
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.ops/count2.compile.fail.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/count2.compile.fail.cpp
index f7324aa22adf322..dd8b3278ae76542 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.ops/count2.compile.fail.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.ops/count2.compile.fail.cpp
@@ -18,16 +18,14 @@
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
-
#include <map>
#include <cassert>
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**)
-{
- typedef std::multimap<int, double, transparent_less_private> M;
+int main(int, char**) {
+ typedef std::multimap<int, double, transparent_less_private> M;
- TEST_IGNORE_NODISCARD M().count(C2Int{5});
+ TEST_IGNORE_NODISCARD M().count(C2Int{5});
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.ops/count3.compile.fail.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/count3.compile.fail.cpp
index acceaae9db6459f..1cb7c48fc1087e5 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.ops/count3.compile.fail.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.ops/count3.compile.fail.cpp
@@ -18,16 +18,14 @@
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
-
#include <map>
#include <cassert>
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**)
-{
- typedef std::multimap<int, double, transparent_less_not_a_type> M;
+int main(int, char**) {
+ typedef std::multimap<int, double, transparent_less_not_a_type> M;
- TEST_IGNORE_NODISCARD M().count(C2Int{5});
+ TEST_IGNORE_NODISCARD M().count(C2Int{5});
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.ops/count_transparent.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/count_transparent.pass.cpp
index 4bb08c6d928cb54..d8dc81884388eba 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.ops/count_transparent.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.ops/count_transparent.pass.cpp
@@ -22,23 +22,15 @@
struct Comp {
using is_transparent = void;
- bool operator()(const std::pair<int, int> &lhs,
- const std::pair<int, int> &rhs) const {
- return lhs < rhs;
- }
-
- bool operator()(const std::pair<int, int> &lhs, int rhs) const {
- return lhs.first < rhs;
- }
-
- bool operator()(int lhs, const std::pair<int, int> &rhs) const {
- return lhs < rhs.first;
- }
+ bool operator()(const std::pair<int, int>& lhs, const std::pair<int, int>& rhs) const { return lhs < rhs; }
+
+ bool operator()(const std::pair<int, int>& lhs, int rhs) const { return lhs.first < rhs; }
+
+ bool operator()(int lhs, const std::pair<int, int>& rhs) const { return lhs < rhs.first; }
};
int main(int, char**) {
- std::multimap<std::pair<int, int>, int, Comp> s{
- {{2, 1}, 1}, {{1, 1}, 2}, {{1, 1}, 3}, {{1, 1}, 4}, {{2, 2}, 5}};
+ std::multimap<std::pair<int, int>, int, Comp> s{{{2, 1}, 1}, {{1, 1}, 2}, {{1, 1}, 3}, {{1, 1}, 4}, {{2, 2}, 5}};
auto cnt = s.count(1);
assert(cnt == 3);
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range.pass.cpp
index c134c779a40c76f..d06a04e40c6b06a 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range.pass.cpp
@@ -21,183 +21,127 @@
#include "private_constructor.h"
#include "is_transparent.h"
-int main(int, char**)
-{
- typedef std::pair<const int, double> V;
- {
+int main(int, char**) {
+ typedef std::pair<const int, double> V;
+ {
typedef std::multimap<int, double> M;
{
- typedef std::pair<M::iterator, M::iterator> R;
- V ar[] =
- {
- V(5, 1),
- V(5, 2),
- V(5, 3),
- V(7, 1),
- V(7, 2),
- V(7, 3),
- V(9, 1),
- V(9, 2),
- V(9, 3)
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.equal_range(4);
- assert(r.first == m.begin());
- assert(r.second == m.begin());
- r = m.equal_range(5);
- assert(r.first == m.begin());
- assert(r.second == std::next(m.begin(), 3));
- r = m.equal_range(6);
- assert(r.first == std::next(m.begin(), 3));
- assert(r.second == std::next(m.begin(), 3));
- r = m.equal_range(7);
- assert(r.first == std::next(m.begin(), 3));
- assert(r.second == std::next(m.begin(), 6));
- r = m.equal_range(8);
- assert(r.first == std::next(m.begin(), 6));
- assert(r.second == std::next(m.begin(), 6));
- r = m.equal_range(9);
- assert(r.first == std::next(m.begin(), 6));
- assert(r.second == std::next(m.begin(), 9));
- r = m.equal_range(10);
- assert(r.first == m.end());
- assert(r.second == m.end());
+ typedef std::pair<M::iterator, M::iterator> R;
+ V ar[] = {V(5, 1), V(5, 2), V(5, 3), V(7, 1), V(7, 2), V(7, 3), V(9, 1), V(9, 2), V(9, 3)};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.equal_range(4);
+ assert(r.first == m.begin());
+ assert(r.second == m.begin());
+ r = m.equal_range(5);
+ assert(r.first == m.begin());
+ assert(r.second == std::next(m.begin(), 3));
+ r = m.equal_range(6);
+ assert(r.first == std::next(m.begin(), 3));
+ assert(r.second == std::next(m.begin(), 3));
+ r = m.equal_range(7);
+ assert(r.first == std::next(m.begin(), 3));
+ assert(r.second == std::next(m.begin(), 6));
+ r = m.equal_range(8);
+ assert(r.first == std::next(m.begin(), 6));
+ assert(r.second == std::next(m.begin(), 6));
+ r = m.equal_range(9);
+ assert(r.first == std::next(m.begin(), 6));
+ assert(r.second == std::next(m.begin(), 9));
+ r = m.equal_range(10);
+ assert(r.first == m.end());
+ assert(r.second == m.end());
}
{
- typedef std::pair<M::const_iterator, M::const_iterator> R;
- V ar[] =
- {
- V(5, 1),
- V(5, 2),
- V(5, 3),
- V(7, 1),
- V(7, 2),
- V(7, 3),
- V(9, 1),
- V(9, 2),
- V(9, 3)
- };
- const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.equal_range(4);
- assert(r.first == m.begin());
- assert(r.second == m.begin());
- r = m.equal_range(5);
- assert(r.first == m.begin());
- assert(r.second == std::next(m.begin(), 3));
- r = m.equal_range(6);
- assert(r.first == std::next(m.begin(), 3));
- assert(r.second == std::next(m.begin(), 3));
- r = m.equal_range(7);
- assert(r.first == std::next(m.begin(), 3));
- assert(r.second == std::next(m.begin(), 6));
- r = m.equal_range(8);
- assert(r.first == std::next(m.begin(), 6));
- assert(r.second == std::next(m.begin(), 6));
- r = m.equal_range(9);
- assert(r.first == std::next(m.begin(), 6));
- assert(r.second == std::next(m.begin(), 9));
- r = m.equal_range(10);
- assert(r.first == m.end());
- assert(r.second == m.end());
- }
+ typedef std::pair<M::const_iterator, M::const_iterator> R;
+ V ar[] = {V(5, 1), V(5, 2), V(5, 3), V(7, 1), V(7, 2), V(7, 3), V(9, 1), V(9, 2), V(9, 3)};
+ const M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.equal_range(4);
+ assert(r.first == m.begin());
+ assert(r.second == m.begin());
+ r = m.equal_range(5);
+ assert(r.first == m.begin());
+ assert(r.second == std::next(m.begin(), 3));
+ r = m.equal_range(6);
+ assert(r.first == std::next(m.begin(), 3));
+ assert(r.second == std::next(m.begin(), 3));
+ r = m.equal_range(7);
+ assert(r.first == std::next(m.begin(), 3));
+ assert(r.second == std::next(m.begin(), 6));
+ r = m.equal_range(8);
+ assert(r.first == std::next(m.begin(), 6));
+ assert(r.second == std::next(m.begin(), 6));
+ r = m.equal_range(9);
+ assert(r.first == std::next(m.begin(), 6));
+ assert(r.second == std::next(m.begin(), 9));
+ r = m.equal_range(10);
+ assert(r.first == m.end());
+ assert(r.second == m.end());
}
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
{
- typedef std::pair<M::iterator, M::iterator> R;
- V ar[] =
- {
- V(5, 1),
- V(5, 2),
- V(5, 3),
- V(7, 1),
- V(7, 2),
- V(7, 3),
- V(9, 1),
- V(9, 2),
- V(9, 3)
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.equal_range(4);
- assert(r.first == m.begin());
- assert(r.second == m.begin());
- r = m.equal_range(5);
- assert(r.first == m.begin());
- assert(r.second == std::next(m.begin(), 3));
- r = m.equal_range(6);
- assert(r.first == std::next(m.begin(), 3));
- assert(r.second == std::next(m.begin(), 3));
- r = m.equal_range(7);
- assert(r.first == std::next(m.begin(), 3));
- assert(r.second == std::next(m.begin(), 6));
- r = m.equal_range(8);
- assert(r.first == std::next(m.begin(), 6));
- assert(r.second == std::next(m.begin(), 6));
- r = m.equal_range(9);
- assert(r.first == std::next(m.begin(), 6));
- assert(r.second == std::next(m.begin(), 9));
- r = m.equal_range(10);
- assert(r.first == m.end());
- assert(r.second == m.end());
+ typedef std::pair<M::iterator, M::iterator> R;
+ V ar[] = {V(5, 1), V(5, 2), V(5, 3), V(7, 1), V(7, 2), V(7, 3), V(9, 1), V(9, 2), V(9, 3)};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.equal_range(4);
+ assert(r.first == m.begin());
+ assert(r.second == m.begin());
+ r = m.equal_range(5);
+ assert(r.first == m.begin());
+ assert(r.second == std::next(m.begin(), 3));
+ r = m.equal_range(6);
+ assert(r.first == std::next(m.begin(), 3));
+ assert(r.second == std::next(m.begin(), 3));
+ r = m.equal_range(7);
+ assert(r.first == std::next(m.begin(), 3));
+ assert(r.second == std::next(m.begin(), 6));
+ r = m.equal_range(8);
+ assert(r.first == std::next(m.begin(), 6));
+ assert(r.second == std::next(m.begin(), 6));
+ r = m.equal_range(9);
+ assert(r.first == std::next(m.begin(), 6));
+ assert(r.second == std::next(m.begin(), 9));
+ r = m.equal_range(10);
+ assert(r.first == m.end());
+ assert(r.second == m.end());
}
{
- typedef std::pair<M::const_iterator, M::const_iterator> R;
- V ar[] =
- {
- V(5, 1),
- V(5, 2),
- V(5, 3),
- V(7, 1),
- V(7, 2),
- V(7, 3),
- V(9, 1),
- V(9, 2),
- V(9, 3)
- };
- const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.equal_range(4);
- assert(r.first == m.begin());
- assert(r.second == m.begin());
- r = m.equal_range(5);
- assert(r.first == m.begin());
- assert(r.second == std::next(m.begin(), 3));
- r = m.equal_range(6);
- assert(r.first == std::next(m.begin(), 3));
- assert(r.second == std::next(m.begin(), 3));
- r = m.equal_range(7);
- assert(r.first == std::next(m.begin(), 3));
- assert(r.second == std::next(m.begin(), 6));
- r = m.equal_range(8);
- assert(r.first == std::next(m.begin(), 6));
- assert(r.second == std::next(m.begin(), 6));
- r = m.equal_range(9);
- assert(r.first == std::next(m.begin(), 6));
- assert(r.second == std::next(m.begin(), 9));
- r = m.equal_range(10);
- assert(r.first == m.end());
- assert(r.second == m.end());
- }
+ typedef std::pair<M::const_iterator, M::const_iterator> R;
+ V ar[] = {V(5, 1), V(5, 2), V(5, 3), V(7, 1), V(7, 2), V(7, 3), V(9, 1), V(9, 2), V(9, 3)};
+ const M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.equal_range(4);
+ assert(r.first == m.begin());
+ assert(r.second == m.begin());
+ r = m.equal_range(5);
+ assert(r.first == m.begin());
+ assert(r.second == std::next(m.begin(), 3));
+ r = m.equal_range(6);
+ assert(r.first == std::next(m.begin(), 3));
+ assert(r.second == std::next(m.begin(), 3));
+ r = m.equal_range(7);
+ assert(r.first == std::next(m.begin(), 3));
+ assert(r.second == std::next(m.begin(), 6));
+ r = m.equal_range(8);
+ assert(r.first == std::next(m.begin(), 6));
+ assert(r.second == std::next(m.begin(), 6));
+ r = m.equal_range(9);
+ assert(r.first == std::next(m.begin(), 6));
+ assert(r.second == std::next(m.begin(), 9));
+ r = m.equal_range(10);
+ assert(r.first == m.end());
+ assert(r.second == m.end());
}
+ }
#endif
#if TEST_STD_VER > 11
- {
+ {
typedef std::multimap<int, double, std::less<>> M;
typedef std::pair<M::iterator, M::iterator> R;
- V ar[] =
- {
- V(5, 1),
- V(5, 2),
- V(5, 3),
- V(7, 1),
- V(7, 2),
- V(7, 3),
- V(9, 1),
- V(9, 2),
- V(9, 3)
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ V ar[] = {V(5, 1), V(5, 2), V(5, 3), V(7, 1), V(7, 2), V(7, 3), V(9, 1), V(9, 2), V(9, 3)};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
R r = m.equal_range(4);
assert(r.first == m.begin());
assert(r.second == m.begin());
@@ -241,25 +185,25 @@ int main(int, char**)
r = m.equal_range(C2Int(10));
assert(r.first == m.end());
assert(r.second == m.end());
- }
+ }
- {
+ {
typedef PrivateConstructor PC;
typedef std::multimap<PC, double, std::less<>> M;
typedef std::pair<M::iterator, M::iterator> R;
M m;
- m.insert ( std::make_pair<PC, double> ( PC::make(5), 1 ));
- m.insert ( std::make_pair<PC, double> ( PC::make(5), 2 ));
- m.insert ( std::make_pair<PC, double> ( PC::make(5), 3 ));
- m.insert ( std::make_pair<PC, double> ( PC::make(7), 1 ));
- m.insert ( std::make_pair<PC, double> ( PC::make(7), 2 ));
- m.insert ( std::make_pair<PC, double> ( PC::make(7), 3 ));
- m.insert ( std::make_pair<PC, double> ( PC::make(9), 1 ));
- m.insert ( std::make_pair<PC, double> ( PC::make(9), 2 ));
- m.insert ( std::make_pair<PC, double> ( PC::make(9), 3 ));
+ m.insert(std::make_pair<PC, double>(PC::make(5), 1));
+ m.insert(std::make_pair<PC, double>(PC::make(5), 2));
+ m.insert(std::make_pair<PC, double>(PC::make(5), 3));
+ m.insert(std::make_pair<PC, double>(PC::make(7), 1));
+ m.insert(std::make_pair<PC, double>(PC::make(7), 2));
+ m.insert(std::make_pair<PC, double>(PC::make(7), 3));
+ m.insert(std::make_pair<PC, double>(PC::make(9), 1));
+ m.insert(std::make_pair<PC, double>(PC::make(9), 2));
+ m.insert(std::make_pair<PC, double>(PC::make(9), 3));
-// assert(m.size() == 9);
+ // assert(m.size() == 9);
R r = m.equal_range(4);
assert(r.first == m.begin());
assert(r.second == m.begin());
@@ -281,7 +225,7 @@ int main(int, char**)
r = m.equal_range(10);
assert(r.first == m.end());
assert(r.second == m.end());
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range0.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range0.pass.cpp
index 470ac4aae49055c..0bead6c7938dbaa 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range0.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range0.pass.cpp
@@ -19,29 +19,27 @@
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
-
#include <map>
#include <cassert>
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::multimap<int, double, transparent_less> M;
typedef std::pair<typename M::iterator, typename M::iterator> P;
M example;
P result = example.equal_range(C2Int{5});
assert(result.first == result.second);
- }
- {
+ }
+ {
typedef std::multimap<int, double, transparent_less_not_referenceable> M;
typedef std::pair<typename M::iterator, typename M::iterator> P;
M example;
P result = example.equal_range(C2Int{5});
assert(result.first == result.second);
- }
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range1.compile.fail.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range1.compile.fail.cpp
index dff6e13c2ec8c81..31ab8071553de5c 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range1.compile.fail.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range1.compile.fail.cpp
@@ -19,16 +19,14 @@
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
-
#include <map>
#include <cassert>
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**)
-{
- typedef std::multimap<int, double, transparent_less_no_type> M;
+int main(int, char**) {
+ typedef std::multimap<int, double, transparent_less_no_type> M;
- TEST_IGNORE_NODISCARD M().equal_range(C2Int{5});
+ TEST_IGNORE_NODISCARD M().equal_range(C2Int{5});
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range2.compile.fail.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range2.compile.fail.cpp
index a57c8404a5fc892..7b92baaed355b88 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range2.compile.fail.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range2.compile.fail.cpp
@@ -19,18 +19,16 @@
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
-
#include <map>
#include <cassert>
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::multimap<int, double, transparent_less_private> M;
TEST_IGNORE_NODISCARD M().equal_range(C2Int{5});
- }
+ }
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range3.compile.fail.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range3.compile.fail.cpp
index e215d0fe8b9968e..a5ce74a8175c8a7 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range3.compile.fail.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range3.compile.fail.cpp
@@ -19,18 +19,16 @@
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
-
#include <map>
#include <cassert>
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::multimap<int, double, transparent_less_not_a_type> M;
TEST_IGNORE_NODISCARD M().equal_range(C2Int{5});
- }
+ }
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range_transparent.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range_transparent.pass.cpp
index 4315d573c6e2c0b..f2caf36b1a4eea8 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range_transparent.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range_transparent.pass.cpp
@@ -25,25 +25,17 @@
struct Comp {
using is_transparent = void;
- bool operator()(const std::pair<int, int> &lhs,
- const std::pair<int, int> &rhs) const {
- return lhs < rhs;
- }
+ bool operator()(const std::pair<int, int>& lhs, const std::pair<int, int>& rhs) const { return lhs < rhs; }
- bool operator()(const std::pair<int, int> &lhs, int rhs) const {
- return lhs.first < rhs;
- }
+ bool operator()(const std::pair<int, int>& lhs, int rhs) const { return lhs.first < rhs; }
- bool operator()(int lhs, const std::pair<int, int> &rhs) const {
- return lhs < rhs.first;
- }
+ bool operator()(int lhs, const std::pair<int, int>& rhs) const { return lhs < rhs.first; }
};
int main(int, char**) {
- std::multimap<std::pair<int, int>, int, Comp> s{
- {{2, 1}, 1}, {{1, 1}, 2}, {{1, 1}, 3}, {{1, 1}, 4}, {{2, 2}, 5}};
+ std::multimap<std::pair<int, int>, int, Comp> s{{{2, 1}, 1}, {{1, 1}, 2}, {{1, 1}, 3}, {{1, 1}, 4}, {{2, 2}, 5}};
- auto er = s.equal_range(1);
+ auto er = s.equal_range(1);
long nels = 0;
for (auto it = er.first; it != er.second; it++) {
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.ops/find.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/find.pass.cpp
index 550e49a6ddf9a99..6d5018ff5263ec1 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.ops/find.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.ops/find.pass.cpp
@@ -21,189 +21,133 @@
#include "private_constructor.h"
#include "is_transparent.h"
-int main(int, char**)
-{
- typedef std::pair<const int, double> V;
- {
+int main(int, char**) {
+ typedef std::pair<const int, double> V;
+ {
typedef std::multimap<int, double> M;
{
- typedef M::iterator R;
- V ar[] =
- {
- V(5, 1),
- V(5, 2),
- V(5, 3),
- V(7, 1),
- V(7, 2),
- V(7, 3),
- V(9, 1),
- V(9, 2),
- V(9, 3)
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.find(5);
- assert(r == m.begin());
- r = m.find(6);
- assert(r == m.end());
- r = m.find(7);
- assert(r == std::next(m.begin(), 3));
- r = m.find(8);
- assert(r == m.end());
- r = m.find(9);
- assert(r == std::next(m.begin(), 6));
- r = m.find(10);
- assert(r == m.end());
+ typedef M::iterator R;
+ V ar[] = {V(5, 1), V(5, 2), V(5, 3), V(7, 1), V(7, 2), V(7, 3), V(9, 1), V(9, 2), V(9, 3)};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.find(5);
+ assert(r == m.begin());
+ r = m.find(6);
+ assert(r == m.end());
+ r = m.find(7);
+ assert(r == std::next(m.begin(), 3));
+ r = m.find(8);
+ assert(r == m.end());
+ r = m.find(9);
+ assert(r == std::next(m.begin(), 6));
+ r = m.find(10);
+ assert(r == m.end());
}
{
- typedef M::const_iterator R;
- V ar[] =
- {
- V(5, 1),
- V(5, 2),
- V(5, 3),
- V(7, 1),
- V(7, 2),
- V(7, 3),
- V(9, 1),
- V(9, 2),
- V(9, 3)
- };
- const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.find(5);
- assert(r == m.begin());
- r = m.find(6);
- assert(r == m.end());
- r = m.find(7);
- assert(r == std::next(m.begin(), 3));
- r = m.find(8);
- assert(r == m.end());
- r = m.find(9);
- assert(r == std::next(m.begin(), 6));
- r = m.find(10);
- assert(r == m.end());
- }
+ typedef M::const_iterator R;
+ V ar[] = {V(5, 1), V(5, 2), V(5, 3), V(7, 1), V(7, 2), V(7, 3), V(9, 1), V(9, 2), V(9, 3)};
+ const M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.find(5);
+ assert(r == m.begin());
+ r = m.find(6);
+ assert(r == m.end());
+ r = m.find(7);
+ assert(r == std::next(m.begin(), 3));
+ r = m.find(8);
+ assert(r == m.end());
+ r = m.find(9);
+ assert(r == std::next(m.begin(), 6));
+ r = m.find(10);
+ assert(r == m.end());
}
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
{
- typedef M::iterator R;
- V ar[] =
- {
- V(5, 1),
- V(5, 2),
- V(5, 3),
- V(7, 1),
- V(7, 2),
- V(7, 3),
- V(9, 1),
- V(9, 2),
- V(9, 3)
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.find(5);
- assert(r == m.begin());
- r = m.find(6);
- assert(r == m.end());
- r = m.find(7);
- assert(r == std::next(m.begin(), 3));
- r = m.find(8);
- assert(r == m.end());
- r = m.find(9);
- assert(r == std::next(m.begin(), 6));
- r = m.find(10);
- assert(r == m.end());
+ typedef M::iterator R;
+ V ar[] = {V(5, 1), V(5, 2), V(5, 3), V(7, 1), V(7, 2), V(7, 3), V(9, 1), V(9, 2), V(9, 3)};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.find(5);
+ assert(r == m.begin());
+ r = m.find(6);
+ assert(r == m.end());
+ r = m.find(7);
+ assert(r == std::next(m.begin(), 3));
+ r = m.find(8);
+ assert(r == m.end());
+ r = m.find(9);
+ assert(r == std::next(m.begin(), 6));
+ r = m.find(10);
+ assert(r == m.end());
}
{
- typedef M::const_iterator R;
- V ar[] =
- {
- V(5, 1),
- V(5, 2),
- V(5, 3),
- V(7, 1),
- V(7, 2),
- V(7, 3),
- V(9, 1),
- V(9, 2),
- V(9, 3)
- };
- const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.find(5);
- assert(r == m.begin());
- r = m.find(6);
- assert(r == m.end());
- r = m.find(7);
- assert(r == std::next(m.begin(), 3));
- r = m.find(8);
- assert(r == m.end());
- r = m.find(9);
- assert(r == std::next(m.begin(), 6));
- r = m.find(10);
- assert(r == m.end());
- }
+ typedef M::const_iterator R;
+ V ar[] = {V(5, 1), V(5, 2), V(5, 3), V(7, 1), V(7, 2), V(7, 3), V(9, 1), V(9, 2), V(9, 3)};
+ const M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.find(5);
+ assert(r == m.begin());
+ r = m.find(6);
+ assert(r == m.end());
+ r = m.find(7);
+ assert(r == std::next(m.begin(), 3));
+ r = m.find(8);
+ assert(r == m.end());
+ r = m.find(9);
+ assert(r == std::next(m.begin(), 6));
+ r = m.find(10);
+ assert(r == m.end());
}
+ }
#endif
#if TEST_STD_VER > 11
- {
+ {
typedef std::multimap<int, double, std::less<>> M;
typedef M::iterator R;
- V ar[] =
- {
- V(5, 1),
- V(5, 2),
- V(5, 3),
- V(7, 1),
- V(7, 2),
- V(7, 3),
- V(9, 1),
- V(9, 2),
- V(9, 3)
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.find(5);
- assert(r == m.begin());
- r = m.find(6);
- assert(r == m.end());
- r = m.find(7);
- assert(r == std::next(m.begin(), 3));
- r = m.find(8);
- assert(r == m.end());
- r = m.find(9);
- assert(r == std::next(m.begin(), 6));
- r = m.find(10);
- assert(r == m.end());
+ V ar[] = {V(5, 1), V(5, 2), V(5, 3), V(7, 1), V(7, 2), V(7, 3), V(9, 1), V(9, 2), V(9, 3)};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.find(5);
+ assert(r == m.begin());
+ r = m.find(6);
+ assert(r == m.end());
+ r = m.find(7);
+ assert(r == std::next(m.begin(), 3));
+ r = m.find(8);
+ assert(r == m.end());
+ r = m.find(9);
+ assert(r == std::next(m.begin(), 6));
+ r = m.find(10);
+ assert(r == m.end());
- r = m.find(C2Int(5));
- assert(r == m.begin());
- r = m.find(C2Int(6));
- assert(r == m.end());
- r = m.find(C2Int(7));
- assert(r == std::next(m.begin(), 3));
- r = m.find(C2Int(8));
- assert(r == m.end());
- r = m.find(C2Int(9));
- assert(r == std::next(m.begin(), 6));
- r = m.find(C2Int(10));
- assert(r == m.end());
- }
+ r = m.find(C2Int(5));
+ assert(r == m.begin());
+ r = m.find(C2Int(6));
+ assert(r == m.end());
+ r = m.find(C2Int(7));
+ assert(r == std::next(m.begin(), 3));
+ r = m.find(C2Int(8));
+ assert(r == m.end());
+ r = m.find(C2Int(9));
+ assert(r == std::next(m.begin(), 6));
+ r = m.find(C2Int(10));
+ assert(r == m.end());
+ }
- {
+ {
typedef PrivateConstructor PC;
typedef std::multimap<PC, double, std::less<>> M;
typedef M::iterator R;
M m;
- m.insert ( std::make_pair<PC, double> ( PC::make(5), 1 ));
- m.insert ( std::make_pair<PC, double> ( PC::make(5), 2 ));
- m.insert ( std::make_pair<PC, double> ( PC::make(5), 3 ));
- m.insert ( std::make_pair<PC, double> ( PC::make(7), 1 ));
- m.insert ( std::make_pair<PC, double> ( PC::make(7), 2 ));
- m.insert ( std::make_pair<PC, double> ( PC::make(7), 3 ));
- m.insert ( std::make_pair<PC, double> ( PC::make(9), 1 ));
- m.insert ( std::make_pair<PC, double> ( PC::make(9), 2 ));
- m.insert ( std::make_pair<PC, double> ( PC::make(9), 3 ));
+ m.insert(std::make_pair<PC, double>(PC::make(5), 1));
+ m.insert(std::make_pair<PC, double>(PC::make(5), 2));
+ m.insert(std::make_pair<PC, double>(PC::make(5), 3));
+ m.insert(std::make_pair<PC, double>(PC::make(7), 1));
+ m.insert(std::make_pair<PC, double>(PC::make(7), 2));
+ m.insert(std::make_pair<PC, double>(PC::make(7), 3));
+ m.insert(std::make_pair<PC, double>(PC::make(9), 1));
+ m.insert(std::make_pair<PC, double>(PC::make(9), 2));
+ m.insert(std::make_pair<PC, double>(PC::make(9), 3));
R r = m.find(5);
assert(r == m.begin());
@@ -217,7 +161,7 @@ int main(int, char**)
assert(r == std::next(m.begin(), 6));
r = m.find(10);
assert(r == m.end());
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.ops/find0.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/find0.pass.cpp
index d5f3969cd89e898..701d4e314e7a880 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.ops/find0.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.ops/find0.pass.cpp
@@ -19,25 +19,23 @@
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
-
#include <map>
#include <cassert>
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::multimap<int, double, transparent_less> M;
M example;
assert(example.find(C2Int{5}) == example.end());
- }
- {
+ }
+ {
typedef std::multimap<int, double, transparent_less_not_referenceable> M;
M example;
assert(example.find(C2Int{5}) == example.end());
- }
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.ops/find1.compile.fail.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/find1.compile.fail.cpp
index 162d334f275935e..170bd8b1aaba3a3 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.ops/find1.compile.fail.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.ops/find1.compile.fail.cpp
@@ -19,18 +19,16 @@
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
-
#include <map>
#include <cassert>
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::multimap<int, double, transparent_less_no_type> M;
TEST_IGNORE_NODISCARD M().find(C2Int{5});
- }
+ }
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.ops/find2.compile.fail.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/find2.compile.fail.cpp
index fe3756e0bba36ac..18eaa45ddd74127 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.ops/find2.compile.fail.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.ops/find2.compile.fail.cpp
@@ -19,18 +19,16 @@
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
-
#include <map>
#include <cassert>
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::multimap<int, double, transparent_less_private> M;
TEST_IGNORE_NODISCARD M().find(C2Int{5});
- }
+ }
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.ops/find3.compile.fail.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/find3.compile.fail.cpp
index b5cce4892890642..66263aa07a5b04d 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.ops/find3.compile.fail.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.ops/find3.compile.fail.cpp
@@ -19,18 +19,16 @@
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
-
#include <map>
#include <cassert>
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::multimap<int, double, transparent_less_not_a_type> M;
TEST_IGNORE_NODISCARD M().find(C2Int{5});
- }
+ }
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp
index aae11c8bba983b7..704cfff775884b8 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp
@@ -21,154 +21,98 @@
#include "private_constructor.h"
#include "is_transparent.h"
-int main(int, char**)
-{
- typedef std::pair<const int, double> V;
- {
+int main(int, char**) {
+ typedef std::pair<const int, double> V;
+ {
typedef std::multimap<int, double> M;
{
- typedef M::iterator R;
- V ar[] =
- {
- V(5, 1),
- V(5, 2),
- V(5, 3),
- V(7, 1),
- V(7, 2),
- V(7, 3),
- V(9, 1),
- V(9, 2),
- V(9, 3)
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.lower_bound(4);
- assert(r == m.begin());
- r = m.lower_bound(5);
- assert(r == m.begin());
- r = m.lower_bound(6);
- assert(r == std::next(m.begin(), 3));
- r = m.lower_bound(7);
- assert(r == std::next(m.begin(), 3));
- r = m.lower_bound(8);
- assert(r == std::next(m.begin(), 6));
- r = m.lower_bound(9);
- assert(r == std::next(m.begin(), 6));
- r = m.lower_bound(10);
- assert(r == m.end());
+ typedef M::iterator R;
+ V ar[] = {V(5, 1), V(5, 2), V(5, 3), V(7, 1), V(7, 2), V(7, 3), V(9, 1), V(9, 2), V(9, 3)};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.lower_bound(4);
+ assert(r == m.begin());
+ r = m.lower_bound(5);
+ assert(r == m.begin());
+ r = m.lower_bound(6);
+ assert(r == std::next(m.begin(), 3));
+ r = m.lower_bound(7);
+ assert(r == std::next(m.begin(), 3));
+ r = m.lower_bound(8);
+ assert(r == std::next(m.begin(), 6));
+ r = m.lower_bound(9);
+ assert(r == std::next(m.begin(), 6));
+ r = m.lower_bound(10);
+ assert(r == m.end());
}
{
- typedef M::const_iterator R;
- V ar[] =
- {
- V(5, 1),
- V(5, 2),
- V(5, 3),
- V(7, 1),
- V(7, 2),
- V(7, 3),
- V(9, 1),
- V(9, 2),
- V(9, 3)
- };
- const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.lower_bound(4);
- assert(r == m.begin());
- r = m.lower_bound(5);
- assert(r == m.begin());
- r = m.lower_bound(6);
- assert(r == std::next(m.begin(), 3));
- r = m.lower_bound(7);
- assert(r == std::next(m.begin(), 3));
- r = m.lower_bound(8);
- assert(r == std::next(m.begin(), 6));
- r = m.lower_bound(9);
- assert(r == std::next(m.begin(), 6));
- r = m.lower_bound(10);
- assert(r == m.end());
- }
+ typedef M::const_iterator R;
+ V ar[] = {V(5, 1), V(5, 2), V(5, 3), V(7, 1), V(7, 2), V(7, 3), V(9, 1), V(9, 2), V(9, 3)};
+ const M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.lower_bound(4);
+ assert(r == m.begin());
+ r = m.lower_bound(5);
+ assert(r == m.begin());
+ r = m.lower_bound(6);
+ assert(r == std::next(m.begin(), 3));
+ r = m.lower_bound(7);
+ assert(r == std::next(m.begin(), 3));
+ r = m.lower_bound(8);
+ assert(r == std::next(m.begin(), 6));
+ r = m.lower_bound(9);
+ assert(r == std::next(m.begin(), 6));
+ r = m.lower_bound(10);
+ assert(r == m.end());
}
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
{
- typedef M::iterator R;
- V ar[] =
- {
- V(5, 1),
- V(5, 2),
- V(5, 3),
- V(7, 1),
- V(7, 2),
- V(7, 3),
- V(9, 1),
- V(9, 2),
- V(9, 3)
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.lower_bound(4);
- assert(r == m.begin());
- r = m.lower_bound(5);
- assert(r == m.begin());
- r = m.lower_bound(6);
- assert(r == std::next(m.begin(), 3));
- r = m.lower_bound(7);
- assert(r == std::next(m.begin(), 3));
- r = m.lower_bound(8);
- assert(r == std::next(m.begin(), 6));
- r = m.lower_bound(9);
- assert(r == std::next(m.begin(), 6));
- r = m.lower_bound(10);
- assert(r == m.end());
+ typedef M::iterator R;
+ V ar[] = {V(5, 1), V(5, 2), V(5, 3), V(7, 1), V(7, 2), V(7, 3), V(9, 1), V(9, 2), V(9, 3)};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.lower_bound(4);
+ assert(r == m.begin());
+ r = m.lower_bound(5);
+ assert(r == m.begin());
+ r = m.lower_bound(6);
+ assert(r == std::next(m.begin(), 3));
+ r = m.lower_bound(7);
+ assert(r == std::next(m.begin(), 3));
+ r = m.lower_bound(8);
+ assert(r == std::next(m.begin(), 6));
+ r = m.lower_bound(9);
+ assert(r == std::next(m.begin(), 6));
+ r = m.lower_bound(10);
+ assert(r == m.end());
}
{
- typedef M::const_iterator R;
- V ar[] =
- {
- V(5, 1),
- V(5, 2),
- V(5, 3),
- V(7, 1),
- V(7, 2),
- V(7, 3),
- V(9, 1),
- V(9, 2),
- V(9, 3)
- };
- const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.lower_bound(4);
- assert(r == m.begin());
- r = m.lower_bound(5);
- assert(r == m.begin());
- r = m.lower_bound(6);
- assert(r == std::next(m.begin(), 3));
- r = m.lower_bound(7);
- assert(r == std::next(m.begin(), 3));
- r = m.lower_bound(8);
- assert(r == std::next(m.begin(), 6));
- r = m.lower_bound(9);
- assert(r == std::next(m.begin(), 6));
- r = m.lower_bound(10);
- assert(r == m.end());
- }
+ typedef M::const_iterator R;
+ V ar[] = {V(5, 1), V(5, 2), V(5, 3), V(7, 1), V(7, 2), V(7, 3), V(9, 1), V(9, 2), V(9, 3)};
+ const M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.lower_bound(4);
+ assert(r == m.begin());
+ r = m.lower_bound(5);
+ assert(r == m.begin());
+ r = m.lower_bound(6);
+ assert(r == std::next(m.begin(), 3));
+ r = m.lower_bound(7);
+ assert(r == std::next(m.begin(), 3));
+ r = m.lower_bound(8);
+ assert(r == std::next(m.begin(), 6));
+ r = m.lower_bound(9);
+ assert(r == std::next(m.begin(), 6));
+ r = m.lower_bound(10);
+ assert(r == m.end());
}
+ }
#endif
#if TEST_STD_VER > 11
- {
+ {
typedef std::multimap<int, double, std::less<>> M;
typedef M::iterator R;
- V ar[] =
- {
- V(5, 1),
- V(5, 2),
- V(5, 3),
- V(7, 1),
- V(7, 2),
- V(7, 3),
- V(9, 1),
- V(9, 2),
- V(9, 3)
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ V ar[] = {V(5, 1), V(5, 2), V(5, 3), V(7, 1), V(7, 2), V(7, 3), V(9, 1), V(9, 2), V(9, 3)};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
R r = m.lower_bound(4);
assert(r == m.begin());
r = m.lower_bound(5);
@@ -198,23 +142,23 @@ int main(int, char**)
assert(r == std::next(m.begin(), 6));
r = m.lower_bound(C2Int(10));
assert(r == m.end());
- }
+ }
- {
+ {
typedef PrivateConstructor PC;
typedef std::multimap<PC, double, std::less<>> M;
typedef M::iterator R;
M m;
- m.insert ( std::make_pair<PC, double> ( PC::make(5), 1 ));
- m.insert ( std::make_pair<PC, double> ( PC::make(5), 2 ));
- m.insert ( std::make_pair<PC, double> ( PC::make(5), 3 ));
- m.insert ( std::make_pair<PC, double> ( PC::make(7), 1 ));
- m.insert ( std::make_pair<PC, double> ( PC::make(7), 2 ));
- m.insert ( std::make_pair<PC, double> ( PC::make(7), 3 ));
- m.insert ( std::make_pair<PC, double> ( PC::make(9), 1 ));
- m.insert ( std::make_pair<PC, double> ( PC::make(9), 2 ));
- m.insert ( std::make_pair<PC, double> ( PC::make(9), 3 ));
+ m.insert(std::make_pair<PC, double>(PC::make(5), 1));
+ m.insert(std::make_pair<PC, double>(PC::make(5), 2));
+ m.insert(std::make_pair<PC, double>(PC::make(5), 3));
+ m.insert(std::make_pair<PC, double>(PC::make(7), 1));
+ m.insert(std::make_pair<PC, double>(PC::make(7), 2));
+ m.insert(std::make_pair<PC, double>(PC::make(7), 3));
+ m.insert(std::make_pair<PC, double>(PC::make(9), 1));
+ m.insert(std::make_pair<PC, double>(PC::make(9), 2));
+ m.insert(std::make_pair<PC, double>(PC::make(9), 3));
R r = m.lower_bound(4);
assert(r == m.begin());
@@ -230,7 +174,7 @@ int main(int, char**)
assert(r == std::next(m.begin(), 6));
r = m.lower_bound(10);
assert(r == m.end());
- }
+ }
#endif
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.ops/lower_bound0.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/lower_bound0.pass.cpp
index be6987d2b812765..79f994847f13126 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.ops/lower_bound0.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.ops/lower_bound0.pass.cpp
@@ -19,25 +19,23 @@
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
-
#include <map>
#include <cassert>
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::multimap<int, double, transparent_less> M;
M example;
assert(example.lower_bound(C2Int{5}) == example.end());
- }
- {
+ }
+ {
typedef std::multimap<int, double, transparent_less_not_referenceable> M;
M example;
assert(example.lower_bound(C2Int{5}) == example.end());
- }
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.ops/lower_bound1.compile.fail.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/lower_bound1.compile.fail.cpp
index d8b34e012e0d2ad..4622cb00da94f8d 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.ops/lower_bound1.compile.fail.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.ops/lower_bound1.compile.fail.cpp
@@ -19,18 +19,16 @@
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
-
#include <map>
#include <cassert>
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::multimap<int, double, transparent_less_no_type> M;
TEST_IGNORE_NODISCARD M().lower_bound(C2Int{5});
- }
+ }
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.ops/lower_bound2.compile.fail.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/lower_bound2.compile.fail.cpp
index 303e17aad1bc0c0..146e202b7e3321e 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.ops/lower_bound2.compile.fail.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.ops/lower_bound2.compile.fail.cpp
@@ -19,18 +19,16 @@
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
-
#include <map>
#include <cassert>
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::multimap<int, double, transparent_less_private> M;
TEST_IGNORE_NODISCARD M().lower_bound(C2Int{5});
- }
+ }
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.ops/lower_bound3.compile.fail.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/lower_bound3.compile.fail.cpp
index 8eb96a99b43c47f..9fe4e0e09732840 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.ops/lower_bound3.compile.fail.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.ops/lower_bound3.compile.fail.cpp
@@ -19,18 +19,16 @@
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
-
#include <map>
#include <cassert>
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::multimap<int, double, transparent_less_not_a_type> M;
TEST_IGNORE_NODISCARD M().lower_bound(C2Int{5});
- }
+ }
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp
index 35c254166709094..164cfc7c88ac9b2 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp
@@ -21,154 +21,98 @@
#include "private_constructor.h"
#include "is_transparent.h"
-int main(int, char**)
-{
- typedef std::pair<const int, double> V;
- {
+int main(int, char**) {
+ typedef std::pair<const int, double> V;
+ {
typedef std::multimap<int, double> M;
{
- typedef M::iterator R;
- V ar[] =
- {
- V(5, 1),
- V(5, 2),
- V(5, 3),
- V(7, 1),
- V(7, 2),
- V(7, 3),
- V(9, 1),
- V(9, 2),
- V(9, 3)
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.upper_bound(4);
- assert(r == m.begin());
- r = m.upper_bound(5);
- assert(r == std::next(m.begin(), 3));
- r = m.upper_bound(6);
- assert(r == std::next(m.begin(), 3));
- r = m.upper_bound(7);
- assert(r == std::next(m.begin(), 6));
- r = m.upper_bound(8);
- assert(r == std::next(m.begin(), 6));
- r = m.upper_bound(9);
- assert(r == std::next(m.begin(), 9));
- r = m.upper_bound(10);
- assert(r == m.end());
+ typedef M::iterator R;
+ V ar[] = {V(5, 1), V(5, 2), V(5, 3), V(7, 1), V(7, 2), V(7, 3), V(9, 1), V(9, 2), V(9, 3)};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.upper_bound(4);
+ assert(r == m.begin());
+ r = m.upper_bound(5);
+ assert(r == std::next(m.begin(), 3));
+ r = m.upper_bound(6);
+ assert(r == std::next(m.begin(), 3));
+ r = m.upper_bound(7);
+ assert(r == std::next(m.begin(), 6));
+ r = m.upper_bound(8);
+ assert(r == std::next(m.begin(), 6));
+ r = m.upper_bound(9);
+ assert(r == std::next(m.begin(), 9));
+ r = m.upper_bound(10);
+ assert(r == m.end());
}
{
- typedef M::const_iterator R;
- V ar[] =
- {
- V(5, 1),
- V(5, 2),
- V(5, 3),
- V(7, 1),
- V(7, 2),
- V(7, 3),
- V(9, 1),
- V(9, 2),
- V(9, 3)
- };
- const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.upper_bound(4);
- assert(r == m.begin());
- r = m.upper_bound(5);
- assert(r == std::next(m.begin(), 3));
- r = m.upper_bound(6);
- assert(r == std::next(m.begin(), 3));
- r = m.upper_bound(7);
- assert(r == std::next(m.begin(), 6));
- r = m.upper_bound(8);
- assert(r == std::next(m.begin(), 6));
- r = m.upper_bound(9);
- assert(r == std::next(m.begin(), 9));
- r = m.upper_bound(10);
- assert(r == m.end());
- }
+ typedef M::const_iterator R;
+ V ar[] = {V(5, 1), V(5, 2), V(5, 3), V(7, 1), V(7, 2), V(7, 3), V(9, 1), V(9, 2), V(9, 3)};
+ const M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.upper_bound(4);
+ assert(r == m.begin());
+ r = m.upper_bound(5);
+ assert(r == std::next(m.begin(), 3));
+ r = m.upper_bound(6);
+ assert(r == std::next(m.begin(), 3));
+ r = m.upper_bound(7);
+ assert(r == std::next(m.begin(), 6));
+ r = m.upper_bound(8);
+ assert(r == std::next(m.begin(), 6));
+ r = m.upper_bound(9);
+ assert(r == std::next(m.begin(), 9));
+ r = m.upper_bound(10);
+ assert(r == m.end());
}
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
{
- typedef M::iterator R;
- V ar[] =
- {
- V(5, 1),
- V(5, 2),
- V(5, 3),
- V(7, 1),
- V(7, 2),
- V(7, 3),
- V(9, 1),
- V(9, 2),
- V(9, 3)
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.upper_bound(4);
- assert(r == m.begin());
- r = m.upper_bound(5);
- assert(r == std::next(m.begin(), 3));
- r = m.upper_bound(6);
- assert(r == std::next(m.begin(), 3));
- r = m.upper_bound(7);
- assert(r == std::next(m.begin(), 6));
- r = m.upper_bound(8);
- assert(r == std::next(m.begin(), 6));
- r = m.upper_bound(9);
- assert(r == std::next(m.begin(), 9));
- r = m.upper_bound(10);
- assert(r == m.end());
+ typedef M::iterator R;
+ V ar[] = {V(5, 1), V(5, 2), V(5, 3), V(7, 1), V(7, 2), V(7, 3), V(9, 1), V(9, 2), V(9, 3)};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.upper_bound(4);
+ assert(r == m.begin());
+ r = m.upper_bound(5);
+ assert(r == std::next(m.begin(), 3));
+ r = m.upper_bound(6);
+ assert(r == std::next(m.begin(), 3));
+ r = m.upper_bound(7);
+ assert(r == std::next(m.begin(), 6));
+ r = m.upper_bound(8);
+ assert(r == std::next(m.begin(), 6));
+ r = m.upper_bound(9);
+ assert(r == std::next(m.begin(), 9));
+ r = m.upper_bound(10);
+ assert(r == m.end());
}
{
- typedef M::const_iterator R;
- V ar[] =
- {
- V(5, 1),
- V(5, 2),
- V(5, 3),
- V(7, 1),
- V(7, 2),
- V(7, 3),
- V(9, 1),
- V(9, 2),
- V(9, 3)
- };
- const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.upper_bound(4);
- assert(r == m.begin());
- r = m.upper_bound(5);
- assert(r == std::next(m.begin(), 3));
- r = m.upper_bound(6);
- assert(r == std::next(m.begin(), 3));
- r = m.upper_bound(7);
- assert(r == std::next(m.begin(), 6));
- r = m.upper_bound(8);
- assert(r == std::next(m.begin(), 6));
- r = m.upper_bound(9);
- assert(r == std::next(m.begin(), 9));
- r = m.upper_bound(10);
- assert(r == m.end());
- }
+ typedef M::const_iterator R;
+ V ar[] = {V(5, 1), V(5, 2), V(5, 3), V(7, 1), V(7, 2), V(7, 3), V(9, 1), V(9, 2), V(9, 3)};
+ const M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.upper_bound(4);
+ assert(r == m.begin());
+ r = m.upper_bound(5);
+ assert(r == std::next(m.begin(), 3));
+ r = m.upper_bound(6);
+ assert(r == std::next(m.begin(), 3));
+ r = m.upper_bound(7);
+ assert(r == std::next(m.begin(), 6));
+ r = m.upper_bound(8);
+ assert(r == std::next(m.begin(), 6));
+ r = m.upper_bound(9);
+ assert(r == std::next(m.begin(), 9));
+ r = m.upper_bound(10);
+ assert(r == m.end());
}
+ }
#endif
#if TEST_STD_VER > 11
- {
+ {
typedef std::multimap<int, double, std::less<>> M;
typedef M::iterator R;
- V ar[] =
- {
- V(5, 1),
- V(5, 2),
- V(5, 3),
- V(7, 1),
- V(7, 2),
- V(7, 3),
- V(9, 1),
- V(9, 2),
- V(9, 3)
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ V ar[] = {V(5, 1), V(5, 2), V(5, 3), V(7, 1), V(7, 2), V(7, 3), V(9, 1), V(9, 2), V(9, 3)};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
R r = m.upper_bound(4);
assert(r == m.begin());
r = m.upper_bound(5);
@@ -197,23 +141,23 @@ int main(int, char**)
r = m.upper_bound(C2Int(9));
assert(r == std::next(m.begin(), 9));
r = m.upper_bound(C2Int(10));
- }
+ }
- {
+ {
typedef PrivateConstructor PC;
typedef std::multimap<PC, double, std::less<>> M;
typedef M::iterator R;
M m;
- m.insert ( std::make_pair<PC, double> ( PC::make(5), 1 ));
- m.insert ( std::make_pair<PC, double> ( PC::make(5), 2 ));
- m.insert ( std::make_pair<PC, double> ( PC::make(5), 3 ));
- m.insert ( std::make_pair<PC, double> ( PC::make(7), 1 ));
- m.insert ( std::make_pair<PC, double> ( PC::make(7), 2 ));
- m.insert ( std::make_pair<PC, double> ( PC::make(7), 3 ));
- m.insert ( std::make_pair<PC, double> ( PC::make(9), 1 ));
- m.insert ( std::make_pair<PC, double> ( PC::make(9), 2 ));
- m.insert ( std::make_pair<PC, double> ( PC::make(9), 3 ));
+ m.insert(std::make_pair<PC, double>(PC::make(5), 1));
+ m.insert(std::make_pair<PC, double>(PC::make(5), 2));
+ m.insert(std::make_pair<PC, double>(PC::make(5), 3));
+ m.insert(std::make_pair<PC, double>(PC::make(7), 1));
+ m.insert(std::make_pair<PC, double>(PC::make(7), 2));
+ m.insert(std::make_pair<PC, double>(PC::make(7), 3));
+ m.insert(std::make_pair<PC, double>(PC::make(9), 1));
+ m.insert(std::make_pair<PC, double>(PC::make(9), 2));
+ m.insert(std::make_pair<PC, double>(PC::make(9), 3));
R r = m.upper_bound(4);
assert(r == m.begin());
@@ -229,7 +173,7 @@ int main(int, char**)
assert(r == std::next(m.begin(), 9));
r = m.upper_bound(10);
assert(r == m.end());
- }
+ }
#endif
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.ops/upper_bound0.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/upper_bound0.pass.cpp
index 4ffda7f5ab70305..62f52416b9156fa 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.ops/upper_bound0.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.ops/upper_bound0.pass.cpp
@@ -19,25 +19,23 @@
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
-
#include <map>
#include <cassert>
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::multimap<int, double, transparent_less> M;
M example;
assert(example.upper_bound(C2Int{5}) == example.end());
- }
- {
+ }
+ {
typedef std::multimap<int, double, transparent_less_not_referenceable> M;
M example;
assert(example.upper_bound(C2Int{5}) == example.end());
- }
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.ops/upper_bound1.compile.fail.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/upper_bound1.compile.fail.cpp
index 4d09bc5177691b0..d28143f7cab9d77 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.ops/upper_bound1.compile.fail.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.ops/upper_bound1.compile.fail.cpp
@@ -19,18 +19,16 @@
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
-
#include <map>
#include <cassert>
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::multimap<int, double, transparent_less_no_type> M;
TEST_IGNORE_NODISCARD M().upper_bound(C2Int{5});
- }
+ }
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.ops/upper_bound2.compile.fail.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/upper_bound2.compile.fail.cpp
index 6494ae3789fe470..0f9897996bccad5 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.ops/upper_bound2.compile.fail.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.ops/upper_bound2.compile.fail.cpp
@@ -19,18 +19,16 @@
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
-
#include <map>
#include <cassert>
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::multimap<int, double, transparent_less_private> M;
TEST_IGNORE_NODISCARD M().upper_bound(C2Int{5});
- }
+ }
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.ops/upper_bound3.compile.fail.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/upper_bound3.compile.fail.cpp
index 246ef0886dc358c..32e8983c8ce3a8e 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.ops/upper_bound3.compile.fail.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.ops/upper_bound3.compile.fail.cpp
@@ -19,18 +19,16 @@
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
-
#include <map>
#include <cassert>
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::multimap<int, double, transparent_less_not_a_type> M;
TEST_IGNORE_NODISCARD M().upper_bound(C2Int{5});
- }
+ }
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.special/member_swap.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.special/member_swap.pass.cpp
index dfe2831890569ef..e3ebe7980dd52d2 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.special/member_swap.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.special/member_swap.pass.cpp
@@ -18,160 +18,95 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- typedef std::pair<const int, double> V;
- {
+int main(int, char**) {
+ typedef std::pair<const int, double> V;
+ {
typedef std::multimap<int, double> M;
{
- M m1;
- M m2;
- M m1_save = m1;
- M m2_save = m2;
- m1.swap(m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
+ M m1;
+ M m2;
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
{
- V ar2[] =
- {
- V(5, 5),
- V(6, 6),
- V(7, 7),
- V(8, 8),
- V(9, 9),
- V(10, 10),
- V(11, 11),
- V(12, 12)
- };
- M m1;
- M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
- M m1_save = m1;
- M m2_save = m2;
- m1.swap(m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
+ V ar2[] = {V(5, 5), V(6, 6), V(7, 7), V(8, 8), V(9, 9), V(10, 10), V(11, 11), V(12, 12)};
+ M m1;
+ M m2(ar2, ar2 + sizeof(ar2) / sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
{
- V ar1[] =
- {
- V(1, 1),
- V(2, 2),
- V(3, 3),
- V(4, 4)
- };
- M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
- M m2;
- M m1_save = m1;
- M m2_save = m2;
- m1.swap(m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
+ V ar1[] = {V(1, 1), V(2, 2), V(3, 3), V(4, 4)};
+ M m1(ar1, ar1 + sizeof(ar1) / sizeof(ar1[0]));
+ M m2;
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
{
- V ar1[] =
- {
- V(1, 1),
- V(2, 2),
- V(3, 3),
- V(4, 4)
- };
- V ar2[] =
- {
- V(5, 5),
- V(6, 6),
- V(7, 7),
- V(8, 8),
- V(9, 9),
- V(10, 10),
- V(11, 11),
- V(12, 12)
- };
- M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
- M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
- M m1_save = m1;
- M m2_save = m2;
- m1.swap(m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
- }
+ V ar1[] = {V(1, 1), V(2, 2), V(3, 3), V(4, 4)};
+ V ar2[] = {V(5, 5), V(6, 6), V(7, 7), V(8, 8), V(9, 9), V(10, 10), V(11, 11), V(12, 12)};
+ M m1(ar1, ar1 + sizeof(ar1) / sizeof(ar1[0]));
+ M m2(ar2, ar2 + sizeof(ar2) / sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
{
- M m1;
- M m2;
- M m1_save = m1;
- M m2_save = m2;
- m1.swap(m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
+ M m1;
+ M m2;
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
{
- V ar2[] =
- {
- V(5, 5),
- V(6, 6),
- V(7, 7),
- V(8, 8),
- V(9, 9),
- V(10, 10),
- V(11, 11),
- V(12, 12)
- };
- M m1;
- M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
- M m1_save = m1;
- M m2_save = m2;
- m1.swap(m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
+ V ar2[] = {V(5, 5), V(6, 6), V(7, 7), V(8, 8), V(9, 9), V(10, 10), V(11, 11), V(12, 12)};
+ M m1;
+ M m2(ar2, ar2 + sizeof(ar2) / sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
{
- V ar1[] =
- {
- V(1, 1),
- V(2, 2),
- V(3, 3),
- V(4, 4)
- };
- M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
- M m2;
- M m1_save = m1;
- M m2_save = m2;
- m1.swap(m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
+ V ar1[] = {V(1, 1), V(2, 2), V(3, 3), V(4, 4)};
+ M m1(ar1, ar1 + sizeof(ar1) / sizeof(ar1[0]));
+ M m2;
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
{
- V ar1[] =
- {
- V(1, 1),
- V(2, 2),
- V(3, 3),
- V(4, 4)
- };
- V ar2[] =
- {
- V(5, 5),
- V(6, 6),
- V(7, 7),
- V(8, 8),
- V(9, 9),
- V(10, 10),
- V(11, 11),
- V(12, 12)
- };
- M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
- M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
- M m1_save = m1;
- M m2_save = m2;
- m1.swap(m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
- }
+ V ar1[] = {V(1, 1), V(2, 2), V(3, 3), V(4, 4)};
+ V ar2[] = {V(5, 5), V(6, 6), V(7, 7), V(8, 8), V(9, 9), V(10, 10), V(11, 11), V(12, 12)};
+ M m1(ar1, ar1 + sizeof(ar1) / sizeof(ar1[0]));
+ M m2(ar2, ar2 + sizeof(ar2) / sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp
index 82a838d54099ae8..7e771c9a034d9fc 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp
@@ -21,262 +21,149 @@
#include "../../../test_compare.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- typedef std::pair<const int, double> V;
- {
+int main(int, char**) {
+ typedef std::pair<const int, double> V;
+ {
typedef std::multimap<int, double> M;
{
- M m1;
- M m2;
- M m1_save = m1;
- M m2_save = m2;
- swap(m1, m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
- }
- {
- V ar2[] =
- {
- V(5, 5),
- V(6, 6),
- V(7, 7),
- V(8, 8),
- V(9, 9),
- V(10, 10),
- V(11, 11),
- V(12, 12)
- };
- M m1;
- M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
- M m1_save = m1;
- M m2_save = m2;
- swap(m1, m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
- }
- {
- V ar1[] =
- {
- V(1, 1),
- V(2, 2),
- V(3, 3),
- V(4, 4)
- };
- M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
- M m2;
- M m1_save = m1;
- M m2_save = m2;
- swap(m1, m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
+ M m1;
+ M m2;
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
{
- V ar1[] =
- {
- V(1, 1),
- V(2, 2),
- V(3, 3),
- V(4, 4)
- };
- V ar2[] =
- {
- V(5, 5),
- V(6, 6),
- V(7, 7),
- V(8, 8),
- V(9, 9),
- V(10, 10),
- V(11, 11),
- V(12, 12)
- };
- M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
- M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
- M m1_save = m1;
- M m2_save = m2;
- swap(m1, m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
- }
+ V ar2[] = {V(5, 5), V(6, 6), V(7, 7), V(8, 8), V(9, 9), V(10, 10), V(11, 11), V(12, 12)};
+ M m1;
+ M m2(ar2, ar2 + sizeof(ar2) / sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
{
- typedef test_allocator<V> A;
- typedef test_less<int> C;
- typedef std::multimap<int, double, C, A> M;
- V ar1[] =
- {
- V(1, 1),
- V(2, 2),
- V(3, 3),
- V(4, 4)
- };
- V ar2[] =
- {
- V(5, 5),
- V(6, 6),
- V(7, 7),
- V(8, 8),
- V(9, 9),
- V(10, 10),
- V(11, 11),
- V(12, 12)
- };
- M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A(1, 1));
- M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A(1, 2));
- M m1_save = m1;
- M m2_save = m2;
- swap(m1, m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
- assert(m1.key_comp() == C(2));
- assert(m1.get_allocator().get_id() == 1);
- assert(m2.key_comp() == C(1));
- assert(m2.get_allocator().get_id() == 2);
+ V ar1[] = {V(1, 1), V(2, 2), V(3, 3), V(4, 4)};
+ M m1(ar1, ar1 + sizeof(ar1) / sizeof(ar1[0]));
+ M m2;
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
{
- typedef other_allocator<V> A;
- typedef test_less<int> C;
- typedef std::multimap<int, double, C, A> M;
- V ar1[] =
- {
- V(1, 1),
- V(2, 2),
- V(3, 3),
- V(4, 4)
- };
- V ar2[] =
- {
- V(5, 5),
- V(6, 6),
- V(7, 7),
- V(8, 8),
- V(9, 9),
- V(10, 10),
- V(11, 11),
- V(12, 12)
- };
- M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A(1));
- M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A(2));
- M m1_save = m1;
- M m2_save = m2;
- swap(m1, m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
- assert(m1.key_comp() == C(2));
- assert(m1.get_allocator() == A(2));
- assert(m2.key_comp() == C(1));
- assert(m2.get_allocator() == A(1));
+ V ar1[] = {V(1, 1), V(2, 2), V(3, 3), V(4, 4)};
+ V ar2[] = {V(5, 5), V(6, 6), V(7, 7), V(8, 8), V(9, 9), V(10, 10), V(11, 11), V(12, 12)};
+ M m1(ar1, ar1 + sizeof(ar1) / sizeof(ar1[0]));
+ M m2(ar2, ar2 + sizeof(ar2) / sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
+ }
+ {
+ typedef test_allocator<V> A;
+ typedef test_less<int> C;
+ typedef std::multimap<int, double, C, A> M;
+ V ar1[] = {V(1, 1), V(2, 2), V(3, 3), V(4, 4)};
+ V ar2[] = {V(5, 5), V(6, 6), V(7, 7), V(8, 8), V(9, 9), V(10, 10), V(11, 11), V(12, 12)};
+ M m1(ar1, ar1 + sizeof(ar1) / sizeof(ar1[0]), C(1), A(1, 1));
+ M m2(ar2, ar2 + sizeof(ar2) / sizeof(ar2[0]), C(2), A(1, 2));
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ assert(m1.key_comp() == C(2));
+ assert(m1.get_allocator().get_id() == 1);
+ assert(m2.key_comp() == C(1));
+ assert(m2.get_allocator().get_id() == 2);
+ }
+ {
+ typedef other_allocator<V> A;
+ typedef test_less<int> C;
+ typedef std::multimap<int, double, C, A> M;
+ V ar1[] = {V(1, 1), V(2, 2), V(3, 3), V(4, 4)};
+ V ar2[] = {V(5, 5), V(6, 6), V(7, 7), V(8, 8), V(9, 9), V(10, 10), V(11, 11), V(12, 12)};
+ M m1(ar1, ar1 + sizeof(ar1) / sizeof(ar1[0]), C(1), A(1));
+ M m2(ar2, ar2 + sizeof(ar2) / sizeof(ar2[0]), C(2), A(2));
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ assert(m1.key_comp() == C(2));
+ assert(m1.get_allocator() == A(2));
+ assert(m2.key_comp() == C(1));
+ assert(m2.get_allocator() == A(1));
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
{
- M m1;
- M m2;
- M m1_save = m1;
- M m2_save = m2;
- swap(m1, m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
+ M m1;
+ M m2;
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
{
- V ar2[] =
- {
- V(5, 5),
- V(6, 6),
- V(7, 7),
- V(8, 8),
- V(9, 9),
- V(10, 10),
- V(11, 11),
- V(12, 12)
- };
- M m1;
- M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
- M m1_save = m1;
- M m2_save = m2;
- swap(m1, m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
+ V ar2[] = {V(5, 5), V(6, 6), V(7, 7), V(8, 8), V(9, 9), V(10, 10), V(11, 11), V(12, 12)};
+ M m1;
+ M m2(ar2, ar2 + sizeof(ar2) / sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
{
- V ar1[] =
- {
- V(1, 1),
- V(2, 2),
- V(3, 3),
- V(4, 4)
- };
- M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
- M m2;
- M m1_save = m1;
- M m2_save = m2;
- swap(m1, m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
- }
- {
- V ar1[] =
- {
- V(1, 1),
- V(2, 2),
- V(3, 3),
- V(4, 4)
- };
- V ar2[] =
- {
- V(5, 5),
- V(6, 6),
- V(7, 7),
- V(8, 8),
- V(9, 9),
- V(10, 10),
- V(11, 11),
- V(12, 12)
- };
- M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
- M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
- M m1_save = m1;
- M m2_save = m2;
- swap(m1, m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
- }
+ V ar1[] = {V(1, 1), V(2, 2), V(3, 3), V(4, 4)};
+ M m1(ar1, ar1 + sizeof(ar1) / sizeof(ar1[0]));
+ M m2;
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
{
- typedef min_allocator<V> A;
- typedef test_less<int> C;
- typedef std::multimap<int, double, C, A> M;
- V ar1[] =
- {
- V(1, 1),
- V(2, 2),
- V(3, 3),
- V(4, 4)
- };
- V ar2[] =
- {
- V(5, 5),
- V(6, 6),
- V(7, 7),
- V(8, 8),
- V(9, 9),
- V(10, 10),
- V(11, 11),
- V(12, 12)
- };
- M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A());
- M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A());
- M m1_save = m1;
- M m2_save = m2;
- swap(m1, m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
- assert(m1.key_comp() == C(2));
- assert(m1.get_allocator() == A());
- assert(m2.key_comp() == C(1));
- assert(m2.get_allocator() == A());
+ V ar1[] = {V(1, 1), V(2, 2), V(3, 3), V(4, 4)};
+ V ar2[] = {V(5, 5), V(6, 6), V(7, 7), V(8, 8), V(9, 9), V(10, 10), V(11, 11), V(12, 12)};
+ M m1(ar1, ar1 + sizeof(ar1) / sizeof(ar1[0]));
+ M m2(ar2, ar2 + sizeof(ar2) / sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
+ }
+ {
+ typedef min_allocator<V> A;
+ typedef test_less<int> C;
+ typedef std::multimap<int, double, C, A> M;
+ V ar1[] = {V(1, 1), V(2, 2), V(3, 3), V(4, 4)};
+ V ar2[] = {V(5, 5), V(6, 6), V(7, 7), V(8, 8), V(9, 9), V(10, 10), V(11, 11), V(12, 12)};
+ M m1(ar1, ar1 + sizeof(ar1) / sizeof(ar1[0]), C(1), A());
+ M m2(ar2, ar2 + sizeof(ar2) / sizeof(ar2[0]), C(2), A());
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ assert(m1.key_comp() == C(2));
+ assert(m1.get_allocator() == A());
+ assert(m2.key_comp() == C(1));
+ assert(m2.get_allocator() == A());
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.special/swap_noexcept.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.special/swap_noexcept.pass.cpp
index 00ec83dfd621c7e..cc8af8bf3a30f3e 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.special/swap_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.special/swap_noexcept.pass.cpp
@@ -29,23 +29,21 @@
#include "test_allocator.h"
template <class T>
-struct some_comp
-{
- typedef T value_type;
+struct some_comp {
+ typedef T value_type;
- some_comp() {}
- some_comp(const some_comp&) {}
- bool operator()(const T&, const T&) const { return false; }
+ some_comp() {}
+ some_comp(const some_comp&) {}
+ bool operator()(const T&, const T&) const { return false; }
};
template <class T>
-struct some_comp2
-{
- typedef T value_type;
+struct some_comp2 {
+ typedef T value_type;
- some_comp2() {}
- some_comp2(const some_comp2&) {}
- bool operator()(const T&, const T&) const { return false; }
+ some_comp2() {}
+ some_comp2(const some_comp2&) {}
+ bool operator()(const T&, const T&) const { return false; }
};
#if TEST_STD_VER >= 14
@@ -54,88 +52,84 @@ void swap(some_comp2<T>&, some_comp2<T>&) noexcept {}
#endif
template <class T>
-struct some_alloc
-{
- typedef T value_type;
+struct some_alloc {
+ typedef T value_type;
- some_alloc() {}
- some_alloc(const some_alloc&);
- void deallocate(void*, unsigned) {}
+ some_alloc() {}
+ some_alloc(const some_alloc&);
+ void deallocate(void*, unsigned) {}
- typedef std::true_type propagate_on_container_swap;
+ typedef std::true_type propagate_on_container_swap;
};
template <class T>
-struct some_alloc2
-{
- typedef T value_type;
+struct some_alloc2 {
+ typedef T value_type;
- some_alloc2() {}
- some_alloc2(const some_alloc2&);
- void deallocate(void*, unsigned) {}
+ some_alloc2() {}
+ some_alloc2(const some_alloc2&);
+ void deallocate(void*, unsigned) {}
- typedef std::false_type propagate_on_container_swap;
- typedef std::true_type is_always_equal;
+ typedef std::false_type propagate_on_container_swap;
+ typedef std::true_type is_always_equal;
};
template <class T>
-struct some_alloc3
-{
- typedef T value_type;
+struct some_alloc3 {
+ typedef T value_type;
- some_alloc3() {}
- some_alloc3(const some_alloc3&);
- void deallocate(void*, unsigned) {}
+ some_alloc3() {}
+ some_alloc3(const some_alloc3&);
+ void deallocate(void*, unsigned) {}
- typedef std::false_type propagate_on_container_swap;
- typedef std::false_type is_always_equal;
+ typedef std::false_type propagate_on_container_swap;
+ typedef std::false_type is_always_equal;
};
-int main(int, char**)
-{
- typedef std::pair<const MoveOnly, MoveOnly> V;
- {
- typedef std::multimap<MoveOnly, MoveOnly> C;
- static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
+int main(int, char**) {
+ typedef std::pair<const MoveOnly, MoveOnly> V;
+ {
+ typedef std::multimap<MoveOnly, MoveOnly> C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
#if defined(_LIBCPP_VERSION)
- {
- typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<V>> C;
- static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- {
- typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<V>> C;
- static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
+ {
+ typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<V>> C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
+ {
+ typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<V>> C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
#endif // _LIBCPP_VERSION
- {
- typedef std::multimap<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
- static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
+ {
+ typedef std::multimap<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
#if TEST_STD_VER >= 14
- { // POCS allocator, throwable swap for comp
- typedef std::multimap<MoveOnly, MoveOnly, some_comp <MoveOnly>, some_alloc <V>> C;
+ { // POCS allocator, throwable swap for comp
+ typedef std::multimap<MoveOnly, MoveOnly, some_comp<MoveOnly>, some_alloc<V>> C;
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- { // always equal allocator, throwable swap for comp
- typedef std::multimap<MoveOnly, MoveOnly, some_comp <MoveOnly>, some_alloc2<V>> C;
+ }
+ { // always equal allocator, throwable swap for comp
+ typedef std::multimap<MoveOnly, MoveOnly, some_comp<MoveOnly>, some_alloc2<V>> C;
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- { // POCS allocator, nothrow swap for comp
- typedef std::multimap<MoveOnly, MoveOnly, some_comp2<MoveOnly>, some_alloc <V>> C;
- static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- { // always equal allocator, nothrow swap for comp
+ }
+ { // POCS allocator, nothrow swap for comp
+ typedef std::multimap<MoveOnly, MoveOnly, some_comp2<MoveOnly>, some_alloc<V>> C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
+ { // always equal allocator, nothrow swap for comp
typedef std::multimap<MoveOnly, MoveOnly, some_comp2<MoveOnly>, some_alloc2<V>> C;
- static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
-#if defined(_LIBCPP_VERSION)
- { // NOT always equal allocator, nothrow swap for comp
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
+# if defined(_LIBCPP_VERSION)
+ { // NOT always equal allocator, nothrow swap for comp
typedef std::multimap<MoveOnly, MoveOnly, some_comp2<MoveOnly>, some_alloc3<V>> C;
- static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
-#endif // _LIBCPP_VERSION
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
+# endif // _LIBCPP_VERSION
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.value_compare/invoke.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.value_compare/invoke.pass.cpp
index 75a1114ed5e0931..67b4743097da836 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.value_compare/invoke.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.value_compare/invoke.pass.cpp
@@ -19,29 +19,29 @@
template <typename MMap>
struct CallCompMember : MMap::value_compare {
- CallCompMember(const typename MMap::value_compare& vc) : MMap::value_compare(vc) {}
+ CallCompMember(const typename MMap::value_compare& vc) : MMap::value_compare(vc) {}
- typedef typename MMap::value_type value_type;
- bool operator()(const value_type& value1, const value_type& value2) const {
- return this->comp(value1.first, value2.first);
- }
+ typedef typename MMap::value_type value_type;
+ bool operator()(const value_type& value1, const value_type& value2) const {
+ return this->comp(value1.first, value2.first);
+ }
};
int main(int, char**) {
- typedef std::multimap<int, std::string> map_type;
+ typedef std::multimap<int, std::string> map_type;
- map_type m;
- map_type::iterator i1 = m.insert(map_type::value_type(1, "abc"));
- map_type::iterator i2 = m.insert(map_type::value_type(2, "abc"));
+ map_type m;
+ map_type::iterator i1 = m.insert(map_type::value_type(1, "abc"));
+ map_type::iterator i2 = m.insert(map_type::value_type(2, "abc"));
- const map_type::value_compare vc = m.value_comp();
- CallCompMember<map_type> call_comp = m.value_comp();
+ const map_type::value_compare vc = m.value_comp();
+ CallCompMember<map_type> call_comp = m.value_comp();
- assert(vc(*i1, *i2));
- assert(call_comp(*i1, *i2));
+ assert(vc(*i1, *i2));
+ assert(call_comp(*i1, *i2));
- assert(!vc(*i2, *i1));
- assert(!call_comp(*i2, *i1));
+ assert(!vc(*i2, *i1));
+ assert(!call_comp(*i2, *i1));
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.value_compare/types.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.value_compare/types.pass.cpp
index 0d0c74f29f4216f..bd1165e61aa9b4b 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.value_compare/types.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.value_compare/types.pass.cpp
@@ -18,13 +18,13 @@
#include "test_macros.h"
int main(int, char**) {
- typedef std::multimap<int, std::string> map_type;
- typedef map_type::value_compare value_compare;
- typedef map_type::value_type value_type;
+ typedef std::multimap<int, std::string> map_type;
+ typedef map_type::value_compare value_compare;
+ typedef map_type::value_type value_type;
- ASSERT_SAME_TYPE(value_compare::result_type, bool);
- ASSERT_SAME_TYPE(value_compare::first_argument_type, value_type);
- ASSERT_SAME_TYPE(value_compare::second_argument_type, value_type);
+ ASSERT_SAME_TYPE(value_compare::result_type, bool);
+ ASSERT_SAME_TYPE(value_compare::first_argument_type, value_type);
+ ASSERT_SAME_TYPE(value_compare::second_argument_type, value_type);
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/associative/multimap/range_concept_conformance.compile.pass.cpp b/libcxx/test/std/containers/associative/multimap/range_concept_conformance.compile.pass.cpp
index fe382dbc93fc371..ee7385d1d0effed 100644
--- a/libcxx/test/std/containers/associative/multimap/range_concept_conformance.compile.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/range_concept_conformance.compile.pass.cpp
@@ -17,7 +17,6 @@
using range = std::multimap<int, int>;
-
static_assert(std::same_as<std::ranges::iterator_t<range>, range::iterator>);
static_assert(std::ranges::common_range<range>);
static_assert(std::ranges::bidirectional_range<range>);
diff --git a/libcxx/test/std/containers/associative/multimap/scary.pass.cpp b/libcxx/test/std/containers/associative/multimap/scary.pass.cpp
index 7dcd4e1a09baca7..2390d8fed335098 100644
--- a/libcxx/test/std/containers/associative/multimap/scary.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/scary.pass.cpp
@@ -16,13 +16,12 @@
#include "test_macros.h"
-int main(int, char**)
-{
- typedef std::map<int, int> M1;
- typedef std::multimap<int, int> M2;
- M2::iterator i;
- M1::iterator j = i;
- ((void)j);
+int main(int, char**) {
+ typedef std::map<int, int> M1;
+ typedef std::multimap<int, int> M2;
+ M2::iterator i;
+ M1::iterator j = i;
+ ((void)j);
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multimap/size.pass.cpp b/libcxx/test/std/containers/associative/multimap/size.pass.cpp
index fdb8f72b5f712bc..77bd807db6b1042 100644
--- a/libcxx/test/std/containers/associative/multimap/size.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/size.pass.cpp
@@ -18,9 +18,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::multimap<int, double> M;
M m;
assert(m.size() == 0);
@@ -36,9 +35,9 @@ int main(int, char**)
assert(m.size() == 1);
m.erase(m.begin());
assert(m.size() == 0);
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
M m;
assert(m.size() == 0);
@@ -54,7 +53,7 @@ int main(int, char**)
assert(m.size() == 1);
m.erase(m.begin());
assert(m.size() == 0);
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/multimap/types.pass.cpp b/libcxx/test/std/containers/associative/multimap/types.pass.cpp
index c9d2f3da6638d73..2b182c36c1a7da3 100644
--- a/libcxx/test/std/containers/associative/multimap/types.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/types.pass.cpp
@@ -34,9 +34,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::multimap<int, double> C;
static_assert((std::is_same<C::key_type, int>::value), "");
static_assert((std::is_same<C::mapped_type, double>::value), "");
@@ -49,9 +48,9 @@ int main(int, char**)
static_assert((std::is_same<C::const_pointer, const std::pair<const int, double>*>::value), "");
static_assert((std::is_same<C::size_type, std::size_t>::value), "");
static_assert((std::is_same<C::
diff erence_type, std::ptr
diff _t>::value), "");
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> C;
static_assert((std::is_same<C::key_type, int>::value), "");
static_assert((std::is_same<C::mapped_type, double>::value), "");
@@ -62,10 +61,10 @@ int main(int, char**)
static_assert((std::is_same<C::const_reference, const std::pair<const int, double>&>::value), "");
static_assert((std::is_same<C::pointer, min_pointer<std::pair<const int, double>>>::value), "");
static_assert((std::is_same<C::const_pointer, min_pointer<const std::pair<const int, double>>>::value), "");
-// min_allocator doesn't have a size_type, so one gets synthesized
+ // min_allocator doesn't have a size_type, so one gets synthesized
static_assert((std::is_same<C::size_type, std::make_unsigned<C::
diff erence_type>::type>::value), "");
static_assert((std::is_same<C::
diff erence_type, std::ptr
diff _t>::value), "");
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/multiset/allocator_mismatch.verify.cpp b/libcxx/test/std/containers/associative/multiset/allocator_mismatch.verify.cpp
index 711dbe049036de4..76515aa6c66415b 100644
--- a/libcxx/test/std/containers/associative/multiset/allocator_mismatch.verify.cpp
+++ b/libcxx/test/std/containers/associative/multiset/allocator_mismatch.verify.cpp
@@ -12,4 +12,4 @@
#include <set>
std::multiset<int, std::less<int>, std::allocator<long> > m;
- // expected-error-re@*:* {{static assertion failed{{.*}}Allocator::value_type must be same type as value_type}}
+// expected-error-re@*:* {{static assertion failed{{.*}}Allocator::value_type must be same type as value_type}}
diff --git a/libcxx/test/std/containers/associative/multiset/clear.pass.cpp b/libcxx/test/std/containers/associative/multiset/clear.pass.cpp
index 93f9fef2caa0ad2..61a5f25eac6088f 100644
--- a/libcxx/test/std/containers/associative/multiset/clear.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/clear.pass.cpp
@@ -18,49 +18,28 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::multiset<int> M;
- typedef int V;
- V ar[] =
- {
- 1,
- 2,
- 3,
- 4,
- 5,
- 6,
- 7,
- 8
- };
- M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
- assert(m.size() == 8);
- ASSERT_NOEXCEPT(m.clear());
- m.clear();
- assert(m.size() == 0);
- }
+int main(int, char**) {
+ {
+ typedef std::multiset<int> M;
+ typedef int V;
+ V ar[] = {1, 2, 3, 4, 5, 6, 7, 8};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(m.size() == 8);
+ ASSERT_NOEXCEPT(m.clear());
+ m.clear();
+ assert(m.size() == 0);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
- typedef int V;
- V ar[] =
- {
- 1,
- 2,
- 3,
- 4,
- 5,
- 6,
- 7,
- 8
- };
- M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
- assert(m.size() == 8);
- ASSERT_NOEXCEPT(m.clear());
- m.clear();
- assert(m.size() == 0);
- }
+ {
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+ typedef int V;
+ V ar[] = {1, 2, 3, 4, 5, 6, 7, 8};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(m.size() == 8);
+ ASSERT_NOEXCEPT(m.clear());
+ m.clear();
+ assert(m.size() == 0);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/multiset/count.pass.cpp b/libcxx/test/std/containers/associative/multiset/count.pass.cpp
index 21575fc12bacde3..6ad96b232083cab 100644
--- a/libcxx/test/std/containers/associative/multiset/count.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/count.pass.cpp
@@ -19,96 +19,62 @@
#include "min_allocator.h"
#include "private_constructor.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef int V;
typedef std::multiset<int> M;
{
- typedef M::size_type R;
- V ar[] =
- {
- 5,
- 5,
- 5,
- 5,
- 7,
- 7,
- 7,
- 9,
- 9
- };
- const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.count(4);
- assert(r == 0);
- r = m.count(5);
- assert(r == 4);
- r = m.count(6);
- assert(r == 0);
- r = m.count(7);
- assert(r == 3);
- r = m.count(8);
- assert(r == 0);
- r = m.count(9);
- assert(r == 2);
- r = m.count(10);
- assert(r == 0);
- }
+ typedef M::size_type R;
+ V ar[] = {5, 5, 5, 5, 7, 7, 7, 9, 9};
+ const M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.count(4);
+ assert(r == 0);
+ r = m.count(5);
+ assert(r == 4);
+ r = m.count(6);
+ assert(r == 0);
+ r = m.count(7);
+ assert(r == 3);
+ r = m.count(8);
+ assert(r == 0);
+ r = m.count(9);
+ assert(r == 2);
+ r = m.count(10);
+ assert(r == 0);
}
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef int V;
typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
{
- typedef M::size_type R;
- V ar[] =
- {
- 5,
- 5,
- 5,
- 5,
- 7,
- 7,
- 7,
- 9,
- 9
- };
- const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.count(4);
- assert(r == 0);
- r = m.count(5);
- assert(r == 4);
- r = m.count(6);
- assert(r == 0);
- r = m.count(7);
- assert(r == 3);
- r = m.count(8);
- assert(r == 0);
- r = m.count(9);
- assert(r == 2);
- r = m.count(10);
- assert(r == 0);
- }
+ typedef M::size_type R;
+ V ar[] = {5, 5, 5, 5, 7, 7, 7, 9, 9};
+ const M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.count(4);
+ assert(r == 0);
+ r = m.count(5);
+ assert(r == 4);
+ r = m.count(6);
+ assert(r == 0);
+ r = m.count(7);
+ assert(r == 3);
+ r = m.count(8);
+ assert(r == 0);
+ r = m.count(9);
+ assert(r == 2);
+ r = m.count(10);
+ assert(r == 0);
}
+ }
#endif
#if TEST_STD_VER > 11
- {
+ {
typedef int V;
typedef std::multiset<int, std::less<>> M;
typedef M::size_type R;
- V ar[] =
- {
- 5,
- 5,
- 5,
- 5,
- 7,
- 7,
- 7,
- 9,
- 9
- };
- const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ V ar[] = {5, 5, 5, 5, 7, 7, 7, 9, 9};
+ const M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
R r = m.count(4);
assert(r == 0);
r = m.count(5);
@@ -123,23 +89,23 @@ int main(int, char**)
assert(r == 2);
r = m.count(10);
assert(r == 0);
- }
+ }
- {
+ {
typedef PrivateConstructor V;
typedef std::multiset<V, std::less<>> M;
typedef M::size_type R;
M m;
- m.insert ( V::make ( 5 ));
- m.insert ( V::make ( 5 ));
- m.insert ( V::make ( 5 ));
- m.insert ( V::make ( 5 ));
- m.insert ( V::make ( 7 ));
- m.insert ( V::make ( 7 ));
- m.insert ( V::make ( 7 ));
- m.insert ( V::make ( 9 ));
- m.insert ( V::make ( 9 ));
+ m.insert(V::make(5));
+ m.insert(V::make(5));
+ m.insert(V::make(5));
+ m.insert(V::make(5));
+ m.insert(V::make(7));
+ m.insert(V::make(7));
+ m.insert(V::make(7));
+ m.insert(V::make(9));
+ m.insert(V::make(9));
R r = m.count(4);
assert(r == 0);
@@ -155,7 +121,7 @@ int main(int, char**)
assert(r == 2);
r = m.count(10);
assert(r == 0);
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/multiset/count_transparent.pass.cpp b/libcxx/test/std/containers/associative/multiset/count_transparent.pass.cpp
index 5e6add9582df28f..aea63384887d46d 100644
--- a/libcxx/test/std/containers/associative/multiset/count_transparent.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/count_transparent.pass.cpp
@@ -22,18 +22,11 @@
struct Comp {
using is_transparent = void;
- bool operator()(const std::pair<int, int> &lhs,
- const std::pair<int, int> &rhs) const {
- return lhs < rhs;
- }
-
- bool operator()(const std::pair<int, int> &lhs, int rhs) const {
- return lhs.first < rhs;
- }
-
- bool operator()(int lhs, const std::pair<int, int> &rhs) const {
- return lhs < rhs.first;
- }
+ bool operator()(const std::pair<int, int>& lhs, const std::pair<int, int>& rhs) const { return lhs < rhs; }
+
+ bool operator()(const std::pair<int, int>& lhs, int rhs) const { return lhs.first < rhs; }
+
+ bool operator()(int lhs, const std::pair<int, int>& rhs) const { return lhs < rhs.first; }
};
int main(int, char**) {
diff --git a/libcxx/test/std/containers/associative/multiset/emplace.pass.cpp b/libcxx/test/std/containers/associative/multiset/emplace.pass.cpp
index 62ac36650d999f9..bddfd8f62143712 100644
--- a/libcxx/test/std/containers/associative/multiset/emplace.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/emplace.pass.cpp
@@ -23,61 +23,60 @@
#include "DefaultOnly.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::multiset<DefaultOnly> M;
- typedef M::iterator R;
- M m;
- assert(DefaultOnly::count == 0);
- R r = m.emplace();
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(*m.begin() == DefaultOnly());
- assert(DefaultOnly::count == 1);
-
- r = m.emplace();
- assert(r == std::next(m.begin()));
- assert(m.size() == 2);
- assert(*m.begin() == DefaultOnly());
- assert(DefaultOnly::count == 2);
- }
+int main(int, char**) {
+ {
+ typedef std::multiset<DefaultOnly> M;
+ typedef M::iterator R;
+ M m;
assert(DefaultOnly::count == 0);
- {
- typedef std::multiset<Emplaceable> M;
- typedef M::iterator R;
- M m;
- R r = m.emplace();
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(*m.begin() == Emplaceable());
- r = m.emplace(2, 3.5);
- assert(r == std::next(m.begin()));
- assert(m.size() == 2);
- assert(*r == Emplaceable(2, 3.5));
- r = m.emplace(2, 3.5);
- assert(r == std::next(m.begin(), 2));
- assert(m.size() == 3);
- assert(*r == Emplaceable(2, 3.5));
- }
- {
- typedef std::multiset<int> M;
- typedef M::iterator R;
- M m;
- R r = m.emplace(M::value_type(2));
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(*r == 2);
- }
- {
- typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
- typedef M::iterator R;
- M m;
- R r = m.emplace(M::value_type(2));
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(*r == 2);
- }
+ R r = m.emplace();
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(*m.begin() == DefaultOnly());
+ assert(DefaultOnly::count == 1);
+
+ r = m.emplace();
+ assert(r == std::next(m.begin()));
+ assert(m.size() == 2);
+ assert(*m.begin() == DefaultOnly());
+ assert(DefaultOnly::count == 2);
+ }
+ assert(DefaultOnly::count == 0);
+ {
+ typedef std::multiset<Emplaceable> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.emplace();
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(*m.begin() == Emplaceable());
+ r = m.emplace(2, 3.5);
+ assert(r == std::next(m.begin()));
+ assert(m.size() == 2);
+ assert(*r == Emplaceable(2, 3.5));
+ r = m.emplace(2, 3.5);
+ assert(r == std::next(m.begin(), 2));
+ assert(m.size() == 3);
+ assert(*r == Emplaceable(2, 3.5));
+ }
+ {
+ typedef std::multiset<int> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.emplace(M::value_type(2));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(*r == 2);
+ }
+ {
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.emplace(M::value_type(2));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(*r == 2);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/emplace_hint.pass.cpp b/libcxx/test/std/containers/associative/multiset/emplace_hint.pass.cpp
index f865d1748a9a5c8..d8e9d1cd4d1c69c 100644
--- a/libcxx/test/std/containers/associative/multiset/emplace_hint.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/emplace_hint.pass.cpp
@@ -23,61 +23,60 @@
#include "DefaultOnly.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::multiset<DefaultOnly> M;
- typedef M::iterator R;
- M m;
- assert(DefaultOnly::count == 0);
- R r = m.emplace_hint(m.cend());
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(*m.begin() == DefaultOnly());
- assert(DefaultOnly::count == 1);
-
- r = m.emplace_hint(m.cbegin());
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(*m.begin() == DefaultOnly());
- assert(DefaultOnly::count == 2);
- }
+int main(int, char**) {
+ {
+ typedef std::multiset<DefaultOnly> M;
+ typedef M::iterator R;
+ M m;
assert(DefaultOnly::count == 0);
- {
- typedef std::multiset<Emplaceable> M;
- typedef M::iterator R;
- M m;
- R r = m.emplace_hint(m.cend());
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(*m.begin() == Emplaceable());
- r = m.emplace_hint(m.cend(), 2, 3.5);
- assert(r == std::next(m.begin()));
- assert(m.size() == 2);
- assert(*r == Emplaceable(2, 3.5));
- r = m.emplace_hint(m.cbegin(), 2, 3.5);
- assert(r == std::next(m.begin()));
- assert(m.size() == 3);
- assert(*r == Emplaceable(2, 3.5));
- }
- {
- typedef std::multiset<int> M;
- typedef M::iterator R;
- M m;
- R r = m.emplace_hint(m.cend(), M::value_type(2));
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(*r == 2);
- }
- {
- typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
- typedef M::iterator R;
- M m;
- R r = m.emplace_hint(m.cend(), M::value_type(2));
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(*r == 2);
- }
+ R r = m.emplace_hint(m.cend());
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(*m.begin() == DefaultOnly());
+ assert(DefaultOnly::count == 1);
+
+ r = m.emplace_hint(m.cbegin());
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(*m.begin() == DefaultOnly());
+ assert(DefaultOnly::count == 2);
+ }
+ assert(DefaultOnly::count == 0);
+ {
+ typedef std::multiset<Emplaceable> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.emplace_hint(m.cend());
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(*m.begin() == Emplaceable());
+ r = m.emplace_hint(m.cend(), 2, 3.5);
+ assert(r == std::next(m.begin()));
+ assert(m.size() == 2);
+ assert(*r == Emplaceable(2, 3.5));
+ r = m.emplace_hint(m.cbegin(), 2, 3.5);
+ assert(r == std::next(m.begin()));
+ assert(m.size() == 3);
+ assert(*r == Emplaceable(2, 3.5));
+ }
+ {
+ typedef std::multiset<int> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.emplace_hint(m.cend(), M::value_type(2));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(*r == 2);
+ }
+ {
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.emplace_hint(m.cend(), M::value_type(2));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(*r == 2);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/empty.pass.cpp b/libcxx/test/std/containers/associative/multiset/empty.pass.cpp
index 837c990ccc8267a..944f610a0c507aa 100644
--- a/libcxx/test/std/containers/associative/multiset/empty.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/empty.pass.cpp
@@ -18,9 +18,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::multiset<int> M;
M m;
assert(m.empty());
@@ -28,9 +27,9 @@ int main(int, char**)
assert(!m.empty());
m.clear();
assert(m.empty());
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
M m;
assert(m.empty());
@@ -38,7 +37,7 @@ int main(int, char**)
assert(!m.empty());
m.clear();
assert(m.empty());
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/multiset/empty.verify.cpp b/libcxx/test/std/containers/associative/multiset/empty.verify.cpp
index 0de93052ad7955d..90c397011fa8b4b 100644
--- a/libcxx/test/std/containers/associative/multiset/empty.verify.cpp
+++ b/libcxx/test/std/containers/associative/multiset/empty.verify.cpp
@@ -17,6 +17,6 @@
#include <set>
void f() {
- std::multiset<int> c;
- c.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::multiset<int> c;
+ c.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}
diff --git a/libcxx/test/std/containers/associative/multiset/equal_range.pass.cpp b/libcxx/test/std/containers/associative/multiset/equal_range.pass.cpp
index 9d1e25d8ab9ee58..e5c1d2b1eab987c 100644
--- a/libcxx/test/std/containers/associative/multiset/equal_range.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/equal_range.pass.cpp
@@ -20,245 +20,189 @@
#include "min_allocator.h"
#include "private_constructor.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef int V;
typedef std::multiset<int> M;
{
- typedef std::pair<M::iterator, M::iterator> R;
- V ar[] =
- {
- 5,
- 5,
- 5,
- 7,
- 7,
- 7,
- 9,
- 9,
- 9
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.equal_range(4);
- assert(r.first == std::next(m.begin(), 0));
- assert(r.second == std::next(m.begin(), 0));
- r = m.equal_range(5);
- assert(r.first == std::next(m.begin(), 0));
- assert(r.second == std::next(m.begin(), 3));
- r = m.equal_range(6);
- assert(r.first == std::next(m.begin(), 3));
- assert(r.second == std::next(m.begin(), 3));
- r = m.equal_range(7);
- assert(r.first == std::next(m.begin(), 3));
- assert(r.second == std::next(m.begin(), 6));
- r = m.equal_range(8);
- assert(r.first == std::next(m.begin(), 6));
- assert(r.second == std::next(m.begin(), 6));
- r = m.equal_range(9);
- assert(r.first == std::next(m.begin(), 6));
- assert(r.second == std::next(m.begin(), 9));
- r = m.equal_range(10);
- assert(r.first == std::next(m.begin(), 9));
- assert(r.second == std::next(m.begin(), 9));
+ typedef std::pair<M::iterator, M::iterator> R;
+ V ar[] = {5, 5, 5, 7, 7, 7, 9, 9, 9};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.equal_range(4);
+ assert(r.first == std::next(m.begin(), 0));
+ assert(r.second == std::next(m.begin(), 0));
+ r = m.equal_range(5);
+ assert(r.first == std::next(m.begin(), 0));
+ assert(r.second == std::next(m.begin(), 3));
+ r = m.equal_range(6);
+ assert(r.first == std::next(m.begin(), 3));
+ assert(r.second == std::next(m.begin(), 3));
+ r = m.equal_range(7);
+ assert(r.first == std::next(m.begin(), 3));
+ assert(r.second == std::next(m.begin(), 6));
+ r = m.equal_range(8);
+ assert(r.first == std::next(m.begin(), 6));
+ assert(r.second == std::next(m.begin(), 6));
+ r = m.equal_range(9);
+ assert(r.first == std::next(m.begin(), 6));
+ assert(r.second == std::next(m.begin(), 9));
+ r = m.equal_range(10);
+ assert(r.first == std::next(m.begin(), 9));
+ assert(r.second == std::next(m.begin(), 9));
}
{
- typedef std::pair<M::const_iterator, M::const_iterator> R;
- V ar[] =
- {
- 5,
- 5,
- 5,
- 7,
- 7,
- 7,
- 9,
- 9,
- 9
- };
- const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.equal_range(4);
- assert(r.first == std::next(m.begin(), 0));
- assert(r.second == std::next(m.begin(), 0));
- r = m.equal_range(5);
- assert(r.first == std::next(m.begin(), 0));
- assert(r.second == std::next(m.begin(), 3));
- r = m.equal_range(6);
- assert(r.first == std::next(m.begin(), 3));
- assert(r.second == std::next(m.begin(), 3));
- r = m.equal_range(7);
- assert(r.first == std::next(m.begin(), 3));
- assert(r.second == std::next(m.begin(), 6));
- r = m.equal_range(8);
- assert(r.first == std::next(m.begin(), 6));
- assert(r.second == std::next(m.begin(), 6));
- r = m.equal_range(9);
- assert(r.first == std::next(m.begin(), 6));
- assert(r.second == std::next(m.begin(), 9));
- r = m.equal_range(10);
- assert(r.first == std::next(m.begin(), 9));
- assert(r.second == std::next(m.begin(), 9));
- }
+ typedef std::pair<M::const_iterator, M::const_iterator> R;
+ V ar[] = {5, 5, 5, 7, 7, 7, 9, 9, 9};
+ const M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.equal_range(4);
+ assert(r.first == std::next(m.begin(), 0));
+ assert(r.second == std::next(m.begin(), 0));
+ r = m.equal_range(5);
+ assert(r.first == std::next(m.begin(), 0));
+ assert(r.second == std::next(m.begin(), 3));
+ r = m.equal_range(6);
+ assert(r.first == std::next(m.begin(), 3));
+ assert(r.second == std::next(m.begin(), 3));
+ r = m.equal_range(7);
+ assert(r.first == std::next(m.begin(), 3));
+ assert(r.second == std::next(m.begin(), 6));
+ r = m.equal_range(8);
+ assert(r.first == std::next(m.begin(), 6));
+ assert(r.second == std::next(m.begin(), 6));
+ r = m.equal_range(9);
+ assert(r.first == std::next(m.begin(), 6));
+ assert(r.second == std::next(m.begin(), 9));
+ r = m.equal_range(10);
+ assert(r.first == std::next(m.begin(), 9));
+ assert(r.second == std::next(m.begin(), 9));
}
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef int V;
typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
{
- typedef std::pair<M::iterator, M::iterator> R;
- V ar[] =
- {
- 5,
- 5,
- 5,
- 7,
- 7,
- 7,
- 9,
- 9,
- 9
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.equal_range(4);
- assert(r.first == std::next(m.begin(), 0));
- assert(r.second == std::next(m.begin(), 0));
- r = m.equal_range(5);
- assert(r.first == std::next(m.begin(), 0));
- assert(r.second == std::next(m.begin(), 3));
- r = m.equal_range(6);
- assert(r.first == std::next(m.begin(), 3));
- assert(r.second == std::next(m.begin(), 3));
- r = m.equal_range(7);
- assert(r.first == std::next(m.begin(), 3));
- assert(r.second == std::next(m.begin(), 6));
- r = m.equal_range(8);
- assert(r.first == std::next(m.begin(), 6));
- assert(r.second == std::next(m.begin(), 6));
- r = m.equal_range(9);
- assert(r.first == std::next(m.begin(), 6));
- assert(r.second == std::next(m.begin(), 9));
- r = m.equal_range(10);
- assert(r.first == std::next(m.begin(), 9));
- assert(r.second == std::next(m.begin(), 9));
+ typedef std::pair<M::iterator, M::iterator> R;
+ V ar[] = {5, 5, 5, 7, 7, 7, 9, 9, 9};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.equal_range(4);
+ assert(r.first == std::next(m.begin(), 0));
+ assert(r.second == std::next(m.begin(), 0));
+ r = m.equal_range(5);
+ assert(r.first == std::next(m.begin(), 0));
+ assert(r.second == std::next(m.begin(), 3));
+ r = m.equal_range(6);
+ assert(r.first == std::next(m.begin(), 3));
+ assert(r.second == std::next(m.begin(), 3));
+ r = m.equal_range(7);
+ assert(r.first == std::next(m.begin(), 3));
+ assert(r.second == std::next(m.begin(), 6));
+ r = m.equal_range(8);
+ assert(r.first == std::next(m.begin(), 6));
+ assert(r.second == std::next(m.begin(), 6));
+ r = m.equal_range(9);
+ assert(r.first == std::next(m.begin(), 6));
+ assert(r.second == std::next(m.begin(), 9));
+ r = m.equal_range(10);
+ assert(r.first == std::next(m.begin(), 9));
+ assert(r.second == std::next(m.begin(), 9));
}
{
- typedef std::pair<M::const_iterator, M::const_iterator> R;
- V ar[] =
- {
- 5,
- 5,
- 5,
- 7,
- 7,
- 7,
- 9,
- 9,
- 9
- };
- const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.equal_range(4);
- assert(r.first == std::next(m.begin(), 0));
- assert(r.second == std::next(m.begin(), 0));
- r = m.equal_range(5);
- assert(r.first == std::next(m.begin(), 0));
- assert(r.second == std::next(m.begin(), 3));
- r = m.equal_range(6);
- assert(r.first == std::next(m.begin(), 3));
- assert(r.second == std::next(m.begin(), 3));
- r = m.equal_range(7);
- assert(r.first == std::next(m.begin(), 3));
- assert(r.second == std::next(m.begin(), 6));
- r = m.equal_range(8);
- assert(r.first == std::next(m.begin(), 6));
- assert(r.second == std::next(m.begin(), 6));
- r = m.equal_range(9);
- assert(r.first == std::next(m.begin(), 6));
- assert(r.second == std::next(m.begin(), 9));
- r = m.equal_range(10);
- assert(r.first == std::next(m.begin(), 9));
- assert(r.second == std::next(m.begin(), 9));
- }
+ typedef std::pair<M::const_iterator, M::const_iterator> R;
+ V ar[] = {5, 5, 5, 7, 7, 7, 9, 9, 9};
+ const M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.equal_range(4);
+ assert(r.first == std::next(m.begin(), 0));
+ assert(r.second == std::next(m.begin(), 0));
+ r = m.equal_range(5);
+ assert(r.first == std::next(m.begin(), 0));
+ assert(r.second == std::next(m.begin(), 3));
+ r = m.equal_range(6);
+ assert(r.first == std::next(m.begin(), 3));
+ assert(r.second == std::next(m.begin(), 3));
+ r = m.equal_range(7);
+ assert(r.first == std::next(m.begin(), 3));
+ assert(r.second == std::next(m.begin(), 6));
+ r = m.equal_range(8);
+ assert(r.first == std::next(m.begin(), 6));
+ assert(r.second == std::next(m.begin(), 6));
+ r = m.equal_range(9);
+ assert(r.first == std::next(m.begin(), 6));
+ assert(r.second == std::next(m.begin(), 9));
+ r = m.equal_range(10);
+ assert(r.first == std::next(m.begin(), 9));
+ assert(r.second == std::next(m.begin(), 9));
}
+ }
#endif
#if TEST_STD_VER > 11
- {
+ {
typedef int V;
typedef std::multiset<V, std::less<>> M;
typedef std::pair<M::iterator, M::iterator> R;
- V ar[] =
- {
- 5,
- 5,
- 5,
- 7,
- 7,
- 7,
- 9,
- 9,
- 9
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ V ar[] = {5, 5, 5, 7, 7, 7, 9, 9, 9};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
R r = m.equal_range(4);
- assert(r.first == std::next(m.begin(), 0));
+ assert(r.first == std::next(m.begin(), 0));
assert(r.second == std::next(m.begin(), 0));
r = m.equal_range(5);
- assert(r.first == std::next(m.begin(), 0));
+ assert(r.first == std::next(m.begin(), 0));
assert(r.second == std::next(m.begin(), 3));
r = m.equal_range(6);
- assert(r.first == std::next(m.begin(), 3));
+ assert(r.first == std::next(m.begin(), 3));
assert(r.second == std::next(m.begin(), 3));
r = m.equal_range(7);
- assert(r.first == std::next(m.begin(), 3));
+ assert(r.first == std::next(m.begin(), 3));
assert(r.second == std::next(m.begin(), 6));
r = m.equal_range(8);
- assert(r.first == std::next(m.begin(), 6));
+ assert(r.first == std::next(m.begin(), 6));
assert(r.second == std::next(m.begin(), 6));
r = m.equal_range(9);
- assert(r.first == std::next(m.begin(), 6));
+ assert(r.first == std::next(m.begin(), 6));
assert(r.second == std::next(m.begin(), 9));
r = m.equal_range(10);
- assert(r.first == std::next(m.begin(), 9));
+ assert(r.first == std::next(m.begin(), 9));
assert(r.second == std::next(m.begin(), 9));
- }
+ }
- {
+ {
typedef PrivateConstructor V;
typedef std::multiset<V, std::less<>> M;
typedef std::pair<M::iterator, M::iterator> R;
M m;
- m.insert ( V::make ( 5 ));
- m.insert ( V::make ( 5 ));
- m.insert ( V::make ( 5 ));
- m.insert ( V::make ( 7 ));
- m.insert ( V::make ( 7 ));
- m.insert ( V::make ( 7 ));
- m.insert ( V::make ( 9 ));
- m.insert ( V::make ( 9 ));
- m.insert ( V::make ( 9 ));
+ m.insert(V::make(5));
+ m.insert(V::make(5));
+ m.insert(V::make(5));
+ m.insert(V::make(7));
+ m.insert(V::make(7));
+ m.insert(V::make(7));
+ m.insert(V::make(9));
+ m.insert(V::make(9));
+ m.insert(V::make(9));
R r = m.equal_range(4);
- assert(r.first == std::next(m.begin(), 0));
+ assert(r.first == std::next(m.begin(), 0));
assert(r.second == std::next(m.begin(), 0));
r = m.equal_range(5);
- assert(r.first == std::next(m.begin(), 0));
+ assert(r.first == std::next(m.begin(), 0));
assert(r.second == std::next(m.begin(), 3));
r = m.equal_range(6);
- assert(r.first == std::next(m.begin(), 3));
+ assert(r.first == std::next(m.begin(), 3));
assert(r.second == std::next(m.begin(), 3));
r = m.equal_range(7);
- assert(r.first == std::next(m.begin(), 3));
+ assert(r.first == std::next(m.begin(), 3));
assert(r.second == std::next(m.begin(), 6));
r = m.equal_range(8);
- assert(r.first == std::next(m.begin(), 6));
+ assert(r.first == std::next(m.begin(), 6));
assert(r.second == std::next(m.begin(), 6));
r = m.equal_range(9);
- assert(r.first == std::next(m.begin(), 6));
+ assert(r.first == std::next(m.begin(), 6));
assert(r.second == std::next(m.begin(), 9));
r = m.equal_range(10);
- assert(r.first == std::next(m.begin(), 9));
+ assert(r.first == std::next(m.begin(), 9));
assert(r.second == std::next(m.begin(), 9));
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/multiset/equal_range_transparent.pass.cpp b/libcxx/test/std/containers/associative/multiset/equal_range_transparent.pass.cpp
index 06b4550933794fe..6402488a44f220a 100644
--- a/libcxx/test/std/containers/associative/multiset/equal_range_transparent.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/equal_range_transparent.pass.cpp
@@ -26,24 +26,17 @@
struct Comp {
using is_transparent = void;
- bool operator()(const std::pair<int, int> &lhs,
- const std::pair<int, int> &rhs) const {
- return lhs < rhs;
- }
+ bool operator()(const std::pair<int, int>& lhs, const std::pair<int, int>& rhs) const { return lhs < rhs; }
- bool operator()(const std::pair<int, int> &lhs, int rhs) const {
- return lhs.first < rhs;
- }
+ bool operator()(const std::pair<int, int>& lhs, int rhs) const { return lhs.first < rhs; }
- bool operator()(int lhs, const std::pair<int, int> &rhs) const {
- return lhs < rhs.first;
- }
+ bool operator()(int lhs, const std::pair<int, int>& rhs) const { return lhs < rhs.first; }
};
int main(int, char**) {
std::multiset<std::pair<int, int>, Comp> s{{2, 1}, {1, 1}, {1, 1}, {1, 1}, {2, 2}};
- auto er = s.equal_range(1);
+ auto er = s.equal_range(1);
long nels = 0;
for (auto it = er.first; it != er.second; it++) {
diff --git a/libcxx/test/std/containers/associative/multiset/erase_iter.pass.cpp b/libcxx/test/std/containers/associative/multiset/erase_iter.pass.cpp
index a42d48b7847df95..31f00feda2977f6 100644
--- a/libcxx/test/std/containers/associative/multiset/erase_iter.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/erase_iter.pass.cpp
@@ -18,187 +18,165 @@
#include "test_macros.h"
#include "min_allocator.h"
-struct TemplateConstructor
-{
- template<typename T>
- TemplateConstructor (const T&) {}
+struct TemplateConstructor {
+ template <typename T>
+ TemplateConstructor(const T&) {}
};
bool operator<(const TemplateConstructor&, const TemplateConstructor&) { return false; }
-int main(int, char**)
-{
- {
- typedef std::multiset<int> M;
- typedef int V;
- typedef M::iterator I;
- V ar[] =
- {
- 1,
- 2,
- 3,
- 4,
- 5,
- 6,
- 7,
- 8
- };
- M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
- assert(m.size() == 8);
- I i = m.erase(std::next(m.cbegin(), 3));
- assert(m.size() == 7);
- assert(i == std::next(m.begin(), 3));
- assert(*std::next(m.begin(), 0) == 1);
- assert(*std::next(m.begin(), 1) == 2);
- assert(*std::next(m.begin(), 2) == 3);
- assert(*std::next(m.begin(), 3) == 5);
- assert(*std::next(m.begin(), 4) == 6);
- assert(*std::next(m.begin(), 5) == 7);
- assert(*std::next(m.begin(), 6) == 8);
-
- i = m.erase(std::next(m.cbegin(), 0));
- assert(m.size() == 6);
- assert(i == m.begin());
- assert(*std::next(m.begin(), 0) == 2);
- assert(*std::next(m.begin(), 1) == 3);
- assert(*std::next(m.begin(), 2) == 5);
- assert(*std::next(m.begin(), 3) == 6);
- assert(*std::next(m.begin(), 4) == 7);
- assert(*std::next(m.begin(), 5) == 8);
-
- i = m.erase(std::next(m.cbegin(), 5));
- assert(m.size() == 5);
- assert(i == m.end());
- assert(*std::next(m.begin(), 0) == 2);
- assert(*std::next(m.begin(), 1) == 3);
- assert(*std::next(m.begin(), 2) == 5);
- assert(*std::next(m.begin(), 3) == 6);
- assert(*std::next(m.begin(), 4) == 7);
-
- i = m.erase(std::next(m.cbegin(), 1));
- assert(m.size() == 4);
- assert(i == std::next(m.begin()));
- assert(*std::next(m.begin(), 0) == 2);
- assert(*std::next(m.begin(), 1) == 5);
- assert(*std::next(m.begin(), 2) == 6);
- assert(*std::next(m.begin(), 3) == 7);
-
- i = m.erase(std::next(m.cbegin(), 2));
- assert(m.size() == 3);
- assert(i == std::next(m.begin(), 2));
- assert(*std::next(m.begin(), 0) == 2);
- assert(*std::next(m.begin(), 1) == 5);
- assert(*std::next(m.begin(), 2) == 7);
-
- i = m.erase(std::next(m.cbegin(), 2));
- assert(m.size() == 2);
- assert(i == std::next(m.begin(), 2));
- assert(*std::next(m.begin(), 0) == 2);
- assert(*std::next(m.begin(), 1) == 5);
-
- i = m.erase(std::next(m.cbegin(), 0));
- assert(m.size() == 1);
- assert(i == std::next(m.begin(), 0));
- assert(*std::next(m.begin(), 0) == 5);
-
- i = m.erase(m.cbegin());
- assert(m.size() == 0);
- assert(i == m.begin());
- assert(i == m.end());
- }
+int main(int, char**) {
+ {
+ typedef std::multiset<int> M;
+ typedef int V;
+ typedef M::iterator I;
+ V ar[] = {1, 2, 3, 4, 5, 6, 7, 8};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(m.size() == 8);
+ I i = m.erase(std::next(m.cbegin(), 3));
+ assert(m.size() == 7);
+ assert(i == std::next(m.begin(), 3));
+ assert(*std::next(m.begin(), 0) == 1);
+ assert(*std::next(m.begin(), 1) == 2);
+ assert(*std::next(m.begin(), 2) == 3);
+ assert(*std::next(m.begin(), 3) == 5);
+ assert(*std::next(m.begin(), 4) == 6);
+ assert(*std::next(m.begin(), 5) == 7);
+ assert(*std::next(m.begin(), 6) == 8);
+
+ i = m.erase(std::next(m.cbegin(), 0));
+ assert(m.size() == 6);
+ assert(i == m.begin());
+ assert(*std::next(m.begin(), 0) == 2);
+ assert(*std::next(m.begin(), 1) == 3);
+ assert(*std::next(m.begin(), 2) == 5);
+ assert(*std::next(m.begin(), 3) == 6);
+ assert(*std::next(m.begin(), 4) == 7);
+ assert(*std::next(m.begin(), 5) == 8);
+
+ i = m.erase(std::next(m.cbegin(), 5));
+ assert(m.size() == 5);
+ assert(i == m.end());
+ assert(*std::next(m.begin(), 0) == 2);
+ assert(*std::next(m.begin(), 1) == 3);
+ assert(*std::next(m.begin(), 2) == 5);
+ assert(*std::next(m.begin(), 3) == 6);
+ assert(*std::next(m.begin(), 4) == 7);
+
+ i = m.erase(std::next(m.cbegin(), 1));
+ assert(m.size() == 4);
+ assert(i == std::next(m.begin()));
+ assert(*std::next(m.begin(), 0) == 2);
+ assert(*std::next(m.begin(), 1) == 5);
+ assert(*std::next(m.begin(), 2) == 6);
+ assert(*std::next(m.begin(), 3) == 7);
+
+ i = m.erase(std::next(m.cbegin(), 2));
+ assert(m.size() == 3);
+ assert(i == std::next(m.begin(), 2));
+ assert(*std::next(m.begin(), 0) == 2);
+ assert(*std::next(m.begin(), 1) == 5);
+ assert(*std::next(m.begin(), 2) == 7);
+
+ i = m.erase(std::next(m.cbegin(), 2));
+ assert(m.size() == 2);
+ assert(i == std::next(m.begin(), 2));
+ assert(*std::next(m.begin(), 0) == 2);
+ assert(*std::next(m.begin(), 1) == 5);
+
+ i = m.erase(std::next(m.cbegin(), 0));
+ assert(m.size() == 1);
+ assert(i == std::next(m.begin(), 0));
+ assert(*std::next(m.begin(), 0) == 5);
+
+ i = m.erase(m.cbegin());
+ assert(m.size() == 0);
+ assert(i == m.begin());
+ assert(i == m.end());
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
- typedef int V;
- typedef M::iterator I;
- V ar[] =
- {
- 1,
- 2,
- 3,
- 4,
- 5,
- 6,
- 7,
- 8
- };
- M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
- assert(m.size() == 8);
- I i = m.erase(std::next(m.cbegin(), 3));
- assert(m.size() == 7);
- assert(i == std::next(m.begin(), 3));
- assert(*std::next(m.begin(), 0) == 1);
- assert(*std::next(m.begin(), 1) == 2);
- assert(*std::next(m.begin(), 2) == 3);
- assert(*std::next(m.begin(), 3) == 5);
- assert(*std::next(m.begin(), 4) == 6);
- assert(*std::next(m.begin(), 5) == 7);
- assert(*std::next(m.begin(), 6) == 8);
-
- i = m.erase(std::next(m.cbegin(), 0));
- assert(m.size() == 6);
- assert(i == m.begin());
- assert(*std::next(m.begin(), 0) == 2);
- assert(*std::next(m.begin(), 1) == 3);
- assert(*std::next(m.begin(), 2) == 5);
- assert(*std::next(m.begin(), 3) == 6);
- assert(*std::next(m.begin(), 4) == 7);
- assert(*std::next(m.begin(), 5) == 8);
-
- i = m.erase(std::next(m.cbegin(), 5));
- assert(m.size() == 5);
- assert(i == m.end());
- assert(*std::next(m.begin(), 0) == 2);
- assert(*std::next(m.begin(), 1) == 3);
- assert(*std::next(m.begin(), 2) == 5);
- assert(*std::next(m.begin(), 3) == 6);
- assert(*std::next(m.begin(), 4) == 7);
-
- i = m.erase(std::next(m.cbegin(), 1));
- assert(m.size() == 4);
- assert(i == std::next(m.begin()));
- assert(*std::next(m.begin(), 0) == 2);
- assert(*std::next(m.begin(), 1) == 5);
- assert(*std::next(m.begin(), 2) == 6);
- assert(*std::next(m.begin(), 3) == 7);
-
- i = m.erase(std::next(m.cbegin(), 2));
- assert(m.size() == 3);
- assert(i == std::next(m.begin(), 2));
- assert(*std::next(m.begin(), 0) == 2);
- assert(*std::next(m.begin(), 1) == 5);
- assert(*std::next(m.begin(), 2) == 7);
-
- i = m.erase(std::next(m.cbegin(), 2));
- assert(m.size() == 2);
- assert(i == std::next(m.begin(), 2));
- assert(*std::next(m.begin(), 0) == 2);
- assert(*std::next(m.begin(), 1) == 5);
-
- i = m.erase(std::next(m.cbegin(), 0));
- assert(m.size() == 1);
- assert(i == std::next(m.begin(), 0));
- assert(*std::next(m.begin(), 0) == 5);
-
- i = m.erase(m.cbegin());
- assert(m.size() == 0);
- assert(i == m.begin());
- assert(i == m.end());
- }
+ {
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+ typedef int V;
+ typedef M::iterator I;
+ V ar[] = {1, 2, 3, 4, 5, 6, 7, 8};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(m.size() == 8);
+ I i = m.erase(std::next(m.cbegin(), 3));
+ assert(m.size() == 7);
+ assert(i == std::next(m.begin(), 3));
+ assert(*std::next(m.begin(), 0) == 1);
+ assert(*std::next(m.begin(), 1) == 2);
+ assert(*std::next(m.begin(), 2) == 3);
+ assert(*std::next(m.begin(), 3) == 5);
+ assert(*std::next(m.begin(), 4) == 6);
+ assert(*std::next(m.begin(), 5) == 7);
+ assert(*std::next(m.begin(), 6) == 8);
+
+ i = m.erase(std::next(m.cbegin(), 0));
+ assert(m.size() == 6);
+ assert(i == m.begin());
+ assert(*std::next(m.begin(), 0) == 2);
+ assert(*std::next(m.begin(), 1) == 3);
+ assert(*std::next(m.begin(), 2) == 5);
+ assert(*std::next(m.begin(), 3) == 6);
+ assert(*std::next(m.begin(), 4) == 7);
+ assert(*std::next(m.begin(), 5) == 8);
+
+ i = m.erase(std::next(m.cbegin(), 5));
+ assert(m.size() == 5);
+ assert(i == m.end());
+ assert(*std::next(m.begin(), 0) == 2);
+ assert(*std::next(m.begin(), 1) == 3);
+ assert(*std::next(m.begin(), 2) == 5);
+ assert(*std::next(m.begin(), 3) == 6);
+ assert(*std::next(m.begin(), 4) == 7);
+
+ i = m.erase(std::next(m.cbegin(), 1));
+ assert(m.size() == 4);
+ assert(i == std::next(m.begin()));
+ assert(*std::next(m.begin(), 0) == 2);
+ assert(*std::next(m.begin(), 1) == 5);
+ assert(*std::next(m.begin(), 2) == 6);
+ assert(*std::next(m.begin(), 3) == 7);
+
+ i = m.erase(std::next(m.cbegin(), 2));
+ assert(m.size() == 3);
+ assert(i == std::next(m.begin(), 2));
+ assert(*std::next(m.begin(), 0) == 2);
+ assert(*std::next(m.begin(), 1) == 5);
+ assert(*std::next(m.begin(), 2) == 7);
+
+ i = m.erase(std::next(m.cbegin(), 2));
+ assert(m.size() == 2);
+ assert(i == std::next(m.begin(), 2));
+ assert(*std::next(m.begin(), 0) == 2);
+ assert(*std::next(m.begin(), 1) == 5);
+
+ i = m.erase(std::next(m.cbegin(), 0));
+ assert(m.size() == 1);
+ assert(i == std::next(m.begin(), 0));
+ assert(*std::next(m.begin(), 0) == 5);
+
+ i = m.erase(m.cbegin());
+ assert(m.size() == 0);
+ assert(i == m.begin());
+ assert(i == m.end());
+ }
#endif
#if TEST_STD_VER >= 14
- {
+ {
// This is LWG #2059
- typedef TemplateConstructor T;
- typedef std::multiset<T> C;
- typedef C::iterator I;
-
- C c;
- T a{0};
- I it = c.find(a);
- if (it != c.end())
- c.erase(it);
- }
+ typedef TemplateConstructor T;
+ typedef std::multiset<T> C;
+ typedef C::iterator I;
+
+ C c;
+ T a{0};
+ I it = c.find(a);
+ if (it != c.end())
+ c.erase(it);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/multiset/erase_iter_iter.pass.cpp b/libcxx/test/std/containers/associative/multiset/erase_iter_iter.pass.cpp
index 54f694926f05e35..a3937d13bbb4bf5 100644
--- a/libcxx/test/std/containers/associative/multiset/erase_iter_iter.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/erase_iter_iter.pass.cpp
@@ -18,125 +18,104 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::multiset<int> M;
- typedef int V;
- typedef M::iterator I;
- V ar[] =
- {
- 1,
- 2,
- 3,
- 4,
- 5,
- 6,
- 7,
- 8
- };
- M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
- assert(m.size() == 8);
- I i = m.erase(std::next(m.cbegin(), 5), std::next(m.cbegin(), 5));
- assert(m.size() == 8);
- assert(i == std::next(m.begin(), 5));
- assert(*std::next(m.begin(), 0) == 1);
- assert(*std::next(m.begin(), 1) == 2);
- assert(*std::next(m.begin(), 2) == 3);
- assert(*std::next(m.begin(), 3) == 4);
- assert(*std::next(m.begin(), 4) == 5);
- assert(*std::next(m.begin(), 5) == 6);
- assert(*std::next(m.begin(), 6) == 7);
- assert(*std::next(m.begin(), 7) == 8);
+int main(int, char**) {
+ {
+ typedef std::multiset<int> M;
+ typedef int V;
+ typedef M::iterator I;
+ V ar[] = {1, 2, 3, 4, 5, 6, 7, 8};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(m.size() == 8);
+ I i = m.erase(std::next(m.cbegin(), 5), std::next(m.cbegin(), 5));
+ assert(m.size() == 8);
+ assert(i == std::next(m.begin(), 5));
+ assert(*std::next(m.begin(), 0) == 1);
+ assert(*std::next(m.begin(), 1) == 2);
+ assert(*std::next(m.begin(), 2) == 3);
+ assert(*std::next(m.begin(), 3) == 4);
+ assert(*std::next(m.begin(), 4) == 5);
+ assert(*std::next(m.begin(), 5) == 6);
+ assert(*std::next(m.begin(), 6) == 7);
+ assert(*std::next(m.begin(), 7) == 8);
- i = m.erase(std::next(m.cbegin(), 3), std::next(m.cbegin(), 4));
- assert(m.size() == 7);
- assert(i == std::next(m.begin(), 3));
- assert(*std::next(m.begin(), 0) == 1);
- assert(*std::next(m.begin(), 1) == 2);
- assert(*std::next(m.begin(), 2) == 3);
- assert(*std::next(m.begin(), 3) == 5);
- assert(*std::next(m.begin(), 4) == 6);
- assert(*std::next(m.begin(), 5) == 7);
- assert(*std::next(m.begin(), 6) == 8);
+ i = m.erase(std::next(m.cbegin(), 3), std::next(m.cbegin(), 4));
+ assert(m.size() == 7);
+ assert(i == std::next(m.begin(), 3));
+ assert(*std::next(m.begin(), 0) == 1);
+ assert(*std::next(m.begin(), 1) == 2);
+ assert(*std::next(m.begin(), 2) == 3);
+ assert(*std::next(m.begin(), 3) == 5);
+ assert(*std::next(m.begin(), 4) == 6);
+ assert(*std::next(m.begin(), 5) == 7);
+ assert(*std::next(m.begin(), 6) == 8);
- i = m.erase(std::next(m.cbegin(), 2), std::next(m.cbegin(), 5));
- assert(m.size() == 4);
- assert(i == std::next(m.begin(), 2));
- assert(*std::next(m.begin(), 0) == 1);
- assert(*std::next(m.begin(), 1) == 2);
- assert(*std::next(m.begin(), 2) == 7);
- assert(*std::next(m.begin(), 3) == 8);
+ i = m.erase(std::next(m.cbegin(), 2), std::next(m.cbegin(), 5));
+ assert(m.size() == 4);
+ assert(i == std::next(m.begin(), 2));
+ assert(*std::next(m.begin(), 0) == 1);
+ assert(*std::next(m.begin(), 1) == 2);
+ assert(*std::next(m.begin(), 2) == 7);
+ assert(*std::next(m.begin(), 3) == 8);
- i = m.erase(std::next(m.cbegin(), 0), std::next(m.cbegin(), 2));
- assert(m.size() == 2);
- assert(i == std::next(m.begin(), 0));
- assert(*std::next(m.begin(), 0) == 7);
- assert(*std::next(m.begin(), 1) == 8);
+ i = m.erase(std::next(m.cbegin(), 0), std::next(m.cbegin(), 2));
+ assert(m.size() == 2);
+ assert(i == std::next(m.begin(), 0));
+ assert(*std::next(m.begin(), 0) == 7);
+ assert(*std::next(m.begin(), 1) == 8);
- i = m.erase(m.cbegin(), m.cend());
- assert(m.size() == 0);
- assert(i == m.end());
- }
+ i = m.erase(m.cbegin(), m.cend());
+ assert(m.size() == 0);
+ assert(i == m.end());
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
- typedef int V;
- typedef M::iterator I;
- V ar[] =
- {
- 1,
- 2,
- 3,
- 4,
- 5,
- 6,
- 7,
- 8
- };
- M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
- assert(m.size() == 8);
- I i = m.erase(std::next(m.cbegin(), 5), std::next(m.cbegin(), 5));
- assert(m.size() == 8);
- assert(i == std::next(m.begin(), 5));
- assert(*std::next(m.begin(), 0) == 1);
- assert(*std::next(m.begin(), 1) == 2);
- assert(*std::next(m.begin(), 2) == 3);
- assert(*std::next(m.begin(), 3) == 4);
- assert(*std::next(m.begin(), 4) == 5);
- assert(*std::next(m.begin(), 5) == 6);
- assert(*std::next(m.begin(), 6) == 7);
- assert(*std::next(m.begin(), 7) == 8);
+ {
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+ typedef int V;
+ typedef M::iterator I;
+ V ar[] = {1, 2, 3, 4, 5, 6, 7, 8};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(m.size() == 8);
+ I i = m.erase(std::next(m.cbegin(), 5), std::next(m.cbegin(), 5));
+ assert(m.size() == 8);
+ assert(i == std::next(m.begin(), 5));
+ assert(*std::next(m.begin(), 0) == 1);
+ assert(*std::next(m.begin(), 1) == 2);
+ assert(*std::next(m.begin(), 2) == 3);
+ assert(*std::next(m.begin(), 3) == 4);
+ assert(*std::next(m.begin(), 4) == 5);
+ assert(*std::next(m.begin(), 5) == 6);
+ assert(*std::next(m.begin(), 6) == 7);
+ assert(*std::next(m.begin(), 7) == 8);
- i = m.erase(std::next(m.cbegin(), 3), std::next(m.cbegin(), 4));
- assert(m.size() == 7);
- assert(i == std::next(m.begin(), 3));
- assert(*std::next(m.begin(), 0) == 1);
- assert(*std::next(m.begin(), 1) == 2);
- assert(*std::next(m.begin(), 2) == 3);
- assert(*std::next(m.begin(), 3) == 5);
- assert(*std::next(m.begin(), 4) == 6);
- assert(*std::next(m.begin(), 5) == 7);
- assert(*std::next(m.begin(), 6) == 8);
+ i = m.erase(std::next(m.cbegin(), 3), std::next(m.cbegin(), 4));
+ assert(m.size() == 7);
+ assert(i == std::next(m.begin(), 3));
+ assert(*std::next(m.begin(), 0) == 1);
+ assert(*std::next(m.begin(), 1) == 2);
+ assert(*std::next(m.begin(), 2) == 3);
+ assert(*std::next(m.begin(), 3) == 5);
+ assert(*std::next(m.begin(), 4) == 6);
+ assert(*std::next(m.begin(), 5) == 7);
+ assert(*std::next(m.begin(), 6) == 8);
- i = m.erase(std::next(m.cbegin(), 2), std::next(m.cbegin(), 5));
- assert(m.size() == 4);
- assert(i == std::next(m.begin(), 2));
- assert(*std::next(m.begin(), 0) == 1);
- assert(*std::next(m.begin(), 1) == 2);
- assert(*std::next(m.begin(), 2) == 7);
- assert(*std::next(m.begin(), 3) == 8);
+ i = m.erase(std::next(m.cbegin(), 2), std::next(m.cbegin(), 5));
+ assert(m.size() == 4);
+ assert(i == std::next(m.begin(), 2));
+ assert(*std::next(m.begin(), 0) == 1);
+ assert(*std::next(m.begin(), 1) == 2);
+ assert(*std::next(m.begin(), 2) == 7);
+ assert(*std::next(m.begin(), 3) == 8);
- i = m.erase(std::next(m.cbegin(), 0), std::next(m.cbegin(), 2));
- assert(m.size() == 2);
- assert(i == std::next(m.begin(), 0));
- assert(*std::next(m.begin(), 0) == 7);
- assert(*std::next(m.begin(), 1) == 8);
+ i = m.erase(std::next(m.cbegin(), 0), std::next(m.cbegin(), 2));
+ assert(m.size() == 2);
+ assert(i == std::next(m.begin(), 0));
+ assert(*std::next(m.begin(), 0) == 7);
+ assert(*std::next(m.begin(), 1) == 8);
- i = m.erase(m.cbegin(), m.cend());
- assert(m.size() == 0);
- assert(i == m.end());
- }
+ i = m.erase(m.cbegin(), m.cend());
+ assert(m.size() == 0);
+ assert(i == m.end());
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/multiset/erase_key.pass.cpp b/libcxx/test/std/containers/associative/multiset/erase_key.pass.cpp
index fa5c9d646a65237..ba04a238e44b50e 100644
--- a/libcxx/test/std/containers/associative/multiset/erase_key.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/erase_key.pass.cpp
@@ -18,113 +18,90 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::multiset<int> M;
- typedef int V;
- typedef M::size_type I;
- V ar[] =
- {
- 3,
- 3,
- 3,
- 5,
- 5,
- 5,
- 7,
- 7,
- 7
- };
- M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
- assert(m.size() == 9);
- I i = m.erase(6);
- assert(m.size() == 9);
- assert(i == 0);
- assert(*std::next(m.begin(), 0) == 3);
- assert(*std::next(m.begin(), 1) == 3);
- assert(*std::next(m.begin(), 2) == 3);
- assert(*std::next(m.begin(), 3) == 5);
- assert(*std::next(m.begin(), 4) == 5);
- assert(*std::next(m.begin(), 5) == 5);
- assert(*std::next(m.begin(), 6) == 7);
- assert(*std::next(m.begin(), 7) == 7);
- assert(*std::next(m.begin(), 8) == 7);
+int main(int, char**) {
+ {
+ typedef std::multiset<int> M;
+ typedef int V;
+ typedef M::size_type I;
+ V ar[] = {3, 3, 3, 5, 5, 5, 7, 7, 7};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(m.size() == 9);
+ I i = m.erase(6);
+ assert(m.size() == 9);
+ assert(i == 0);
+ assert(*std::next(m.begin(), 0) == 3);
+ assert(*std::next(m.begin(), 1) == 3);
+ assert(*std::next(m.begin(), 2) == 3);
+ assert(*std::next(m.begin(), 3) == 5);
+ assert(*std::next(m.begin(), 4) == 5);
+ assert(*std::next(m.begin(), 5) == 5);
+ assert(*std::next(m.begin(), 6) == 7);
+ assert(*std::next(m.begin(), 7) == 7);
+ assert(*std::next(m.begin(), 8) == 7);
- i = m.erase(5);
- assert(m.size() == 6);
- assert(i == 3);
- assert(*std::next(m.begin(), 0) == 3);
- assert(*std::next(m.begin(), 1) == 3);
- assert(*std::next(m.begin(), 2) == 3);
- assert(*std::next(m.begin(), 3) == 7);
- assert(*std::next(m.begin(), 4) == 7);
- assert(*std::next(m.begin(), 5) == 7);
+ i = m.erase(5);
+ assert(m.size() == 6);
+ assert(i == 3);
+ assert(*std::next(m.begin(), 0) == 3);
+ assert(*std::next(m.begin(), 1) == 3);
+ assert(*std::next(m.begin(), 2) == 3);
+ assert(*std::next(m.begin(), 3) == 7);
+ assert(*std::next(m.begin(), 4) == 7);
+ assert(*std::next(m.begin(), 5) == 7);
- i = m.erase(3);
- assert(m.size() == 3);
- assert(i == 3);
- assert(*std::next(m.begin(), 0) == 7);
- assert(*std::next(m.begin(), 1) == 7);
- assert(*std::next(m.begin(), 2) == 7);
+ i = m.erase(3);
+ assert(m.size() == 3);
+ assert(i == 3);
+ assert(*std::next(m.begin(), 0) == 7);
+ assert(*std::next(m.begin(), 1) == 7);
+ assert(*std::next(m.begin(), 2) == 7);
- i = m.erase(7);
- assert(m.size() == 0);
- assert(i == 3);
- }
+ i = m.erase(7);
+ assert(m.size() == 0);
+ assert(i == 3);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
- typedef int V;
- typedef M::size_type I;
- V ar[] =
- {
- 3,
- 3,
- 3,
- 5,
- 5,
- 5,
- 7,
- 7,
- 7
- };
- M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
- assert(m.size() == 9);
- I i = m.erase(6);
- assert(m.size() == 9);
- assert(i == 0);
- assert(*std::next(m.begin(), 0) == 3);
- assert(*std::next(m.begin(), 1) == 3);
- assert(*std::next(m.begin(), 2) == 3);
- assert(*std::next(m.begin(), 3) == 5);
- assert(*std::next(m.begin(), 4) == 5);
- assert(*std::next(m.begin(), 5) == 5);
- assert(*std::next(m.begin(), 6) == 7);
- assert(*std::next(m.begin(), 7) == 7);
- assert(*std::next(m.begin(), 8) == 7);
+ {
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+ typedef int V;
+ typedef M::size_type I;
+ V ar[] = {3, 3, 3, 5, 5, 5, 7, 7, 7};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(m.size() == 9);
+ I i = m.erase(6);
+ assert(m.size() == 9);
+ assert(i == 0);
+ assert(*std::next(m.begin(), 0) == 3);
+ assert(*std::next(m.begin(), 1) == 3);
+ assert(*std::next(m.begin(), 2) == 3);
+ assert(*std::next(m.begin(), 3) == 5);
+ assert(*std::next(m.begin(), 4) == 5);
+ assert(*std::next(m.begin(), 5) == 5);
+ assert(*std::next(m.begin(), 6) == 7);
+ assert(*std::next(m.begin(), 7) == 7);
+ assert(*std::next(m.begin(), 8) == 7);
- i = m.erase(5);
- assert(m.size() == 6);
- assert(i == 3);
- assert(*std::next(m.begin(), 0) == 3);
- assert(*std::next(m.begin(), 1) == 3);
- assert(*std::next(m.begin(), 2) == 3);
- assert(*std::next(m.begin(), 3) == 7);
- assert(*std::next(m.begin(), 4) == 7);
- assert(*std::next(m.begin(), 5) == 7);
+ i = m.erase(5);
+ assert(m.size() == 6);
+ assert(i == 3);
+ assert(*std::next(m.begin(), 0) == 3);
+ assert(*std::next(m.begin(), 1) == 3);
+ assert(*std::next(m.begin(), 2) == 3);
+ assert(*std::next(m.begin(), 3) == 7);
+ assert(*std::next(m.begin(), 4) == 7);
+ assert(*std::next(m.begin(), 5) == 7);
- i = m.erase(3);
- assert(m.size() == 3);
- assert(i == 3);
- assert(*std::next(m.begin(), 0) == 7);
- assert(*std::next(m.begin(), 1) == 7);
- assert(*std::next(m.begin(), 2) == 7);
+ i = m.erase(3);
+ assert(m.size() == 3);
+ assert(i == 3);
+ assert(*std::next(m.begin(), 0) == 7);
+ assert(*std::next(m.begin(), 1) == 7);
+ assert(*std::next(m.begin(), 2) == 7);
- i = m.erase(7);
- assert(m.size() == 0);
- assert(i == 3);
- }
+ i = m.erase(7);
+ assert(m.size() == 0);
+ assert(i == 3);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/multiset/extract_iterator.pass.cpp b/libcxx/test/std/containers/associative/multiset/extract_iterator.pass.cpp
index ac8c5e3b3d45962..7f32fa82c46ab5e 100644
--- a/libcxx/test/std/containers/associative/multiset/extract_iterator.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/extract_iterator.pass.cpp
@@ -20,43 +20,40 @@
#include "Counter.h"
template <class Container>
-void test(Container& c)
-{
- std::size_t sz = c.size();
-
- for (auto first = c.cbegin(); first != c.cend();)
- {
- auto key_value = *first;
- typename Container::node_type t = c.extract(first++);
- --sz;
- assert(t.value() == key_value);
- assert(t.get_allocator() == c.get_allocator());
- assert(sz == c.size());
- }
-
- assert(c.size() == 0);
+void test(Container& c) {
+ std::size_t sz = c.size();
+
+ for (auto first = c.cbegin(); first != c.cend();) {
+ auto key_value = *first;
+ typename Container::node_type t = c.extract(first++);
+ --sz;
+ assert(t.value() == key_value);
+ assert(t.get_allocator() == c.get_allocator());
+ assert(sz == c.size());
+ }
+
+ assert(c.size() == 0);
}
-int main(int, char**)
-{
- {
- using set_type = std::multiset<int>;
- set_type m = {1, 2, 3, 4, 5, 6};
- test(m);
- }
-
- {
- std::multiset<Counter<int>> m = {1, 2, 3, 4, 5, 6};
- assert(Counter_base::gConstructed == 6);
- test(m);
- assert(Counter_base::gConstructed == 0);
- }
-
- {
- using min_alloc_set = std::multiset<int, std::less<int>, min_allocator<int>>;
- min_alloc_set m = {1, 2, 3, 4, 5, 6};
- test(m);
- }
+int main(int, char**) {
+ {
+ using set_type = std::multiset<int>;
+ set_type m = {1, 2, 3, 4, 5, 6};
+ test(m);
+ }
+
+ {
+ std::multiset<Counter<int>> m = {1, 2, 3, 4, 5, 6};
+ assert(Counter_base::gConstructed == 6);
+ test(m);
+ assert(Counter_base::gConstructed == 0);
+ }
+
+ {
+ using min_alloc_set = std::multiset<int, std::less<int>, min_allocator<int>>;
+ min_alloc_set m = {1, 2, 3, 4, 5, 6};
+ test(m);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/extract_key.pass.cpp b/libcxx/test/std/containers/associative/multiset/extract_key.pass.cpp
index bad5d1bb3d39425..24d98cfaaf31aea 100644
--- a/libcxx/test/std/containers/associative/multiset/extract_key.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/extract_key.pass.cpp
@@ -20,54 +20,50 @@
#include "Counter.h"
template <class Container, class KeyTypeIter>
-void test(Container& c, KeyTypeIter first, KeyTypeIter last)
-{
- std::size_t sz = c.size();
- assert((std::size_t)std::distance(first, last) == sz);
+void test(Container& c, KeyTypeIter first, KeyTypeIter last) {
+ std::size_t sz = c.size();
+ assert((std::size_t)std::distance(first, last) == sz);
- for (KeyTypeIter copy = first; copy != last; ++copy)
- {
- typename Container::node_type t = c.extract(*copy);
- assert(!t.empty());
- --sz;
- assert(t.value() == *copy);
- assert(t.get_allocator() == c.get_allocator());
- assert(sz == c.size());
- }
+ for (KeyTypeIter copy = first; copy != last; ++copy) {
+ typename Container::node_type t = c.extract(*copy);
+ assert(!t.empty());
+ --sz;
+ assert(t.value() == *copy);
+ assert(t.get_allocator() == c.get_allocator());
+ assert(sz == c.size());
+ }
- assert(c.size() == 0);
+ assert(c.size() == 0);
- for (KeyTypeIter copy = first; copy != last; ++copy)
- {
- typename Container::node_type t = c.extract(*copy);
- assert(t.empty());
- }
+ for (KeyTypeIter copy = first; copy != last; ++copy) {
+ typename Container::node_type t = c.extract(*copy);
+ assert(t.empty());
+ }
}
-int main(int, char**)
-{
- {
- std::multiset<int> m = {1, 2, 3, 4, 5, 6};
- int keys[] = {1, 2, 3, 4, 5, 6};
- test(m, std::begin(keys), std::end(keys));
- }
+int main(int, char**) {
+ {
+ std::multiset<int> m = {1, 2, 3, 4, 5, 6};
+ int keys[] = {1, 2, 3, 4, 5, 6};
+ test(m, std::begin(keys), std::end(keys));
+ }
+ {
+ std::multiset<Counter<int>> m = {1, 2, 3, 4, 5, 6};
{
- std::multiset<Counter<int>> m = {1, 2, 3, 4, 5, 6};
- {
- Counter<int> keys[] = {1, 2, 3, 4, 5, 6};
- assert(Counter_base::gConstructed == 6+6);
- test(m, std::begin(keys), std::end(keys));
- }
- assert(Counter_base::gConstructed == 0);
+ Counter<int> keys[] = {1, 2, 3, 4, 5, 6};
+ assert(Counter_base::gConstructed == 6 + 6);
+ test(m, std::begin(keys), std::end(keys));
}
+ assert(Counter_base::gConstructed == 0);
+ }
- {
- using min_alloc_set = std::multiset<int, std::less<int>, min_allocator<int>>;
- min_alloc_set m = {1, 2, 3, 4, 5, 6};
- int keys[] = {1, 2, 3, 4, 5, 6};
- test(m, std::begin(keys), std::end(keys));
- }
+ {
+ using min_alloc_set = std::multiset<int, std::less<int>, min_allocator<int>>;
+ min_alloc_set m = {1, 2, 3, 4, 5, 6};
+ int keys[] = {1, 2, 3, 4, 5, 6};
+ test(m, std::begin(keys), std::end(keys));
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/find.pass.cpp b/libcxx/test/std/containers/associative/multiset/find.pass.cpp
index da75b5b00f28625..62e6b9dae431d27 100644
--- a/libcxx/test/std/containers/associative/multiset/find.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/find.pass.cpp
@@ -20,168 +20,117 @@
#include "min_allocator.h"
#include "private_constructor.h"
-int main(int, char**)
-{
+int main(int, char**) {
+ {
+ typedef int V;
+ typedef std::multiset<int> M;
+ {
+ typedef M::iterator R;
+ V ar[] = {5, 6, 7, 8, 9, 10, 11, 12};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.find(5);
+ assert(r == m.begin());
+ r = m.find(6);
+ assert(r == std::next(m.begin()));
+ r = m.find(7);
+ assert(r == std::next(m.begin(), 2));
+ r = m.find(8);
+ assert(r == std::next(m.begin(), 3));
+ r = m.find(9);
+ assert(r == std::next(m.begin(), 4));
+ r = m.find(10);
+ assert(r == std::next(m.begin(), 5));
+ r = m.find(11);
+ assert(r == std::next(m.begin(), 6));
+ r = m.find(12);
+ assert(r == std::next(m.begin(), 7));
+ r = m.find(4);
+ assert(r == std::next(m.begin(), 8));
+ }
{
- typedef int V;
- typedef std::multiset<int> M;
- {
- typedef M::iterator R;
- V ar[] =
- {
- 5,
- 6,
- 7,
- 8,
- 9,
- 10,
- 11,
- 12
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.find(5);
- assert(r == m.begin());
- r = m.find(6);
- assert(r == std::next(m.begin()));
- r = m.find(7);
- assert(r == std::next(m.begin(), 2));
- r = m.find(8);
- assert(r == std::next(m.begin(), 3));
- r = m.find(9);
- assert(r == std::next(m.begin(), 4));
- r = m.find(10);
- assert(r == std::next(m.begin(), 5));
- r = m.find(11);
- assert(r == std::next(m.begin(), 6));
- r = m.find(12);
- assert(r == std::next(m.begin(), 7));
- r = m.find(4);
- assert(r == std::next(m.begin(), 8));
- }
- {
- typedef M::const_iterator R;
- V ar[] =
- {
- 5,
- 6,
- 7,
- 8,
- 9,
- 10,
- 11,
- 12
- };
- const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.find(5);
- assert(r == m.begin());
- r = m.find(6);
- assert(r == std::next(m.begin()));
- r = m.find(7);
- assert(r == std::next(m.begin(), 2));
- r = m.find(8);
- assert(r == std::next(m.begin(), 3));
- r = m.find(9);
- assert(r == std::next(m.begin(), 4));
- r = m.find(10);
- assert(r == std::next(m.begin(), 5));
- r = m.find(11);
- assert(r == std::next(m.begin(), 6));
- r = m.find(12);
- assert(r == std::next(m.begin(), 7));
- r = m.find(4);
- assert(r == std::next(m.begin(), 8));
- }
+ typedef M::const_iterator R;
+ V ar[] = {5, 6, 7, 8, 9, 10, 11, 12};
+ const M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.find(5);
+ assert(r == m.begin());
+ r = m.find(6);
+ assert(r == std::next(m.begin()));
+ r = m.find(7);
+ assert(r == std::next(m.begin(), 2));
+ r = m.find(8);
+ assert(r == std::next(m.begin(), 3));
+ r = m.find(9);
+ assert(r == std::next(m.begin(), 4));
+ r = m.find(10);
+ assert(r == std::next(m.begin(), 5));
+ r = m.find(11);
+ assert(r == std::next(m.begin(), 6));
+ r = m.find(12);
+ assert(r == std::next(m.begin(), 7));
+ r = m.find(4);
+ assert(r == std::next(m.begin(), 8));
}
+ }
#if TEST_STD_VER >= 11
+ {
+ typedef int V;
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+ {
+ typedef M::iterator R;
+ V ar[] = {5, 6, 7, 8, 9, 10, 11, 12};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.find(5);
+ assert(r == m.begin());
+ r = m.find(6);
+ assert(r == std::next(m.begin()));
+ r = m.find(7);
+ assert(r == std::next(m.begin(), 2));
+ r = m.find(8);
+ assert(r == std::next(m.begin(), 3));
+ r = m.find(9);
+ assert(r == std::next(m.begin(), 4));
+ r = m.find(10);
+ assert(r == std::next(m.begin(), 5));
+ r = m.find(11);
+ assert(r == std::next(m.begin(), 6));
+ r = m.find(12);
+ assert(r == std::next(m.begin(), 7));
+ r = m.find(4);
+ assert(r == std::next(m.begin(), 8));
+ }
{
- typedef int V;
- typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
- {
- typedef M::iterator R;
- V ar[] =
- {
- 5,
- 6,
- 7,
- 8,
- 9,
- 10,
- 11,
- 12
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.find(5);
- assert(r == m.begin());
- r = m.find(6);
- assert(r == std::next(m.begin()));
- r = m.find(7);
- assert(r == std::next(m.begin(), 2));
- r = m.find(8);
- assert(r == std::next(m.begin(), 3));
- r = m.find(9);
- assert(r == std::next(m.begin(), 4));
- r = m.find(10);
- assert(r == std::next(m.begin(), 5));
- r = m.find(11);
- assert(r == std::next(m.begin(), 6));
- r = m.find(12);
- assert(r == std::next(m.begin(), 7));
- r = m.find(4);
- assert(r == std::next(m.begin(), 8));
- }
- {
- typedef M::const_iterator R;
- V ar[] =
- {
- 5,
- 6,
- 7,
- 8,
- 9,
- 10,
- 11,
- 12
- };
- const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.find(5);
- assert(r == m.begin());
- r = m.find(6);
- assert(r == std::next(m.begin()));
- r = m.find(7);
- assert(r == std::next(m.begin(), 2));
- r = m.find(8);
- assert(r == std::next(m.begin(), 3));
- r = m.find(9);
- assert(r == std::next(m.begin(), 4));
- r = m.find(10);
- assert(r == std::next(m.begin(), 5));
- r = m.find(11);
- assert(r == std::next(m.begin(), 6));
- r = m.find(12);
- assert(r == std::next(m.begin(), 7));
- r = m.find(4);
- assert(r == std::next(m.begin(), 8));
- }
+ typedef M::const_iterator R;
+ V ar[] = {5, 6, 7, 8, 9, 10, 11, 12};
+ const M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.find(5);
+ assert(r == m.begin());
+ r = m.find(6);
+ assert(r == std::next(m.begin()));
+ r = m.find(7);
+ assert(r == std::next(m.begin(), 2));
+ r = m.find(8);
+ assert(r == std::next(m.begin(), 3));
+ r = m.find(9);
+ assert(r == std::next(m.begin(), 4));
+ r = m.find(10);
+ assert(r == std::next(m.begin(), 5));
+ r = m.find(11);
+ assert(r == std::next(m.begin(), 6));
+ r = m.find(12);
+ assert(r == std::next(m.begin(), 7));
+ r = m.find(4);
+ assert(r == std::next(m.begin(), 8));
}
+ }
#endif
#if TEST_STD_VER > 11
- {
+ {
typedef int V;
typedef std::multiset<V, std::less<>> M;
typedef M::iterator R;
- V ar[] =
- {
- 5,
- 6,
- 7,
- 8,
- 9,
- 10,
- 11,
- 12
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ V ar[] = {5, 6, 7, 8, 9, 10, 11, 12};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
R r = m.find(5);
assert(r == m.begin());
r = m.find(6);
@@ -200,22 +149,22 @@ int main(int, char**)
assert(r == std::next(m.begin(), 7));
r = m.find(4);
assert(r == std::next(m.begin(), 8));
- }
+ }
- {
+ {
typedef PrivateConstructor V;
typedef std::multiset<V, std::less<>> M;
typedef M::iterator R;
M m;
- m.insert ( V::make ( 5 ));
- m.insert ( V::make ( 6 ));
- m.insert ( V::make ( 7 ));
- m.insert ( V::make ( 8 ));
- m.insert ( V::make ( 9 ));
- m.insert ( V::make ( 10 ));
- m.insert ( V::make ( 11 ));
- m.insert ( V::make ( 12 ));
+ m.insert(V::make(5));
+ m.insert(V::make(6));
+ m.insert(V::make(7));
+ m.insert(V::make(8));
+ m.insert(V::make(9));
+ m.insert(V::make(10));
+ m.insert(V::make(11));
+ m.insert(V::make(12));
R r = m.find(5);
assert(r == m.begin());
@@ -235,7 +184,7 @@ int main(int, char**)
assert(r == std::next(m.begin(), 7));
r = m.find(4);
assert(r == std::next(m.begin(), 8));
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/multiset/get_allocator.pass.cpp b/libcxx/test/std/containers/associative/multiset/get_allocator.pass.cpp
index 3d0d8a4dcb1fba6..55bbd567d436097 100644
--- a/libcxx/test/std/containers/associative/multiset/get_allocator.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/get_allocator.pass.cpp
@@ -19,15 +19,15 @@
#include "test_macros.h"
int main(int, char**) {
- {
- std::allocator<int> alloc;
- const std::multiset<int> s(alloc);
- assert(s.get_allocator() == alloc);
- }
- {
- other_allocator<int> alloc(1);
- const std::multiset<int, std::less<int>, other_allocator<int> > s(alloc);
- assert(s.get_allocator() == alloc);
- }
- return 0;
+ {
+ std::allocator<int> alloc;
+ const std::multiset<int> s(alloc);
+ assert(s.get_allocator() == alloc);
+ }
+ {
+ other_allocator<int> alloc(1);
+ const std::multiset<int, std::less<int>, other_allocator<int> > s(alloc);
+ assert(s.get_allocator() == alloc);
+ }
+ return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/incomplete_type.pass.cpp b/libcxx/test/std/containers/associative/multiset/incomplete_type.pass.cpp
index 4f2970d5840fb6f..31cb96ec33e7657 100644
--- a/libcxx/test/std/containers/associative/multiset/incomplete_type.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/incomplete_type.pass.cpp
@@ -16,17 +16,17 @@
#include "test_macros.h"
struct A {
- typedef std::multiset<A> Set;
- int data;
- Set m;
- Set::iterator it;
- Set::const_iterator cit;
+ typedef std::multiset<A> Set;
+ int data;
+ Set m;
+ Set::iterator it;
+ Set::const_iterator cit;
};
inline bool operator==(A const& L, A const& R) { return &L == &R; }
-inline bool operator<(A const& L, A const& R) { return L.data < R.data; }
+inline bool operator<(A const& L, A const& R) { return L.data < R.data; }
int main(int, char**) {
- A a;
+ A a;
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/insert_cv.pass.cpp b/libcxx/test/std/containers/associative/multiset/insert_cv.pass.cpp
index b8a36ec38537759..237cf9bb6fac212 100644
--- a/libcxx/test/std/containers/associative/multiset/insert_cv.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/insert_cv.pass.cpp
@@ -18,45 +18,43 @@
#include "test_macros.h"
#include "min_allocator.h"
-template<class Container>
-void do_insert_cv_test()
-{
- typedef Container M;
- typedef typename M::iterator R;
- typedef typename M::value_type VT;
- M m;
- const VT v1(2);
- R r = m.insert(v1);
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(*r == 2);
-
- const VT v2(1);
- r = m.insert(v2);
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(*r == 1);
-
- const VT v3(3);
- r = m.insert(v3);
- assert(r == std::prev(m.end()));
- assert(m.size() == 3);
- assert(*r == 3);
-
- r = m.insert(v3);
- assert(r == std::prev(m.end()));
- assert(m.size() == 4);
- assert(*r == 3);
+template <class Container>
+void do_insert_cv_test() {
+ typedef Container M;
+ typedef typename M::iterator R;
+ typedef typename M::value_type VT;
+ M m;
+ const VT v1(2);
+ R r = m.insert(v1);
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(*r == 2);
+
+ const VT v2(1);
+ r = m.insert(v2);
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(*r == 1);
+
+ const VT v3(3);
+ r = m.insert(v3);
+ assert(r == std::prev(m.end()));
+ assert(m.size() == 3);
+ assert(*r == 3);
+
+ r = m.insert(v3);
+ assert(r == std::prev(m.end()));
+ assert(m.size() == 4);
+ assert(*r == 3);
}
-int main(int, char**)
-{
- do_insert_cv_test<std::multiset<int> >();
+int main(int, char**) {
+ do_insert_cv_test<std::multiset<int> >();
#if TEST_STD_VER >= 11
- {
- typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
- do_insert_cv_test<M>();
- }
+ {
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+ do_insert_cv_test<M>();
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/multiset/insert_emplace_allocator_requirements.pass.cpp b/libcxx/test/std/containers/associative/multiset/insert_emplace_allocator_requirements.pass.cpp
index 232748fc353a37f..8085ac7cbb2f1f4 100644
--- a/libcxx/test/std/containers/associative/multiset/insert_emplace_allocator_requirements.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/insert_emplace_allocator_requirements.pass.cpp
@@ -20,8 +20,7 @@
#include "container_test_types.h"
#include "../../set_allocator_requirement_test_templates.h"
-int main(int, char**)
-{
+int main(int, char**) {
testMultisetInsert<TCT::multiset<> >();
testMultisetEmplace<TCT::multiset<> >();
diff --git a/libcxx/test/std/containers/associative/multiset/insert_initializer_list.pass.cpp b/libcxx/test/std/containers/associative/multiset/insert_initializer_list.pass.cpp
index 9c870b1298615d0..8f4f165252d36b2 100644
--- a/libcxx/test/std/containers/associative/multiset/insert_initializer_list.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/insert_initializer_list.pass.cpp
@@ -21,9 +21,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::multiset<int> C;
typedef C::value_type V;
C m = {10, 8};
@@ -39,8 +38,8 @@ int main(int, char**)
assert(*++i == V(6));
assert(*++i == V(8));
assert(*++i == V(10));
- }
- {
+ }
+ {
typedef std::multiset<int, std::less<int>, min_allocator<int>> C;
typedef C::value_type V;
C m = {10, 8};
@@ -56,7 +55,7 @@ int main(int, char**)
assert(*++i == V(6));
assert(*++i == V(8));
assert(*++i == V(10));
- }
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/insert_iter_cv.pass.cpp b/libcxx/test/std/containers/associative/multiset/insert_iter_cv.pass.cpp
index 242e801c2acbfac..97c03be6cc57be3 100644
--- a/libcxx/test/std/containers/associative/multiset/insert_iter_cv.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/insert_iter_cv.pass.cpp
@@ -18,57 +18,56 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::multiset<int> M;
- typedef M::iterator R;
- M m;
- R r = m.insert(m.cend(), M::value_type(2));
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(*r == 2);
+int main(int, char**) {
+ {
+ typedef std::multiset<int> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.insert(m.cend(), M::value_type(2));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(*r == 2);
- r = m.insert(m.cend(), M::value_type(1));
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(*r == 1);
+ r = m.insert(m.cend(), M::value_type(1));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(*r == 1);
- r = m.insert(m.cend(), M::value_type(3));
- assert(r == std::prev(m.end()));
- assert(m.size() == 3);
- assert(*r == 3);
+ r = m.insert(m.cend(), M::value_type(3));
+ assert(r == std::prev(m.end()));
+ assert(m.size() == 3);
+ assert(*r == 3);
- r = m.insert(m.cend(), M::value_type(3));
- assert(r == std::prev(m.end()));
- assert(m.size() == 4);
- assert(*r == 3);
- }
+ r = m.insert(m.cend(), M::value_type(3));
+ assert(r == std::prev(m.end()));
+ assert(m.size() == 4);
+ assert(*r == 3);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
- typedef M::iterator R;
- M m;
- R r = m.insert(m.cend(), M::value_type(2));
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(*r == 2);
+ {
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.insert(m.cend(), M::value_type(2));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(*r == 2);
- r = m.insert(m.cend(), M::value_type(1));
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(*r == 1);
+ r = m.insert(m.cend(), M::value_type(1));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(*r == 1);
- r = m.insert(m.cend(), M::value_type(3));
- assert(r == std::prev(m.end()));
- assert(m.size() == 3);
- assert(*r == 3);
+ r = m.insert(m.cend(), M::value_type(3));
+ assert(r == std::prev(m.end()));
+ assert(m.size() == 3);
+ assert(*r == 3);
- r = m.insert(m.cend(), M::value_type(3));
- assert(r == std::prev(m.end()));
- assert(m.size() == 4);
- assert(*r == 3);
- }
+ r = m.insert(m.cend(), M::value_type(3));
+ assert(r == std::prev(m.end()));
+ assert(m.size() == 4);
+ assert(*r == 3);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/multiset/insert_iter_iter.pass.cpp b/libcxx/test/std/containers/associative/multiset/insert_iter_iter.pass.cpp
index 23d44b8e375bfc1..f3dd91794c9d5c5 100644
--- a/libcxx/test/std/containers/associative/multiset/insert_iter_iter.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/insert_iter_iter.pass.cpp
@@ -20,67 +20,42 @@
#include "test_iterators.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::multiset<int> M;
- typedef int V;
- V ar[] =
- {
- 1,
- 1,
- 1,
- 2,
- 2,
- 2,
- 3,
- 3,
- 3
- };
- M m;
- m.insert(cpp17_input_iterator<const V*>(ar),
- cpp17_input_iterator<const V*>(ar + sizeof(ar)/sizeof(ar[0])));
- assert(m.size() == 9);
- assert(*std::next(m.begin(), 0) == 1);
- assert(*std::next(m.begin(), 1) == 1);
- assert(*std::next(m.begin(), 2) == 1);
- assert(*std::next(m.begin(), 3) == 2);
- assert(*std::next(m.begin(), 4) == 2);
- assert(*std::next(m.begin(), 5) == 2);
- assert(*std::next(m.begin(), 6) == 3);
- assert(*std::next(m.begin(), 7) == 3);
- assert(*std::next(m.begin(), 8) == 3);
- }
+int main(int, char**) {
+ {
+ typedef std::multiset<int> M;
+ typedef int V;
+ V ar[] = {1, 1, 1, 2, 2, 2, 3, 3, 3};
+ M m;
+ m.insert(cpp17_input_iterator<const V*>(ar), cpp17_input_iterator<const V*>(ar + sizeof(ar) / sizeof(ar[0])));
+ assert(m.size() == 9);
+ assert(*std::next(m.begin(), 0) == 1);
+ assert(*std::next(m.begin(), 1) == 1);
+ assert(*std::next(m.begin(), 2) == 1);
+ assert(*std::next(m.begin(), 3) == 2);
+ assert(*std::next(m.begin(), 4) == 2);
+ assert(*std::next(m.begin(), 5) == 2);
+ assert(*std::next(m.begin(), 6) == 3);
+ assert(*std::next(m.begin(), 7) == 3);
+ assert(*std::next(m.begin(), 8) == 3);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
- typedef int V;
- V ar[] =
- {
- 1,
- 1,
- 1,
- 2,
- 2,
- 2,
- 3,
- 3,
- 3
- };
- M m;
- m.insert(cpp17_input_iterator<const V*>(ar),
- cpp17_input_iterator<const V*>(ar + sizeof(ar)/sizeof(ar[0])));
- assert(m.size() == 9);
- assert(*std::next(m.begin(), 0) == 1);
- assert(*std::next(m.begin(), 1) == 1);
- assert(*std::next(m.begin(), 2) == 1);
- assert(*std::next(m.begin(), 3) == 2);
- assert(*std::next(m.begin(), 4) == 2);
- assert(*std::next(m.begin(), 5) == 2);
- assert(*std::next(m.begin(), 6) == 3);
- assert(*std::next(m.begin(), 7) == 3);
- assert(*std::next(m.begin(), 8) == 3);
- }
+ {
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+ typedef int V;
+ V ar[] = {1, 1, 1, 2, 2, 2, 3, 3, 3};
+ M m;
+ m.insert(cpp17_input_iterator<const V*>(ar), cpp17_input_iterator<const V*>(ar + sizeof(ar) / sizeof(ar[0])));
+ assert(m.size() == 9);
+ assert(*std::next(m.begin(), 0) == 1);
+ assert(*std::next(m.begin(), 1) == 1);
+ assert(*std::next(m.begin(), 2) == 1);
+ assert(*std::next(m.begin(), 3) == 2);
+ assert(*std::next(m.begin(), 4) == 2);
+ assert(*std::next(m.begin(), 5) == 2);
+ assert(*std::next(m.begin(), 6) == 3);
+ assert(*std::next(m.begin(), 7) == 3);
+ assert(*std::next(m.begin(), 8) == 3);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/multiset/insert_iter_rv.pass.cpp b/libcxx/test/std/containers/associative/multiset/insert_iter_rv.pass.cpp
index 75df25e9b0999ab..d01f6b9b2c306fb 100644
--- a/libcxx/test/std/containers/associative/multiset/insert_iter_rv.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/insert_iter_rv.pass.cpp
@@ -21,56 +21,55 @@
#include "MoveOnly.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::multiset<MoveOnly> M;
- typedef M::iterator R;
- M m;
- R r = m.insert(m.cend(), M::value_type(2));
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(*r == 2);
+int main(int, char**) {
+ {
+ typedef std::multiset<MoveOnly> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.insert(m.cend(), M::value_type(2));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(*r == 2);
- r = m.insert(m.cend(), M::value_type(1));
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(*r == 1);
+ r = m.insert(m.cend(), M::value_type(1));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(*r == 1);
- r = m.insert(m.cend(), M::value_type(3));
- assert(r == std::prev(m.end()));
- assert(m.size() == 3);
- assert(*r == 3);
+ r = m.insert(m.cend(), M::value_type(3));
+ assert(r == std::prev(m.end()));
+ assert(m.size() == 3);
+ assert(*r == 3);
- r = m.insert(m.cend(), M::value_type(3));
- assert(r == std::prev(m.end()));
- assert(m.size() == 4);
- assert(*r == 3);
- }
- {
- typedef std::multiset<MoveOnly, std::less<MoveOnly>, min_allocator<MoveOnly>> M;
- typedef M::iterator R;
- M m;
- R r = m.insert(m.cend(), M::value_type(2));
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(*r == 2);
+ r = m.insert(m.cend(), M::value_type(3));
+ assert(r == std::prev(m.end()));
+ assert(m.size() == 4);
+ assert(*r == 3);
+ }
+ {
+ typedef std::multiset<MoveOnly, std::less<MoveOnly>, min_allocator<MoveOnly>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.insert(m.cend(), M::value_type(2));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(*r == 2);
- r = m.insert(m.cend(), M::value_type(1));
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(*r == 1);
+ r = m.insert(m.cend(), M::value_type(1));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(*r == 1);
- r = m.insert(m.cend(), M::value_type(3));
- assert(r == std::prev(m.end()));
- assert(m.size() == 3);
- assert(*r == 3);
+ r = m.insert(m.cend(), M::value_type(3));
+ assert(r == std::prev(m.end()));
+ assert(m.size() == 3);
+ assert(*r == 3);
- r = m.insert(m.cend(), M::value_type(3));
- assert(r == std::prev(m.end()));
- assert(m.size() == 4);
- assert(*r == 3);
- }
+ r = m.insert(m.cend(), M::value_type(3));
+ assert(r == std::prev(m.end()));
+ assert(m.size() == 4);
+ assert(*r == 3);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/insert_node_type.pass.cpp b/libcxx/test/std/containers/associative/multiset/insert_node_type.pass.cpp
index bc0d9bcac93617a..6971d6b6e5eae2a 100644
--- a/libcxx/test/std/containers/associative/multiset/insert_node_type.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/insert_node_type.pass.cpp
@@ -20,60 +20,54 @@
#include "min_allocator.h"
template <class Container>
-typename Container::node_type
-node_factory(typename Container::key_type const& key)
-{
- static Container c;
- auto it = c.insert(key);
- return c.extract(it);
+typename Container::node_type node_factory(typename Container::key_type const& key) {
+ static Container c;
+ auto it = c.insert(key);
+ return c.extract(it);
}
template <class Container>
-void test(Container& c)
-{
- auto* nf = &node_factory<Container>;
+void test(Container& c) {
+ auto* nf = &node_factory<Container>;
- for (int i = 0; i != 10; ++i)
- {
- typename Container::node_type node = nf(i);
- assert(!node.empty());
- typename Container::iterator it = c.insert(std::move(node));
- assert(node.empty());
- assert(it == c.find(i) && it != c.end());
- assert(*it == i);
- assert(node.empty());
- }
+ for (int i = 0; i != 10; ++i) {
+ typename Container::node_type node = nf(i);
+ assert(!node.empty());
+ typename Container::iterator it = c.insert(std::move(node));
+ assert(node.empty());
+ assert(it == c.find(i) && it != c.end());
+ assert(*it == i);
+ assert(node.empty());
+ }
- assert(c.size() == 10);
+ assert(c.size() == 10);
- { // Insert empty node.
- typename Container::node_type def;
- auto it = c.insert(std::move(def));
- assert(def.empty());
- assert(it == c.end());
- }
+ { // Insert empty node.
+ typename Container::node_type def;
+ auto it = c.insert(std::move(def));
+ assert(def.empty());
+ assert(it == c.end());
+ }
- { // Insert duplicate node.
- typename Container::node_type dupl = nf(0);
- auto it = c.insert(std::move(dupl));
- assert(*it == 0);
- }
+ { // Insert duplicate node.
+ typename Container::node_type dupl = nf(0);
+ auto it = c.insert(std::move(dupl));
+ assert(*it == 0);
+ }
- assert(c.size() == 11);
+ assert(c.size() == 11);
- assert(c.count(0) == 2);
- for (int i = 1; i != 10; ++i)
- {
- assert(c.count(i) == 1);
- }
+ assert(c.count(0) == 2);
+ for (int i = 1; i != 10; ++i) {
+ assert(c.count(i) == 1);
+ }
}
-int main(int, char**)
-{
- std::multiset<int> m;
- test(m);
- std::multiset<int, std::less<int>, min_allocator<int>> m2;
- test(m2);
+int main(int, char**) {
+ std::multiset<int> m;
+ test(m);
+ std::multiset<int, std::less<int>, min_allocator<int>> m2;
+ test(m2);
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/insert_node_type_hint.pass.cpp b/libcxx/test/std/containers/associative/multiset/insert_node_type_hint.pass.cpp
index e5c628e8509bc43..b0392088beb6b8e 100644
--- a/libcxx/test/std/containers/associative/multiset/insert_node_type_hint.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/insert_node_type_hint.pass.cpp
@@ -19,43 +19,37 @@
#include "min_allocator.h"
template <class Container>
-typename Container::node_type
-node_factory(typename Container::key_type const& key)
-{
- static Container c;
- auto it = c.insert(key);
- return c.extract(it);
+typename Container::node_type node_factory(typename Container::key_type const& key) {
+ static Container c;
+ auto it = c.insert(key);
+ return c.extract(it);
}
template <class Container>
-void test(Container& c)
-{
- auto* nf = &node_factory<Container>;
-
- for (int i = 0; i != 10; ++i)
- {
- typename Container::node_type node = nf(i);
- assert(!node.empty());
- std::size_t prev = c.size();
- auto it = c.insert(c.end(), std::move(node));
- assert(prev + 1 == c.size());
- assert(*it == i);
- }
-
- assert(c.size() == 10);
-
- for (int i = 0; i != 10; ++i)
- {
- assert(c.count(i) == 1);
- }
+void test(Container& c) {
+ auto* nf = &node_factory<Container>;
+
+ for (int i = 0; i != 10; ++i) {
+ typename Container::node_type node = nf(i);
+ assert(!node.empty());
+ std::size_t prev = c.size();
+ auto it = c.insert(c.end(), std::move(node));
+ assert(prev + 1 == c.size());
+ assert(*it == i);
+ }
+
+ assert(c.size() == 10);
+
+ for (int i = 0; i != 10; ++i) {
+ assert(c.count(i) == 1);
+ }
}
-int main(int, char**)
-{
- std::multiset<int> m;
- test(m);
- std::multiset<int, std::less<int>, min_allocator<int>> m2;
- test(m2);
+int main(int, char**) {
+ std::multiset<int> m;
+ test(m);
+ std::multiset<int, std::less<int>, min_allocator<int>> m2;
+ test(m2);
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/insert_rv.pass.cpp b/libcxx/test/std/containers/associative/multiset/insert_rv.pass.cpp
index d34c96891d4084a..88155572f1680da 100644
--- a/libcxx/test/std/containers/associative/multiset/insert_rv.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/insert_rv.pass.cpp
@@ -21,56 +21,55 @@
#include "MoveOnly.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::multiset<MoveOnly> M;
- typedef M::iterator R;
- M m;
- R r = m.insert(M::value_type(2));
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(*r == 2);
+int main(int, char**) {
+ {
+ typedef std::multiset<MoveOnly> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.insert(M::value_type(2));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(*r == 2);
- r = m.insert(M::value_type(1));
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(*r == 1);
+ r = m.insert(M::value_type(1));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(*r == 1);
- r = m.insert(M::value_type(3));
- assert(r == std::prev(m.end()));
- assert(m.size() == 3);
- assert(*r == 3);
+ r = m.insert(M::value_type(3));
+ assert(r == std::prev(m.end()));
+ assert(m.size() == 3);
+ assert(*r == 3);
- r = m.insert(M::value_type(3));
- assert(r == std::prev(m.end()));
- assert(m.size() == 4);
- assert(*r == 3);
- }
- {
- typedef std::multiset<MoveOnly, std::less<MoveOnly>, min_allocator<MoveOnly>> M;
- typedef M::iterator R;
- M m;
- R r = m.insert(M::value_type(2));
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(*r == 2);
+ r = m.insert(M::value_type(3));
+ assert(r == std::prev(m.end()));
+ assert(m.size() == 4);
+ assert(*r == 3);
+ }
+ {
+ typedef std::multiset<MoveOnly, std::less<MoveOnly>, min_allocator<MoveOnly>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.insert(M::value_type(2));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(*r == 2);
- r = m.insert(M::value_type(1));
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(*r == 1);
+ r = m.insert(M::value_type(1));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(*r == 1);
- r = m.insert(M::value_type(3));
- assert(r == std::prev(m.end()));
- assert(m.size() == 3);
- assert(*r == 3);
+ r = m.insert(M::value_type(3));
+ assert(r == std::prev(m.end()));
+ assert(m.size() == 3);
+ assert(*r == 3);
- r = m.insert(M::value_type(3));
- assert(r == std::prev(m.end()));
- assert(m.size() == 4);
- assert(*r == 3);
- }
+ r = m.insert(M::value_type(3));
+ assert(r == std::prev(m.end()));
+ assert(m.size() == 4);
+ assert(*r == 3);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/iterator.pass.cpp b/libcxx/test/std/containers/associative/multiset/iterator.pass.cpp
index 27a8dbf1a0388ed..fee8bf9d3eb3029 100644
--- a/libcxx/test/std/containers/associative/multiset/iterator.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/iterator.pass.cpp
@@ -32,214 +32,109 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef int V;
- V ar[] =
- {
- 1,
- 1,
- 1,
- 2,
- 2,
- 2,
- 3,
- 3,
- 3,
- 4,
- 4,
- 4,
- 5,
- 5,
- 5,
- 6,
- 6,
- 6,
- 7,
- 7,
- 7,
- 8,
- 8,
- 8
- };
- std::multiset<int> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
- assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
- std::multiset<int>::iterator i;
- i = m.begin();
- std::multiset<int>::const_iterator k = i;
- assert(i == k);
- for (int j = 1; j <= 8; ++j)
- for (int n = 0; n < 3; ++n, ++i)
- assert(*i == j);
- assert(i == m.end());
- for (int j = 8; j >= 1; --j)
- for (int n = 0; n < 3; ++n) {
- --i;
- assert(*i == j);
- }
- assert(i == m.begin());
- }
- {
- typedef int V;
- V ar[] =
- {
- 1,
- 1,
- 1,
- 2,
- 2,
- 2,
- 3,
- 3,
- 3,
- 4,
- 4,
- 4,
- 5,
- 5,
- 5,
- 6,
- 6,
- 6,
- 7,
- 7,
- 7,
- 8,
- 8,
- 8
- };
- const std::multiset<int> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
- assert(static_cast<std::size_t>(std::distance(m.cbegin(), m.cend())) == m.size());
- assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
- assert(static_cast<std::size_t>(std::distance(m.crbegin(), m.crend())) == m.size());
- std::multiset<int>::const_iterator i;
- i = m.begin();
- for (int j = 1; j <= 8; ++j)
- for (int k = 0; k < 3; ++k, ++i)
- assert(*i == j);
- assert(i == m.end());
- for (int j = 8; j >= 1; --j)
- for (int k = 0; k < 3; ++k) {
- --i;
- assert(*i == j);
- }
- assert(i == m.begin());
- }
+int main(int, char**) {
+ {
+ typedef int V;
+ V ar[] = {1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8};
+ std::multiset<int> m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
+ std::multiset<int>::iterator i;
+ i = m.begin();
+ std::multiset<int>::const_iterator k = i;
+ assert(i == k);
+ for (int j = 1; j <= 8; ++j)
+ for (int n = 0; n < 3; ++n, ++i)
+ assert(*i == j);
+ assert(i == m.end());
+ for (int j = 8; j >= 1; --j)
+ for (int n = 0; n < 3; ++n) {
+ --i;
+ assert(*i == j);
+ }
+ assert(i == m.begin());
+ }
+ {
+ typedef int V;
+ V ar[] = {1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8};
+ const std::multiset<int> m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.cbegin(), m.cend())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.crbegin(), m.crend())) == m.size());
+ std::multiset<int>::const_iterator i;
+ i = m.begin();
+ for (int j = 1; j <= 8; ++j)
+ for (int k = 0; k < 3; ++k, ++i)
+ assert(*i == j);
+ assert(i == m.end());
+ for (int j = 8; j >= 1; --j)
+ for (int k = 0; k < 3; ++k) {
+ --i;
+ assert(*i == j);
+ }
+ assert(i == m.begin());
+ }
#if TEST_STD_VER >= 11
- {
- typedef int V;
- V ar[] =
- {
- 1,
- 1,
- 1,
- 2,
- 2,
- 2,
- 3,
- 3,
- 3,
- 4,
- 4,
- 4,
- 5,
- 5,
- 5,
- 6,
- 6,
- 6,
- 7,
- 7,
- 7,
- 8,
- 8,
- 8
- };
- std::multiset<int, std::less<int>, min_allocator<int>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
- assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
- std::multiset<int, std::less<int>, min_allocator<int>>::iterator i;
- i = m.begin();
- std::multiset<int, std::less<int>, min_allocator<int>>::const_iterator k = i;
- assert(i == k);
- for (int j = 1; j <= 8; ++j)
- for (int n = 0; n < 3; ++n, ++i)
- assert(*i == j);
- assert(i == m.end());
- for (int j = 8; j >= 1; --j)
- for (int n = 0; n < 3; ++n) {
- --i;
- assert(*i == j);
- }
- assert(i == m.begin());
- }
- {
- typedef int V;
- V ar[] =
- {
- 1,
- 1,
- 1,
- 2,
- 2,
- 2,
- 3,
- 3,
- 3,
- 4,
- 4,
- 4,
- 5,
- 5,
- 5,
- 6,
- 6,
- 6,
- 7,
- 7,
- 7,
- 8,
- 8,
- 8
- };
- const std::multiset<int, std::less<int>, min_allocator<int>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
- assert(static_cast<std::size_t>(std::distance(m.cbegin(), m.cend())) == m.size());
- assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
- assert(static_cast<std::size_t>(std::distance(m.crbegin(), m.crend())) == m.size());
- std::multiset<int, std::less<int>, min_allocator<int>>::const_iterator i;
- i = m.begin();
- for (int j = 1; j <= 8; ++j)
- for (int k = 0; k < 3; ++k, ++i)
- assert(*i == j);
- assert(i == m.end());
- for (int j = 8; j >= 1; --j)
- for (int k = 0; k < 3; ++k) {
- --i;
- assert(*i == j);
- }
- assert(i == m.begin());
- }
+ {
+ typedef int V;
+ V ar[] = {1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8};
+ std::multiset<int, std::less<int>, min_allocator<int>> m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
+ std::multiset<int, std::less<int>, min_allocator<int>>::iterator i;
+ i = m.begin();
+ std::multiset<int, std::less<int>, min_allocator<int>>::const_iterator k = i;
+ assert(i == k);
+ for (int j = 1; j <= 8; ++j)
+ for (int n = 0; n < 3; ++n, ++i)
+ assert(*i == j);
+ assert(i == m.end());
+ for (int j = 8; j >= 1; --j)
+ for (int n = 0; n < 3; ++n) {
+ --i;
+ assert(*i == j);
+ }
+ assert(i == m.begin());
+ }
+ {
+ typedef int V;
+ V ar[] = {1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8};
+ const std::multiset<int, std::less<int>, min_allocator<int>> m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.cbegin(), m.cend())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.crbegin(), m.crend())) == m.size());
+ std::multiset<int, std::less<int>, min_allocator<int>>::const_iterator i;
+ i = m.begin();
+ for (int j = 1; j <= 8; ++j)
+ for (int k = 0; k < 3; ++k, ++i)
+ assert(*i == j);
+ assert(i == m.end());
+ for (int j = 8; j >= 1; --j)
+ for (int k = 0; k < 3; ++k) {
+ --i;
+ assert(*i == j);
+ }
+ assert(i == m.begin());
+ }
#endif
#if TEST_STD_VER > 11
- { // N3644 testing
- typedef std::multiset<int> C;
- C::iterator ii1{}, ii2{};
- C::iterator ii4 = ii1;
- C::const_iterator cii{};
- assert ( ii1 == ii2 );
- assert ( ii1 == ii4 );
+ { // N3644 testing
+ typedef std::multiset<int> C;
+ C::iterator ii1{}, ii2{};
+ C::iterator ii4 = ii1;
+ C::const_iterator cii{};
+ assert(ii1 == ii2);
+ assert(ii1 == ii4);
- assert (!(ii1 != ii2 ));
+ assert(!(ii1 != ii2));
- assert ( (ii1 == cii ));
- assert ( (cii == ii1 ));
- assert (!(ii1 != cii ));
- assert (!(cii != ii1 ));
- }
+ assert((ii1 == cii));
+ assert((cii == ii1));
+ assert(!(ii1 != cii));
+ assert(!(cii != ii1));
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/multiset/iterator_concept_conformance.compile.pass.cpp b/libcxx/test/std/containers/associative/multiset/iterator_concept_conformance.compile.pass.cpp
index d452afcaeb4baef..81e5e9ddfb0d289 100644
--- a/libcxx/test/std/containers/associative/multiset/iterator_concept_conformance.compile.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/iterator_concept_conformance.compile.pass.cpp
@@ -14,11 +14,11 @@
#include <iterator>
-using iterator = std::multiset<int>::iterator;
-using const_iterator = std::multiset<int>::const_iterator;
-using reverse_iterator = std::multiset<int>::reverse_iterator;
+using iterator = std::multiset<int>::iterator;
+using const_iterator = std::multiset<int>::const_iterator;
+using reverse_iterator = std::multiset<int>::reverse_iterator;
using const_reverse_iterator = std::multiset<int>::const_reverse_iterator;
-using value_type = int;
+using value_type = int;
static_assert(std::bidirectional_iterator<iterator>);
static_assert(!std::random_access_iterator<iterator>);
diff --git a/libcxx/test/std/containers/associative/multiset/lower_bound.pass.cpp b/libcxx/test/std/containers/associative/multiset/lower_bound.pass.cpp
index d391da8ab0f7047..ddd39d8fc034859 100644
--- a/libcxx/test/std/containers/associative/multiset/lower_bound.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/lower_bound.pass.cpp
@@ -20,157 +20,101 @@
#include "min_allocator.h"
#include "private_constructor.h"
-int main(int, char**)
-{
+int main(int, char**) {
+ {
+ typedef int V;
+ typedef std::multiset<int> M;
+ {
+ typedef M::iterator R;
+ V ar[] = {5, 5, 5, 7, 7, 7, 9, 9, 9};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.lower_bound(4);
+ assert(r == std::next(m.begin(), 0));
+ r = m.lower_bound(5);
+ assert(r == std::next(m.begin(), 0));
+ r = m.lower_bound(6);
+ assert(r == std::next(m.begin(), 3));
+ r = m.lower_bound(7);
+ assert(r == std::next(m.begin(), 3));
+ r = m.lower_bound(8);
+ assert(r == std::next(m.begin(), 6));
+ r = m.lower_bound(9);
+ assert(r == std::next(m.begin(), 6));
+ r = m.lower_bound(11);
+ assert(r == std::next(m.begin(), 9));
+ }
{
- typedef int V;
- typedef std::multiset<int> M;
- {
- typedef M::iterator R;
- V ar[] =
- {
- 5,
- 5,
- 5,
- 7,
- 7,
- 7,
- 9,
- 9,
- 9
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.lower_bound(4);
- assert(r == std::next(m.begin(), 0));
- r = m.lower_bound(5);
- assert(r == std::next(m.begin(), 0));
- r = m.lower_bound(6);
- assert(r == std::next(m.begin(), 3));
- r = m.lower_bound(7);
- assert(r == std::next(m.begin(), 3));
- r = m.lower_bound(8);
- assert(r == std::next(m.begin(), 6));
- r = m.lower_bound(9);
- assert(r == std::next(m.begin(), 6));
- r = m.lower_bound(11);
- assert(r == std::next(m.begin(), 9));
- }
- {
- typedef M::const_iterator R;
- V ar[] =
- {
- 5,
- 5,
- 5,
- 7,
- 7,
- 7,
- 9,
- 9,
- 9
- };
- const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.lower_bound(4);
- assert(r == std::next(m.begin(), 0));
- r = m.lower_bound(5);
- assert(r == std::next(m.begin(), 0));
- r = m.lower_bound(6);
- assert(r == std::next(m.begin(), 3));
- r = m.lower_bound(7);
- assert(r == std::next(m.begin(), 3));
- r = m.lower_bound(8);
- assert(r == std::next(m.begin(), 6));
- r = m.lower_bound(9);
- assert(r == std::next(m.begin(), 6));
- r = m.lower_bound(11);
- assert(r == std::next(m.begin(), 9));
- }
+ typedef M::const_iterator R;
+ V ar[] = {5, 5, 5, 7, 7, 7, 9, 9, 9};
+ const M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.lower_bound(4);
+ assert(r == std::next(m.begin(), 0));
+ r = m.lower_bound(5);
+ assert(r == std::next(m.begin(), 0));
+ r = m.lower_bound(6);
+ assert(r == std::next(m.begin(), 3));
+ r = m.lower_bound(7);
+ assert(r == std::next(m.begin(), 3));
+ r = m.lower_bound(8);
+ assert(r == std::next(m.begin(), 6));
+ r = m.lower_bound(9);
+ assert(r == std::next(m.begin(), 6));
+ r = m.lower_bound(11);
+ assert(r == std::next(m.begin(), 9));
}
+ }
#if TEST_STD_VER >= 11
+ {
+ typedef int V;
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+ {
+ typedef M::iterator R;
+ V ar[] = {5, 5, 5, 7, 7, 7, 9, 9, 9};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.lower_bound(4);
+ assert(r == std::next(m.begin(), 0));
+ r = m.lower_bound(5);
+ assert(r == std::next(m.begin(), 0));
+ r = m.lower_bound(6);
+ assert(r == std::next(m.begin(), 3));
+ r = m.lower_bound(7);
+ assert(r == std::next(m.begin(), 3));
+ r = m.lower_bound(8);
+ assert(r == std::next(m.begin(), 6));
+ r = m.lower_bound(9);
+ assert(r == std::next(m.begin(), 6));
+ r = m.lower_bound(11);
+ assert(r == std::next(m.begin(), 9));
+ }
{
- typedef int V;
- typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
- {
- typedef M::iterator R;
- V ar[] =
- {
- 5,
- 5,
- 5,
- 7,
- 7,
- 7,
- 9,
- 9,
- 9
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.lower_bound(4);
- assert(r == std::next(m.begin(), 0));
- r = m.lower_bound(5);
- assert(r == std::next(m.begin(), 0));
- r = m.lower_bound(6);
- assert(r == std::next(m.begin(), 3));
- r = m.lower_bound(7);
- assert(r == std::next(m.begin(), 3));
- r = m.lower_bound(8);
- assert(r == std::next(m.begin(), 6));
- r = m.lower_bound(9);
- assert(r == std::next(m.begin(), 6));
- r = m.lower_bound(11);
- assert(r == std::next(m.begin(), 9));
- }
- {
- typedef M::const_iterator R;
- V ar[] =
- {
- 5,
- 5,
- 5,
- 7,
- 7,
- 7,
- 9,
- 9,
- 9
- };
- const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.lower_bound(4);
- assert(r == std::next(m.begin(), 0));
- r = m.lower_bound(5);
- assert(r == std::next(m.begin(), 0));
- r = m.lower_bound(6);
- assert(r == std::next(m.begin(), 3));
- r = m.lower_bound(7);
- assert(r == std::next(m.begin(), 3));
- r = m.lower_bound(8);
- assert(r == std::next(m.begin(), 6));
- r = m.lower_bound(9);
- assert(r == std::next(m.begin(), 6));
- r = m.lower_bound(11);
- assert(r == std::next(m.begin(), 9));
- }
+ typedef M::const_iterator R;
+ V ar[] = {5, 5, 5, 7, 7, 7, 9, 9, 9};
+ const M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.lower_bound(4);
+ assert(r == std::next(m.begin(), 0));
+ r = m.lower_bound(5);
+ assert(r == std::next(m.begin(), 0));
+ r = m.lower_bound(6);
+ assert(r == std::next(m.begin(), 3));
+ r = m.lower_bound(7);
+ assert(r == std::next(m.begin(), 3));
+ r = m.lower_bound(8);
+ assert(r == std::next(m.begin(), 6));
+ r = m.lower_bound(9);
+ assert(r == std::next(m.begin(), 6));
+ r = m.lower_bound(11);
+ assert(r == std::next(m.begin(), 9));
}
+ }
#endif
#if TEST_STD_VER > 11
- {
+ {
typedef int V;
typedef std::multiset<V, std::less<>> M;
typedef M::iterator R;
- V ar[] =
- {
- 5,
- 5,
- 5,
- 7,
- 7,
- 7,
- 9,
- 9,
- 9
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ V ar[] = {5, 5, 5, 7, 7, 7, 9, 9, 9};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
R r = m.lower_bound(4);
assert(r == std::next(m.begin(), 0));
@@ -186,23 +130,23 @@ int main(int, char**)
assert(r == std::next(m.begin(), 6));
r = m.lower_bound(11);
assert(r == std::next(m.begin(), 9));
- }
+ }
- {
+ {
typedef PrivateConstructor V;
typedef std::multiset<V, std::less<>> M;
typedef M::iterator R;
M m;
- m.insert ( V::make ( 5 ));
- m.insert ( V::make ( 5 ));
- m.insert ( V::make ( 5 ));
- m.insert ( V::make ( 7 ));
- m.insert ( V::make ( 7 ));
- m.insert ( V::make ( 7 ));
- m.insert ( V::make ( 9 ));
- m.insert ( V::make ( 9 ));
- m.insert ( V::make ( 9 ));
+ m.insert(V::make(5));
+ m.insert(V::make(5));
+ m.insert(V::make(5));
+ m.insert(V::make(7));
+ m.insert(V::make(7));
+ m.insert(V::make(7));
+ m.insert(V::make(9));
+ m.insert(V::make(9));
+ m.insert(V::make(9));
R r = m.lower_bound(4);
assert(r == std::next(m.begin(), 0));
@@ -218,7 +162,7 @@ int main(int, char**)
assert(r == std::next(m.begin(), 6));
r = m.lower_bound(11);
assert(r == std::next(m.begin(), 9));
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/multiset/max_size.pass.cpp b/libcxx/test/std/containers/associative/multiset/max_size.pass.cpp
index 09faf8f9b97e6a9..a6cff58b090bdc8 100644
--- a/libcxx/test/std/containers/associative/multiset/max_size.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/max_size.pass.cpp
@@ -20,32 +20,29 @@
#include "test_allocator.h"
#include "test_macros.h"
-int main(int, char**)
-{
- {
- typedef limited_allocator<int, 10> A;
- typedef std::multiset<int, std::less<int>, A> C;
- C c;
- assert(c.max_size() <= 10);
- LIBCPP_ASSERT(c.max_size() == 10);
- }
- {
- typedef limited_allocator<int, (std::size_t)-1> A;
- typedef std::multiset<int, std::less<int>, A> C;
- const C::size_type max_dist =
- static_cast<C::size_type>(std::numeric_limits<C::
diff erence_type>::max());
- C c;
- assert(c.max_size() <= max_dist);
- LIBCPP_ASSERT(c.max_size() == max_dist);
- }
- {
- typedef std::multiset<char> C;
- const C::size_type max_dist =
- static_cast<C::size_type>(std::numeric_limits<C::
diff erence_type>::max());
- C c;
- assert(c.max_size() <= max_dist);
- assert(c.max_size() <= alloc_max_size(c.get_allocator()));
- }
+int main(int, char**) {
+ {
+ typedef limited_allocator<int, 10> A;
+ typedef std::multiset<int, std::less<int>, A> C;
+ C c;
+ assert(c.max_size() <= 10);
+ LIBCPP_ASSERT(c.max_size() == 10);
+ }
+ {
+ typedef limited_allocator<int, (std::size_t)-1> A;
+ typedef std::multiset<int, std::less<int>, A> C;
+ const C::size_type max_dist = static_cast<C::size_type>(std::numeric_limits<C::
diff erence_type>::max());
+ C c;
+ assert(c.max_size() <= max_dist);
+ LIBCPP_ASSERT(c.max_size() == max_dist);
+ }
+ {
+ typedef std::multiset<char> C;
+ const C::size_type max_dist = static_cast<C::size_type>(std::numeric_limits<C::
diff erence_type>::max());
+ C c;
+ assert(c.max_size() <= max_dist);
+ assert(c.max_size() <= alloc_max_size(c.get_allocator()));
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/merge.pass.cpp b/libcxx/test/std/containers/associative/multiset/merge.pass.cpp
index 3e99d88995fb826..90eaeb2adbfcbb1 100644
--- a/libcxx/test/std/containers/associative/multiset/merge.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/merge.pass.cpp
@@ -27,123 +27,112 @@
#include "Counter.h"
template <class Set>
-bool set_equal(const Set& set, Set other)
-{
- return set == other;
+bool set_equal(const Set& set, Set other) {
+ return set == other;
}
#ifndef TEST_HAS_NO_EXCEPTIONS
-struct throw_comparator
-{
- bool& should_throw_;
+struct throw_comparator {
+ bool& should_throw_;
- throw_comparator(bool& should_throw) : should_throw_(should_throw) {}
+ throw_comparator(bool& should_throw) : should_throw_(should_throw) {}
- template <class T>
- bool operator()(const T& lhs, const T& rhs) const
- {
- if (should_throw_)
- throw 0;
- return lhs < rhs;
- }
+ template <class T>
+ bool operator()(const T& lhs, const T& rhs) const {
+ if (should_throw_)
+ throw 0;
+ return lhs < rhs;
+ }
};
#endif
-int main(int, char**)
-{
- {
- std::multiset<int> src{1, 3, 5};
- std::multiset<int> dst{2, 4, 5};
- dst.merge(src);
- assert(set_equal(src, {}));
- assert(set_equal(dst, {1, 2, 3, 4, 5, 5}));
- }
+int main(int, char**) {
+ {
+ std::multiset<int> src{1, 3, 5};
+ std::multiset<int> dst{2, 4, 5};
+ dst.merge(src);
+ assert(set_equal(src, {}));
+ assert(set_equal(dst, {1, 2, 3, 4, 5, 5}));
+ }
#ifndef TEST_HAS_NO_EXCEPTIONS
- {
- bool do_throw = false;
- typedef std::multiset<Counter<int>, throw_comparator> set_type;
- set_type src({1, 3, 5}, throw_comparator(do_throw));
- set_type dst({2, 4, 5}, throw_comparator(do_throw));
-
- assert(Counter_base::gConstructed == 6);
-
- do_throw = true;
- try
- {
- dst.merge(src);
- }
- catch (int)
- {
- do_throw = false;
- }
- assert(!do_throw);
- assert(set_equal(src, set_type({1, 3, 5}, throw_comparator(do_throw))));
- assert(set_equal(dst, set_type({2, 4, 5}, throw_comparator(do_throw))));
+ {
+ bool do_throw = false;
+ typedef std::multiset<Counter<int>, throw_comparator> set_type;
+ set_type src({1, 3, 5}, throw_comparator(do_throw));
+ set_type dst({2, 4, 5}, throw_comparator(do_throw));
+
+ assert(Counter_base::gConstructed == 6);
+
+ do_throw = true;
+ try {
+ dst.merge(src);
+ } catch (int) {
+ do_throw = false;
}
+ assert(!do_throw);
+ assert(set_equal(src, set_type({1, 3, 5}, throw_comparator(do_throw))));
+ assert(set_equal(dst, set_type({2, 4, 5}, throw_comparator(do_throw))));
+ }
#endif
- assert(Counter_base::gConstructed == 0);
- struct comparator
- {
- comparator() = default;
+ assert(Counter_base::gConstructed == 0);
+ struct comparator {
+ comparator() = default;
- bool operator()(const Counter<int>& lhs, const Counter<int>& rhs) const
- {
- return lhs < rhs;
- }
- };
- {
- typedef std::multiset<Counter<int>, std::less<Counter<int>>> first_set_type;
- typedef std::multiset<Counter<int>, comparator> second_set_type;
- typedef std::set<Counter<int>, comparator> third_set_type;
+ bool operator()(const Counter<int>& lhs, const Counter<int>& rhs) const { return lhs < rhs; }
+ };
+ {
+ typedef std::multiset<Counter<int>, std::less<Counter<int>>> first_set_type;
+ typedef std::multiset<Counter<int>, comparator> second_set_type;
+ typedef std::set<Counter<int>, comparator> third_set_type;
- {
- first_set_type first{1, 2, 3};
- second_set_type second{2, 3, 4};
- third_set_type third{1, 3};
+ {
+ first_set_type first{1, 2, 3};
+ second_set_type second{2, 3, 4};
+ third_set_type third{1, 3};
- assert(Counter_base::gConstructed == 8);
+ assert(Counter_base::gConstructed == 8);
- first.merge(second);
- first.merge(third);
+ first.merge(second);
+ first.merge(third);
- assert(set_equal(first, {1, 1, 2, 2, 3, 3, 3, 4}));
- assert(set_equal(second, {}));
- assert(set_equal(third, {}));
+ assert(set_equal(first, {1, 1, 2, 2, 3, 3, 3, 4}));
+ assert(set_equal(second, {}));
+ assert(set_equal(third, {}));
- assert(Counter_base::gConstructed == 8);
- }
- assert(Counter_base::gConstructed == 0);
- {
- first_set_type first{1, 2, 3};
- second_set_type second{2, 3, 4};
- third_set_type third{1, 3};
+ assert(Counter_base::gConstructed == 8);
+ }
+ assert(Counter_base::gConstructed == 0);
+ {
+ first_set_type first{1, 2, 3};
+ second_set_type second{2, 3, 4};
+ third_set_type third{1, 3};
- assert(Counter_base::gConstructed == 8);
+ assert(Counter_base::gConstructed == 8);
- first.merge(std::move(second));
- first.merge(std::move(third));
+ first.merge(std::move(second));
+ first.merge(std::move(third));
- assert(set_equal(first, {1, 1, 2, 2, 3, 3, 3, 4}));
- assert(set_equal(second, {}));
- assert(set_equal(third, {}));
+ assert(set_equal(first, {1, 1, 2, 2, 3, 3, 3, 4}));
+ assert(set_equal(second, {}));
+ assert(set_equal(third, {}));
- assert(Counter_base::gConstructed == 8);
- }
- assert(Counter_base::gConstructed == 0);
+ assert(Counter_base::gConstructed == 8);
+ }
+ assert(Counter_base::gConstructed == 0);
+ }
+ {
+ std::multiset<int> first;
+ {
+ std::multiset<int> second;
+ first.merge(second);
+ first.merge(std::move(second));
}
{
- std::multiset<int> first;
- {
- std::multiset<int> second;
- first.merge(second);
- first.merge(std::move(second));
- }
- {
- std::set<int> second;
- first.merge(second);
- first.merge(std::move(second));
- }
+ std::set<int> second;
+ first.merge(second);
+ first.merge(std::move(second));
}
- return 0;
+ }
+ return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.cons/alloc.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.cons/alloc.pass.cpp
index 8aa09cae659d0af..1f05201d706b1cf 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.cons/alloc.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.cons/alloc.pass.cpp
@@ -18,14 +18,13 @@
#include "test_macros.h"
#include "test_allocator.h"
-int main(int, char**)
-{
- typedef std::less<int> C;
- typedef test_allocator<int> A;
- std::multiset<int, C, A> m(A(5));
- assert(m.empty());
- assert(m.begin() == m.end());
- assert(m.get_allocator() == A(5));
+int main(int, char**) {
+ typedef std::less<int> C;
+ typedef test_allocator<int> A;
+ std::multiset<int, C, A> m(A(5));
+ assert(m.empty());
+ assert(m.begin() == m.end());
+ assert(m.get_allocator() == A(5));
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.cons/assign_initializer_list.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.cons/assign_initializer_list.pass.cpp
index 3c39455e4e17ab0..7234e61d28bfa97 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.cons/assign_initializer_list.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.cons/assign_initializer_list.pass.cpp
@@ -20,13 +20,12 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::multiset<int> C;
typedef C::value_type V;
C m = {10, 8};
- m = {1, 2, 3, 4, 5, 6};
+ m = {1, 2, 3, 4, 5, 6};
assert(m.size() == 6);
assert(std::distance(m.begin(), m.end()) == 6);
C::const_iterator i = m.cbegin();
@@ -36,12 +35,12 @@ int main(int, char**)
assert(*++i == V(4));
assert(*++i == V(5));
assert(*++i == V(6));
- }
- {
+ }
+ {
typedef std::multiset<int, std::less<int>, min_allocator<int>> C;
typedef C::value_type V;
C m = {10, 8};
- m = {1, 2, 3, 4, 5, 6};
+ m = {1, 2, 3, 4, 5, 6};
assert(m.size() == 6);
assert(std::distance(m.begin(), m.end()) == 6);
C::const_iterator i = m.cbegin();
@@ -51,7 +50,7 @@ int main(int, char**)
assert(*++i == V(4));
assert(*++i == V(5));
assert(*++i == V(6));
- }
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.cons/compare.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.cons/compare.pass.cpp
index 6debbd6d3d852f3..b7da7f66b020d07 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.cons/compare.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.cons/compare.pass.cpp
@@ -18,14 +18,13 @@
#include "test_macros.h"
#include "../../../test_compare.h"
-int main(int, char**)
-{
- typedef test_less<int> C;
- const std::multiset<int, C> m(C(3));
- assert(m.empty());
- assert(m.begin() == m.end());
- assert(m.key_comp() == C(3));
- assert(m.value_comp() == C(3));
+int main(int, char**) {
+ typedef test_less<int> C;
+ const std::multiset<int, C> m(C(3));
+ assert(m.empty());
+ assert(m.begin() == m.end());
+ assert(m.key_comp() == C(3));
+ assert(m.value_comp() == C(3));
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.cons/compare_alloc.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.cons/compare_alloc.pass.cpp
index 61458e71d90b459..be8a451fdc405bb 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.cons/compare_alloc.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.cons/compare_alloc.pass.cpp
@@ -19,15 +19,14 @@
#include "../../../test_compare.h"
#include "test_allocator.h"
-int main(int, char**)
-{
- typedef test_less<int> C;
- typedef test_allocator<int> A;
- std::multiset<int, C, A> m(C(4), A(5));
- assert(m.empty());
- assert(m.begin() == m.end());
- assert(m.key_comp() == C(4));
- assert(m.get_allocator() == A(5));
+int main(int, char**) {
+ typedef test_less<int> C;
+ typedef test_allocator<int> A;
+ std::multiset<int, C, A> m(C(4), A(5));
+ assert(m.empty());
+ assert(m.begin() == m.end());
+ assert(m.key_comp() == C(4));
+ assert(m.get_allocator() == A(5));
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.cons/compare_copy_constructible.compile.fail.cpp b/libcxx/test/std/containers/associative/multiset/multiset.cons/compare_copy_constructible.compile.fail.cpp
index ae987c64c85bae4..020a11ac24626d6 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.cons/compare_copy_constructible.compile.fail.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.cons/compare_copy_constructible.compile.fail.cpp
@@ -15,16 +15,16 @@
template <class T>
struct Comp {
- bool operator () (const T& lhs, const T& rhs) const { return lhs < rhs; }
+ bool operator()(const T& lhs, const T& rhs) const { return lhs < rhs; }
- Comp () {}
-private:
- Comp (const Comp &); // declared but not defined
- };
+ Comp() {}
+private:
+ Comp(const Comp&); // declared but not defined
+};
int main(int, char**) {
- std::multiset<int, Comp<int> > m;
+ std::multiset<int, Comp<int> > m;
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.cons/copy.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.cons/copy.pass.cpp
index 9d643199e6b9a7b..8138227128e8aa7 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.cons/copy.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.cons/copy.pass.cpp
@@ -20,101 +20,78 @@
#include "../../../test_compare.h"
#include "test_allocator.h"
-int main(int, char**)
-{
- {
- typedef int V;
- V ar[] =
- {
- 1,
- 1,
- 1,
- 2,
- 2,
- 2,
- 3,
- 3,
- 3
- };
- typedef test_less<int> C;
- typedef test_allocator<V> A;
- std::multiset<int, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(7));
- std::multiset<int, C, A> m = mo;
- assert(m.get_allocator() == A(7));
- assert(m.key_comp() == C(5));
- assert(m.size() == 9);
- assert(std::distance(m.begin(), m.end()) == 9);
- assert(*std::next(m.begin(), 0) == 1);
- assert(*std::next(m.begin(), 1) == 1);
- assert(*std::next(m.begin(), 2) == 1);
- assert(*std::next(m.begin(), 3) == 2);
- assert(*std::next(m.begin(), 4) == 2);
- assert(*std::next(m.begin(), 5) == 2);
- assert(*std::next(m.begin(), 6) == 3);
- assert(*std::next(m.begin(), 7) == 3);
- assert(*std::next(m.begin(), 8) == 3);
+int main(int, char**) {
+ {
+ typedef int V;
+ V ar[] = {1, 1, 1, 2, 2, 2, 3, 3, 3};
+ typedef test_less<int> C;
+ typedef test_allocator<V> A;
+ std::multiset<int, C, A> mo(ar, ar + sizeof(ar) / sizeof(ar[0]), C(5), A(7));
+ std::multiset<int, C, A> m = mo;
+ assert(m.get_allocator() == A(7));
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 9);
+ assert(std::distance(m.begin(), m.end()) == 9);
+ assert(*std::next(m.begin(), 0) == 1);
+ assert(*std::next(m.begin(), 1) == 1);
+ assert(*std::next(m.begin(), 2) == 1);
+ assert(*std::next(m.begin(), 3) == 2);
+ assert(*std::next(m.begin(), 4) == 2);
+ assert(*std::next(m.begin(), 5) == 2);
+ assert(*std::next(m.begin(), 6) == 3);
+ assert(*std::next(m.begin(), 7) == 3);
+ assert(*std::next(m.begin(), 8) == 3);
- assert(mo.get_allocator() == A(7));
- assert(mo.key_comp() == C(5));
- assert(mo.size() == 9);
- assert(std::distance(mo.begin(), mo.end()) == 9);
- assert(*std::next(mo.begin(), 0) == 1);
- assert(*std::next(mo.begin(), 1) == 1);
- assert(*std::next(mo.begin(), 2) == 1);
- assert(*std::next(mo.begin(), 3) == 2);
- assert(*std::next(mo.begin(), 4) == 2);
- assert(*std::next(mo.begin(), 5) == 2);
- assert(*std::next(mo.begin(), 6) == 3);
- assert(*std::next(mo.begin(), 7) == 3);
- assert(*std::next(mo.begin(), 8) == 3);
- }
+ assert(mo.get_allocator() == A(7));
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 9);
+ assert(std::distance(mo.begin(), mo.end()) == 9);
+ assert(*std::next(mo.begin(), 0) == 1);
+ assert(*std::next(mo.begin(), 1) == 1);
+ assert(*std::next(mo.begin(), 2) == 1);
+ assert(*std::next(mo.begin(), 3) == 2);
+ assert(*std::next(mo.begin(), 4) == 2);
+ assert(*std::next(mo.begin(), 5) == 2);
+ assert(*std::next(mo.begin(), 6) == 3);
+ assert(*std::next(mo.begin(), 7) == 3);
+ assert(*std::next(mo.begin(), 8) == 3);
+ }
#if TEST_STD_VER >= 11
- {
- typedef int V;
- V ar[] =
- {
- 1,
- 1,
- 1,
- 2,
- 2,
- 2,
- 3,
- 3,
- 3
- };
- typedef test_less<int> C;
- typedef other_allocator<V> A;
- std::multiset<int, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(7));
- std::multiset<int, C, A> m = mo;
- assert(m.get_allocator() == A(-2));
- assert(m.key_comp() == C(5));
- assert(m.size() == 9);
- assert(std::distance(m.begin(), m.end()) == 9);
- assert(*std::next(m.begin(), 0) == 1);
- assert(*std::next(m.begin(), 1) == 1);
- assert(*std::next(m.begin(), 2) == 1);
- assert(*std::next(m.begin(), 3) == 2);
- assert(*std::next(m.begin(), 4) == 2);
- assert(*std::next(m.begin(), 5) == 2);
- assert(*std::next(m.begin(), 6) == 3);
- assert(*std::next(m.begin(), 7) == 3);
- assert(*std::next(m.begin(), 8) == 3);
+ {
+ typedef int V;
+ V ar[] = {1, 1, 1, 2, 2, 2, 3, 3, 3};
+ typedef test_less<int> C;
+ typedef other_allocator<V> A;
+ std::multiset<int, C, A> mo(ar, ar + sizeof(ar) / sizeof(ar[0]), C(5), A(7));
+ std::multiset<int, C, A> m = mo;
+ assert(m.get_allocator() == A(-2));
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 9);
+ assert(std::distance(m.begin(), m.end()) == 9);
+ assert(*std::next(m.begin(), 0) == 1);
+ assert(*std::next(m.begin(), 1) == 1);
+ assert(*std::next(m.begin(), 2) == 1);
+ assert(*std::next(m.begin(), 3) == 2);
+ assert(*std::next(m.begin(), 4) == 2);
+ assert(*std::next(m.begin(), 5) == 2);
+ assert(*std::next(m.begin(), 6) == 3);
+ assert(*std::next(m.begin(), 7) == 3);
+ assert(*std::next(m.begin(), 8) == 3);
- assert(mo.get_allocator() == A(7));
- assert(mo.key_comp() == C(5));
- assert(mo.size() == 9);
- assert(std::distance(mo.begin(), mo.end()) == 9);
- assert(*std::next(mo.begin(), 0) == 1);
- assert(*std::next(mo.begin(), 1) == 1);
- assert(*std::next(mo.begin(), 2) == 1);
- assert(*std::next(mo.begin(), 3) == 2);
- assert(*std::next(mo.begin(), 4) == 2);
- assert(*std::next(mo.begin(), 5) == 2);
- assert(*std::next(mo.begin(), 6) == 3);
- assert(*std::next(mo.begin(), 7) == 3);
- assert(*std::next(mo.begin(), 8) == 3);
- }
+ assert(mo.get_allocator() == A(7));
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 9);
+ assert(std::distance(mo.begin(), mo.end()) == 9);
+ assert(*std::next(mo.begin(), 0) == 1);
+ assert(*std::next(mo.begin(), 1) == 1);
+ assert(*std::next(mo.begin(), 2) == 1);
+ assert(*std::next(mo.begin(), 3) == 2);
+ assert(*std::next(mo.begin(), 4) == 2);
+ assert(*std::next(mo.begin(), 5) == 2);
+ assert(*std::next(mo.begin(), 6) == 3);
+ assert(*std::next(mo.begin(), 7) == 3);
+ assert(*std::next(mo.begin(), 8) == 3);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.cons/copy_alloc.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.cons/copy_alloc.pass.cpp
index ece846c63ec8e6c..7570673066829fd 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.cons/copy_alloc.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.cons/copy_alloc.pass.cpp
@@ -20,52 +20,40 @@
#include "../../../test_compare.h"
#include "test_allocator.h"
-int main(int, char**)
-{
- typedef int V;
- V ar[] =
- {
- 1,
- 1,
- 1,
- 2,
- 2,
- 2,
- 3,
- 3,
- 3
- };
- typedef test_less<int> C;
- typedef test_allocator<V> A;
- std::multiset<int, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(7));
- std::multiset<int, C, A> m(mo, A(3));
- assert(m.get_allocator() == A(3));
- assert(m.key_comp() == C(5));
- assert(m.size() == 9);
- assert(std::distance(m.begin(), m.end()) == 9);
- assert(*std::next(m.begin(), 0) == 1);
- assert(*std::next(m.begin(), 1) == 1);
- assert(*std::next(m.begin(), 2) == 1);
- assert(*std::next(m.begin(), 3) == 2);
- assert(*std::next(m.begin(), 4) == 2);
- assert(*std::next(m.begin(), 5) == 2);
- assert(*std::next(m.begin(), 6) == 3);
- assert(*std::next(m.begin(), 7) == 3);
- assert(*std::next(m.begin(), 8) == 3);
-
- assert(mo.get_allocator() == A(7));
- assert(mo.key_comp() == C(5));
- assert(mo.size() == 9);
- assert(std::distance(mo.begin(), mo.end()) == 9);
- assert(*std::next(mo.begin(), 0) == 1);
- assert(*std::next(mo.begin(), 1) == 1);
- assert(*std::next(mo.begin(), 2) == 1);
- assert(*std::next(mo.begin(), 3) == 2);
- assert(*std::next(mo.begin(), 4) == 2);
- assert(*std::next(mo.begin(), 5) == 2);
- assert(*std::next(mo.begin(), 6) == 3);
- assert(*std::next(mo.begin(), 7) == 3);
- assert(*std::next(mo.begin(), 8) == 3);
+int main(int, char**) {
+ typedef int V;
+ V ar[] = {1, 1, 1, 2, 2, 2, 3, 3, 3};
+ typedef test_less<int> C;
+ typedef test_allocator<V> A;
+ std::multiset<int, C, A> mo(ar, ar + sizeof(ar) / sizeof(ar[0]), C(5), A(7));
+ std::multiset<int, C, A> m(mo, A(3));
+ assert(m.get_allocator() == A(3));
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 9);
+ assert(std::distance(m.begin(), m.end()) == 9);
+ assert(*std::next(m.begin(), 0) == 1);
+ assert(*std::next(m.begin(), 1) == 1);
+ assert(*std::next(m.begin(), 2) == 1);
+ assert(*std::next(m.begin(), 3) == 2);
+ assert(*std::next(m.begin(), 4) == 2);
+ assert(*std::next(m.begin(), 5) == 2);
+ assert(*std::next(m.begin(), 6) == 3);
+ assert(*std::next(m.begin(), 7) == 3);
+ assert(*std::next(m.begin(), 8) == 3);
+
+ assert(mo.get_allocator() == A(7));
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 9);
+ assert(std::distance(mo.begin(), mo.end()) == 9);
+ assert(*std::next(mo.begin(), 0) == 1);
+ assert(*std::next(mo.begin(), 1) == 1);
+ assert(*std::next(mo.begin(), 2) == 1);
+ assert(*std::next(mo.begin(), 3) == 2);
+ assert(*std::next(mo.begin(), 4) == 2);
+ assert(*std::next(mo.begin(), 5) == 2);
+ assert(*std::next(mo.begin(), 6) == 3);
+ assert(*std::next(mo.begin(), 7) == 3);
+ assert(*std::next(mo.begin(), 8) == 3);
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.cons/copy_assign.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.cons/copy_assign.pass.cpp
index 6835020a9822328..d6b394ff666985a 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.cons/copy_assign.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.cons/copy_assign.pass.cpp
@@ -20,122 +20,88 @@
#include "../../../test_compare.h"
#include "test_allocator.h"
-int main(int, char**)
-{
- {
- typedef int V;
- V ar[] =
- {
- 1,
- 1,
- 1,
- 2,
- 2,
- 2,
- 3,
- 3,
- 3
- };
- typedef test_less<int> C;
- typedef test_allocator<V> A;
- std::multiset<int, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(2));
- std::multiset<int, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0])/2, C(3), A(7));
- m = mo;
- assert(m.get_allocator() == A(7));
- assert(m.key_comp() == C(5));
- assert(m.size() == 9);
- assert(std::distance(m.begin(), m.end()) == 9);
- assert(*std::next(m.begin(), 0) == 1);
- assert(*std::next(m.begin(), 1) == 1);
- assert(*std::next(m.begin(), 2) == 1);
- assert(*std::next(m.begin(), 3) == 2);
- assert(*std::next(m.begin(), 4) == 2);
- assert(*std::next(m.begin(), 5) == 2);
- assert(*std::next(m.begin(), 6) == 3);
- assert(*std::next(m.begin(), 7) == 3);
- assert(*std::next(m.begin(), 8) == 3);
+int main(int, char**) {
+ {
+ typedef int V;
+ V ar[] = {1, 1, 1, 2, 2, 2, 3, 3, 3};
+ typedef test_less<int> C;
+ typedef test_allocator<V> A;
+ std::multiset<int, C, A> mo(ar, ar + sizeof(ar) / sizeof(ar[0]), C(5), A(2));
+ std::multiset<int, C, A> m(ar, ar + sizeof(ar) / sizeof(ar[0]) / 2, C(3), A(7));
+ m = mo;
+ assert(m.get_allocator() == A(7));
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 9);
+ assert(std::distance(m.begin(), m.end()) == 9);
+ assert(*std::next(m.begin(), 0) == 1);
+ assert(*std::next(m.begin(), 1) == 1);
+ assert(*std::next(m.begin(), 2) == 1);
+ assert(*std::next(m.begin(), 3) == 2);
+ assert(*std::next(m.begin(), 4) == 2);
+ assert(*std::next(m.begin(), 5) == 2);
+ assert(*std::next(m.begin(), 6) == 3);
+ assert(*std::next(m.begin(), 7) == 3);
+ assert(*std::next(m.begin(), 8) == 3);
- assert(mo.get_allocator() == A(2));
- assert(mo.key_comp() == C(5));
- assert(mo.size() == 9);
- assert(std::distance(mo.begin(), mo.end()) == 9);
- assert(*std::next(mo.begin(), 0) == 1);
- assert(*std::next(mo.begin(), 1) == 1);
- assert(*std::next(mo.begin(), 2) == 1);
- assert(*std::next(mo.begin(), 3) == 2);
- assert(*std::next(mo.begin(), 4) == 2);
- assert(*std::next(mo.begin(), 5) == 2);
- assert(*std::next(mo.begin(), 6) == 3);
- assert(*std::next(mo.begin(), 7) == 3);
- assert(*std::next(mo.begin(), 8) == 3);
- }
- {
- typedef int V;
- const V ar[] =
- {
- 1,
- 1,
- 1,
- 2,
- 2,
- 2,
- 3,
- 3,
- 3
- };
- std::multiset<int> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- std::multiset<int> *p = &m;
- m = *p;
- assert(m.size() == 9);
- assert(std::equal(m.begin(), m.end(), ar));
- }
- {
- typedef int V;
- V ar[] =
- {
- 1,
- 1,
- 1,
- 2,
- 2,
- 2,
- 3,
- 3,
- 3
- };
- typedef test_less<int> C;
- typedef other_allocator<V> A;
- std::multiset<int, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(2));
- std::multiset<int, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0])/2, C(3), A(7));
- m = mo;
- assert(m.get_allocator() == A(2));
- assert(m.key_comp() == C(5));
- assert(m.size() == 9);
- assert(std::distance(m.begin(), m.end()) == 9);
- assert(*std::next(m.begin(), 0) == 1);
- assert(*std::next(m.begin(), 1) == 1);
- assert(*std::next(m.begin(), 2) == 1);
- assert(*std::next(m.begin(), 3) == 2);
- assert(*std::next(m.begin(), 4) == 2);
- assert(*std::next(m.begin(), 5) == 2);
- assert(*std::next(m.begin(), 6) == 3);
- assert(*std::next(m.begin(), 7) == 3);
- assert(*std::next(m.begin(), 8) == 3);
+ assert(mo.get_allocator() == A(2));
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 9);
+ assert(std::distance(mo.begin(), mo.end()) == 9);
+ assert(*std::next(mo.begin(), 0) == 1);
+ assert(*std::next(mo.begin(), 1) == 1);
+ assert(*std::next(mo.begin(), 2) == 1);
+ assert(*std::next(mo.begin(), 3) == 2);
+ assert(*std::next(mo.begin(), 4) == 2);
+ assert(*std::next(mo.begin(), 5) == 2);
+ assert(*std::next(mo.begin(), 6) == 3);
+ assert(*std::next(mo.begin(), 7) == 3);
+ assert(*std::next(mo.begin(), 8) == 3);
+ }
+ {
+ typedef int V;
+ const V ar[] = {1, 1, 1, 2, 2, 2, 3, 3, 3};
+ std::multiset<int> m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ std::multiset<int>* p = &m;
+ m = *p;
+ assert(m.size() == 9);
+ assert(std::equal(m.begin(), m.end(), ar));
+ }
+ {
+ typedef int V;
+ V ar[] = {1, 1, 1, 2, 2, 2, 3, 3, 3};
+ typedef test_less<int> C;
+ typedef other_allocator<V> A;
+ std::multiset<int, C, A> mo(ar, ar + sizeof(ar) / sizeof(ar[0]), C(5), A(2));
+ std::multiset<int, C, A> m(ar, ar + sizeof(ar) / sizeof(ar[0]) / 2, C(3), A(7));
+ m = mo;
+ assert(m.get_allocator() == A(2));
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 9);
+ assert(std::distance(m.begin(), m.end()) == 9);
+ assert(*std::next(m.begin(), 0) == 1);
+ assert(*std::next(m.begin(), 1) == 1);
+ assert(*std::next(m.begin(), 2) == 1);
+ assert(*std::next(m.begin(), 3) == 2);
+ assert(*std::next(m.begin(), 4) == 2);
+ assert(*std::next(m.begin(), 5) == 2);
+ assert(*std::next(m.begin(), 6) == 3);
+ assert(*std::next(m.begin(), 7) == 3);
+ assert(*std::next(m.begin(), 8) == 3);
- assert(mo.get_allocator() == A(2));
- assert(mo.key_comp() == C(5));
- assert(mo.size() == 9);
- assert(std::distance(mo.begin(), mo.end()) == 9);
- assert(*std::next(mo.begin(), 0) == 1);
- assert(*std::next(mo.begin(), 1) == 1);
- assert(*std::next(mo.begin(), 2) == 1);
- assert(*std::next(mo.begin(), 3) == 2);
- assert(*std::next(mo.begin(), 4) == 2);
- assert(*std::next(mo.begin(), 5) == 2);
- assert(*std::next(mo.begin(), 6) == 3);
- assert(*std::next(mo.begin(), 7) == 3);
- assert(*std::next(mo.begin(), 8) == 3);
- }
+ assert(mo.get_allocator() == A(2));
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 9);
+ assert(std::distance(mo.begin(), mo.end()) == 9);
+ assert(*std::next(mo.begin(), 0) == 1);
+ assert(*std::next(mo.begin(), 1) == 1);
+ assert(*std::next(mo.begin(), 2) == 1);
+ assert(*std::next(mo.begin(), 3) == 2);
+ assert(*std::next(mo.begin(), 4) == 2);
+ assert(*std::next(mo.begin(), 5) == 2);
+ assert(*std::next(mo.begin(), 6) == 3);
+ assert(*std::next(mo.begin(), 7) == 3);
+ assert(*std::next(mo.begin(), 8) == 3);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.cons/deduct.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.cons/deduct.pass.cpp
index 93bff1a41c66748..f9797ca571c47d8 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.cons/deduct.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.cons/deduct.pass.cpp
@@ -52,38 +52,32 @@ struct NotAnAllocator {
friend bool operator<(NotAnAllocator, NotAnAllocator) { return false; }
};
-int main(int, char **) {
+int main(int, char**) {
{
- const int arr[] = { 1, 2, 1, INT_MAX, 3 };
+ const int arr[] = {1, 2, 1, INT_MAX, 3};
std::multiset s(std::begin(arr), std::end(arr));
ASSERT_SAME_TYPE(decltype(s), std::multiset<int>);
- const int expected_s[] = { 1, 1, 2, 3, INT_MAX };
- assert(std::equal(s.begin(), s.end(), std::begin(expected_s),
- std::end(expected_s)));
+ const int expected_s[] = {1, 1, 2, 3, INT_MAX};
+ assert(std::equal(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s)));
}
{
- const int arr[] = { 1, 2, 1, INT_MAX, 3 };
+ const int arr[] = {1, 2, 1, INT_MAX, 3};
std::multiset s(std::begin(arr), std::end(arr), std::greater<int>());
ASSERT_SAME_TYPE(decltype(s), std::multiset<int, std::greater<int> >);
- const int expected_s[] = { INT_MAX, 3, 2, 1, 1 };
- assert(std::equal(s.begin(), s.end(), std::begin(expected_s),
- std::end(expected_s)));
+ const int expected_s[] = {INT_MAX, 3, 2, 1, 1};
+ assert(std::equal(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s)));
}
{
- const int arr[] = { 1, 2, 1, INT_MAX, 3 };
- std::multiset s(std::begin(arr), std::end(arr), std::greater<int>(),
- test_allocator<int>(0, 42));
+ const int arr[] = {1, 2, 1, INT_MAX, 3};
+ std::multiset s(std::begin(arr), std::end(arr), std::greater<int>(), test_allocator<int>(0, 42));
- ASSERT_SAME_TYPE(
- decltype(s),
- std::multiset<int, std::greater<int>, test_allocator<int> >);
- const int expected_s[] = { INT_MAX, 3, 2, 1, 1 };
- assert(std::equal(s.begin(), s.end(), std::begin(expected_s),
- std::end(expected_s)));
+ ASSERT_SAME_TYPE(decltype(s), std::multiset<int, std::greater<int>, test_allocator<int> >);
+ const int expected_s[] = {INT_MAX, 3, 2, 1, 1};
+ assert(std::equal(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s)));
assert(s.get_allocator().get_id() == 42);
}
@@ -96,7 +90,7 @@ int main(int, char **) {
{
std::multiset<long> source;
- std::multiset s{ source }; // braces instead of parens
+ std::multiset s{source}; // braces instead of parens
ASSERT_SAME_TYPE(decltype(s), std::multiset<long>);
assert(s.size() == 0);
}
@@ -109,121 +103,111 @@ int main(int, char **) {
}
{
- std::multiset s{ 1, 2, 1, INT_MAX, 3 };
+ std::multiset s{1, 2, 1, INT_MAX, 3};
ASSERT_SAME_TYPE(decltype(s), std::multiset<int>);
- const int expected_s[] = { 1, 1, 2, 3, INT_MAX };
- assert(std::equal(s.begin(), s.end(), std::begin(expected_s),
- std::end(expected_s)));
+ const int expected_s[] = {1, 1, 2, 3, INT_MAX};
+ assert(std::equal(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s)));
}
{
- std::multiset s({ 1, 2, 1, INT_MAX, 3 }, std::greater<int>());
+ std::multiset s({1, 2, 1, INT_MAX, 3}, std::greater<int>());
ASSERT_SAME_TYPE(decltype(s), std::multiset<int, std::greater<int> >);
- const int expected_s[] = { INT_MAX, 3, 2, 1, 1 };
- assert(std::equal(s.begin(), s.end(), std::begin(expected_s),
- std::end(expected_s)));
+ const int expected_s[] = {INT_MAX, 3, 2, 1, 1};
+ assert(std::equal(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s)));
}
{
- std::multiset s({ 1, 2, 1, INT_MAX, 3 }, std::greater<int>(),
- test_allocator<int>(0, 43));
+ std::multiset s({1, 2, 1, INT_MAX, 3}, std::greater<int>(), test_allocator<int>(0, 43));
- ASSERT_SAME_TYPE(
- decltype(s),
- std::multiset<int, std::greater<int>, test_allocator<int> >);
- const int expected_s[] = { INT_MAX, 3, 2, 1, 1 };
- assert(std::equal(s.begin(), s.end(), std::begin(expected_s),
- std::end(expected_s)));
+ ASSERT_SAME_TYPE(decltype(s), std::multiset<int, std::greater<int>, test_allocator<int> >);
+ const int expected_s[] = {INT_MAX, 3, 2, 1, 1};
+ assert(std::equal(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s)));
assert(s.get_allocator().get_id() == 43);
}
{
- const int arr[] = { 1, 2, 1, INT_MAX, 3 };
+ const int arr[] = {1, 2, 1, INT_MAX, 3};
std::multiset s(std::begin(arr), std::end(arr), test_allocator<int>(0, 44));
- ASSERT_SAME_TYPE(decltype(s),
- std::multiset<int, std::less<int>, test_allocator<int> >);
- const int expected_s[] = { 1, 1, 2, 3, INT_MAX };
- assert(std::equal(s.begin(), s.end(), std::begin(expected_s),
- std::end(expected_s)));
+ ASSERT_SAME_TYPE(decltype(s), std::multiset<int, std::less<int>, test_allocator<int> >);
+ const int expected_s[] = {1, 1, 2, 3, INT_MAX};
+ assert(std::equal(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s)));
assert(s.get_allocator().get_id() == 44);
}
{
- std::multiset s({ 1, 2, 1, INT_MAX, 3 }, test_allocator<int>(0, 45));
+ std::multiset s({1, 2, 1, INT_MAX, 3}, test_allocator<int>(0, 45));
- ASSERT_SAME_TYPE(decltype(s),
- std::multiset<int, std::less<int>, test_allocator<int> >);
- const int expected_s[] = { 1, 1, 2, 3, INT_MAX };
- assert(std::equal(s.begin(), s.end(), std::begin(expected_s),
- std::end(expected_s)));
+ ASSERT_SAME_TYPE(decltype(s), std::multiset<int, std::less<int>, test_allocator<int> >);
+ const int expected_s[] = {1, 1, 2, 3, INT_MAX};
+ assert(std::equal(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s)));
assert(s.get_allocator().get_id() == 45);
}
{
NotAnAllocator a;
- std::multiset s{ a }; // multiset(initializer_list<NotAnAllocator>)
+ std::multiset s{a}; // multiset(initializer_list<NotAnAllocator>)
ASSERT_SAME_TYPE(decltype(s), std::multiset<NotAnAllocator>);
assert(s.size() == 1);
}
{
std::multiset<long> source;
- std::multiset s{ source, source }; // multiset(initializer_list<multiset<long>>)
+ std::multiset s{source, source}; // multiset(initializer_list<multiset<long>>)
ASSERT_SAME_TYPE(decltype(s), std::multiset<std::multiset<long> >);
assert(s.size() == 2);
}
{
NotAnAllocator a;
- std::multiset s{ a, a }; // multiset(initializer_list<NotAnAllocator>)
+ std::multiset s{a, a}; // multiset(initializer_list<NotAnAllocator>)
ASSERT_SAME_TYPE(decltype(s), std::multiset<NotAnAllocator>);
assert(s.size() == 2);
}
{
- int source[3] = { 3, 4, 5 };
+ int source[3] = {3, 4, 5};
std::multiset s(source, source + 3); // multiset(InputIterator, InputIterator)
ASSERT_SAME_TYPE(decltype(s), std::multiset<int>);
assert(s.size() == 3);
}
{
- int source[3] = { 3, 4, 5 };
- std::multiset s{ source, source + 3 }; // multiset(initializer_list<int*>)
- ASSERT_SAME_TYPE(decltype(s), std::multiset<int *>);
+ int source[3] = {3, 4, 5};
+ std::multiset s{source, source + 3}; // multiset(initializer_list<int*>)
+ ASSERT_SAME_TYPE(decltype(s), std::multiset<int*>);
assert(s.size() == 2);
}
#if TEST_STD_VER >= 23
- {
- using Range = std::array<int, 0>;
- using Comp = std::greater<int>;
- using DefaultComp = std::less<int>;
- using Alloc = test_allocator<int>;
-
- { // (from_range, range)
- std::multiset c(std::from_range, Range());
- static_assert(std::is_same_v<decltype(c), std::multiset<int>>);
- }
-
- { // (from_range, range, comp)
- std::multiset c(std::from_range, Range(), Comp());
- static_assert(std::is_same_v<decltype(c), std::multiset<int, Comp>>);
- }
-
- { // (from_range, range, comp, alloc)
- std::multiset c(std::from_range, Range(), Comp(), Alloc());
- static_assert(std::is_same_v<decltype(c), std::multiset<int, Comp, Alloc>>);
- }
-
- { // (from_range, range, alloc)
- std::multiset c(std::from_range, Range(), Alloc());
- static_assert(std::is_same_v<decltype(c), std::multiset<int, DefaultComp, Alloc>>);
- }
+ {
+ using Range = std::array<int, 0>;
+ using Comp = std::greater<int>;
+ using DefaultComp = std::less<int>;
+ using Alloc = test_allocator<int>;
+
+ { // (from_range, range)
+ std::multiset c(std::from_range, Range());
+ static_assert(std::is_same_v<decltype(c), std::multiset<int>>);
}
+
+ { // (from_range, range, comp)
+ std::multiset c(std::from_range, Range(), Comp());
+ static_assert(std::is_same_v<decltype(c), std::multiset<int, Comp>>);
+ }
+
+ { // (from_range, range, comp, alloc)
+ std::multiset c(std::from_range, Range(), Comp(), Alloc());
+ static_assert(std::is_same_v<decltype(c), std::multiset<int, Comp, Alloc>>);
+ }
+
+ { // (from_range, range, alloc)
+ std::multiset c(std::from_range, Range(), Alloc());
+ static_assert(std::is_same_v<decltype(c), std::multiset<int, DefaultComp, Alloc>>);
+ }
+ }
#endif
AssociativeContainerDeductionGuidesSfinaeAway<std::multiset, std::multiset<int>>();
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.cons/deduct.verify.cpp b/libcxx/test/std/containers/associative/multiset/multiset.cons/deduct.verify.cpp
index 30dd08b04815574..6c7484078187c1b 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.cons/deduct.verify.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.cons/deduct.verify.cpp
@@ -36,7 +36,7 @@ struct NotAnAllocator {
friend bool operator<(NotAnAllocator, NotAnAllocator) { return false; }
};
-int main(int, char **) {
+int main(int, char**) {
{
// cannot deduce Key from nothing
std::multiset s;
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.cons/default.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.cons/default.pass.cpp
index 793c0f5c7ef9f4f..4f7dabfea2c6831 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.cons/default.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.cons/default.pass.cpp
@@ -18,38 +18,37 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
std::multiset<int> m;
assert(m.empty());
assert(m.begin() == m.end());
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
std::multiset<int, std::less<int>, min_allocator<int>> m;
assert(m.empty());
assert(m.begin() == m.end());
- }
- {
+ }
+ {
typedef explicit_allocator<int> A;
- {
- std::multiset<int, std::less<int>, A> m;
- assert(m.empty());
- assert(m.begin() == m.end());
- }
- {
- A a;
- std::multiset<int, std::less<int>, A> m(a);
- assert(m.empty());
- assert(m.begin() == m.end());
- }
+ {
+ std::multiset<int, std::less<int>, A> m;
+ assert(m.empty());
+ assert(m.begin() == m.end());
}
{
+ A a;
+ std::multiset<int, std::less<int>, A> m(a);
+ assert(m.empty());
+ assert(m.begin() == m.end());
+ }
+ }
+ {
std::multiset<int> m = {};
assert(m.empty());
assert(m.begin() == m.end());
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.cons/default_noexcept.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.cons/default_noexcept.pass.cpp
index b6d1cb267846fff..052b032d6e798b6 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.cons/default_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.cons/default_noexcept.pass.cpp
@@ -26,33 +26,31 @@
#include "test_allocator.h"
template <class T>
-struct some_comp
-{
- typedef T value_type;
- some_comp();
- bool operator()(const T&, const T&) const { return false; }
+struct some_comp {
+ typedef T value_type;
+ some_comp();
+ bool operator()(const T&, const T&) const { return false; }
};
-int main(int, char**)
-{
+int main(int, char**) {
#if defined(_LIBCPP_VERSION)
- {
- typedef std::multiset<MoveOnly> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
- }
- {
- typedef std::multiset<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
- }
+ {
+ typedef std::multiset<MoveOnly> C;
+ static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ }
+ {
+ typedef std::multiset<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
+ static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ }
#endif // _LIBCPP_VERSION
- {
- typedef std::multiset<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
- static_assert(!std::is_nothrow_default_constructible<C>::value, "");
- }
- {
- typedef std::multiset<MoveOnly, some_comp<MoveOnly>> C;
- static_assert(!std::is_nothrow_default_constructible<C>::value, "");
- }
+ {
+ typedef std::multiset<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
+ static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+ }
+ {
+ typedef std::multiset<MoveOnly, some_comp<MoveOnly>> C;
+ static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.cons/dtor_noexcept.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.cons/dtor_noexcept.pass.cpp
index a9f7a648773e7f5..987eca0706076b7 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.cons/dtor_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.cons/dtor_noexcept.pass.cpp
@@ -20,32 +20,30 @@
#include "test_allocator.h"
template <class T>
-struct some_comp
-{
- typedef T value_type;
- ~some_comp() noexcept(false);
- bool operator()(const T&, const T&) const { return false; }
+struct some_comp {
+ typedef T value_type;
+ ~some_comp() noexcept(false);
+ bool operator()(const T&, const T&) const { return false; }
};
-int main(int, char**)
-{
- {
- typedef std::multiset<MoveOnly> C;
- static_assert(std::is_nothrow_destructible<C>::value, "");
- }
- {
- typedef std::multiset<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_destructible<C>::value, "");
- }
- {
- typedef std::multiset<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_destructible<C>::value, "");
- }
+int main(int, char**) {
+ {
+ typedef std::multiset<MoveOnly> C;
+ static_assert(std::is_nothrow_destructible<C>::value, "");
+ }
+ {
+ typedef std::multiset<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
+ static_assert(std::is_nothrow_destructible<C>::value, "");
+ }
+ {
+ typedef std::multiset<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
+ static_assert(std::is_nothrow_destructible<C>::value, "");
+ }
#if defined(_LIBCPP_VERSION)
- {
- typedef std::multiset<MoveOnly, some_comp<MoveOnly>> C;
- static_assert(!std::is_nothrow_destructible<C>::value, "");
- }
+ {
+ typedef std::multiset<MoveOnly, some_comp<MoveOnly>> C;
+ static_assert(!std::is_nothrow_destructible<C>::value, "");
+ }
#endif // _LIBCPP_VERSION
return 0;
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.cons/from_range.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.cons/from_range.pass.cpp
index 74533d7e41abff4..15275781a8aac11 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.cons/from_range.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.cons/from_range.pass.cpp
@@ -24,7 +24,7 @@
void test_duplicates() {
std::array input = {1, 2, 3, 3, 3, 4, 2, 1, 2};
- auto c = std::multiset<int>(std::from_range, input);
+ auto c = std::multiset<int>(std::from_range, input);
assert(std::ranges::is_permutation(input, c));
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp
index fa4a85e20f82af3..c860f17bb4196b6 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp
@@ -20,9 +20,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::multiset<int> C;
typedef C::value_type V;
C m = {1, 2, 3, 4, 5, 6};
@@ -35,8 +34,8 @@ int main(int, char**)
assert(*++i == V(4));
assert(*++i == V(5));
assert(*++i == V(6));
- }
- {
+ }
+ {
typedef std::multiset<int, std::less<int>, min_allocator<int>> C;
typedef C::value_type V;
C m = {1, 2, 3, 4, 5, 6};
@@ -49,12 +48,12 @@ int main(int, char**)
assert(*++i == V(4));
assert(*++i == V(5));
assert(*++i == V(6));
- }
- {
+ }
+ {
typedef std::multiset<int, std::less<int>, min_allocator<int>> C;
typedef C::value_type V;
min_allocator<int> a;
- C m ({1, 2, 3, 4, 5, 6}, a);
+ C m({1, 2, 3, 4, 5, 6}, a);
assert(m.size() == 6);
assert(std::distance(m.begin(), m.end()) == 6);
C::const_iterator i = m.cbegin();
@@ -65,7 +64,7 @@ int main(int, char**)
assert(*++i == V(5));
assert(*++i == V(6));
assert(m.get_allocator() == a);
- }
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare.pass.cpp
index 4abbddb8c15d4fb..5bb400cb82be9d6 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare.pass.cpp
@@ -21,22 +21,21 @@
#include "test_macros.h"
#include "../../../test_compare.h"
-int main(int, char**)
-{
- typedef test_less<int> Cmp;
- typedef std::multiset<int, Cmp> C;
- typedef C::value_type V;
- C m({1, 2, 3, 4, 5, 6}, Cmp(10));
- assert(m.size() == 6);
- assert(std::distance(m.begin(), m.end()) == 6);
- C::const_iterator i = m.cbegin();
- assert(*i == V(1));
- assert(*++i == V(2));
- assert(*++i == V(3));
- assert(*++i == V(4));
- assert(*++i == V(5));
- assert(*++i == V(6));
- assert(m.key_comp() == Cmp(10));
+int main(int, char**) {
+ typedef test_less<int> Cmp;
+ typedef std::multiset<int, Cmp> C;
+ typedef C::value_type V;
+ C m({1, 2, 3, 4, 5, 6}, Cmp(10));
+ assert(m.size() == 6);
+ assert(std::distance(m.begin(), m.end()) == 6);
+ C::const_iterator i = m.cbegin();
+ assert(*i == V(1));
+ assert(*++i == V(2));
+ assert(*++i == V(3));
+ assert(*++i == V(4));
+ assert(*++i == V(5));
+ assert(*++i == V(6));
+ assert(m.key_comp() == Cmp(10));
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare_alloc.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare_alloc.pass.cpp
index 8234fe3ab7fee0b..a12e68c1e582b65 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare_alloc.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare_alloc.pass.cpp
@@ -22,24 +22,23 @@
#include "../../../test_compare.h"
#include "test_allocator.h"
-int main(int, char**)
-{
- typedef test_less<int> Cmp;
- typedef test_allocator<int> A;
- typedef std::multiset<int, Cmp, A> C;
- typedef C::value_type V;
- C m({1, 2, 3, 4, 5, 6}, Cmp(10), A(4));
- assert(m.size() == 6);
- assert(std::distance(m.begin(), m.end()) == 6);
- C::const_iterator i = m.cbegin();
- assert(*i == V(1));
- assert(*++i == V(2));
- assert(*++i == V(3));
- assert(*++i == V(4));
- assert(*++i == V(5));
- assert(*++i == V(6));
- assert(m.key_comp() == Cmp(10));
- assert(m.get_allocator() == A(4));
+int main(int, char**) {
+ typedef test_less<int> Cmp;
+ typedef test_allocator<int> A;
+ typedef std::multiset<int, Cmp, A> C;
+ typedef C::value_type V;
+ C m({1, 2, 3, 4, 5, 6}, Cmp(10), A(4));
+ assert(m.size() == 6);
+ assert(std::distance(m.begin(), m.end()) == 6);
+ C::const_iterator i = m.cbegin();
+ assert(*i == V(1));
+ assert(*++i == V(2));
+ assert(*++i == V(3));
+ assert(*++i == V(4));
+ assert(*++i == V(5));
+ assert(*++i == V(6));
+ assert(m.key_comp() == Cmp(10));
+ assert(m.get_allocator() == A(4));
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.cons/iter_iter.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.cons/iter_iter.pass.cpp
index df28a27df26bcdc..6b98ceb1c0df701 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.cons/iter_iter.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.cons/iter_iter.pass.cpp
@@ -20,24 +20,12 @@
#include "test_iterators.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef int V;
- V ar[] =
- {
- 1,
- 1,
- 1,
- 2,
- 2,
- 2,
- 3,
- 3,
- 3
- };
- std::multiset<V> m(cpp17_input_iterator<const int*>(ar),
- cpp17_input_iterator<const int*>(ar+sizeof(ar)/sizeof(ar[0])));
+ V ar[] = {1, 1, 1, 2, 2, 2, 3, 3, 3};
+ std::multiset<V> m(
+ cpp17_input_iterator<const int*>(ar), cpp17_input_iterator<const int*>(ar + sizeof(ar) / sizeof(ar[0])));
assert(m.size() == 9);
assert(std::distance(m.begin(), m.end()) == 9);
assert(*std::next(m.begin(), 0) == 1);
@@ -49,24 +37,13 @@ int main(int, char**)
assert(*std::next(m.begin(), 6) == 3);
assert(*std::next(m.begin(), 7) == 3);
assert(*std::next(m.begin(), 8) == 3);
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef int V;
- V ar[] =
- {
- 1,
- 1,
- 1,
- 2,
- 2,
- 2,
- 3,
- 3,
- 3
- };
- std::multiset<V, std::less<V>, min_allocator<V>> m(cpp17_input_iterator<const int*>(ar),
- cpp17_input_iterator<const int*>(ar+sizeof(ar)/sizeof(ar[0])));
+ V ar[] = {1, 1, 1, 2, 2, 2, 3, 3, 3};
+ std::multiset<V, std::less<V>, min_allocator<V>> m(
+ cpp17_input_iterator<const int*>(ar), cpp17_input_iterator<const int*>(ar + sizeof(ar) / sizeof(ar[0])));
assert(m.size() == 9);
assert(std::distance(m.begin(), m.end()) == 9);
assert(*std::next(m.begin(), 0) == 1);
@@ -78,7 +55,7 @@ int main(int, char**)
assert(*std::next(m.begin(), 6) == 3);
assert(*std::next(m.begin(), 7) == 3);
assert(*std::next(m.begin(), 8) == 3);
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.cons/iter_iter_alloc.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.cons/iter_iter_alloc.pass.cpp
index dcc7e0dd2cc07a7..01f14d79823fab0 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.cons/iter_iter_alloc.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.cons/iter_iter_alloc.pass.cpp
@@ -22,27 +22,17 @@
#include "../../../test_compare.h"
#include "test_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef int V;
- V ar[] =
- {
- 1,
- 1,
- 1,
- 2,
- 2,
- 2,
- 3,
- 3,
- 3
- };
+ V ar[] = {1, 1, 1, 2, 2, 2, 3, 3, 3};
typedef test_less<V> C;
typedef test_allocator<V> A;
- std::multiset<V, C, A> m(cpp17_input_iterator<const V*>(ar),
- cpp17_input_iterator<const V*>(ar+sizeof(ar)/sizeof(ar[0])),
- C(5), A(7));
+ std::multiset<V, C, A> m(
+ cpp17_input_iterator<const V*>(ar),
+ cpp17_input_iterator<const V*>(ar + sizeof(ar) / sizeof(ar[0])),
+ C(5),
+ A(7));
assert(m.value_comp() == C(5));
assert(m.get_allocator() == A(7));
assert(m.size() == 9);
@@ -56,26 +46,15 @@ int main(int, char**)
assert(*std::next(m.begin(), 6) == 3);
assert(*std::next(m.begin(), 7) == 3);
assert(*std::next(m.begin(), 8) == 3);
- }
+ }
#if TEST_STD_VER > 11
- {
+ {
typedef int V;
- V ar[] =
- {
- 1,
- 1,
- 1,
- 2,
- 2,
- 2,
- 3,
- 3,
- 3
- };
+ V ar[] = {1, 1, 1, 2, 2, 2, 3, 3, 3};
typedef test_allocator<V> A;
typedef test_less<int> C;
A a;
- std::multiset<V, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0]), a);
+ std::multiset<V, C, A> m(ar, ar + sizeof(ar) / sizeof(ar[0]), a);
assert(m.size() == 9);
assert(std::distance(m.begin(), m.end()) == 9);
@@ -89,7 +68,7 @@ int main(int, char**)
assert(*std::next(m.begin(), 7) == 3);
assert(*std::next(m.begin(), 8) == 3);
assert(m.get_allocator() == a);
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.cons/iter_iter_comp.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.cons/iter_iter_comp.pass.cpp
index b0527f17252f2fd..a7ce697335944ec 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.cons/iter_iter_comp.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.cons/iter_iter_comp.pass.cpp
@@ -20,36 +20,24 @@
#include "test_iterators.h"
#include "../../../test_compare.h"
-int main(int, char**)
-{
- typedef int V;
- V ar[] =
- {
- 1,
- 1,
- 1,
- 2,
- 2,
- 2,
- 3,
- 3,
- 3
- };
- typedef test_less<V> C;
- std::multiset<V, C> m(cpp17_input_iterator<const V*>(ar),
- cpp17_input_iterator<const V*>(ar+sizeof(ar)/sizeof(ar[0])), C(5));
- assert(m.value_comp() == C(5));
- assert(m.size() == 9);
- assert(std::distance(m.begin(), m.end()) == 9);
- assert(*std::next(m.begin(), 0) == 1);
- assert(*std::next(m.begin(), 1) == 1);
- assert(*std::next(m.begin(), 2) == 1);
- assert(*std::next(m.begin(), 3) == 2);
- assert(*std::next(m.begin(), 4) == 2);
- assert(*std::next(m.begin(), 5) == 2);
- assert(*std::next(m.begin(), 6) == 3);
- assert(*std::next(m.begin(), 7) == 3);
- assert(*std::next(m.begin(), 8) == 3);
+int main(int, char**) {
+ typedef int V;
+ V ar[] = {1, 1, 1, 2, 2, 2, 3, 3, 3};
+ typedef test_less<V> C;
+ std::multiset<V, C> m(
+ cpp17_input_iterator<const V*>(ar), cpp17_input_iterator<const V*>(ar + sizeof(ar) / sizeof(ar[0])), C(5));
+ assert(m.value_comp() == C(5));
+ assert(m.size() == 9);
+ assert(std::distance(m.begin(), m.end()) == 9);
+ assert(*std::next(m.begin(), 0) == 1);
+ assert(*std::next(m.begin(), 1) == 1);
+ assert(*std::next(m.begin(), 2) == 1);
+ assert(*std::next(m.begin(), 3) == 2);
+ assert(*std::next(m.begin(), 4) == 2);
+ assert(*std::next(m.begin(), 5) == 2);
+ assert(*std::next(m.begin(), 6) == 3);
+ assert(*std::next(m.begin(), 7) == 3);
+ assert(*std::next(m.begin(), 8) == 3);
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.cons/move.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.cons/move.pass.cpp
index 63898747180ae74..2d71f21e182c9be 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.cons/move.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.cons/move.pass.cpp
@@ -22,100 +22,77 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef int V;
- typedef test_less<int> C;
- typedef test_allocator<V> A;
- std::multiset<int, C, A> mo(C(5), A(7));
- std::multiset<int, C, A> m = std::move(mo);
- assert(m.get_allocator() == A(7));
- assert(m.key_comp() == C(5));
- assert(m.size() == 0);
- assert(std::distance(m.begin(), m.end()) == 0);
+int main(int, char**) {
+ {
+ typedef int V;
+ typedef test_less<int> C;
+ typedef test_allocator<V> A;
+ std::multiset<int, C, A> mo(C(5), A(7));
+ std::multiset<int, C, A> m = std::move(mo);
+ assert(m.get_allocator() == A(7));
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 0);
+ assert(std::distance(m.begin(), m.end()) == 0);
- assert(mo.get_allocator() == A(7));
- assert(mo.get_allocator().get_id() == test_alloc_base::moved_value);
- assert(mo.key_comp() == C(5));
- assert(mo.size() == 0);
- assert(std::distance(mo.begin(), mo.end()) == 0);
- }
- {
- typedef int V;
- V ar[] =
- {
- 1,
- 1,
- 1,
- 2,
- 2,
- 2,
- 3,
- 3,
- 3
- };
- typedef test_less<int> C;
- typedef test_allocator<V> A;
- std::multiset<int, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(7));
- std::multiset<int, C, A> m = std::move(mo);
- assert(m.get_allocator() == A(7));
- assert(m.key_comp() == C(5));
- assert(m.size() == 9);
- assert(std::distance(m.begin(), m.end()) == 9);
- assert(*std::next(m.begin(), 0) == 1);
- assert(*std::next(m.begin(), 1) == 1);
- assert(*std::next(m.begin(), 2) == 1);
- assert(*std::next(m.begin(), 3) == 2);
- assert(*std::next(m.begin(), 4) == 2);
- assert(*std::next(m.begin(), 5) == 2);
- assert(*std::next(m.begin(), 6) == 3);
- assert(*std::next(m.begin(), 7) == 3);
- assert(*std::next(m.begin(), 8) == 3);
+ assert(mo.get_allocator() == A(7));
+ assert(mo.get_allocator().get_id() == test_alloc_base::moved_value);
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 0);
+ assert(std::distance(mo.begin(), mo.end()) == 0);
+ }
+ {
+ typedef int V;
+ V ar[] = {1, 1, 1, 2, 2, 2, 3, 3, 3};
+ typedef test_less<int> C;
+ typedef test_allocator<V> A;
+ std::multiset<int, C, A> mo(ar, ar + sizeof(ar) / sizeof(ar[0]), C(5), A(7));
+ std::multiset<int, C, A> m = std::move(mo);
+ assert(m.get_allocator() == A(7));
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 9);
+ assert(std::distance(m.begin(), m.end()) == 9);
+ assert(*std::next(m.begin(), 0) == 1);
+ assert(*std::next(m.begin(), 1) == 1);
+ assert(*std::next(m.begin(), 2) == 1);
+ assert(*std::next(m.begin(), 3) == 2);
+ assert(*std::next(m.begin(), 4) == 2);
+ assert(*std::next(m.begin(), 5) == 2);
+ assert(*std::next(m.begin(), 6) == 3);
+ assert(*std::next(m.begin(), 7) == 3);
+ assert(*std::next(m.begin(), 8) == 3);
- assert(mo.get_allocator() == A(7));
- assert(mo.get_allocator().get_id() == test_alloc_base::moved_value);
- assert(mo.key_comp() == C(5));
- assert(mo.size() == 0);
- assert(std::distance(mo.begin(), mo.end()) == 0);
- }
- {
- typedef int V;
- V ar[] =
- {
- 1,
- 1,
- 1,
- 2,
- 2,
- 2,
- 3,
- 3,
- 3
- };
- typedef test_less<int> C;
- typedef min_allocator<V> A;
- std::multiset<int, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
- std::multiset<int, C, A> m = std::move(mo);
- assert(m.get_allocator() == A());
- assert(m.key_comp() == C(5));
- assert(m.size() == 9);
- assert(std::distance(m.begin(), m.end()) == 9);
- assert(*std::next(m.begin(), 0) == 1);
- assert(*std::next(m.begin(), 1) == 1);
- assert(*std::next(m.begin(), 2) == 1);
- assert(*std::next(m.begin(), 3) == 2);
- assert(*std::next(m.begin(), 4) == 2);
- assert(*std::next(m.begin(), 5) == 2);
- assert(*std::next(m.begin(), 6) == 3);
- assert(*std::next(m.begin(), 7) == 3);
- assert(*std::next(m.begin(), 8) == 3);
+ assert(mo.get_allocator() == A(7));
+ assert(mo.get_allocator().get_id() == test_alloc_base::moved_value);
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 0);
+ assert(std::distance(mo.begin(), mo.end()) == 0);
+ }
+ {
+ typedef int V;
+ V ar[] = {1, 1, 1, 2, 2, 2, 3, 3, 3};
+ typedef test_less<int> C;
+ typedef min_allocator<V> A;
+ std::multiset<int, C, A> mo(ar, ar + sizeof(ar) / sizeof(ar[0]), C(5), A());
+ std::multiset<int, C, A> m = std::move(mo);
+ assert(m.get_allocator() == A());
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 9);
+ assert(std::distance(m.begin(), m.end()) == 9);
+ assert(*std::next(m.begin(), 0) == 1);
+ assert(*std::next(m.begin(), 1) == 1);
+ assert(*std::next(m.begin(), 2) == 1);
+ assert(*std::next(m.begin(), 3) == 2);
+ assert(*std::next(m.begin(), 4) == 2);
+ assert(*std::next(m.begin(), 5) == 2);
+ assert(*std::next(m.begin(), 6) == 3);
+ assert(*std::next(m.begin(), 7) == 3);
+ assert(*std::next(m.begin(), 8) == 3);
- assert(mo.get_allocator() == A());
- assert(mo.key_comp() == C(5));
- assert(mo.size() == 0);
- assert(std::distance(mo.begin(), mo.end()) == 0);
- }
+ assert(mo.get_allocator() == A());
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 0);
+ assert(std::distance(mo.begin(), mo.end()) == 0);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.cons/move_alloc.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.cons/move_alloc.pass.cpp
index 090be76483be2fc..771a7038bf6338e 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.cons/move_alloc.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.cons/move_alloc.pass.cpp
@@ -24,170 +24,92 @@
#include "test_allocator.h"
#include "Counter.h"
-int main(int, char**)
-{
+int main(int, char**) {
+ {
+ typedef MoveOnly V;
+ typedef test_less<MoveOnly> C;
+ typedef test_allocator<V> A;
+ typedef std::multiset<MoveOnly, C, A> M;
+ typedef std::move_iterator<V*> I;
+ V a1[] = {V(1), V(1), V(1), V(2), V(2), V(2), V(3), V(3), V(3)};
+ M m1(I(a1), I(a1 + sizeof(a1) / sizeof(a1[0])), C(5), A(7));
+ V a2[] = {V(1), V(1), V(1), V(2), V(2), V(2), V(3), V(3), V(3)};
+ M m2(I(a2), I(a2 + sizeof(a2) / sizeof(a2[0])), C(5), A(7));
+ M m3(std::move(m1), A(7));
+ assert(m3 == m2);
+ assert(m3.get_allocator() == A(7));
+ assert(m3.key_comp() == C(5));
+ LIBCPP_ASSERT(m1.empty());
+ }
+ {
+ typedef MoveOnly V;
+ typedef test_less<MoveOnly> C;
+ typedef test_allocator<V> A;
+ typedef std::multiset<MoveOnly, C, A> M;
+ typedef std::move_iterator<V*> I;
+ V a1[] = {V(1), V(1), V(1), V(2), V(2), V(2), V(3), V(3), V(3)};
+ M m1(I(a1), I(a1 + sizeof(a1) / sizeof(a1[0])), C(5), A(7));
+ V a2[] = {V(1), V(1), V(1), V(2), V(2), V(2), V(3), V(3), V(3)};
+ M m2(I(a2), I(a2 + sizeof(a2) / sizeof(a2[0])), C(5), A(7));
+ M m3(std::move(m1), A(5));
+ assert(m3 == m2);
+ assert(m3.get_allocator() == A(5));
+ assert(m3.key_comp() == C(5));
+ LIBCPP_ASSERT(m1.empty());
+ }
+ {
+ typedef MoveOnly V;
+ typedef test_less<MoveOnly> C;
+ typedef other_allocator<V> A;
+ typedef std::multiset<MoveOnly, C, A> M;
+ typedef std::move_iterator<V*> I;
+ V a1[] = {V(1), V(1), V(1), V(2), V(2), V(2), V(3), V(3), V(3)};
+ M m1(I(a1), I(a1 + sizeof(a1) / sizeof(a1[0])), C(5), A(7));
+ V a2[] = {V(1), V(1), V(1), V(2), V(2), V(2), V(3), V(3), V(3)};
+ M m2(I(a2), I(a2 + sizeof(a2) / sizeof(a2[0])), C(5), A(7));
+ M m3(std::move(m1), A(5));
+ assert(m3 == m2);
+ assert(m3.get_allocator() == A(5));
+ assert(m3.key_comp() == C(5));
+ LIBCPP_ASSERT(m1.empty());
+ }
+ {
+ typedef Counter<int> V;
+ typedef std::less<V> C;
+ typedef test_allocator<V> A;
+ typedef std::multiset<V, C, A> M;
+ typedef V* I;
+ Counter_base::gConstructed = 0;
{
- typedef MoveOnly V;
- typedef test_less<MoveOnly> C;
- typedef test_allocator<V> A;
- typedef std::multiset<MoveOnly, C, A> M;
- typedef std::move_iterator<V*> I;
- V a1[] =
- {
- V(1),
- V(1),
- V(1),
- V(2),
- V(2),
- V(2),
- V(3),
- V(3),
- V(3)
- };
- M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A(7));
- V a2[] =
- {
- V(1),
- V(1),
- V(1),
- V(2),
- V(2),
- V(2),
- V(3),
- V(3),
- V(3)
- };
- M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A(7));
- M m3(std::move(m1), A(7));
- assert(m3 == m2);
- assert(m3.get_allocator() == A(7));
- assert(m3.key_comp() == C(5));
- LIBCPP_ASSERT(m1.empty());
- }
- {
- typedef MoveOnly V;
- typedef test_less<MoveOnly> C;
- typedef test_allocator<V> A;
- typedef std::multiset<MoveOnly, C, A> M;
- typedef std::move_iterator<V*> I;
- V a1[] =
- {
- V(1),
- V(1),
- V(1),
- V(2),
- V(2),
- V(2),
- V(3),
- V(3),
- V(3)
- };
- M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A(7));
- V a2[] =
- {
- V(1),
- V(1),
- V(1),
- V(2),
- V(2),
- V(2),
- V(3),
- V(3),
- V(3)
- };
- M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A(7));
- M m3(std::move(m1), A(5));
- assert(m3 == m2);
- assert(m3.get_allocator() == A(5));
- assert(m3.key_comp() == C(5));
- LIBCPP_ASSERT(m1.empty());
- }
- {
- typedef MoveOnly V;
- typedef test_less<MoveOnly> C;
- typedef other_allocator<V> A;
- typedef std::multiset<MoveOnly, C, A> M;
- typedef std::move_iterator<V*> I;
- V a1[] =
- {
- V(1),
- V(1),
- V(1),
- V(2),
- V(2),
- V(2),
- V(3),
- V(3),
- V(3)
- };
- M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A(7));
- V a2[] =
- {
- V(1),
- V(1),
- V(1),
- V(2),
- V(2),
- V(2),
- V(3),
- V(3),
- V(3)
- };
- M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A(7));
- M m3(std::move(m1), A(5));
- assert(m3 == m2);
- assert(m3.get_allocator() == A(5));
- assert(m3.key_comp() == C(5));
- LIBCPP_ASSERT(m1.empty());
- }
- {
- typedef Counter<int> V;
- typedef std::less<V> C;
- typedef test_allocator<V> A;
- typedef std::multiset<V, C, A> M;
- typedef V* I;
- Counter_base::gConstructed = 0;
- {
- V a1[] =
- {
- V(1),
- V(1),
- V(1),
- V(2),
- V(2),
- V(2),
- V(3),
- V(3),
- V(3)
- };
- const std::size_t num = sizeof(a1)/sizeof(a1[0]);
- assert(Counter_base::gConstructed == num);
+ V a1[] = {V(1), V(1), V(1), V(2), V(2), V(2), V(3), V(3), V(3)};
+ const std::size_t num = sizeof(a1) / sizeof(a1[0]);
+ assert(Counter_base::gConstructed == num);
- M m1(I(a1), I(a1+num), C(), A());
- assert(Counter_base::gConstructed == 2*num);
+ M m1(I(a1), I(a1 + num), C(), A());
+ assert(Counter_base::gConstructed == 2 * num);
- M m2(m1);
- assert(m2 == m1);
- assert(Counter_base::gConstructed == 3*num);
+ M m2(m1);
+ assert(m2 == m1);
+ assert(Counter_base::gConstructed == 3 * num);
- M m3(std::move(m1), A());
- assert(m3 == m2);
- LIBCPP_ASSERT(m1.empty());
- assert(Counter_base::gConstructed >= (int)(3*num));
- assert(Counter_base::gConstructed <= (int)(4*num));
+ M m3(std::move(m1), A());
+ assert(m3 == m2);
+ LIBCPP_ASSERT(m1.empty());
+ assert(Counter_base::gConstructed >= (int)(3 * num));
+ assert(Counter_base::gConstructed <= (int)(4 * num));
- {
- M m4(std::move(m2), A(5));
- assert(Counter_base::gConstructed >= (int)(3*num));
- assert(Counter_base::gConstructed <= (int)(5*num));
- assert(m4 == m3);
- LIBCPP_ASSERT(m2.empty());
- }
- assert(Counter_base::gConstructed >= (int)(2*num));
- assert(Counter_base::gConstructed <= (int)(4*num));
- }
- assert(Counter_base::gConstructed == 0);
+ {
+ M m4(std::move(m2), A(5));
+ assert(Counter_base::gConstructed >= (int)(3 * num));
+ assert(Counter_base::gConstructed <= (int)(5 * num));
+ assert(m4 == m3);
+ LIBCPP_ASSERT(m2.empty());
+ }
+ assert(Counter_base::gConstructed >= (int)(2 * num));
+ assert(Counter_base::gConstructed <= (int)(4 * num));
}
+ assert(Counter_base::gConstructed == 0);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.cons/move_assign.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.cons/move_assign.pass.cpp
index c57a56cd44880d7..5cdd4ec67b8e07e 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.cons/move_assign.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.cons/move_assign.pass.cpp
@@ -23,164 +23,75 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef MoveOnly V;
- typedef test_less<MoveOnly> C;
- typedef test_allocator<V> A;
- typedef std::multiset<MoveOnly, C, A> M;
- typedef std::move_iterator<V*> I;
- V a1[] =
- {
- V(1),
- V(1),
- V(1),
- V(2),
- V(2),
- V(2),
- V(3),
- V(3),
- V(3)
- };
- M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A(7));
- V a2[] =
- {
- V(1),
- V(1),
- V(1),
- V(2),
- V(2),
- V(2),
- V(3),
- V(3),
- V(3)
- };
- M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A(7));
- M m3(C(3), A(7));
- m3 = std::move(m1);
- assert(m3 == m2);
- assert(m3.get_allocator() == A(7));
- assert(m3.key_comp() == C(5));
- assert(m1.empty());
- }
- {
- typedef MoveOnly V;
- typedef test_less<MoveOnly> C;
- typedef test_allocator<V> A;
- typedef std::multiset<MoveOnly, C, A> M;
- typedef std::move_iterator<V*> I;
- V a1[] =
- {
- V(1),
- V(1),
- V(1),
- V(2),
- V(2),
- V(2),
- V(3),
- V(3),
- V(3)
- };
- M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A(7));
- V a2[] =
- {
- V(1),
- V(1),
- V(1),
- V(2),
- V(2),
- V(2),
- V(3),
- V(3),
- V(3)
- };
- M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A(7));
- M m3(C(3), A(5));
- m3 = std::move(m1);
- assert(m3 == m2);
- assert(m3.get_allocator() == A(5));
- assert(m3.key_comp() == C(5));
- LIBCPP_ASSERT(m1.empty());
- }
- {
- typedef MoveOnly V;
- typedef test_less<MoveOnly> C;
- typedef other_allocator<V> A;
- typedef std::multiset<MoveOnly, C, A> M;
- typedef std::move_iterator<V*> I;
- V a1[] =
- {
- V(1),
- V(1),
- V(1),
- V(2),
- V(2),
- V(2),
- V(3),
- V(3),
- V(3)
- };
- M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A(7));
- V a2[] =
- {
- V(1),
- V(1),
- V(1),
- V(2),
- V(2),
- V(2),
- V(3),
- V(3),
- V(3)
- };
- M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A(7));
- M m3(C(3), A(5));
- m3 = std::move(m1);
- assert(m3 == m2);
- assert(m3.get_allocator() == A(7));
- assert(m3.key_comp() == C(5));
- assert(m1.empty());
- }
- {
- typedef MoveOnly V;
- typedef test_less<MoveOnly> C;
- typedef min_allocator<V> A;
- typedef std::multiset<MoveOnly, C, A> M;
- typedef std::move_iterator<V*> I;
- V a1[] =
- {
- V(1),
- V(1),
- V(1),
- V(2),
- V(2),
- V(2),
- V(3),
- V(3),
- V(3)
- };
- M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A());
- V a2[] =
- {
- V(1),
- V(1),
- V(1),
- V(2),
- V(2),
- V(2),
- V(3),
- V(3),
- V(3)
- };
- M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A());
- M m3(C(3), A());
- m3 = std::move(m1);
- assert(m3 == m2);
- assert(m3.get_allocator() == A());
- assert(m3.key_comp() == C(5));
- assert(m1.empty());
- }
+int main(int, char**) {
+ {
+ typedef MoveOnly V;
+ typedef test_less<MoveOnly> C;
+ typedef test_allocator<V> A;
+ typedef std::multiset<MoveOnly, C, A> M;
+ typedef std::move_iterator<V*> I;
+ V a1[] = {V(1), V(1), V(1), V(2), V(2), V(2), V(3), V(3), V(3)};
+ M m1(I(a1), I(a1 + sizeof(a1) / sizeof(a1[0])), C(5), A(7));
+ V a2[] = {V(1), V(1), V(1), V(2), V(2), V(2), V(3), V(3), V(3)};
+ M m2(I(a2), I(a2 + sizeof(a2) / sizeof(a2[0])), C(5), A(7));
+ M m3(C(3), A(7));
+ m3 = std::move(m1);
+ assert(m3 == m2);
+ assert(m3.get_allocator() == A(7));
+ assert(m3.key_comp() == C(5));
+ assert(m1.empty());
+ }
+ {
+ typedef MoveOnly V;
+ typedef test_less<MoveOnly> C;
+ typedef test_allocator<V> A;
+ typedef std::multiset<MoveOnly, C, A> M;
+ typedef std::move_iterator<V*> I;
+ V a1[] = {V(1), V(1), V(1), V(2), V(2), V(2), V(3), V(3), V(3)};
+ M m1(I(a1), I(a1 + sizeof(a1) / sizeof(a1[0])), C(5), A(7));
+ V a2[] = {V(1), V(1), V(1), V(2), V(2), V(2), V(3), V(3), V(3)};
+ M m2(I(a2), I(a2 + sizeof(a2) / sizeof(a2[0])), C(5), A(7));
+ M m3(C(3), A(5));
+ m3 = std::move(m1);
+ assert(m3 == m2);
+ assert(m3.get_allocator() == A(5));
+ assert(m3.key_comp() == C(5));
+ LIBCPP_ASSERT(m1.empty());
+ }
+ {
+ typedef MoveOnly V;
+ typedef test_less<MoveOnly> C;
+ typedef other_allocator<V> A;
+ typedef std::multiset<MoveOnly, C, A> M;
+ typedef std::move_iterator<V*> I;
+ V a1[] = {V(1), V(1), V(1), V(2), V(2), V(2), V(3), V(3), V(3)};
+ M m1(I(a1), I(a1 + sizeof(a1) / sizeof(a1[0])), C(5), A(7));
+ V a2[] = {V(1), V(1), V(1), V(2), V(2), V(2), V(3), V(3), V(3)};
+ M m2(I(a2), I(a2 + sizeof(a2) / sizeof(a2[0])), C(5), A(7));
+ M m3(C(3), A(5));
+ m3 = std::move(m1);
+ assert(m3 == m2);
+ assert(m3.get_allocator() == A(7));
+ assert(m3.key_comp() == C(5));
+ assert(m1.empty());
+ }
+ {
+ typedef MoveOnly V;
+ typedef test_less<MoveOnly> C;
+ typedef min_allocator<V> A;
+ typedef std::multiset<MoveOnly, C, A> M;
+ typedef std::move_iterator<V*> I;
+ V a1[] = {V(1), V(1), V(1), V(2), V(2), V(2), V(3), V(3), V(3)};
+ M m1(I(a1), I(a1 + sizeof(a1) / sizeof(a1[0])), C(5), A());
+ V a2[] = {V(1), V(1), V(1), V(2), V(2), V(2), V(3), V(3), V(3)};
+ M m2(I(a2), I(a2 + sizeof(a2) / sizeof(a2[0])), C(5), A());
+ M m3(C(3), A());
+ m3 = std::move(m1);
+ assert(m3 == m2);
+ assert(m3.get_allocator() == A());
+ assert(m3.key_comp() == C(5));
+ assert(m1.empty());
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.cons/move_noexcept.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.cons/move_noexcept.pass.cpp
index 4bf70682d711355..73b4be5005e1c3f 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.cons/move_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.cons/move_noexcept.pass.cpp
@@ -24,33 +24,31 @@
#include "test_allocator.h"
template <class T>
-struct some_comp
-{
- typedef T value_type;
- some_comp(const some_comp&);
- bool operator()(const T&, const T&) const { return false; }
+struct some_comp {
+ typedef T value_type;
+ some_comp(const some_comp&);
+ bool operator()(const T&, const T&) const { return false; }
};
-int main(int, char**)
-{
+int main(int, char**) {
#if defined(_LIBCPP_VERSION)
- {
- typedef std::multiset<MoveOnly> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
- }
- {
- typedef std::multiset<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
- }
- {
- typedef std::multiset<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
- }
+ {
+ typedef std::multiset<MoveOnly> C;
+ static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ }
+ {
+ typedef std::multiset<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
+ static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ }
+ {
+ typedef std::multiset<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
+ static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ }
#endif // _LIBCPP_VERSION
- {
- typedef std::multiset<MoveOnly, some_comp<MoveOnly>> C;
- static_assert(!std::is_nothrow_move_constructible<C>::value, "");
- }
+ {
+ typedef std::multiset<MoveOnly, some_comp<MoveOnly>> C;
+ static_assert(!std::is_nothrow_move_constructible<C>::value, "");
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.erasure/erase_if.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.erasure/erase_if.pass.cpp
index 476f4f54e28e157..cfb304ee3be39e7 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.erasure/erase_if.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.erasure/erase_if.pass.cpp
@@ -27,52 +27,50 @@ void test0(S s, Pred p, S expected, std::size_t expected_erased_count) {
}
template <typename S>
-void test()
-{
- auto is1 = [](auto v) { return v == 1;};
- auto is2 = [](auto v) { return v == 2;};
- auto is3 = [](auto v) { return v == 3;};
- auto is4 = [](auto v) { return v == 4;};
- auto True = [](auto) { return true; };
- auto False = [](auto) { return false; };
+void test() {
+ auto is1 = [](auto v) { return v == 1; };
+ auto is2 = [](auto v) { return v == 2; };
+ auto is3 = [](auto v) { return v == 3; };
+ auto is4 = [](auto v) { return v == 4; };
+ auto True = [](auto) { return true; };
+ auto False = [](auto) { return false; };
- test0(S(), is1, S(), 0);
+ test0(S(), is1, S(), 0);
- test0(S({1}), is1, S(), 1);
- test0(S({1}), is2, S({1}), 0);
+ test0(S({1}), is1, S(), 1);
+ test0(S({1}), is2, S({1}), 0);
- test0(S({1, 2}), is1, S({2}), 1);
- test0(S({1, 2}), is2, S({1}), 1);
- test0(S({1, 2}), is3, S({1, 2}), 0);
- test0(S({1, 1}), is1, S(), 2);
- test0(S({1, 1}), is3, S({1, 1}), 0);
+ test0(S({1, 2}), is1, S({2}), 1);
+ test0(S({1, 2}), is2, S({1}), 1);
+ test0(S({1, 2}), is3, S({1, 2}), 0);
+ test0(S({1, 1}), is1, S(), 2);
+ test0(S({1, 1}), is3, S({1, 1}), 0);
- test0(S({1, 2, 3}), is1, S({2, 3}), 1);
- test0(S({1, 2, 3}), is2, S({1, 3}), 1);
- test0(S({1, 2, 3}), is3, S({1, 2}), 1);
- test0(S({1, 2, 3}), is4, S({1, 2, 3}), 0);
+ test0(S({1, 2, 3}), is1, S({2, 3}), 1);
+ test0(S({1, 2, 3}), is2, S({1, 3}), 1);
+ test0(S({1, 2, 3}), is3, S({1, 2}), 1);
+ test0(S({1, 2, 3}), is4, S({1, 2, 3}), 0);
- test0(S({1, 1, 1}), is1, S(), 3);
- test0(S({1, 1, 1}), is2, S({1, 1, 1}), 0);
- test0(S({1, 1, 2}), is1, S({2}), 2);
- test0(S({1, 1, 2}), is2, S({1, 1}), 1);
- test0(S({1, 1, 2}), is3, S({1, 1, 2}), 0);
- test0(S({1, 2, 2}), is1, S({2, 2}), 1);
- test0(S({1, 2, 2}), is2, S({1}), 2);
- test0(S({1, 2, 2}), is3, S({1, 2, 2}), 0);
+ test0(S({1, 1, 1}), is1, S(), 3);
+ test0(S({1, 1, 1}), is2, S({1, 1, 1}), 0);
+ test0(S({1, 1, 2}), is1, S({2}), 2);
+ test0(S({1, 1, 2}), is2, S({1, 1}), 1);
+ test0(S({1, 1, 2}), is3, S({1, 1, 2}), 0);
+ test0(S({1, 2, 2}), is1, S({2, 2}), 1);
+ test0(S({1, 2, 2}), is2, S({1}), 2);
+ test0(S({1, 2, 2}), is3, S({1, 2, 2}), 0);
- test0(S({1, 2, 3}), True, S(), 3);
- test0(S({1, 2, 3}), False, S({1, 2, 3}), 0);
+ test0(S({1, 2, 3}), True, S(), 3);
+ test0(S({1, 2, 3}), False, S({1, 2, 3}), 0);
}
-int main(int, char**)
-{
- test<std::multiset<int>>();
- test<std::multiset<int, std::less<int>, min_allocator<int>>> ();
- test<std::multiset<int, std::less<int>, test_allocator<int>>> ();
+int main(int, char**) {
+ test<std::multiset<int>>();
+ test<std::multiset<int, std::less<int>, min_allocator<int>>>();
+ test<std::multiset<int, std::less<int>, test_allocator<int>>>();
- test<std::multiset<long>>();
- test<std::multiset<double>>();
+ test<std::multiset<long>>();
+ test<std::multiset<double>>();
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.nonmember/op_compare.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.nonmember/op_compare.pass.cpp
index a8011f199775edb..9ffb5dc3593c564 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.nonmember/op_compare.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.nonmember/op_compare.pass.cpp
@@ -39,36 +39,36 @@
#include "test_comparisons.h"
int main(int, char**) {
- {
- std::multiset<int> s1, s2;
- s1.insert(1);
- s2.insert(2);
- const std::multiset<int>& cs1 = s1, cs2 = s2;
- assert(testComparisons(cs1, cs2, false, true));
- }
- {
- std::multiset<int> s1, s2;
- s1.insert(1);
- s2.insert(1);
- const std::multiset<int>& cs1 = s1, cs2 = s2;
- assert(testComparisons(cs1, cs2, true, false));
- }
- {
- std::multiset<int> s1, s2;
- s1.insert(1);
- s2.insert(1);
- s2.insert(2);
- const std::multiset<int>& cs1 = s1, cs2 = s2;
- assert(testComparisons(cs1, cs2, false, true));
- }
- {
- std::multiset<int> s1, s2;
- s1.insert(1);
- s2.insert(1);
- s2.insert(1);
- s2.insert(1);
- const std::multiset<int>& cs1 = s1, cs2 = s2;
- assert(testComparisons(cs1, cs2, false, true));
- }
- return 0;
+ {
+ std::multiset<int> s1, s2;
+ s1.insert(1);
+ s2.insert(2);
+ const std::multiset<int>&cs1 = s1, cs2 = s2;
+ assert(testComparisons(cs1, cs2, false, true));
+ }
+ {
+ std::multiset<int> s1, s2;
+ s1.insert(1);
+ s2.insert(1);
+ const std::multiset<int>&cs1 = s1, cs2 = s2;
+ assert(testComparisons(cs1, cs2, true, false));
+ }
+ {
+ std::multiset<int> s1, s2;
+ s1.insert(1);
+ s2.insert(1);
+ s2.insert(2);
+ const std::multiset<int>&cs1 = s1, cs2 = s2;
+ assert(testComparisons(cs1, cs2, false, true));
+ }
+ {
+ std::multiset<int> s1, s2;
+ s1.insert(1);
+ s2.insert(1);
+ s2.insert(1);
+ s2.insert(1);
+ const std::multiset<int>&cs1 = s1, cs2 = s2;
+ assert(testComparisons(cs1, cs2, false, true));
+ }
+ return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.observers/comp.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.observers/comp.pass.cpp
index ad2a304be703b03..63647a052c041d2 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.observers/comp.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.observers/comp.pass.cpp
@@ -15,19 +15,19 @@
#include <cassert>
int main(int, char**) {
- typedef std::multiset<int> set_type;
+ typedef std::multiset<int> set_type;
- set_type s;
- set_type::iterator i1 = s.insert(1);
- set_type::iterator i2 = s.insert(2);
+ set_type s;
+ set_type::iterator i1 = s.insert(1);
+ set_type::iterator i2 = s.insert(2);
- const set_type& cs = s;
+ const set_type& cs = s;
- assert(cs.key_comp()(*i1, *i2));
- assert(!cs.key_comp()(*i2, *i1));
+ assert(cs.key_comp()(*i1, *i2));
+ assert(!cs.key_comp()(*i2, *i1));
- assert(cs.value_comp()(*i1, *i2));
- assert(!cs.value_comp()(*i2, *i1));
+ assert(cs.value_comp()(*i1, *i2));
+ assert(!cs.value_comp()(*i2, *i1));
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.special/member_swap.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.special/member_swap.pass.cpp
index 7e7b097fdff167c..af32e1882093d6a 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.special/member_swap.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.special/member_swap.pass.cpp
@@ -18,161 +18,96 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef int V;
typedef std::multiset<int> M;
{
- M m1;
- M m2;
- M m1_save = m1;
- M m2_save = m2;
- m1.swap(m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
+ M m1;
+ M m2;
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
{
- V ar2[] =
- {
- 5,
- 6,
- 7,
- 8,
- 9,
- 10,
- 11,
- 12
- };
- M m1;
- M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
- M m1_save = m1;
- M m2_save = m2;
- m1.swap(m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
+ V ar2[] = {5, 6, 7, 8, 9, 10, 11, 12};
+ M m1;
+ M m2(ar2, ar2 + sizeof(ar2) / sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
{
- V ar1[] =
- {
- 1,
- 2,
- 3,
- 4
- };
- M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
- M m2;
- M m1_save = m1;
- M m2_save = m2;
- m1.swap(m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
+ V ar1[] = {1, 2, 3, 4};
+ M m1(ar1, ar1 + sizeof(ar1) / sizeof(ar1[0]));
+ M m2;
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
{
- V ar1[] =
- {
- 1,
- 2,
- 3,
- 4
- };
- V ar2[] =
- {
- 5,
- 6,
- 7,
- 8,
- 9,
- 10,
- 11,
- 12
- };
- M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
- M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
- M m1_save = m1;
- M m2_save = m2;
- m1.swap(m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
- }
+ V ar1[] = {1, 2, 3, 4};
+ V ar2[] = {5, 6, 7, 8, 9, 10, 11, 12};
+ M m1(ar1, ar1 + sizeof(ar1) / sizeof(ar1[0]));
+ M m2(ar2, ar2 + sizeof(ar2) / sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef int V;
typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
{
- M m1;
- M m2;
- M m1_save = m1;
- M m2_save = m2;
- m1.swap(m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
+ M m1;
+ M m2;
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
{
- V ar2[] =
- {
- 5,
- 6,
- 7,
- 8,
- 9,
- 10,
- 11,
- 12
- };
- M m1;
- M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
- M m1_save = m1;
- M m2_save = m2;
- m1.swap(m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
+ V ar2[] = {5, 6, 7, 8, 9, 10, 11, 12};
+ M m1;
+ M m2(ar2, ar2 + sizeof(ar2) / sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
{
- V ar1[] =
- {
- 1,
- 2,
- 3,
- 4
- };
- M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
- M m2;
- M m1_save = m1;
- M m2_save = m2;
- m1.swap(m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
+ V ar1[] = {1, 2, 3, 4};
+ M m1(ar1, ar1 + sizeof(ar1) / sizeof(ar1[0]));
+ M m2;
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
{
- V ar1[] =
- {
- 1,
- 2,
- 3,
- 4
- };
- V ar2[] =
- {
- 5,
- 6,
- 7,
- 8,
- 9,
- 10,
- 11,
- 12
- };
- M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
- M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
- M m1_save = m1;
- M m2_save = m2;
- m1.swap(m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
- }
+ V ar1[] = {1, 2, 3, 4};
+ V ar2[] = {5, 6, 7, 8, 9, 10, 11, 12};
+ M m1(ar1, ar1 + sizeof(ar1) / sizeof(ar1[0]));
+ M m2(ar2, ar2 + sizeof(ar2) / sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.special/non_member_swap.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.special/non_member_swap.pass.cpp
index e77a3b8d053dbe9..53630b3ca0a019a 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.special/non_member_swap.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.special/non_member_swap.pass.cpp
@@ -18,152 +18,87 @@
#include "test_allocator.h"
#include "../../../test_compare.h"
-int main(int, char**)
-{
- typedef int V;
- {
+int main(int, char**) {
+ typedef int V;
+ {
typedef std::multiset<int> M;
{
- M m1;
- M m2;
- M m1_save = m1;
- M m2_save = m2;
- swap(m1, m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
- }
- {
- V ar2[] =
- {
- 5,
- 6,
- 7,
- 8,
- 9,
- 10,
- 11,
- 12
- };
- M m1;
- M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
- M m1_save = m1;
- M m2_save = m2;
- swap(m1, m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
+ M m1;
+ M m2;
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
{
- V ar1[] =
- {
- 1,
- 2,
- 3,
- 4
- };
- M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
- M m2;
- M m1_save = m1;
- M m2_save = m2;
- swap(m1, m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
- }
- {
- V ar1[] =
- {
- 1,
- 2,
- 3,
- 4
- };
- V ar2[] =
- {
- 5,
- 6,
- 7,
- 8,
- 9,
- 10,
- 11,
- 12
- };
- M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
- M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
- M m1_save = m1;
- M m2_save = m2;
- swap(m1, m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
- }
+ V ar2[] = {5, 6, 7, 8, 9, 10, 11, 12};
+ M m1;
+ M m2(ar2, ar2 + sizeof(ar2) / sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
{
- typedef test_allocator<V> A;
- typedef test_less<int> C;
- typedef std::set<int, C, A> M;
- V ar1[] =
- {
- 1,
- 2,
- 3,
- 4
- };
- V ar2[] =
- {
- 5,
- 6,
- 7,
- 8,
- 9,
- 10,
- 11,
- 12
- };
- M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A(1, 1));
- M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A(1, 2));
- M m1_save = m1;
- M m2_save = m2;
- swap(m1, m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
- assert(m1.key_comp() == C(2));
- assert(m1.get_allocator().get_id() == 1);
- assert(m2.key_comp() == C(1));
- assert(m2.get_allocator().get_id() == 2);
+ V ar1[] = {1, 2, 3, 4};
+ M m1(ar1, ar1 + sizeof(ar1) / sizeof(ar1[0]));
+ M m2;
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
{
- typedef other_allocator<V> A;
- typedef test_less<int> C;
- typedef std::set<int, C, A> M;
- V ar1[] =
- {
- 1,
- 2,
- 3,
- 4
- };
- V ar2[] =
- {
- 5,
- 6,
- 7,
- 8,
- 9,
- 10,
- 11,
- 12
- };
- M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A(1));
- M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A(2));
- M m1_save = m1;
- M m2_save = m2;
- swap(m1, m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
- assert(m1.key_comp() == C(2));
- assert(m1.get_allocator() == A(2));
- assert(m2.key_comp() == C(1));
- assert(m2.get_allocator() == A(1));
+ V ar1[] = {1, 2, 3, 4};
+ V ar2[] = {5, 6, 7, 8, 9, 10, 11, 12};
+ M m1(ar1, ar1 + sizeof(ar1) / sizeof(ar1[0]));
+ M m2(ar2, ar2 + sizeof(ar2) / sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
+ }
+ {
+ typedef test_allocator<V> A;
+ typedef test_less<int> C;
+ typedef std::set<int, C, A> M;
+ V ar1[] = {1, 2, 3, 4};
+ V ar2[] = {5, 6, 7, 8, 9, 10, 11, 12};
+ M m1(ar1, ar1 + sizeof(ar1) / sizeof(ar1[0]), C(1), A(1, 1));
+ M m2(ar2, ar2 + sizeof(ar2) / sizeof(ar2[0]), C(2), A(1, 2));
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ assert(m1.key_comp() == C(2));
+ assert(m1.get_allocator().get_id() == 1);
+ assert(m2.key_comp() == C(1));
+ assert(m2.get_allocator().get_id() == 2);
+ }
+ {
+ typedef other_allocator<V> A;
+ typedef test_less<int> C;
+ typedef std::set<int, C, A> M;
+ V ar1[] = {1, 2, 3, 4};
+ V ar2[] = {5, 6, 7, 8, 9, 10, 11, 12};
+ M m1(ar1, ar1 + sizeof(ar1) / sizeof(ar1[0]), C(1), A(1));
+ M m2(ar2, ar2 + sizeof(ar2) / sizeof(ar2[0]), C(2), A(2));
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ assert(m1.key_comp() == C(2));
+ assert(m1.get_allocator() == A(2));
+ assert(m2.key_comp() == C(1));
+ assert(m2.get_allocator() == A(1));
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.special/swap_noexcept.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.special/swap_noexcept.pass.cpp
index 467be8e7dafd5f4..7a7ccf87e9de9b8 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.special/swap_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.special/swap_noexcept.pass.cpp
@@ -29,23 +29,21 @@
#include "test_allocator.h"
template <class T>
-struct some_comp
-{
- typedef T value_type;
+struct some_comp {
+ typedef T value_type;
- some_comp() {}
- some_comp(const some_comp&) {}
- bool operator()(const T&, const T&) const { return false; }
+ some_comp() {}
+ some_comp(const some_comp&) {}
+ bool operator()(const T&, const T&) const { return false; }
};
template <class T>
-struct some_comp2
-{
- typedef T value_type;
+struct some_comp2 {
+ typedef T value_type;
- some_comp2() {}
- some_comp2(const some_comp2&) {}
- bool operator()(const T&, const T&) const { return false; }
+ some_comp2() {}
+ some_comp2(const some_comp2&) {}
+ bool operator()(const T&, const T&) const { return false; }
};
#if TEST_STD_VER >= 14
@@ -54,87 +52,83 @@ void swap(some_comp2<T>&, some_comp2<T>&) noexcept {}
#endif
template <class T>
-struct some_alloc
-{
- typedef T value_type;
+struct some_alloc {
+ typedef T value_type;
- some_alloc() {}
- some_alloc(const some_alloc&);
- void deallocate(void*, unsigned) {}
+ some_alloc() {}
+ some_alloc(const some_alloc&);
+ void deallocate(void*, unsigned) {}
- typedef std::true_type propagate_on_container_swap;
+ typedef std::true_type propagate_on_container_swap;
};
template <class T>
-struct some_alloc2
-{
- typedef T value_type;
+struct some_alloc2 {
+ typedef T value_type;
- some_alloc2() {}
- some_alloc2(const some_alloc2&);
- void deallocate(void*, unsigned) {}
+ some_alloc2() {}
+ some_alloc2(const some_alloc2&);
+ void deallocate(void*, unsigned) {}
- typedef std::false_type propagate_on_container_swap;
- typedef std::true_type is_always_equal;
+ typedef std::false_type propagate_on_container_swap;
+ typedef std::true_type is_always_equal;
};
template <class T>
-struct some_alloc3
-{
- typedef T value_type;
+struct some_alloc3 {
+ typedef T value_type;
- some_alloc3() {}
- some_alloc3(const some_alloc3&);
- void deallocate(void*, unsigned) {}
+ some_alloc3() {}
+ some_alloc3(const some_alloc3&);
+ void deallocate(void*, unsigned) {}
- typedef std::false_type propagate_on_container_swap;
- typedef std::false_type is_always_equal;
+ typedef std::false_type propagate_on_container_swap;
+ typedef std::false_type is_always_equal;
};
-int main(int, char**)
-{
- {
- typedef std::multiset<MoveOnly> C;
- static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
+int main(int, char**) {
+ {
+ typedef std::multiset<MoveOnly> C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
#if defined(_LIBCPP_VERSION)
- {
- typedef std::multiset<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
- static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- {
- typedef std::multiset<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
- static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
+ {
+ typedef std::multiset<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
+ {
+ typedef std::multiset<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
#endif // _LIBCPP_VERSION
- {
- typedef std::multiset<MoveOnly, some_comp<MoveOnly>> C;
- static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
+ {
+ typedef std::multiset<MoveOnly, some_comp<MoveOnly>> C;
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
#if TEST_STD_VER >= 14
- { // POCS allocator, throwable swap for comp
- typedef std::multiset<MoveOnly, some_comp <MoveOnly>, some_alloc <MoveOnly>> C;
+ { // POCS allocator, throwable swap for comp
+ typedef std::multiset<MoveOnly, some_comp<MoveOnly>, some_alloc<MoveOnly>> C;
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- { // always equal allocator, throwable swap for comp
- typedef std::multiset<MoveOnly, some_comp <MoveOnly>, some_alloc2<MoveOnly>> C;
+ }
+ { // always equal allocator, throwable swap for comp
+ typedef std::multiset<MoveOnly, some_comp<MoveOnly>, some_alloc2<MoveOnly>> C;
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- { // POCS allocator, nothrow swap for comp
- typedef std::multiset<MoveOnly, some_comp2<MoveOnly>, some_alloc <MoveOnly>> C;
- static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- { // always equal allocator, nothrow swap for comp
+ }
+ { // POCS allocator, nothrow swap for comp
+ typedef std::multiset<MoveOnly, some_comp2<MoveOnly>, some_alloc<MoveOnly>> C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
+ { // always equal allocator, nothrow swap for comp
typedef std::multiset<MoveOnly, some_comp2<MoveOnly>, some_alloc2<MoveOnly>> C;
- static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
-#if defined(_LIBCPP_VERSION)
- { // NOT always equal allocator, nothrow swap for comp
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
+# if defined(_LIBCPP_VERSION)
+ { // NOT always equal allocator, nothrow swap for comp
typedef std::multiset<MoveOnly, some_comp2<MoveOnly>, some_alloc3<MoveOnly>> C;
- static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
-#endif // _LIBCPP_VERSION
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
+# endif // _LIBCPP_VERSION
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/multiset/scary.pass.cpp b/libcxx/test/std/containers/associative/multiset/scary.pass.cpp
index fc4efd46edee3bc..4d30c2773364725 100644
--- a/libcxx/test/std/containers/associative/multiset/scary.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/scary.pass.cpp
@@ -16,13 +16,12 @@
#include "test_macros.h"
-int main(int, char**)
-{
- typedef std::set<int> M1;
- typedef std::multiset<int> M2;
- M2::iterator i;
- M1::iterator j = i;
- ((void)j);
+int main(int, char**) {
+ typedef std::set<int> M1;
+ typedef std::multiset<int> M2;
+ M2::iterator i;
+ M1::iterator j = i;
+ ((void)j);
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/size.pass.cpp b/libcxx/test/std/containers/associative/multiset/size.pass.cpp
index d0350251dc38aad..405437211b8ca90 100644
--- a/libcxx/test/std/containers/associative/multiset/size.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/size.pass.cpp
@@ -18,9 +18,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::multiset<int> M;
M m;
assert(m.size() == 0);
@@ -36,9 +35,9 @@ int main(int, char**)
assert(m.size() == 1);
m.erase(m.begin());
assert(m.size() == 0);
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
M m;
assert(m.size() == 0);
@@ -54,7 +53,7 @@ int main(int, char**)
assert(m.size() == 1);
m.erase(m.begin());
assert(m.size() == 0);
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/multiset/types.pass.cpp b/libcxx/test/std/containers/associative/multiset/types.pass.cpp
index a6d0dd58100bb68..3595f7a8b5e0df1 100644
--- a/libcxx/test/std/containers/associative/multiset/types.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/types.pass.cpp
@@ -34,9 +34,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::multiset<int> C;
static_assert((std::is_same<C::key_type, int>::value), "");
static_assert((std::is_same<C::value_type, int>::value), "");
@@ -49,9 +48,9 @@ int main(int, char**)
static_assert((std::is_same<C::const_pointer, const int*>::value), "");
static_assert((std::is_same<C::size_type, std::size_t>::value), "");
static_assert((std::is_same<C::
diff erence_type, std::ptr
diff _t>::value), "");
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::multiset<int, std::less<int>, min_allocator<int>> C;
static_assert((std::is_same<C::key_type, int>::value), "");
static_assert((std::is_same<C::value_type, int>::value), "");
@@ -62,10 +61,10 @@ int main(int, char**)
static_assert((std::is_same<C::const_reference, const int&>::value), "");
static_assert((std::is_same<C::pointer, min_pointer<int>>::value), "");
static_assert((std::is_same<C::const_pointer, min_pointer<const int>>::value), "");
-// min_allocator doesn't have a size_type, so one gets synthesized
+ // min_allocator doesn't have a size_type, so one gets synthesized
static_assert((std::is_same<C::size_type, std::make_unsigned<C::
diff erence_type>::type>::value), "");
static_assert((std::is_same<C::
diff erence_type, std::ptr
diff _t>::value), "");
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/multiset/upper_bound.pass.cpp b/libcxx/test/std/containers/associative/multiset/upper_bound.pass.cpp
index 05ac595ca42cd09..c61859b1feffbf1 100644
--- a/libcxx/test/std/containers/associative/multiset/upper_bound.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/upper_bound.pass.cpp
@@ -20,157 +20,101 @@
#include "min_allocator.h"
#include "private_constructor.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef int V;
typedef std::multiset<int> M;
{
- typedef M::iterator R;
- V ar[] =
- {
- 5,
- 5,
- 5,
- 7,
- 7,
- 7,
- 9,
- 9,
- 9
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.upper_bound(4);
- assert(r == std::next(m.begin(), 0));
- r = m.upper_bound(5);
- assert(r == std::next(m.begin(), 3));
- r = m.upper_bound(6);
- assert(r == std::next(m.begin(), 3));
- r = m.upper_bound(7);
- assert(r == std::next(m.begin(), 6));
- r = m.upper_bound(8);
- assert(r == std::next(m.begin(), 6));
- r = m.upper_bound(9);
- assert(r == std::next(m.begin(), 9));
- r = m.upper_bound(11);
- assert(r == std::next(m.begin(), 9));
+ typedef M::iterator R;
+ V ar[] = {5, 5, 5, 7, 7, 7, 9, 9, 9};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.upper_bound(4);
+ assert(r == std::next(m.begin(), 0));
+ r = m.upper_bound(5);
+ assert(r == std::next(m.begin(), 3));
+ r = m.upper_bound(6);
+ assert(r == std::next(m.begin(), 3));
+ r = m.upper_bound(7);
+ assert(r == std::next(m.begin(), 6));
+ r = m.upper_bound(8);
+ assert(r == std::next(m.begin(), 6));
+ r = m.upper_bound(9);
+ assert(r == std::next(m.begin(), 9));
+ r = m.upper_bound(11);
+ assert(r == std::next(m.begin(), 9));
}
{
- typedef M::const_iterator R;
- V ar[] =
- {
- 5,
- 5,
- 5,
- 7,
- 7,
- 7,
- 9,
- 9,
- 9
- };
- const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.upper_bound(4);
- assert(r == std::next(m.begin(), 0));
- r = m.upper_bound(5);
- assert(r == std::next(m.begin(), 3));
- r = m.upper_bound(6);
- assert(r == std::next(m.begin(), 3));
- r = m.upper_bound(7);
- assert(r == std::next(m.begin(), 6));
- r = m.upper_bound(8);
- assert(r == std::next(m.begin(), 6));
- r = m.upper_bound(9);
- assert(r == std::next(m.begin(), 9));
- r = m.upper_bound(11);
- assert(r == std::next(m.begin(), 9));
- }
+ typedef M::const_iterator R;
+ V ar[] = {5, 5, 5, 7, 7, 7, 9, 9, 9};
+ const M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.upper_bound(4);
+ assert(r == std::next(m.begin(), 0));
+ r = m.upper_bound(5);
+ assert(r == std::next(m.begin(), 3));
+ r = m.upper_bound(6);
+ assert(r == std::next(m.begin(), 3));
+ r = m.upper_bound(7);
+ assert(r == std::next(m.begin(), 6));
+ r = m.upper_bound(8);
+ assert(r == std::next(m.begin(), 6));
+ r = m.upper_bound(9);
+ assert(r == std::next(m.begin(), 9));
+ r = m.upper_bound(11);
+ assert(r == std::next(m.begin(), 9));
}
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef int V;
typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
{
- typedef M::iterator R;
- V ar[] =
- {
- 5,
- 5,
- 5,
- 7,
- 7,
- 7,
- 9,
- 9,
- 9
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.upper_bound(4);
- assert(r == std::next(m.begin(), 0));
- r = m.upper_bound(5);
- assert(r == std::next(m.begin(), 3));
- r = m.upper_bound(6);
- assert(r == std::next(m.begin(), 3));
- r = m.upper_bound(7);
- assert(r == std::next(m.begin(), 6));
- r = m.upper_bound(8);
- assert(r == std::next(m.begin(), 6));
- r = m.upper_bound(9);
- assert(r == std::next(m.begin(), 9));
- r = m.upper_bound(11);
- assert(r == std::next(m.begin(), 9));
+ typedef M::iterator R;
+ V ar[] = {5, 5, 5, 7, 7, 7, 9, 9, 9};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.upper_bound(4);
+ assert(r == std::next(m.begin(), 0));
+ r = m.upper_bound(5);
+ assert(r == std::next(m.begin(), 3));
+ r = m.upper_bound(6);
+ assert(r == std::next(m.begin(), 3));
+ r = m.upper_bound(7);
+ assert(r == std::next(m.begin(), 6));
+ r = m.upper_bound(8);
+ assert(r == std::next(m.begin(), 6));
+ r = m.upper_bound(9);
+ assert(r == std::next(m.begin(), 9));
+ r = m.upper_bound(11);
+ assert(r == std::next(m.begin(), 9));
}
{
- typedef M::const_iterator R;
- V ar[] =
- {
- 5,
- 5,
- 5,
- 7,
- 7,
- 7,
- 9,
- 9,
- 9
- };
- const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.upper_bound(4);
- assert(r == std::next(m.begin(), 0));
- r = m.upper_bound(5);
- assert(r == std::next(m.begin(), 3));
- r = m.upper_bound(6);
- assert(r == std::next(m.begin(), 3));
- r = m.upper_bound(7);
- assert(r == std::next(m.begin(), 6));
- r = m.upper_bound(8);
- assert(r == std::next(m.begin(), 6));
- r = m.upper_bound(9);
- assert(r == std::next(m.begin(), 9));
- r = m.upper_bound(11);
- assert(r == std::next(m.begin(), 9));
- }
+ typedef M::const_iterator R;
+ V ar[] = {5, 5, 5, 7, 7, 7, 9, 9, 9};
+ const M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.upper_bound(4);
+ assert(r == std::next(m.begin(), 0));
+ r = m.upper_bound(5);
+ assert(r == std::next(m.begin(), 3));
+ r = m.upper_bound(6);
+ assert(r == std::next(m.begin(), 3));
+ r = m.upper_bound(7);
+ assert(r == std::next(m.begin(), 6));
+ r = m.upper_bound(8);
+ assert(r == std::next(m.begin(), 6));
+ r = m.upper_bound(9);
+ assert(r == std::next(m.begin(), 9));
+ r = m.upper_bound(11);
+ assert(r == std::next(m.begin(), 9));
}
+ }
#endif
#if TEST_STD_VER > 11
- {
+ {
typedef int V;
typedef std::multiset<V, std::less<>> M;
typedef M::iterator R;
- V ar[] =
- {
- 5,
- 5,
- 5,
- 7,
- 7,
- 7,
- 9,
- 9,
- 9
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ V ar[] = {5, 5, 5, 7, 7, 7, 9, 9, 9};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
R r = m.upper_bound(4);
assert(r == std::next(m.begin(), 0));
r = m.upper_bound(5);
@@ -185,23 +129,23 @@ int main(int, char**)
assert(r == std::next(m.begin(), 9));
r = m.upper_bound(11);
assert(r == std::next(m.begin(), 9));
- }
+ }
- {
+ {
typedef PrivateConstructor V;
typedef std::multiset<V, std::less<>> M;
typedef M::iterator R;
M m;
- m.insert ( V::make ( 5 ));
- m.insert ( V::make ( 5 ));
- m.insert ( V::make ( 5 ));
- m.insert ( V::make ( 7 ));
- m.insert ( V::make ( 7 ));
- m.insert ( V::make ( 7 ));
- m.insert ( V::make ( 9 ));
- m.insert ( V::make ( 9 ));
- m.insert ( V::make ( 9 ));
+ m.insert(V::make(5));
+ m.insert(V::make(5));
+ m.insert(V::make(5));
+ m.insert(V::make(7));
+ m.insert(V::make(7));
+ m.insert(V::make(7));
+ m.insert(V::make(9));
+ m.insert(V::make(9));
+ m.insert(V::make(9));
R r = m.upper_bound(4);
assert(r == std::next(m.begin(), 0));
@@ -217,7 +161,7 @@ int main(int, char**)
assert(r == std::next(m.begin(), 9));
r = m.upper_bound(11);
assert(r == std::next(m.begin(), 9));
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/set/allocator_mismatch.verify.cpp b/libcxx/test/std/containers/associative/set/allocator_mismatch.verify.cpp
index 279a07946f0059c..e36f7743d2cf6ea 100644
--- a/libcxx/test/std/containers/associative/set/allocator_mismatch.verify.cpp
+++ b/libcxx/test/std/containers/associative/set/allocator_mismatch.verify.cpp
@@ -12,4 +12,4 @@
#include <set>
std::set<int, std::less<int>, std::allocator<long> > m;
- // expected-error-re@*:* {{static assertion failed{{.*}}Allocator::value_type must be same type as value_type}}
+// expected-error-re@*:* {{static assertion failed{{.*}}Allocator::value_type must be same type as value_type}}
diff --git a/libcxx/test/std/containers/associative/set/clear.pass.cpp b/libcxx/test/std/containers/associative/set/clear.pass.cpp
index 0650e912fd35c12..a53b6a86a660eba 100644
--- a/libcxx/test/std/containers/associative/set/clear.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/clear.pass.cpp
@@ -18,49 +18,28 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::set<int> M;
- typedef int V;
- V ar[] =
- {
- 1,
- 2,
- 3,
- 4,
- 5,
- 6,
- 7,
- 8
- };
- M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
- assert(m.size() == 8);
- ASSERT_NOEXCEPT(m.clear());
- m.clear();
- assert(m.size() == 0);
- }
+int main(int, char**) {
+ {
+ typedef std::set<int> M;
+ typedef int V;
+ V ar[] = {1, 2, 3, 4, 5, 6, 7, 8};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(m.size() == 8);
+ ASSERT_NOEXCEPT(m.clear());
+ m.clear();
+ assert(m.size() == 0);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::set<int, std::less<int>, min_allocator<int>> M;
- typedef int V;
- V ar[] =
- {
- 1,
- 2,
- 3,
- 4,
- 5,
- 6,
- 7,
- 8
- };
- M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
- assert(m.size() == 8);
- ASSERT_NOEXCEPT(m.clear());
- m.clear();
- assert(m.size() == 0);
- }
+ {
+ typedef std::set<int, std::less<int>, min_allocator<int>> M;
+ typedef int V;
+ V ar[] = {1, 2, 3, 4, 5, 6, 7, 8};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(m.size() == 8);
+ ASSERT_NOEXCEPT(m.clear());
+ m.clear();
+ assert(m.size() == 0);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/set/contains.pass.cpp b/libcxx/test/std/containers/associative/set/contains.pass.cpp
index d595e380dffcae8..93e6ff0a288854a 100644
--- a/libcxx/test/std/containers/associative/set/contains.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/contains.pass.cpp
@@ -17,27 +17,32 @@
template <typename T, typename V, typename B, typename... Vals>
void test(B bad, Vals... args) {
- T set;
- V vals[] = {args...};
+ T set;
+ V vals[] = {args...};
- for (auto& v : vals) set.insert(v);
- for (auto& v : vals) assert(set.contains(v));
+ for (auto& v : vals)
+ set.insert(v);
+ for (auto& v : vals)
+ assert(set.contains(v));
- assert(!set.contains(bad));
+ assert(!set.contains(bad));
}
-struct E { int a = 1; double b = 1; char c = 1; };
-
-int main(int, char**)
-{
- {
- test<std::set<int>, int>(14, 10, 11, 12, 13);
- test<std::set<char>, char>('e', 'a', 'b', 'c', 'd');
- }
- {
- test<std::multiset<int>, int>(14, 10, 11, 12, 13);
- test<std::multiset<char>, char>('e', 'a', 'b', 'c', 'd');
- }
-
- return 0;
+struct E {
+ int a = 1;
+ double b = 1;
+ char c = 1;
+};
+
+int main(int, char**) {
+ {
+ test<std::set<int>, int>(14, 10, 11, 12, 13);
+ test<std::set<char>, char>('e', 'a', 'b', 'c', 'd');
+ }
+ {
+ test<std::multiset<int>, int>(14, 10, 11, 12, 13);
+ test<std::multiset<char>, char>('e', 'a', 'b', 'c', 'd');
+ }
+
+ return 0;
}
diff --git a/libcxx/test/std/containers/associative/set/contains_transparent.pass.cpp b/libcxx/test/std/containers/associative/set/contains_transparent.pass.cpp
index e4caa0b7128b467..c5d6b293e8a4bba 100644
--- a/libcxx/test/std/containers/associative/set/contains_transparent.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/contains_transparent.pass.cpp
@@ -21,18 +21,11 @@
struct Comp {
using is_transparent = void;
- bool operator()(const std::pair<int, int>& lhs,
- const std::pair<int, int>& rhs) const {
- return lhs < rhs;
- }
-
- bool operator()(const std::pair<int, int>& lhs, int rhs) const {
- return lhs.first < rhs;
- }
-
- bool operator()(int lhs, const std::pair<int, int>& rhs) const {
- return lhs < rhs.first;
- }
+ bool operator()(const std::pair<int, int>& lhs, const std::pair<int, int>& rhs) const { return lhs < rhs; }
+
+ bool operator()(const std::pair<int, int>& lhs, int rhs) const { return lhs.first < rhs; }
+
+ bool operator()(int lhs, const std::pair<int, int>& rhs) const { return lhs < rhs.first; }
};
template <typename Container>
diff --git a/libcxx/test/std/containers/associative/set/count.pass.cpp b/libcxx/test/std/containers/associative/set/count.pass.cpp
index 06ddf78b9684641..abd1e98f1a4eeda 100644
--- a/libcxx/test/std/containers/associative/set/count.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/count.pass.cpp
@@ -19,130 +19,99 @@
#include "min_allocator.h"
#include "private_constructor.h"
-int main(int, char**)
-{
- {
- typedef int V;
- typedef std::set<int> M;
- typedef M::size_type R;
- V ar[] =
- {
- 5,
- 6,
- 7,
- 8,
- 9,
- 10,
- 11,
- 12
- };
- const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.count(5);
- assert(r == 1);
- r = m.count(6);
- assert(r == 1);
- r = m.count(7);
- assert(r == 1);
- r = m.count(8);
- assert(r == 1);
- r = m.count(9);
- assert(r == 1);
- r = m.count(10);
- assert(r == 1);
- r = m.count(11);
- assert(r == 1);
- r = m.count(12);
- assert(r == 1);
- r = m.count(4);
- assert(r == 0);
- }
+int main(int, char**) {
+ {
+ typedef int V;
+ typedef std::set<int> M;
+ typedef M::size_type R;
+ V ar[] = {5, 6, 7, 8, 9, 10, 11, 12};
+ const M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.count(5);
+ assert(r == 1);
+ r = m.count(6);
+ assert(r == 1);
+ r = m.count(7);
+ assert(r == 1);
+ r = m.count(8);
+ assert(r == 1);
+ r = m.count(9);
+ assert(r == 1);
+ r = m.count(10);
+ assert(r == 1);
+ r = m.count(11);
+ assert(r == 1);
+ r = m.count(12);
+ assert(r == 1);
+ r = m.count(4);
+ assert(r == 0);
+ }
#if TEST_STD_VER >= 11
- {
- typedef int V;
- typedef std::set<int, std::less<int>, min_allocator<int>> M;
- typedef M::size_type R;
- V ar[] =
- {
- 5,
- 6,
- 7,
- 8,
- 9,
- 10,
- 11,
- 12
- };
- const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.count(5);
- assert(r == 1);
- r = m.count(6);
- assert(r == 1);
- r = m.count(7);
- assert(r == 1);
- r = m.count(8);
- assert(r == 1);
- r = m.count(9);
- assert(r == 1);
- r = m.count(10);
- assert(r == 1);
- r = m.count(11);
- assert(r == 1);
- r = m.count(12);
- assert(r == 1);
- r = m.count(4);
- assert(r == 0);
- }
+ {
+ typedef int V;
+ typedef std::set<int, std::less<int>, min_allocator<int>> M;
+ typedef M::size_type R;
+ V ar[] = {5, 6, 7, 8, 9, 10, 11, 12};
+ const M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.count(5);
+ assert(r == 1);
+ r = m.count(6);
+ assert(r == 1);
+ r = m.count(7);
+ assert(r == 1);
+ r = m.count(8);
+ assert(r == 1);
+ r = m.count(9);
+ assert(r == 1);
+ r = m.count(10);
+ assert(r == 1);
+ r = m.count(11);
+ assert(r == 1);
+ r = m.count(12);
+ assert(r == 1);
+ r = m.count(4);
+ assert(r == 0);
+ }
#endif
#if TEST_STD_VER > 11
- {
- typedef int V;
- typedef std::set<int, std::less<>> M;
- typedef M::size_type R;
- V ar[] =
- {
- 5,
- 6,
- 7,
- 8,
- 9,
- 10,
- 11,
- 12
- };
- const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.count(5);
- assert(r == 1);
- r = m.count(6);
- assert(r == 1);
- r = m.count(7);
- assert(r == 1);
- r = m.count(8);
- assert(r == 1);
- r = m.count(9);
- assert(r == 1);
- r = m.count(10);
- assert(r == 1);
- r = m.count(11);
- assert(r == 1);
- r = m.count(12);
- assert(r == 1);
- r = m.count(4);
- assert(r == 0);
- }
- {
+ {
+ typedef int V;
+ typedef std::set<int, std::less<>> M;
+ typedef M::size_type R;
+ V ar[] = {5, 6, 7, 8, 9, 10, 11, 12};
+ const M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.count(5);
+ assert(r == 1);
+ r = m.count(6);
+ assert(r == 1);
+ r = m.count(7);
+ assert(r == 1);
+ r = m.count(8);
+ assert(r == 1);
+ r = m.count(9);
+ assert(r == 1);
+ r = m.count(10);
+ assert(r == 1);
+ r = m.count(11);
+ assert(r == 1);
+ r = m.count(12);
+ assert(r == 1);
+ r = m.count(4);
+ assert(r == 0);
+ }
+ {
typedef PrivateConstructor V;
typedef std::set<V, std::less<>> M;
- typedef M::size_type R;
+ typedef M::size_type R;
M m;
- m.insert ( V::make ( 5 ));
- m.insert ( V::make ( 6 ));
- m.insert ( V::make ( 7 ));
- m.insert ( V::make ( 8 ));
- m.insert ( V::make ( 9 ));
- m.insert ( V::make ( 10 ));
- m.insert ( V::make ( 11 ));
- m.insert ( V::make ( 12 ));
+ m.insert(V::make(5));
+ m.insert(V::make(6));
+ m.insert(V::make(7));
+ m.insert(V::make(8));
+ m.insert(V::make(9));
+ m.insert(V::make(10));
+ m.insert(V::make(11));
+ m.insert(V::make(12));
const M& mc = m;
@@ -164,9 +133,8 @@ int main(int, char**)
assert(r == 1);
r = mc.count(4);
assert(r == 0);
- }
+ }
#endif
-
return 0;
}
diff --git a/libcxx/test/std/containers/associative/set/count_transparent.pass.cpp b/libcxx/test/std/containers/associative/set/count_transparent.pass.cpp
index 3cb7e5fd312f39f..4e0b61029246095 100644
--- a/libcxx/test/std/containers/associative/set/count_transparent.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/count_transparent.pass.cpp
@@ -22,18 +22,11 @@
struct Comp {
using is_transparent = void;
- bool operator()(const std::pair<int, int> &lhs,
- const std::pair<int, int> &rhs) const {
- return lhs < rhs;
- }
-
- bool operator()(const std::pair<int, int> &lhs, int rhs) const {
- return lhs.first < rhs;
- }
-
- bool operator()(int lhs, const std::pair<int, int> &rhs) const {
- return lhs < rhs.first;
- }
+ bool operator()(const std::pair<int, int>& lhs, const std::pair<int, int>& rhs) const { return lhs < rhs; }
+
+ bool operator()(const std::pair<int, int>& lhs, int rhs) const { return lhs.first < rhs; }
+
+ bool operator()(int lhs, const std::pair<int, int>& rhs) const { return lhs < rhs.first; }
};
int main(int, char**) {
diff --git a/libcxx/test/std/containers/associative/set/emplace.pass.cpp b/libcxx/test/std/containers/associative/set/emplace.pass.cpp
index f2f302c05881d35..e038de77d48a62c 100644
--- a/libcxx/test/std/containers/associative/set/emplace.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/emplace.pass.cpp
@@ -23,68 +23,67 @@
#include "DefaultOnly.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::set<DefaultOnly> M;
- typedef std::pair<M::iterator, bool> R;
- M m;
- assert(DefaultOnly::count == 0);
- R r = m.emplace();
- assert(r.second);
- assert(r.first == m.begin());
- assert(m.size() == 1);
- assert(*m.begin() == DefaultOnly());
- assert(DefaultOnly::count == 1);
-
- r = m.emplace();
- assert(!r.second);
- assert(r.first == m.begin());
- assert(m.size() == 1);
- assert(*m.begin() == DefaultOnly());
- assert(DefaultOnly::count == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::set<DefaultOnly> M;
+ typedef std::pair<M::iterator, bool> R;
+ M m;
assert(DefaultOnly::count == 0);
- {
- typedef std::set<Emplaceable> M;
- typedef std::pair<M::iterator, bool> R;
- M m;
- R r = m.emplace();
- assert(r.second);
- assert(r.first == m.begin());
- assert(m.size() == 1);
- assert(*m.begin() == Emplaceable());
- r = m.emplace(2, 3.5);
- assert(r.second);
- assert(r.first == std::next(m.begin()));
- assert(m.size() == 2);
- assert(*r.first == Emplaceable(2, 3.5));
- r = m.emplace(2, 3.5);
- assert(!r.second);
- assert(r.first == std::next(m.begin()));
- assert(m.size() == 2);
- assert(*r.first == Emplaceable(2, 3.5));
- }
- {
- typedef std::set<int> M;
- typedef std::pair<M::iterator, bool> R;
- M m;
- R r = m.emplace(M::value_type(2));
- assert(r.second);
- assert(r.first == m.begin());
- assert(m.size() == 1);
- assert(*r.first == 2);
- }
- {
- typedef std::set<int, std::less<int>, min_allocator<int>> M;
- typedef std::pair<M::iterator, bool> R;
- M m;
- R r = m.emplace(M::value_type(2));
- assert(r.second);
- assert(r.first == m.begin());
- assert(m.size() == 1);
- assert(*r.first == 2);
- }
+ R r = m.emplace();
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 1);
+ assert(*m.begin() == DefaultOnly());
+ assert(DefaultOnly::count == 1);
+
+ r = m.emplace();
+ assert(!r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 1);
+ assert(*m.begin() == DefaultOnly());
+ assert(DefaultOnly::count == 1);
+ }
+ assert(DefaultOnly::count == 0);
+ {
+ typedef std::set<Emplaceable> M;
+ typedef std::pair<M::iterator, bool> R;
+ M m;
+ R r = m.emplace();
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 1);
+ assert(*m.begin() == Emplaceable());
+ r = m.emplace(2, 3.5);
+ assert(r.second);
+ assert(r.first == std::next(m.begin()));
+ assert(m.size() == 2);
+ assert(*r.first == Emplaceable(2, 3.5));
+ r = m.emplace(2, 3.5);
+ assert(!r.second);
+ assert(r.first == std::next(m.begin()));
+ assert(m.size() == 2);
+ assert(*r.first == Emplaceable(2, 3.5));
+ }
+ {
+ typedef std::set<int> M;
+ typedef std::pair<M::iterator, bool> R;
+ M m;
+ R r = m.emplace(M::value_type(2));
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 1);
+ assert(*r.first == 2);
+ }
+ {
+ typedef std::set<int, std::less<int>, min_allocator<int>> M;
+ typedef std::pair<M::iterator, bool> R;
+ M m;
+ R r = m.emplace(M::value_type(2));
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 1);
+ assert(*r.first == 2);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/set/emplace_hint.pass.cpp b/libcxx/test/std/containers/associative/set/emplace_hint.pass.cpp
index a7d6857a820b89a..9f0d5fbd2c5e551 100644
--- a/libcxx/test/std/containers/associative/set/emplace_hint.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/emplace_hint.pass.cpp
@@ -23,61 +23,60 @@
#include "DefaultOnly.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::set<DefaultOnly> M;
- typedef M::iterator R;
- M m;
- assert(DefaultOnly::count == 0);
- R r = m.emplace_hint(m.cend());
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(*m.begin() == DefaultOnly());
- assert(DefaultOnly::count == 1);
-
- r = m.emplace_hint(m.cbegin());
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(*m.begin() == DefaultOnly());
- assert(DefaultOnly::count == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::set<DefaultOnly> M;
+ typedef M::iterator R;
+ M m;
assert(DefaultOnly::count == 0);
- {
- typedef std::set<Emplaceable> M;
- typedef M::iterator R;
- M m;
- R r = m.emplace_hint(m.cend());
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(*m.begin() == Emplaceable());
- r = m.emplace_hint(m.cend(), 2, 3.5);
- assert(r == std::next(m.begin()));
- assert(m.size() == 2);
- assert(*r == Emplaceable(2, 3.5));
- r = m.emplace_hint(m.cbegin(), 2, 3.5);
- assert(r == std::next(m.begin()));
- assert(m.size() == 2);
- assert(*r == Emplaceable(2, 3.5));
- }
- {
- typedef std::set<int> M;
- typedef M::iterator R;
- M m;
- R r = m.emplace_hint(m.cend(), M::value_type(2));
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(*r == 2);
- }
- {
- typedef std::set<int, std::less<int>, min_allocator<int>> M;
- typedef M::iterator R;
- M m;
- R r = m.emplace_hint(m.cend(), M::value_type(2));
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(*r == 2);
- }
+ R r = m.emplace_hint(m.cend());
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(*m.begin() == DefaultOnly());
+ assert(DefaultOnly::count == 1);
+
+ r = m.emplace_hint(m.cbegin());
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(*m.begin() == DefaultOnly());
+ assert(DefaultOnly::count == 1);
+ }
+ assert(DefaultOnly::count == 0);
+ {
+ typedef std::set<Emplaceable> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.emplace_hint(m.cend());
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(*m.begin() == Emplaceable());
+ r = m.emplace_hint(m.cend(), 2, 3.5);
+ assert(r == std::next(m.begin()));
+ assert(m.size() == 2);
+ assert(*r == Emplaceable(2, 3.5));
+ r = m.emplace_hint(m.cbegin(), 2, 3.5);
+ assert(r == std::next(m.begin()));
+ assert(m.size() == 2);
+ assert(*r == Emplaceable(2, 3.5));
+ }
+ {
+ typedef std::set<int> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.emplace_hint(m.cend(), M::value_type(2));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(*r == 2);
+ }
+ {
+ typedef std::set<int, std::less<int>, min_allocator<int>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.emplace_hint(m.cend(), M::value_type(2));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(*r == 2);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/set/empty.pass.cpp b/libcxx/test/std/containers/associative/set/empty.pass.cpp
index 8bf1e1295eda4c4..aaefade5cff7bfc 100644
--- a/libcxx/test/std/containers/associative/set/empty.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/empty.pass.cpp
@@ -18,9 +18,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::set<int> M;
M m;
assert(m.empty());
@@ -28,9 +27,9 @@ int main(int, char**)
assert(!m.empty());
m.clear();
assert(m.empty());
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::set<int, std::less<int>, min_allocator<int>> M;
M m;
assert(m.empty());
@@ -38,7 +37,7 @@ int main(int, char**)
assert(!m.empty());
m.clear();
assert(m.empty());
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/set/empty.verify.cpp b/libcxx/test/std/containers/associative/set/empty.verify.cpp
index e0405f70e67da53..67dae7d0a9dc93d 100644
--- a/libcxx/test/std/containers/associative/set/empty.verify.cpp
+++ b/libcxx/test/std/containers/associative/set/empty.verify.cpp
@@ -17,6 +17,6 @@
#include <set>
void f() {
- std::set<int> c;
- c.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::set<int> c;
+ c.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}
diff --git a/libcxx/test/std/containers/associative/set/equal_range.pass.cpp b/libcxx/test/std/containers/associative/set/equal_range.pass.cpp
index c0602ba626afe16..239aa3e8784266e 100644
--- a/libcxx/test/std/containers/associative/set/equal_range.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/equal_range.pass.cpp
@@ -20,161 +20,130 @@
#include "min_allocator.h"
#include "private_constructor.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef int V;
typedef std::set<int> M;
{
- typedef std::pair<M::iterator, M::iterator> R;
- V ar[] =
- {
- 5,
- 7,
- 9,
- 11,
- 13,
- 15,
- 17,
- 19
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.equal_range(5);
- assert(r.first == std::next(m.begin(), 0));
- assert(r.second == std::next(m.begin(), 1));
- r = m.equal_range(7);
- assert(r.first == std::next(m.begin(), 1));
- assert(r.second == std::next(m.begin(), 2));
- r = m.equal_range(9);
- assert(r.first == std::next(m.begin(), 2));
- assert(r.second == std::next(m.begin(), 3));
- r = m.equal_range(11);
- assert(r.first == std::next(m.begin(), 3));
- assert(r.second == std::next(m.begin(), 4));
- r = m.equal_range(13);
- assert(r.first == std::next(m.begin(), 4));
- assert(r.second == std::next(m.begin(), 5));
- r = m.equal_range(15);
- assert(r.first == std::next(m.begin(), 5));
- assert(r.second == std::next(m.begin(), 6));
- r = m.equal_range(17);
- assert(r.first == std::next(m.begin(), 6));
- assert(r.second == std::next(m.begin(), 7));
- r = m.equal_range(19);
- assert(r.first == std::next(m.begin(), 7));
- assert(r.second == std::next(m.begin(), 8));
- r = m.equal_range(4);
- assert(r.first == std::next(m.begin(), 0));
- assert(r.second == std::next(m.begin(), 0));
- r = m.equal_range(6);
- assert(r.first == std::next(m.begin(), 1));
- assert(r.second == std::next(m.begin(), 1));
- r = m.equal_range(8);
- assert(r.first == std::next(m.begin(), 2));
- assert(r.second == std::next(m.begin(), 2));
- r = m.equal_range(10);
- assert(r.first == std::next(m.begin(), 3));
- assert(r.second == std::next(m.begin(), 3));
- r = m.equal_range(12);
- assert(r.first == std::next(m.begin(), 4));
- assert(r.second == std::next(m.begin(), 4));
- r = m.equal_range(14);
- assert(r.first == std::next(m.begin(), 5));
- assert(r.second == std::next(m.begin(), 5));
- r = m.equal_range(16);
- assert(r.first == std::next(m.begin(), 6));
- assert(r.second == std::next(m.begin(), 6));
- r = m.equal_range(18);
- assert(r.first == std::next(m.begin(), 7));
- assert(r.second == std::next(m.begin(), 7));
- r = m.equal_range(20);
- assert(r.first == std::next(m.begin(), 8));
- assert(r.second == std::next(m.begin(), 8));
+ typedef std::pair<M::iterator, M::iterator> R;
+ V ar[] = {5, 7, 9, 11, 13, 15, 17, 19};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.equal_range(5);
+ assert(r.first == std::next(m.begin(), 0));
+ assert(r.second == std::next(m.begin(), 1));
+ r = m.equal_range(7);
+ assert(r.first == std::next(m.begin(), 1));
+ assert(r.second == std::next(m.begin(), 2));
+ r = m.equal_range(9);
+ assert(r.first == std::next(m.begin(), 2));
+ assert(r.second == std::next(m.begin(), 3));
+ r = m.equal_range(11);
+ assert(r.first == std::next(m.begin(), 3));
+ assert(r.second == std::next(m.begin(), 4));
+ r = m.equal_range(13);
+ assert(r.first == std::next(m.begin(), 4));
+ assert(r.second == std::next(m.begin(), 5));
+ r = m.equal_range(15);
+ assert(r.first == std::next(m.begin(), 5));
+ assert(r.second == std::next(m.begin(), 6));
+ r = m.equal_range(17);
+ assert(r.first == std::next(m.begin(), 6));
+ assert(r.second == std::next(m.begin(), 7));
+ r = m.equal_range(19);
+ assert(r.first == std::next(m.begin(), 7));
+ assert(r.second == std::next(m.begin(), 8));
+ r = m.equal_range(4);
+ assert(r.first == std::next(m.begin(), 0));
+ assert(r.second == std::next(m.begin(), 0));
+ r = m.equal_range(6);
+ assert(r.first == std::next(m.begin(), 1));
+ assert(r.second == std::next(m.begin(), 1));
+ r = m.equal_range(8);
+ assert(r.first == std::next(m.begin(), 2));
+ assert(r.second == std::next(m.begin(), 2));
+ r = m.equal_range(10);
+ assert(r.first == std::next(m.begin(), 3));
+ assert(r.second == std::next(m.begin(), 3));
+ r = m.equal_range(12);
+ assert(r.first == std::next(m.begin(), 4));
+ assert(r.second == std::next(m.begin(), 4));
+ r = m.equal_range(14);
+ assert(r.first == std::next(m.begin(), 5));
+ assert(r.second == std::next(m.begin(), 5));
+ r = m.equal_range(16);
+ assert(r.first == std::next(m.begin(), 6));
+ assert(r.second == std::next(m.begin(), 6));
+ r = m.equal_range(18);
+ assert(r.first == std::next(m.begin(), 7));
+ assert(r.second == std::next(m.begin(), 7));
+ r = m.equal_range(20);
+ assert(r.first == std::next(m.begin(), 8));
+ assert(r.second == std::next(m.begin(), 8));
}
{
- typedef std::pair<M::const_iterator, M::const_iterator> R;
- V ar[] =
- {
- 5,
- 7,
- 9,
- 11,
- 13,
- 15,
- 17,
- 19
- };
- const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.equal_range(5);
- assert(r.first == std::next(m.begin(), 0));
- assert(r.second == std::next(m.begin(), 1));
- r = m.equal_range(7);
- assert(r.first == std::next(m.begin(), 1));
- assert(r.second == std::next(m.begin(), 2));
- r = m.equal_range(9);
- assert(r.first == std::next(m.begin(), 2));
- assert(r.second == std::next(m.begin(), 3));
- r = m.equal_range(11);
- assert(r.first == std::next(m.begin(), 3));
- assert(r.second == std::next(m.begin(), 4));
- r = m.equal_range(13);
- assert(r.first == std::next(m.begin(), 4));
- assert(r.second == std::next(m.begin(), 5));
- r = m.equal_range(15);
- assert(r.first == std::next(m.begin(), 5));
- assert(r.second == std::next(m.begin(), 6));
- r = m.equal_range(17);
- assert(r.first == std::next(m.begin(), 6));
- assert(r.second == std::next(m.begin(), 7));
- r = m.equal_range(19);
- assert(r.first == std::next(m.begin(), 7));
- assert(r.second == std::next(m.begin(), 8));
- r = m.equal_range(4);
- assert(r.first == std::next(m.begin(), 0));
- assert(r.second == std::next(m.begin(), 0));
- r = m.equal_range(6);
- assert(r.first == std::next(m.begin(), 1));
- assert(r.second == std::next(m.begin(), 1));
- r = m.equal_range(8);
- assert(r.first == std::next(m.begin(), 2));
- assert(r.second == std::next(m.begin(), 2));
- r = m.equal_range(10);
- assert(r.first == std::next(m.begin(), 3));
- assert(r.second == std::next(m.begin(), 3));
- r = m.equal_range(12);
- assert(r.first == std::next(m.begin(), 4));
- assert(r.second == std::next(m.begin(), 4));
- r = m.equal_range(14);
- assert(r.first == std::next(m.begin(), 5));
- assert(r.second == std::next(m.begin(), 5));
- r = m.equal_range(16);
- assert(r.first == std::next(m.begin(), 6));
- assert(r.second == std::next(m.begin(), 6));
- r = m.equal_range(18);
- assert(r.first == std::next(m.begin(), 7));
- assert(r.second == std::next(m.begin(), 7));
- r = m.equal_range(20);
- assert(r.first == std::next(m.begin(), 8));
- assert(r.second == std::next(m.begin(), 8));
- }
+ typedef std::pair<M::const_iterator, M::const_iterator> R;
+ V ar[] = {5, 7, 9, 11, 13, 15, 17, 19};
+ const M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.equal_range(5);
+ assert(r.first == std::next(m.begin(), 0));
+ assert(r.second == std::next(m.begin(), 1));
+ r = m.equal_range(7);
+ assert(r.first == std::next(m.begin(), 1));
+ assert(r.second == std::next(m.begin(), 2));
+ r = m.equal_range(9);
+ assert(r.first == std::next(m.begin(), 2));
+ assert(r.second == std::next(m.begin(), 3));
+ r = m.equal_range(11);
+ assert(r.first == std::next(m.begin(), 3));
+ assert(r.second == std::next(m.begin(), 4));
+ r = m.equal_range(13);
+ assert(r.first == std::next(m.begin(), 4));
+ assert(r.second == std::next(m.begin(), 5));
+ r = m.equal_range(15);
+ assert(r.first == std::next(m.begin(), 5));
+ assert(r.second == std::next(m.begin(), 6));
+ r = m.equal_range(17);
+ assert(r.first == std::next(m.begin(), 6));
+ assert(r.second == std::next(m.begin(), 7));
+ r = m.equal_range(19);
+ assert(r.first == std::next(m.begin(), 7));
+ assert(r.second == std::next(m.begin(), 8));
+ r = m.equal_range(4);
+ assert(r.first == std::next(m.begin(), 0));
+ assert(r.second == std::next(m.begin(), 0));
+ r = m.equal_range(6);
+ assert(r.first == std::next(m.begin(), 1));
+ assert(r.second == std::next(m.begin(), 1));
+ r = m.equal_range(8);
+ assert(r.first == std::next(m.begin(), 2));
+ assert(r.second == std::next(m.begin(), 2));
+ r = m.equal_range(10);
+ assert(r.first == std::next(m.begin(), 3));
+ assert(r.second == std::next(m.begin(), 3));
+ r = m.equal_range(12);
+ assert(r.first == std::next(m.begin(), 4));
+ assert(r.second == std::next(m.begin(), 4));
+ r = m.equal_range(14);
+ assert(r.first == std::next(m.begin(), 5));
+ assert(r.second == std::next(m.begin(), 5));
+ r = m.equal_range(16);
+ assert(r.first == std::next(m.begin(), 6));
+ assert(r.second == std::next(m.begin(), 6));
+ r = m.equal_range(18);
+ assert(r.first == std::next(m.begin(), 7));
+ assert(r.second == std::next(m.begin(), 7));
+ r = m.equal_range(20);
+ assert(r.first == std::next(m.begin(), 8));
+ assert(r.second == std::next(m.begin(), 8));
}
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef int V;
typedef std::set<int, std::less<int>, min_allocator<int>> M;
typedef std::pair<M::iterator, M::iterator> R;
- V ar[] =
- {
- 5,
- 7,
- 9,
- 11,
- 13,
- 15,
- 17,
- 19
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ V ar[] = {5, 7, 9, 11, 13, 15, 17, 19};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
R r = m.equal_range(5);
assert(r.first == std::next(m.begin(), 0));
assert(r.second == std::next(m.begin(), 1));
@@ -226,93 +195,83 @@ int main(int, char**)
r = m.equal_range(20);
assert(r.first == std::next(m.begin(), 8));
assert(r.second == std::next(m.begin(), 8));
- }
+ }
#endif
#if TEST_STD_VER > 11
- {
+ {
typedef int V;
typedef std::set<V, std::less<>> M;
{
- typedef std::pair<M::iterator, M::iterator> R;
- V ar[] =
- {
- 5,
- 7,
- 9,
- 11,
- 13,
- 15,
- 17,
- 19
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.equal_range(5);
- assert(r.first == std::next(m.begin(), 0));
- assert(r.second == std::next(m.begin(), 1));
- r = m.equal_range(7);
- assert(r.first == std::next(m.begin(), 1));
- assert(r.second == std::next(m.begin(), 2));
- r = m.equal_range(9);
- assert(r.first == std::next(m.begin(), 2));
- assert(r.second == std::next(m.begin(), 3));
- r = m.equal_range(11);
- assert(r.first == std::next(m.begin(), 3));
- assert(r.second == std::next(m.begin(), 4));
- r = m.equal_range(13);
- assert(r.first == std::next(m.begin(), 4));
- assert(r.second == std::next(m.begin(), 5));
- r = m.equal_range(15);
- assert(r.first == std::next(m.begin(), 5));
- assert(r.second == std::next(m.begin(), 6));
- r = m.equal_range(17);
- assert(r.first == std::next(m.begin(), 6));
- assert(r.second == std::next(m.begin(), 7));
- r = m.equal_range(19);
- assert(r.first == std::next(m.begin(), 7));
- assert(r.second == std::next(m.begin(), 8));
- r = m.equal_range(4);
- assert(r.first == std::next(m.begin(), 0));
- assert(r.second == std::next(m.begin(), 0));
- r = m.equal_range(6);
- assert(r.first == std::next(m.begin(), 1));
- assert(r.second == std::next(m.begin(), 1));
- r = m.equal_range(8);
- assert(r.first == std::next(m.begin(), 2));
- assert(r.second == std::next(m.begin(), 2));
- r = m.equal_range(10);
- assert(r.first == std::next(m.begin(), 3));
- assert(r.second == std::next(m.begin(), 3));
- r = m.equal_range(12);
- assert(r.first == std::next(m.begin(), 4));
- assert(r.second == std::next(m.begin(), 4));
- r = m.equal_range(14);
- assert(r.first == std::next(m.begin(), 5));
- assert(r.second == std::next(m.begin(), 5));
- r = m.equal_range(16);
- assert(r.first == std::next(m.begin(), 6));
- assert(r.second == std::next(m.begin(), 6));
- r = m.equal_range(18);
- assert(r.first == std::next(m.begin(), 7));
- assert(r.second == std::next(m.begin(), 7));
- r = m.equal_range(20);
- assert(r.first == std::next(m.begin(), 8));
- assert(r.second == std::next(m.begin(), 8));
- }
+ typedef std::pair<M::iterator, M::iterator> R;
+ V ar[] = {5, 7, 9, 11, 13, 15, 17, 19};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.equal_range(5);
+ assert(r.first == std::next(m.begin(), 0));
+ assert(r.second == std::next(m.begin(), 1));
+ r = m.equal_range(7);
+ assert(r.first == std::next(m.begin(), 1));
+ assert(r.second == std::next(m.begin(), 2));
+ r = m.equal_range(9);
+ assert(r.first == std::next(m.begin(), 2));
+ assert(r.second == std::next(m.begin(), 3));
+ r = m.equal_range(11);
+ assert(r.first == std::next(m.begin(), 3));
+ assert(r.second == std::next(m.begin(), 4));
+ r = m.equal_range(13);
+ assert(r.first == std::next(m.begin(), 4));
+ assert(r.second == std::next(m.begin(), 5));
+ r = m.equal_range(15);
+ assert(r.first == std::next(m.begin(), 5));
+ assert(r.second == std::next(m.begin(), 6));
+ r = m.equal_range(17);
+ assert(r.first == std::next(m.begin(), 6));
+ assert(r.second == std::next(m.begin(), 7));
+ r = m.equal_range(19);
+ assert(r.first == std::next(m.begin(), 7));
+ assert(r.second == std::next(m.begin(), 8));
+ r = m.equal_range(4);
+ assert(r.first == std::next(m.begin(), 0));
+ assert(r.second == std::next(m.begin(), 0));
+ r = m.equal_range(6);
+ assert(r.first == std::next(m.begin(), 1));
+ assert(r.second == std::next(m.begin(), 1));
+ r = m.equal_range(8);
+ assert(r.first == std::next(m.begin(), 2));
+ assert(r.second == std::next(m.begin(), 2));
+ r = m.equal_range(10);
+ assert(r.first == std::next(m.begin(), 3));
+ assert(r.second == std::next(m.begin(), 3));
+ r = m.equal_range(12);
+ assert(r.first == std::next(m.begin(), 4));
+ assert(r.second == std::next(m.begin(), 4));
+ r = m.equal_range(14);
+ assert(r.first == std::next(m.begin(), 5));
+ assert(r.second == std::next(m.begin(), 5));
+ r = m.equal_range(16);
+ assert(r.first == std::next(m.begin(), 6));
+ assert(r.second == std::next(m.begin(), 6));
+ r = m.equal_range(18);
+ assert(r.first == std::next(m.begin(), 7));
+ assert(r.second == std::next(m.begin(), 7));
+ r = m.equal_range(20);
+ assert(r.first == std::next(m.begin(), 8));
+ assert(r.second == std::next(m.begin(), 8));
}
- {
+ }
+ {
typedef PrivateConstructor V;
typedef std::set<V, std::less<>> M;
typedef std::pair<M::iterator, M::iterator> R;
M m;
- m.insert ( V::make ( 5 ));
- m.insert ( V::make ( 7 ));
- m.insert ( V::make ( 9 ));
- m.insert ( V::make ( 11 ));
- m.insert ( V::make ( 13 ));
- m.insert ( V::make ( 15 ));
- m.insert ( V::make ( 17 ));
- m.insert ( V::make ( 19 ));
+ m.insert(V::make(5));
+ m.insert(V::make(7));
+ m.insert(V::make(9));
+ m.insert(V::make(11));
+ m.insert(V::make(13));
+ m.insert(V::make(15));
+ m.insert(V::make(17));
+ m.insert(V::make(19));
R r = m.equal_range(5);
assert(r.first == std::next(m.begin(), 0));
@@ -365,7 +324,7 @@ int main(int, char**)
r = m.equal_range(20);
assert(r.first == std::next(m.begin(), 8));
assert(r.second == std::next(m.begin(), 8));
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/set/equal_range_transparent.pass.cpp b/libcxx/test/std/containers/associative/set/equal_range_transparent.pass.cpp
index e4b7833910a172e..a44fcf4b74a0298 100644
--- a/libcxx/test/std/containers/associative/set/equal_range_transparent.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/equal_range_transparent.pass.cpp
@@ -26,24 +26,17 @@
struct Comp {
using is_transparent = void;
- bool operator()(const std::pair<int, int> &lhs,
- const std::pair<int, int> &rhs) const {
- return lhs < rhs;
- }
+ bool operator()(const std::pair<int, int>& lhs, const std::pair<int, int>& rhs) const { return lhs < rhs; }
- bool operator()(const std::pair<int, int> &lhs, int rhs) const {
- return lhs.first < rhs;
- }
+ bool operator()(const std::pair<int, int>& lhs, int rhs) const { return lhs.first < rhs; }
- bool operator()(int lhs, const std::pair<int, int> &rhs) const {
- return lhs < rhs.first;
- }
+ bool operator()(int lhs, const std::pair<int, int>& rhs) const { return lhs < rhs.first; }
};
int main(int, char**) {
std::set<std::pair<int, int>, Comp> s{{2, 1}, {1, 2}, {1, 3}, {1, 4}, {2, 2}};
- auto er = s.equal_range(1);
+ auto er = s.equal_range(1);
long nels = 0;
for (auto it = er.first; it != er.second; it++) {
diff --git a/libcxx/test/std/containers/associative/set/erase_iter.pass.cpp b/libcxx/test/std/containers/associative/set/erase_iter.pass.cpp
index 9d9fa180b7a1674..73a4cc4266ec991 100644
--- a/libcxx/test/std/containers/associative/set/erase_iter.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/erase_iter.pass.cpp
@@ -18,187 +18,165 @@
#include "test_macros.h"
#include "min_allocator.h"
-struct TemplateConstructor
-{
- template<typename T>
- TemplateConstructor (const T&) {}
+struct TemplateConstructor {
+ template <typename T>
+ TemplateConstructor(const T&) {}
};
bool operator<(const TemplateConstructor&, const TemplateConstructor&) { return false; }
-int main(int, char**)
-{
- {
- typedef std::set<int> M;
- typedef int V;
- typedef M::iterator I;
- V ar[] =
- {
- 1,
- 2,
- 3,
- 4,
- 5,
- 6,
- 7,
- 8
- };
- M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
- assert(m.size() == 8);
- I i = m.erase(std::next(m.cbegin(), 3));
- assert(m.size() == 7);
- assert(i == std::next(m.begin(), 3));
- assert(*std::next(m.begin(), 0) == 1);
- assert(*std::next(m.begin(), 1) == 2);
- assert(*std::next(m.begin(), 2) == 3);
- assert(*std::next(m.begin(), 3) == 5);
- assert(*std::next(m.begin(), 4) == 6);
- assert(*std::next(m.begin(), 5) == 7);
- assert(*std::next(m.begin(), 6) == 8);
-
- i = m.erase(std::next(m.cbegin(), 0));
- assert(m.size() == 6);
- assert(i == m.begin());
- assert(*std::next(m.begin(), 0) == 2);
- assert(*std::next(m.begin(), 1) == 3);
- assert(*std::next(m.begin(), 2) == 5);
- assert(*std::next(m.begin(), 3) == 6);
- assert(*std::next(m.begin(), 4) == 7);
- assert(*std::next(m.begin(), 5) == 8);
-
- i = m.erase(std::next(m.cbegin(), 5));
- assert(m.size() == 5);
- assert(i == m.end());
- assert(*std::next(m.begin(), 0) == 2);
- assert(*std::next(m.begin(), 1) == 3);
- assert(*std::next(m.begin(), 2) == 5);
- assert(*std::next(m.begin(), 3) == 6);
- assert(*std::next(m.begin(), 4) == 7);
-
- i = m.erase(std::next(m.cbegin(), 1));
- assert(m.size() == 4);
- assert(i == std::next(m.begin()));
- assert(*std::next(m.begin(), 0) == 2);
- assert(*std::next(m.begin(), 1) == 5);
- assert(*std::next(m.begin(), 2) == 6);
- assert(*std::next(m.begin(), 3) == 7);
-
- i = m.erase(std::next(m.cbegin(), 2));
- assert(m.size() == 3);
- assert(i == std::next(m.begin(), 2));
- assert(*std::next(m.begin(), 0) == 2);
- assert(*std::next(m.begin(), 1) == 5);
- assert(*std::next(m.begin(), 2) == 7);
-
- i = m.erase(std::next(m.cbegin(), 2));
- assert(m.size() == 2);
- assert(i == std::next(m.begin(), 2));
- assert(*std::next(m.begin(), 0) == 2);
- assert(*std::next(m.begin(), 1) == 5);
-
- i = m.erase(std::next(m.cbegin(), 0));
- assert(m.size() == 1);
- assert(i == std::next(m.begin(), 0));
- assert(*std::next(m.begin(), 0) == 5);
-
- i = m.erase(m.cbegin());
- assert(m.size() == 0);
- assert(i == m.begin());
- assert(i == m.end());
- }
+int main(int, char**) {
+ {
+ typedef std::set<int> M;
+ typedef int V;
+ typedef M::iterator I;
+ V ar[] = {1, 2, 3, 4, 5, 6, 7, 8};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(m.size() == 8);
+ I i = m.erase(std::next(m.cbegin(), 3));
+ assert(m.size() == 7);
+ assert(i == std::next(m.begin(), 3));
+ assert(*std::next(m.begin(), 0) == 1);
+ assert(*std::next(m.begin(), 1) == 2);
+ assert(*std::next(m.begin(), 2) == 3);
+ assert(*std::next(m.begin(), 3) == 5);
+ assert(*std::next(m.begin(), 4) == 6);
+ assert(*std::next(m.begin(), 5) == 7);
+ assert(*std::next(m.begin(), 6) == 8);
+
+ i = m.erase(std::next(m.cbegin(), 0));
+ assert(m.size() == 6);
+ assert(i == m.begin());
+ assert(*std::next(m.begin(), 0) == 2);
+ assert(*std::next(m.begin(), 1) == 3);
+ assert(*std::next(m.begin(), 2) == 5);
+ assert(*std::next(m.begin(), 3) == 6);
+ assert(*std::next(m.begin(), 4) == 7);
+ assert(*std::next(m.begin(), 5) == 8);
+
+ i = m.erase(std::next(m.cbegin(), 5));
+ assert(m.size() == 5);
+ assert(i == m.end());
+ assert(*std::next(m.begin(), 0) == 2);
+ assert(*std::next(m.begin(), 1) == 3);
+ assert(*std::next(m.begin(), 2) == 5);
+ assert(*std::next(m.begin(), 3) == 6);
+ assert(*std::next(m.begin(), 4) == 7);
+
+ i = m.erase(std::next(m.cbegin(), 1));
+ assert(m.size() == 4);
+ assert(i == std::next(m.begin()));
+ assert(*std::next(m.begin(), 0) == 2);
+ assert(*std::next(m.begin(), 1) == 5);
+ assert(*std::next(m.begin(), 2) == 6);
+ assert(*std::next(m.begin(), 3) == 7);
+
+ i = m.erase(std::next(m.cbegin(), 2));
+ assert(m.size() == 3);
+ assert(i == std::next(m.begin(), 2));
+ assert(*std::next(m.begin(), 0) == 2);
+ assert(*std::next(m.begin(), 1) == 5);
+ assert(*std::next(m.begin(), 2) == 7);
+
+ i = m.erase(std::next(m.cbegin(), 2));
+ assert(m.size() == 2);
+ assert(i == std::next(m.begin(), 2));
+ assert(*std::next(m.begin(), 0) == 2);
+ assert(*std::next(m.begin(), 1) == 5);
+
+ i = m.erase(std::next(m.cbegin(), 0));
+ assert(m.size() == 1);
+ assert(i == std::next(m.begin(), 0));
+ assert(*std::next(m.begin(), 0) == 5);
+
+ i = m.erase(m.cbegin());
+ assert(m.size() == 0);
+ assert(i == m.begin());
+ assert(i == m.end());
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::set<int, std::less<int>, min_allocator<int>> M;
- typedef int V;
- typedef M::iterator I;
- V ar[] =
- {
- 1,
- 2,
- 3,
- 4,
- 5,
- 6,
- 7,
- 8
- };
- M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
- assert(m.size() == 8);
- I i = m.erase(std::next(m.cbegin(), 3));
- assert(m.size() == 7);
- assert(i == std::next(m.begin(), 3));
- assert(*std::next(m.begin(), 0) == 1);
- assert(*std::next(m.begin(), 1) == 2);
- assert(*std::next(m.begin(), 2) == 3);
- assert(*std::next(m.begin(), 3) == 5);
- assert(*std::next(m.begin(), 4) == 6);
- assert(*std::next(m.begin(), 5) == 7);
- assert(*std::next(m.begin(), 6) == 8);
-
- i = m.erase(std::next(m.cbegin(), 0));
- assert(m.size() == 6);
- assert(i == m.begin());
- assert(*std::next(m.begin(), 0) == 2);
- assert(*std::next(m.begin(), 1) == 3);
- assert(*std::next(m.begin(), 2) == 5);
- assert(*std::next(m.begin(), 3) == 6);
- assert(*std::next(m.begin(), 4) == 7);
- assert(*std::next(m.begin(), 5) == 8);
-
- i = m.erase(std::next(m.cbegin(), 5));
- assert(m.size() == 5);
- assert(i == m.end());
- assert(*std::next(m.begin(), 0) == 2);
- assert(*std::next(m.begin(), 1) == 3);
- assert(*std::next(m.begin(), 2) == 5);
- assert(*std::next(m.begin(), 3) == 6);
- assert(*std::next(m.begin(), 4) == 7);
-
- i = m.erase(std::next(m.cbegin(), 1));
- assert(m.size() == 4);
- assert(i == std::next(m.begin()));
- assert(*std::next(m.begin(), 0) == 2);
- assert(*std::next(m.begin(), 1) == 5);
- assert(*std::next(m.begin(), 2) == 6);
- assert(*std::next(m.begin(), 3) == 7);
-
- i = m.erase(std::next(m.cbegin(), 2));
- assert(m.size() == 3);
- assert(i == std::next(m.begin(), 2));
- assert(*std::next(m.begin(), 0) == 2);
- assert(*std::next(m.begin(), 1) == 5);
- assert(*std::next(m.begin(), 2) == 7);
-
- i = m.erase(std::next(m.cbegin(), 2));
- assert(m.size() == 2);
- assert(i == std::next(m.begin(), 2));
- assert(*std::next(m.begin(), 0) == 2);
- assert(*std::next(m.begin(), 1) == 5);
-
- i = m.erase(std::next(m.cbegin(), 0));
- assert(m.size() == 1);
- assert(i == std::next(m.begin(), 0));
- assert(*std::next(m.begin(), 0) == 5);
-
- i = m.erase(m.cbegin());
- assert(m.size() == 0);
- assert(i == m.begin());
- assert(i == m.end());
- }
+ {
+ typedef std::set<int, std::less<int>, min_allocator<int>> M;
+ typedef int V;
+ typedef M::iterator I;
+ V ar[] = {1, 2, 3, 4, 5, 6, 7, 8};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(m.size() == 8);
+ I i = m.erase(std::next(m.cbegin(), 3));
+ assert(m.size() == 7);
+ assert(i == std::next(m.begin(), 3));
+ assert(*std::next(m.begin(), 0) == 1);
+ assert(*std::next(m.begin(), 1) == 2);
+ assert(*std::next(m.begin(), 2) == 3);
+ assert(*std::next(m.begin(), 3) == 5);
+ assert(*std::next(m.begin(), 4) == 6);
+ assert(*std::next(m.begin(), 5) == 7);
+ assert(*std::next(m.begin(), 6) == 8);
+
+ i = m.erase(std::next(m.cbegin(), 0));
+ assert(m.size() == 6);
+ assert(i == m.begin());
+ assert(*std::next(m.begin(), 0) == 2);
+ assert(*std::next(m.begin(), 1) == 3);
+ assert(*std::next(m.begin(), 2) == 5);
+ assert(*std::next(m.begin(), 3) == 6);
+ assert(*std::next(m.begin(), 4) == 7);
+ assert(*std::next(m.begin(), 5) == 8);
+
+ i = m.erase(std::next(m.cbegin(), 5));
+ assert(m.size() == 5);
+ assert(i == m.end());
+ assert(*std::next(m.begin(), 0) == 2);
+ assert(*std::next(m.begin(), 1) == 3);
+ assert(*std::next(m.begin(), 2) == 5);
+ assert(*std::next(m.begin(), 3) == 6);
+ assert(*std::next(m.begin(), 4) == 7);
+
+ i = m.erase(std::next(m.cbegin(), 1));
+ assert(m.size() == 4);
+ assert(i == std::next(m.begin()));
+ assert(*std::next(m.begin(), 0) == 2);
+ assert(*std::next(m.begin(), 1) == 5);
+ assert(*std::next(m.begin(), 2) == 6);
+ assert(*std::next(m.begin(), 3) == 7);
+
+ i = m.erase(std::next(m.cbegin(), 2));
+ assert(m.size() == 3);
+ assert(i == std::next(m.begin(), 2));
+ assert(*std::next(m.begin(), 0) == 2);
+ assert(*std::next(m.begin(), 1) == 5);
+ assert(*std::next(m.begin(), 2) == 7);
+
+ i = m.erase(std::next(m.cbegin(), 2));
+ assert(m.size() == 2);
+ assert(i == std::next(m.begin(), 2));
+ assert(*std::next(m.begin(), 0) == 2);
+ assert(*std::next(m.begin(), 1) == 5);
+
+ i = m.erase(std::next(m.cbegin(), 0));
+ assert(m.size() == 1);
+ assert(i == std::next(m.begin(), 0));
+ assert(*std::next(m.begin(), 0) == 5);
+
+ i = m.erase(m.cbegin());
+ assert(m.size() == 0);
+ assert(i == m.begin());
+ assert(i == m.end());
+ }
#endif
#if TEST_STD_VER >= 14
- {
+ {
// This is LWG #2059
- typedef TemplateConstructor T;
- typedef std::set<T> C;
- typedef C::iterator I;
-
- C c;
- T a{0};
- I it = c.find(a);
- if (it != c.end())
- c.erase(it);
- }
+ typedef TemplateConstructor T;
+ typedef std::set<T> C;
+ typedef C::iterator I;
+
+ C c;
+ T a{0};
+ I it = c.find(a);
+ if (it != c.end())
+ c.erase(it);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/set/erase_iter_iter.pass.cpp b/libcxx/test/std/containers/associative/set/erase_iter_iter.pass.cpp
index 8508e17bc717bc8..20c97c28fce5679 100644
--- a/libcxx/test/std/containers/associative/set/erase_iter_iter.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/erase_iter_iter.pass.cpp
@@ -18,125 +18,104 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::set<int> M;
- typedef int V;
- typedef M::iterator I;
- V ar[] =
- {
- 1,
- 2,
- 3,
- 4,
- 5,
- 6,
- 7,
- 8
- };
- M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
- assert(m.size() == 8);
- I i = m.erase(std::next(m.cbegin(), 5), std::next(m.cbegin(), 5));
- assert(m.size() == 8);
- assert(i == std::next(m.begin(), 5));
- assert(*std::next(m.begin(), 0) == 1);
- assert(*std::next(m.begin(), 1) == 2);
- assert(*std::next(m.begin(), 2) == 3);
- assert(*std::next(m.begin(), 3) == 4);
- assert(*std::next(m.begin(), 4) == 5);
- assert(*std::next(m.begin(), 5) == 6);
- assert(*std::next(m.begin(), 6) == 7);
- assert(*std::next(m.begin(), 7) == 8);
+int main(int, char**) {
+ {
+ typedef std::set<int> M;
+ typedef int V;
+ typedef M::iterator I;
+ V ar[] = {1, 2, 3, 4, 5, 6, 7, 8};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(m.size() == 8);
+ I i = m.erase(std::next(m.cbegin(), 5), std::next(m.cbegin(), 5));
+ assert(m.size() == 8);
+ assert(i == std::next(m.begin(), 5));
+ assert(*std::next(m.begin(), 0) == 1);
+ assert(*std::next(m.begin(), 1) == 2);
+ assert(*std::next(m.begin(), 2) == 3);
+ assert(*std::next(m.begin(), 3) == 4);
+ assert(*std::next(m.begin(), 4) == 5);
+ assert(*std::next(m.begin(), 5) == 6);
+ assert(*std::next(m.begin(), 6) == 7);
+ assert(*std::next(m.begin(), 7) == 8);
- i = m.erase(std::next(m.cbegin(), 3), std::next(m.cbegin(), 4));
- assert(m.size() == 7);
- assert(i == std::next(m.begin(), 3));
- assert(*std::next(m.begin(), 0) == 1);
- assert(*std::next(m.begin(), 1) == 2);
- assert(*std::next(m.begin(), 2) == 3);
- assert(*std::next(m.begin(), 3) == 5);
- assert(*std::next(m.begin(), 4) == 6);
- assert(*std::next(m.begin(), 5) == 7);
- assert(*std::next(m.begin(), 6) == 8);
+ i = m.erase(std::next(m.cbegin(), 3), std::next(m.cbegin(), 4));
+ assert(m.size() == 7);
+ assert(i == std::next(m.begin(), 3));
+ assert(*std::next(m.begin(), 0) == 1);
+ assert(*std::next(m.begin(), 1) == 2);
+ assert(*std::next(m.begin(), 2) == 3);
+ assert(*std::next(m.begin(), 3) == 5);
+ assert(*std::next(m.begin(), 4) == 6);
+ assert(*std::next(m.begin(), 5) == 7);
+ assert(*std::next(m.begin(), 6) == 8);
- i = m.erase(std::next(m.cbegin(), 2), std::next(m.cbegin(), 5));
- assert(m.size() == 4);
- assert(i == std::next(m.begin(), 2));
- assert(*std::next(m.begin(), 0) == 1);
- assert(*std::next(m.begin(), 1) == 2);
- assert(*std::next(m.begin(), 2) == 7);
- assert(*std::next(m.begin(), 3) == 8);
+ i = m.erase(std::next(m.cbegin(), 2), std::next(m.cbegin(), 5));
+ assert(m.size() == 4);
+ assert(i == std::next(m.begin(), 2));
+ assert(*std::next(m.begin(), 0) == 1);
+ assert(*std::next(m.begin(), 1) == 2);
+ assert(*std::next(m.begin(), 2) == 7);
+ assert(*std::next(m.begin(), 3) == 8);
- i = m.erase(std::next(m.cbegin(), 0), std::next(m.cbegin(), 2));
- assert(m.size() == 2);
- assert(i == std::next(m.begin(), 0));
- assert(*std::next(m.begin(), 0) == 7);
- assert(*std::next(m.begin(), 1) == 8);
+ i = m.erase(std::next(m.cbegin(), 0), std::next(m.cbegin(), 2));
+ assert(m.size() == 2);
+ assert(i == std::next(m.begin(), 0));
+ assert(*std::next(m.begin(), 0) == 7);
+ assert(*std::next(m.begin(), 1) == 8);
- i = m.erase(m.cbegin(), m.cend());
- assert(m.size() == 0);
- assert(i == m.end());
- }
+ i = m.erase(m.cbegin(), m.cend());
+ assert(m.size() == 0);
+ assert(i == m.end());
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::set<int, std::less<int>, min_allocator<int>> M;
- typedef int V;
- typedef M::iterator I;
- V ar[] =
- {
- 1,
- 2,
- 3,
- 4,
- 5,
- 6,
- 7,
- 8
- };
- M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
- assert(m.size() == 8);
- I i = m.erase(std::next(m.cbegin(), 5), std::next(m.cbegin(), 5));
- assert(m.size() == 8);
- assert(i == std::next(m.begin(), 5));
- assert(*std::next(m.begin(), 0) == 1);
- assert(*std::next(m.begin(), 1) == 2);
- assert(*std::next(m.begin(), 2) == 3);
- assert(*std::next(m.begin(), 3) == 4);
- assert(*std::next(m.begin(), 4) == 5);
- assert(*std::next(m.begin(), 5) == 6);
- assert(*std::next(m.begin(), 6) == 7);
- assert(*std::next(m.begin(), 7) == 8);
+ {
+ typedef std::set<int, std::less<int>, min_allocator<int>> M;
+ typedef int V;
+ typedef M::iterator I;
+ V ar[] = {1, 2, 3, 4, 5, 6, 7, 8};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(m.size() == 8);
+ I i = m.erase(std::next(m.cbegin(), 5), std::next(m.cbegin(), 5));
+ assert(m.size() == 8);
+ assert(i == std::next(m.begin(), 5));
+ assert(*std::next(m.begin(), 0) == 1);
+ assert(*std::next(m.begin(), 1) == 2);
+ assert(*std::next(m.begin(), 2) == 3);
+ assert(*std::next(m.begin(), 3) == 4);
+ assert(*std::next(m.begin(), 4) == 5);
+ assert(*std::next(m.begin(), 5) == 6);
+ assert(*std::next(m.begin(), 6) == 7);
+ assert(*std::next(m.begin(), 7) == 8);
- i = m.erase(std::next(m.cbegin(), 3), std::next(m.cbegin(), 4));
- assert(m.size() == 7);
- assert(i == std::next(m.begin(), 3));
- assert(*std::next(m.begin(), 0) == 1);
- assert(*std::next(m.begin(), 1) == 2);
- assert(*std::next(m.begin(), 2) == 3);
- assert(*std::next(m.begin(), 3) == 5);
- assert(*std::next(m.begin(), 4) == 6);
- assert(*std::next(m.begin(), 5) == 7);
- assert(*std::next(m.begin(), 6) == 8);
+ i = m.erase(std::next(m.cbegin(), 3), std::next(m.cbegin(), 4));
+ assert(m.size() == 7);
+ assert(i == std::next(m.begin(), 3));
+ assert(*std::next(m.begin(), 0) == 1);
+ assert(*std::next(m.begin(), 1) == 2);
+ assert(*std::next(m.begin(), 2) == 3);
+ assert(*std::next(m.begin(), 3) == 5);
+ assert(*std::next(m.begin(), 4) == 6);
+ assert(*std::next(m.begin(), 5) == 7);
+ assert(*std::next(m.begin(), 6) == 8);
- i = m.erase(std::next(m.cbegin(), 2), std::next(m.cbegin(), 5));
- assert(m.size() == 4);
- assert(i == std::next(m.begin(), 2));
- assert(*std::next(m.begin(), 0) == 1);
- assert(*std::next(m.begin(), 1) == 2);
- assert(*std::next(m.begin(), 2) == 7);
- assert(*std::next(m.begin(), 3) == 8);
+ i = m.erase(std::next(m.cbegin(), 2), std::next(m.cbegin(), 5));
+ assert(m.size() == 4);
+ assert(i == std::next(m.begin(), 2));
+ assert(*std::next(m.begin(), 0) == 1);
+ assert(*std::next(m.begin(), 1) == 2);
+ assert(*std::next(m.begin(), 2) == 7);
+ assert(*std::next(m.begin(), 3) == 8);
- i = m.erase(std::next(m.cbegin(), 0), std::next(m.cbegin(), 2));
- assert(m.size() == 2);
- assert(i == std::next(m.begin(), 0));
- assert(*std::next(m.begin(), 0) == 7);
- assert(*std::next(m.begin(), 1) == 8);
+ i = m.erase(std::next(m.cbegin(), 0), std::next(m.cbegin(), 2));
+ assert(m.size() == 2);
+ assert(i == std::next(m.begin(), 0));
+ assert(*std::next(m.begin(), 0) == 7);
+ assert(*std::next(m.begin(), 1) == 8);
- i = m.erase(m.cbegin(), m.cend());
- assert(m.size() == 0);
- assert(i == m.end());
- }
+ i = m.erase(m.cbegin(), m.cend());
+ assert(m.size() == 0);
+ assert(i == m.end());
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/set/erase_key.pass.cpp b/libcxx/test/std/containers/associative/set/erase_key.pass.cpp
index 03b78eb12312f71..318c35d21cd87c0 100644
--- a/libcxx/test/std/containers/associative/set/erase_key.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/erase_key.pass.cpp
@@ -18,187 +18,166 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::set<int> M;
- typedef int V;
- typedef M::size_type I;
- V ar[] =
- {
- 1,
- 2,
- 3,
- 4,
- 5,
- 6,
- 7,
- 8
- };
- M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
- assert(m.size() == 8);
- I i = m.erase(9);
- assert(m.size() == 8);
- assert(i == 0);
- assert(*std::next(m.begin(), 0) == 1);
- assert(*std::next(m.begin(), 1) == 2);
- assert(*std::next(m.begin(), 2) == 3);
- assert(*std::next(m.begin(), 3) == 4);
- assert(*std::next(m.begin(), 4) == 5);
- assert(*std::next(m.begin(), 5) == 6);
- assert(*std::next(m.begin(), 6) == 7);
- assert(*std::next(m.begin(), 7) == 8);
-
- i = m.erase(4);
- assert(m.size() == 7);
- assert(i == 1);
- assert(*std::next(m.begin(), 0) == 1);
- assert(*std::next(m.begin(), 1) == 2);
- assert(*std::next(m.begin(), 2) == 3);
- assert(*std::next(m.begin(), 3) == 5);
- assert(*std::next(m.begin(), 4) == 6);
- assert(*std::next(m.begin(), 5) == 7);
- assert(*std::next(m.begin(), 6) == 8);
-
- i = m.erase(1);
- assert(m.size() == 6);
- assert(i == 1);
- assert(*std::next(m.begin(), 0) == 2);
- assert(*std::next(m.begin(), 1) == 3);
- assert(*std::next(m.begin(), 2) == 5);
- assert(*std::next(m.begin(), 3) == 6);
- assert(*std::next(m.begin(), 4) == 7);
- assert(*std::next(m.begin(), 5) == 8);
-
- i = m.erase(8);
- assert(m.size() == 5);
- assert(i == 1);
- assert(*std::next(m.begin(), 0) == 2);
- assert(*std::next(m.begin(), 1) == 3);
- assert(*std::next(m.begin(), 2) == 5);
- assert(*std::next(m.begin(), 3) == 6);
- assert(*std::next(m.begin(), 4) == 7);
-
- i = m.erase(3);
- assert(m.size() == 4);
- assert(i == 1);
- assert(*std::next(m.begin(), 0) == 2);
- assert(*std::next(m.begin(), 1) == 5);
- assert(*std::next(m.begin(), 2) == 6);
- assert(*std::next(m.begin(), 3) == 7);
-
- i = m.erase(6);
- assert(m.size() == 3);
- assert(i == 1);
- assert(*std::next(m.begin(), 0) == 2);
- assert(*std::next(m.begin(), 1) == 5);
- assert(*std::next(m.begin(), 2) == 7);
-
- i = m.erase(7);
- assert(m.size() == 2);
- assert(i == 1);
- assert(*std::next(m.begin(), 0) == 2);
- assert(*std::next(m.begin(), 1) == 5);
-
- i = m.erase(2);
- assert(m.size() == 1);
- assert(i == 1);
- assert(*std::next(m.begin(), 0) == 5);
-
- i = m.erase(5);
- assert(m.size() == 0);
- assert(i == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::set<int> M;
+ typedef int V;
+ typedef M::size_type I;
+ V ar[] = {1, 2, 3, 4, 5, 6, 7, 8};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(m.size() == 8);
+ I i = m.erase(9);
+ assert(m.size() == 8);
+ assert(i == 0);
+ assert(*std::next(m.begin(), 0) == 1);
+ assert(*std::next(m.begin(), 1) == 2);
+ assert(*std::next(m.begin(), 2) == 3);
+ assert(*std::next(m.begin(), 3) == 4);
+ assert(*std::next(m.begin(), 4) == 5);
+ assert(*std::next(m.begin(), 5) == 6);
+ assert(*std::next(m.begin(), 6) == 7);
+ assert(*std::next(m.begin(), 7) == 8);
+
+ i = m.erase(4);
+ assert(m.size() == 7);
+ assert(i == 1);
+ assert(*std::next(m.begin(), 0) == 1);
+ assert(*std::next(m.begin(), 1) == 2);
+ assert(*std::next(m.begin(), 2) == 3);
+ assert(*std::next(m.begin(), 3) == 5);
+ assert(*std::next(m.begin(), 4) == 6);
+ assert(*std::next(m.begin(), 5) == 7);
+ assert(*std::next(m.begin(), 6) == 8);
+
+ i = m.erase(1);
+ assert(m.size() == 6);
+ assert(i == 1);
+ assert(*std::next(m.begin(), 0) == 2);
+ assert(*std::next(m.begin(), 1) == 3);
+ assert(*std::next(m.begin(), 2) == 5);
+ assert(*std::next(m.begin(), 3) == 6);
+ assert(*std::next(m.begin(), 4) == 7);
+ assert(*std::next(m.begin(), 5) == 8);
+
+ i = m.erase(8);
+ assert(m.size() == 5);
+ assert(i == 1);
+ assert(*std::next(m.begin(), 0) == 2);
+ assert(*std::next(m.begin(), 1) == 3);
+ assert(*std::next(m.begin(), 2) == 5);
+ assert(*std::next(m.begin(), 3) == 6);
+ assert(*std::next(m.begin(), 4) == 7);
+
+ i = m.erase(3);
+ assert(m.size() == 4);
+ assert(i == 1);
+ assert(*std::next(m.begin(), 0) == 2);
+ assert(*std::next(m.begin(), 1) == 5);
+ assert(*std::next(m.begin(), 2) == 6);
+ assert(*std::next(m.begin(), 3) == 7);
+
+ i = m.erase(6);
+ assert(m.size() == 3);
+ assert(i == 1);
+ assert(*std::next(m.begin(), 0) == 2);
+ assert(*std::next(m.begin(), 1) == 5);
+ assert(*std::next(m.begin(), 2) == 7);
+
+ i = m.erase(7);
+ assert(m.size() == 2);
+ assert(i == 1);
+ assert(*std::next(m.begin(), 0) == 2);
+ assert(*std::next(m.begin(), 1) == 5);
+
+ i = m.erase(2);
+ assert(m.size() == 1);
+ assert(i == 1);
+ assert(*std::next(m.begin(), 0) == 5);
+
+ i = m.erase(5);
+ assert(m.size() == 0);
+ assert(i == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::set<int, std::less<int>, min_allocator<int>> M;
- typedef int V;
- typedef M::size_type I;
- V ar[] =
- {
- 1,
- 2,
- 3,
- 4,
- 5,
- 6,
- 7,
- 8
- };
- M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
- assert(m.size() == 8);
- I i = m.erase(9);
- assert(m.size() == 8);
- assert(i == 0);
- assert(*std::next(m.begin(), 0) == 1);
- assert(*std::next(m.begin(), 1) == 2);
- assert(*std::next(m.begin(), 2) == 3);
- assert(*std::next(m.begin(), 3) == 4);
- assert(*std::next(m.begin(), 4) == 5);
- assert(*std::next(m.begin(), 5) == 6);
- assert(*std::next(m.begin(), 6) == 7);
- assert(*std::next(m.begin(), 7) == 8);
-
- i = m.erase(4);
- assert(m.size() == 7);
- assert(i == 1);
- assert(*std::next(m.begin(), 0) == 1);
- assert(*std::next(m.begin(), 1) == 2);
- assert(*std::next(m.begin(), 2) == 3);
- assert(*std::next(m.begin(), 3) == 5);
- assert(*std::next(m.begin(), 4) == 6);
- assert(*std::next(m.begin(), 5) == 7);
- assert(*std::next(m.begin(), 6) == 8);
-
- i = m.erase(1);
- assert(m.size() == 6);
- assert(i == 1);
- assert(*std::next(m.begin(), 0) == 2);
- assert(*std::next(m.begin(), 1) == 3);
- assert(*std::next(m.begin(), 2) == 5);
- assert(*std::next(m.begin(), 3) == 6);
- assert(*std::next(m.begin(), 4) == 7);
- assert(*std::next(m.begin(), 5) == 8);
-
- i = m.erase(8);
- assert(m.size() == 5);
- assert(i == 1);
- assert(*std::next(m.begin(), 0) == 2);
- assert(*std::next(m.begin(), 1) == 3);
- assert(*std::next(m.begin(), 2) == 5);
- assert(*std::next(m.begin(), 3) == 6);
- assert(*std::next(m.begin(), 4) == 7);
-
- i = m.erase(3);
- assert(m.size() == 4);
- assert(i == 1);
- assert(*std::next(m.begin(), 0) == 2);
- assert(*std::next(m.begin(), 1) == 5);
- assert(*std::next(m.begin(), 2) == 6);
- assert(*std::next(m.begin(), 3) == 7);
-
- i = m.erase(6);
- assert(m.size() == 3);
- assert(i == 1);
- assert(*std::next(m.begin(), 0) == 2);
- assert(*std::next(m.begin(), 1) == 5);
- assert(*std::next(m.begin(), 2) == 7);
-
- i = m.erase(7);
- assert(m.size() == 2);
- assert(i == 1);
- assert(*std::next(m.begin(), 0) == 2);
- assert(*std::next(m.begin(), 1) == 5);
-
- i = m.erase(2);
- assert(m.size() == 1);
- assert(i == 1);
- assert(*std::next(m.begin(), 0) == 5);
-
- i = m.erase(5);
- assert(m.size() == 0);
- assert(i == 1);
- }
+ {
+ typedef std::set<int, std::less<int>, min_allocator<int>> M;
+ typedef int V;
+ typedef M::size_type I;
+ V ar[] = {1, 2, 3, 4, 5, 6, 7, 8};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(m.size() == 8);
+ I i = m.erase(9);
+ assert(m.size() == 8);
+ assert(i == 0);
+ assert(*std::next(m.begin(), 0) == 1);
+ assert(*std::next(m.begin(), 1) == 2);
+ assert(*std::next(m.begin(), 2) == 3);
+ assert(*std::next(m.begin(), 3) == 4);
+ assert(*std::next(m.begin(), 4) == 5);
+ assert(*std::next(m.begin(), 5) == 6);
+ assert(*std::next(m.begin(), 6) == 7);
+ assert(*std::next(m.begin(), 7) == 8);
+
+ i = m.erase(4);
+ assert(m.size() == 7);
+ assert(i == 1);
+ assert(*std::next(m.begin(), 0) == 1);
+ assert(*std::next(m.begin(), 1) == 2);
+ assert(*std::next(m.begin(), 2) == 3);
+ assert(*std::next(m.begin(), 3) == 5);
+ assert(*std::next(m.begin(), 4) == 6);
+ assert(*std::next(m.begin(), 5) == 7);
+ assert(*std::next(m.begin(), 6) == 8);
+
+ i = m.erase(1);
+ assert(m.size() == 6);
+ assert(i == 1);
+ assert(*std::next(m.begin(), 0) == 2);
+ assert(*std::next(m.begin(), 1) == 3);
+ assert(*std::next(m.begin(), 2) == 5);
+ assert(*std::next(m.begin(), 3) == 6);
+ assert(*std::next(m.begin(), 4) == 7);
+ assert(*std::next(m.begin(), 5) == 8);
+
+ i = m.erase(8);
+ assert(m.size() == 5);
+ assert(i == 1);
+ assert(*std::next(m.begin(), 0) == 2);
+ assert(*std::next(m.begin(), 1) == 3);
+ assert(*std::next(m.begin(), 2) == 5);
+ assert(*std::next(m.begin(), 3) == 6);
+ assert(*std::next(m.begin(), 4) == 7);
+
+ i = m.erase(3);
+ assert(m.size() == 4);
+ assert(i == 1);
+ assert(*std::next(m.begin(), 0) == 2);
+ assert(*std::next(m.begin(), 1) == 5);
+ assert(*std::next(m.begin(), 2) == 6);
+ assert(*std::next(m.begin(), 3) == 7);
+
+ i = m.erase(6);
+ assert(m.size() == 3);
+ assert(i == 1);
+ assert(*std::next(m.begin(), 0) == 2);
+ assert(*std::next(m.begin(), 1) == 5);
+ assert(*std::next(m.begin(), 2) == 7);
+
+ i = m.erase(7);
+ assert(m.size() == 2);
+ assert(i == 1);
+ assert(*std::next(m.begin(), 0) == 2);
+ assert(*std::next(m.begin(), 1) == 5);
+
+ i = m.erase(2);
+ assert(m.size() == 1);
+ assert(i == 1);
+ assert(*std::next(m.begin(), 0) == 5);
+
+ i = m.erase(5);
+ assert(m.size() == 0);
+ assert(i == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/set/extract_iterator.pass.cpp b/libcxx/test/std/containers/associative/set/extract_iterator.pass.cpp
index c6ef11301d7a6dd..2d7b6e521d961e7 100644
--- a/libcxx/test/std/containers/associative/set/extract_iterator.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/extract_iterator.pass.cpp
@@ -20,43 +20,40 @@
#include "Counter.h"
template <class Container>
-void test(Container& c)
-{
- std::size_t sz = c.size();
-
- for (auto first = c.cbegin(); first != c.cend();)
- {
- auto key_value = *first;
- typename Container::node_type t = c.extract(first++);
- --sz;
- assert(t.value() == key_value);
- assert(t.get_allocator() == c.get_allocator());
- assert(sz == c.size());
- }
-
- assert(c.size() == 0);
+void test(Container& c) {
+ std::size_t sz = c.size();
+
+ for (auto first = c.cbegin(); first != c.cend();) {
+ auto key_value = *first;
+ typename Container::node_type t = c.extract(first++);
+ --sz;
+ assert(t.value() == key_value);
+ assert(t.get_allocator() == c.get_allocator());
+ assert(sz == c.size());
+ }
+
+ assert(c.size() == 0);
}
-int main(int, char**)
-{
- {
- using set_type = std::set<int>;
- set_type m = {1, 2, 3, 4, 5, 6};
- test(m);
- }
-
- {
- std::set<Counter<int>> m = {1, 2, 3, 4, 5, 6};
- assert(Counter_base::gConstructed == 6);
- test(m);
- assert(Counter_base::gConstructed == 0);
- }
-
- {
- using min_alloc_set = std::set<int, std::less<int>, min_allocator<int>>;
- min_alloc_set m = {1, 2, 3, 4, 5, 6};
- test(m);
- }
+int main(int, char**) {
+ {
+ using set_type = std::set<int>;
+ set_type m = {1, 2, 3, 4, 5, 6};
+ test(m);
+ }
+
+ {
+ std::set<Counter<int>> m = {1, 2, 3, 4, 5, 6};
+ assert(Counter_base::gConstructed == 6);
+ test(m);
+ assert(Counter_base::gConstructed == 0);
+ }
+
+ {
+ using min_alloc_set = std::set<int, std::less<int>, min_allocator<int>>;
+ min_alloc_set m = {1, 2, 3, 4, 5, 6};
+ test(m);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/set/extract_key.pass.cpp b/libcxx/test/std/containers/associative/set/extract_key.pass.cpp
index f37665b4a2a28b2..0802387f2c9b3fd 100644
--- a/libcxx/test/std/containers/associative/set/extract_key.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/extract_key.pass.cpp
@@ -20,54 +20,50 @@
#include "Counter.h"
template <class Container, class KeyTypeIter>
-void test(Container& c, KeyTypeIter first, KeyTypeIter last)
-{
- std::size_t sz = c.size();
- assert((std::size_t)std::distance(first, last) == sz);
+void test(Container& c, KeyTypeIter first, KeyTypeIter last) {
+ std::size_t sz = c.size();
+ assert((std::size_t)std::distance(first, last) == sz);
- for (KeyTypeIter copy = first; copy != last; ++copy)
- {
- typename Container::node_type t = c.extract(*copy);
- assert(!t.empty());
- --sz;
- assert(t.value() == *copy);
- assert(t.get_allocator() == c.get_allocator());
- assert(sz == c.size());
- }
+ for (KeyTypeIter copy = first; copy != last; ++copy) {
+ typename Container::node_type t = c.extract(*copy);
+ assert(!t.empty());
+ --sz;
+ assert(t.value() == *copy);
+ assert(t.get_allocator() == c.get_allocator());
+ assert(sz == c.size());
+ }
- assert(c.size() == 0);
+ assert(c.size() == 0);
- for (KeyTypeIter copy = first; copy != last; ++copy)
- {
- typename Container::node_type t = c.extract(*copy);
- assert(t.empty());
- }
+ for (KeyTypeIter copy = first; copy != last; ++copy) {
+ typename Container::node_type t = c.extract(*copy);
+ assert(t.empty());
+ }
}
-int main(int, char**)
-{
- {
- std::set<int> m = {1, 2, 3, 4, 5, 6};
- int keys[] = {1, 2, 3, 4, 5, 6};
- test(m, std::begin(keys), std::end(keys));
- }
+int main(int, char**) {
+ {
+ std::set<int> m = {1, 2, 3, 4, 5, 6};
+ int keys[] = {1, 2, 3, 4, 5, 6};
+ test(m, std::begin(keys), std::end(keys));
+ }
+ {
+ std::set<Counter<int>> m = {1, 2, 3, 4, 5, 6};
{
- std::set<Counter<int>> m = {1, 2, 3, 4, 5, 6};
- {
- Counter<int> keys[] = {1, 2, 3, 4, 5, 6};
- assert(Counter_base::gConstructed == 6+6);
- test(m, std::begin(keys), std::end(keys));
- }
- assert(Counter_base::gConstructed == 0);
+ Counter<int> keys[] = {1, 2, 3, 4, 5, 6};
+ assert(Counter_base::gConstructed == 6 + 6);
+ test(m, std::begin(keys), std::end(keys));
}
+ assert(Counter_base::gConstructed == 0);
+ }
- {
- using min_alloc_set = std::set<int, std::less<int>, min_allocator<int>>;
- min_alloc_set m = {1, 2, 3, 4, 5, 6};
- int keys[] = {1, 2, 3, 4, 5, 6};
- test(m, std::begin(keys), std::end(keys));
- }
+ {
+ using min_alloc_set = std::set<int, std::less<int>, min_allocator<int>>;
+ min_alloc_set m = {1, 2, 3, 4, 5, 6};
+ int keys[] = {1, 2, 3, 4, 5, 6};
+ test(m, std::begin(keys), std::end(keys));
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/set/find.pass.cpp b/libcxx/test/std/containers/associative/set/find.pass.cpp
index 081ff94fd0f4a5c..88ceff0cb144fd1 100644
--- a/libcxx/test/std/containers/associative/set/find.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/find.pass.cpp
@@ -20,168 +20,117 @@
#include "min_allocator.h"
#include "private_constructor.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef int V;
typedef std::set<int> M;
{
- typedef M::iterator R;
- V ar[] =
- {
- 5,
- 6,
- 7,
- 8,
- 9,
- 10,
- 11,
- 12
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.find(5);
- assert(r == m.begin());
- r = m.find(6);
- assert(r == std::next(m.begin()));
- r = m.find(7);
- assert(r == std::next(m.begin(), 2));
- r = m.find(8);
- assert(r == std::next(m.begin(), 3));
- r = m.find(9);
- assert(r == std::next(m.begin(), 4));
- r = m.find(10);
- assert(r == std::next(m.begin(), 5));
- r = m.find(11);
- assert(r == std::next(m.begin(), 6));
- r = m.find(12);
- assert(r == std::next(m.begin(), 7));
- r = m.find(4);
- assert(r == std::next(m.begin(), 8));
+ typedef M::iterator R;
+ V ar[] = {5, 6, 7, 8, 9, 10, 11, 12};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.find(5);
+ assert(r == m.begin());
+ r = m.find(6);
+ assert(r == std::next(m.begin()));
+ r = m.find(7);
+ assert(r == std::next(m.begin(), 2));
+ r = m.find(8);
+ assert(r == std::next(m.begin(), 3));
+ r = m.find(9);
+ assert(r == std::next(m.begin(), 4));
+ r = m.find(10);
+ assert(r == std::next(m.begin(), 5));
+ r = m.find(11);
+ assert(r == std::next(m.begin(), 6));
+ r = m.find(12);
+ assert(r == std::next(m.begin(), 7));
+ r = m.find(4);
+ assert(r == std::next(m.begin(), 8));
}
{
- typedef M::const_iterator R;
- V ar[] =
- {
- 5,
- 6,
- 7,
- 8,
- 9,
- 10,
- 11,
- 12
- };
- const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.find(5);
- assert(r == m.begin());
- r = m.find(6);
- assert(r == std::next(m.begin()));
- r = m.find(7);
- assert(r == std::next(m.begin(), 2));
- r = m.find(8);
- assert(r == std::next(m.begin(), 3));
- r = m.find(9);
- assert(r == std::next(m.begin(), 4));
- r = m.find(10);
- assert(r == std::next(m.begin(), 5));
- r = m.find(11);
- assert(r == std::next(m.begin(), 6));
- r = m.find(12);
- assert(r == std::next(m.begin(), 7));
- r = m.find(4);
- assert(r == std::next(m.begin(), 8));
- }
+ typedef M::const_iterator R;
+ V ar[] = {5, 6, 7, 8, 9, 10, 11, 12};
+ const M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.find(5);
+ assert(r == m.begin());
+ r = m.find(6);
+ assert(r == std::next(m.begin()));
+ r = m.find(7);
+ assert(r == std::next(m.begin(), 2));
+ r = m.find(8);
+ assert(r == std::next(m.begin(), 3));
+ r = m.find(9);
+ assert(r == std::next(m.begin(), 4));
+ r = m.find(10);
+ assert(r == std::next(m.begin(), 5));
+ r = m.find(11);
+ assert(r == std::next(m.begin(), 6));
+ r = m.find(12);
+ assert(r == std::next(m.begin(), 7));
+ r = m.find(4);
+ assert(r == std::next(m.begin(), 8));
}
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef int V;
typedef std::set<int, std::less<int>, min_allocator<int>> M;
{
- typedef M::iterator R;
- V ar[] =
- {
- 5,
- 6,
- 7,
- 8,
- 9,
- 10,
- 11,
- 12
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.find(5);
- assert(r == m.begin());
- r = m.find(6);
- assert(r == std::next(m.begin()));
- r = m.find(7);
- assert(r == std::next(m.begin(), 2));
- r = m.find(8);
- assert(r == std::next(m.begin(), 3));
- r = m.find(9);
- assert(r == std::next(m.begin(), 4));
- r = m.find(10);
- assert(r == std::next(m.begin(), 5));
- r = m.find(11);
- assert(r == std::next(m.begin(), 6));
- r = m.find(12);
- assert(r == std::next(m.begin(), 7));
- r = m.find(4);
- assert(r == std::next(m.begin(), 8));
+ typedef M::iterator R;
+ V ar[] = {5, 6, 7, 8, 9, 10, 11, 12};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.find(5);
+ assert(r == m.begin());
+ r = m.find(6);
+ assert(r == std::next(m.begin()));
+ r = m.find(7);
+ assert(r == std::next(m.begin(), 2));
+ r = m.find(8);
+ assert(r == std::next(m.begin(), 3));
+ r = m.find(9);
+ assert(r == std::next(m.begin(), 4));
+ r = m.find(10);
+ assert(r == std::next(m.begin(), 5));
+ r = m.find(11);
+ assert(r == std::next(m.begin(), 6));
+ r = m.find(12);
+ assert(r == std::next(m.begin(), 7));
+ r = m.find(4);
+ assert(r == std::next(m.begin(), 8));
}
{
- typedef M::const_iterator R;
- V ar[] =
- {
- 5,
- 6,
- 7,
- 8,
- 9,
- 10,
- 11,
- 12
- };
- const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.find(5);
- assert(r == m.begin());
- r = m.find(6);
- assert(r == std::next(m.begin()));
- r = m.find(7);
- assert(r == std::next(m.begin(), 2));
- r = m.find(8);
- assert(r == std::next(m.begin(), 3));
- r = m.find(9);
- assert(r == std::next(m.begin(), 4));
- r = m.find(10);
- assert(r == std::next(m.begin(), 5));
- r = m.find(11);
- assert(r == std::next(m.begin(), 6));
- r = m.find(12);
- assert(r == std::next(m.begin(), 7));
- r = m.find(4);
- assert(r == std::next(m.begin(), 8));
- }
+ typedef M::const_iterator R;
+ V ar[] = {5, 6, 7, 8, 9, 10, 11, 12};
+ const M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.find(5);
+ assert(r == m.begin());
+ r = m.find(6);
+ assert(r == std::next(m.begin()));
+ r = m.find(7);
+ assert(r == std::next(m.begin(), 2));
+ r = m.find(8);
+ assert(r == std::next(m.begin(), 3));
+ r = m.find(9);
+ assert(r == std::next(m.begin(), 4));
+ r = m.find(10);
+ assert(r == std::next(m.begin(), 5));
+ r = m.find(11);
+ assert(r == std::next(m.begin(), 6));
+ r = m.find(12);
+ assert(r == std::next(m.begin(), 7));
+ r = m.find(4);
+ assert(r == std::next(m.begin(), 8));
}
+ }
#endif
#if TEST_STD_VER > 11
- {
+ {
typedef int V;
typedef std::set<V, std::less<>> M;
typedef M::iterator R;
- V ar[] =
- {
- 5,
- 6,
- 7,
- 8,
- 9,
- 10,
- 11,
- 12
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ V ar[] = {5, 6, 7, 8, 9, 10, 11, 12};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
R r = m.find(5);
assert(r == m.begin());
r = m.find(6);
@@ -200,22 +149,22 @@ int main(int, char**)
assert(r == std::next(m.begin(), 7));
r = m.find(4);
assert(r == std::next(m.begin(), 8));
- }
+ }
- {
+ {
typedef PrivateConstructor V;
typedef std::set<V, std::less<>> M;
typedef M::iterator R;
M m;
- m.insert ( V::make ( 5 ));
- m.insert ( V::make ( 6 ));
- m.insert ( V::make ( 7 ));
- m.insert ( V::make ( 8 ));
- m.insert ( V::make ( 9 ));
- m.insert ( V::make ( 10 ));
- m.insert ( V::make ( 11 ));
- m.insert ( V::make ( 12 ));
+ m.insert(V::make(5));
+ m.insert(V::make(6));
+ m.insert(V::make(7));
+ m.insert(V::make(8));
+ m.insert(V::make(9));
+ m.insert(V::make(10));
+ m.insert(V::make(11));
+ m.insert(V::make(12));
R r = m.find(5);
assert(r == m.begin());
@@ -235,7 +184,7 @@ int main(int, char**)
assert(r == std::next(m.begin(), 7));
r = m.find(4);
assert(r == std::next(m.begin(), 8));
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/set/get_allocator.pass.cpp b/libcxx/test/std/containers/associative/set/get_allocator.pass.cpp
index f6a7d5a97623e0c..0270c9e82ab0eff 100644
--- a/libcxx/test/std/containers/associative/set/get_allocator.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/get_allocator.pass.cpp
@@ -19,15 +19,15 @@
#include "test_macros.h"
int main(int, char**) {
- {
- std::allocator<int> alloc;
- const std::set<int> s(alloc);
- assert(s.get_allocator() == alloc);
- }
- {
- other_allocator<int> alloc(1);
- const std::set<int, std::less<int>, other_allocator<int> > s(alloc);
- assert(s.get_allocator() == alloc);
- }
- return 0;
+ {
+ std::allocator<int> alloc;
+ const std::set<int> s(alloc);
+ assert(s.get_allocator() == alloc);
+ }
+ {
+ other_allocator<int> alloc(1);
+ const std::set<int, std::less<int>, other_allocator<int> > s(alloc);
+ assert(s.get_allocator() == alloc);
+ }
+ return 0;
}
diff --git a/libcxx/test/std/containers/associative/set/incomplete_type.pass.cpp b/libcxx/test/std/containers/associative/set/incomplete_type.pass.cpp
index d50b56ff1efcddb..acbda713619bd1e 100644
--- a/libcxx/test/std/containers/associative/set/incomplete_type.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/incomplete_type.pass.cpp
@@ -16,17 +16,17 @@
#include "test_macros.h"
struct A {
- typedef std::set<A> Set;
- int data;
- Set m;
- Set::iterator it;
- Set::const_iterator cit;
+ typedef std::set<A> Set;
+ int data;
+ Set m;
+ Set::iterator it;
+ Set::const_iterator cit;
};
inline bool operator==(A const& L, A const& R) { return &L == &R; }
-inline bool operator<(A const& L, A const& R) { return L.data < R.data; }
+inline bool operator<(A const& L, A const& R) { return L.data < R.data; }
int main(int, char**) {
- A a;
+ A a;
return 0;
}
diff --git a/libcxx/test/std/containers/associative/set/insert_and_emplace_allocator_requirements.pass.cpp b/libcxx/test/std/containers/associative/set/insert_and_emplace_allocator_requirements.pass.cpp
index 21ae9a30b45982f..4711473de4dad2b 100644
--- a/libcxx/test/std/containers/associative/set/insert_and_emplace_allocator_requirements.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/insert_and_emplace_allocator_requirements.pass.cpp
@@ -21,8 +21,7 @@
#include "container_test_types.h"
#include "../../set_allocator_requirement_test_templates.h"
-int main(int, char**)
-{
+int main(int, char**) {
testSetInsert<TCT::set<> >();
testSetEmplace<TCT::set<> >();
testSetEmplaceHint<TCT::set<> >();
diff --git a/libcxx/test/std/containers/associative/set/insert_cv.pass.cpp b/libcxx/test/std/containers/associative/set/insert_cv.pass.cpp
index 4ef283410c6b3a0..2683f2924e760a1 100644
--- a/libcxx/test/std/containers/associative/set/insert_cv.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/insert_cv.pass.cpp
@@ -18,50 +18,48 @@
#include "test_macros.h"
#include "min_allocator.h"
-template<class Container>
-void do_insert_cv_test()
-{
- typedef Container M;
- typedef std::pair<typename M::iterator, bool> R;
- typedef typename M::value_type VT;
- M m;
+template <class Container>
+void do_insert_cv_test() {
+ typedef Container M;
+ typedef std::pair<typename M::iterator, bool> R;
+ typedef typename M::value_type VT;
+ M m;
- const VT v1(2);
- R r = m.insert(v1);
- assert(r.second);
- assert(r.first == m.begin());
- assert(m.size() == 1);
- assert(*r.first == 2);
+ const VT v1(2);
+ R r = m.insert(v1);
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 1);
+ assert(*r.first == 2);
- const VT v2(1);
- r = m.insert(v2);
- assert(r.second);
- assert(r.first == m.begin());
- assert(m.size() == 2);
- assert(*r.first == 1);
+ const VT v2(1);
+ r = m.insert(v2);
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 2);
+ assert(*r.first == 1);
- const VT v3(3);
- r = m.insert(v3);
- assert(r.second);
- assert(r.first == std::prev(m.end()));
- assert(m.size() == 3);
- assert(*r.first == 3);
+ const VT v3(3);
+ r = m.insert(v3);
+ assert(r.second);
+ assert(r.first == std::prev(m.end()));
+ assert(m.size() == 3);
+ assert(*r.first == 3);
- r = m.insert(v3);
- assert(!r.second);
- assert(r.first == std::prev(m.end()));
- assert(m.size() == 3);
- assert(*r.first == 3);
+ r = m.insert(v3);
+ assert(!r.second);
+ assert(r.first == std::prev(m.end()));
+ assert(m.size() == 3);
+ assert(*r.first == 3);
}
-int main(int, char**)
-{
- do_insert_cv_test<std::set<int> >();
+int main(int, char**) {
+ do_insert_cv_test<std::set<int> >();
#if TEST_STD_VER >= 11
- {
- typedef std::set<int, std::less<int>, min_allocator<int>> M;
- do_insert_cv_test<M>();
- }
+ {
+ typedef std::set<int, std::less<int>, min_allocator<int>> M;
+ do_insert_cv_test<M>();
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/set/insert_initializer_list.pass.cpp b/libcxx/test/std/containers/associative/set/insert_initializer_list.pass.cpp
index 913be9aab299bf5..f3b69a59987e83b 100644
--- a/libcxx/test/std/containers/associative/set/insert_initializer_list.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/insert_initializer_list.pass.cpp
@@ -21,9 +21,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::set<int> C;
typedef C::value_type V;
C m = {10, 8};
@@ -39,8 +38,8 @@ int main(int, char**)
assert(*++i == V(6));
assert(*++i == V(8));
assert(*++i == V(10));
- }
- {
+ }
+ {
typedef std::set<int, std::less<int>, min_allocator<int>> C;
typedef C::value_type V;
C m = {10, 8};
@@ -56,7 +55,7 @@ int main(int, char**)
assert(*++i == V(6));
assert(*++i == V(8));
assert(*++i == V(10));
- }
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/set/insert_iter_cv.pass.cpp b/libcxx/test/std/containers/associative/set/insert_iter_cv.pass.cpp
index a7c0b654fc8789c..159487ee0e479d6 100644
--- a/libcxx/test/std/containers/associative/set/insert_iter_cv.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/insert_iter_cv.pass.cpp
@@ -18,57 +18,56 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::set<int> M;
- typedef M::iterator R;
- M m;
- R r = m.insert(m.cend(), M::value_type(2));
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(*r == 2);
+int main(int, char**) {
+ {
+ typedef std::set<int> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.insert(m.cend(), M::value_type(2));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(*r == 2);
- r = m.insert(m.cend(), M::value_type(1));
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(*r == 1);
+ r = m.insert(m.cend(), M::value_type(1));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(*r == 1);
- r = m.insert(m.cend(), M::value_type(3));
- assert(r == std::prev(m.end()));
- assert(m.size() == 3);
- assert(*r == 3);
+ r = m.insert(m.cend(), M::value_type(3));
+ assert(r == std::prev(m.end()));
+ assert(m.size() == 3);
+ assert(*r == 3);
- r = m.insert(m.cend(), M::value_type(3));
- assert(r == std::prev(m.end()));
- assert(m.size() == 3);
- assert(*r == 3);
- }
+ r = m.insert(m.cend(), M::value_type(3));
+ assert(r == std::prev(m.end()));
+ assert(m.size() == 3);
+ assert(*r == 3);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::set<int, std::less<int>, min_allocator<int>> M;
- typedef M::iterator R;
- M m;
- R r = m.insert(m.cend(), M::value_type(2));
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(*r == 2);
+ {
+ typedef std::set<int, std::less<int>, min_allocator<int>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.insert(m.cend(), M::value_type(2));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(*r == 2);
- r = m.insert(m.cend(), M::value_type(1));
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(*r == 1);
+ r = m.insert(m.cend(), M::value_type(1));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(*r == 1);
- r = m.insert(m.cend(), M::value_type(3));
- assert(r == std::prev(m.end()));
- assert(m.size() == 3);
- assert(*r == 3);
+ r = m.insert(m.cend(), M::value_type(3));
+ assert(r == std::prev(m.end()));
+ assert(m.size() == 3);
+ assert(*r == 3);
- r = m.insert(m.cend(), M::value_type(3));
- assert(r == std::prev(m.end()));
- assert(m.size() == 3);
- assert(*r == 3);
- }
+ r = m.insert(m.cend(), M::value_type(3));
+ assert(r == std::prev(m.end()));
+ assert(m.size() == 3);
+ assert(*r == 3);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/set/insert_iter_iter.pass.cpp b/libcxx/test/std/containers/associative/set/insert_iter_iter.pass.cpp
index fe495309ba663e7..6c9707ca31a8192 100644
--- a/libcxx/test/std/containers/associative/set/insert_iter_iter.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/insert_iter_iter.pass.cpp
@@ -20,55 +20,30 @@
#include "test_iterators.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::set<int> M;
- typedef int V;
- V ar[] =
- {
- 1,
- 1,
- 1,
- 2,
- 2,
- 2,
- 3,
- 3,
- 3
- };
- M m;
- m.insert(cpp17_input_iterator<const V*>(ar),
- cpp17_input_iterator<const V*>(ar + sizeof(ar)/sizeof(ar[0])));
- assert(m.size() == 3);
- assert(*m.begin() == 1);
- assert(*std::next(m.begin()) == 2);
- assert(*std::next(m.begin(), 2) == 3);
- }
+int main(int, char**) {
+ {
+ typedef std::set<int> M;
+ typedef int V;
+ V ar[] = {1, 1, 1, 2, 2, 2, 3, 3, 3};
+ M m;
+ m.insert(cpp17_input_iterator<const V*>(ar), cpp17_input_iterator<const V*>(ar + sizeof(ar) / sizeof(ar[0])));
+ assert(m.size() == 3);
+ assert(*m.begin() == 1);
+ assert(*std::next(m.begin()) == 2);
+ assert(*std::next(m.begin(), 2) == 3);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::set<int, std::less<int>, min_allocator<int>> M;
- typedef int V;
- V ar[] =
- {
- 1,
- 1,
- 1,
- 2,
- 2,
- 2,
- 3,
- 3,
- 3
- };
- M m;
- m.insert(cpp17_input_iterator<const V*>(ar),
- cpp17_input_iterator<const V*>(ar + sizeof(ar)/sizeof(ar[0])));
- assert(m.size() == 3);
- assert(*m.begin() == 1);
- assert(*std::next(m.begin()) == 2);
- assert(*std::next(m.begin(), 2) == 3);
- }
+ {
+ typedef std::set<int, std::less<int>, min_allocator<int>> M;
+ typedef int V;
+ V ar[] = {1, 1, 1, 2, 2, 2, 3, 3, 3};
+ M m;
+ m.insert(cpp17_input_iterator<const V*>(ar), cpp17_input_iterator<const V*>(ar + sizeof(ar) / sizeof(ar[0])));
+ assert(m.size() == 3);
+ assert(*m.begin() == 1);
+ assert(*std::next(m.begin()) == 2);
+ assert(*std::next(m.begin(), 2) == 3);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/set/insert_iter_rv.pass.cpp b/libcxx/test/std/containers/associative/set/insert_iter_rv.pass.cpp
index 5ce5182b868f9a8..21358f3c40c9c33 100644
--- a/libcxx/test/std/containers/associative/set/insert_iter_rv.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/insert_iter_rv.pass.cpp
@@ -22,56 +22,55 @@
#include "MoveOnly.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::set<MoveOnly> M;
- typedef M::iterator R;
- M m;
- R r = m.insert(m.cend(), M::value_type(2));
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(*r == 2);
+int main(int, char**) {
+ {
+ typedef std::set<MoveOnly> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.insert(m.cend(), M::value_type(2));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(*r == 2);
- r = m.insert(m.cend(), M::value_type(1));
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(*r == 1);
+ r = m.insert(m.cend(), M::value_type(1));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(*r == 1);
- r = m.insert(m.cend(), M::value_type(3));
- assert(r == std::prev(m.end()));
- assert(m.size() == 3);
- assert(*r == 3);
+ r = m.insert(m.cend(), M::value_type(3));
+ assert(r == std::prev(m.end()));
+ assert(m.size() == 3);
+ assert(*r == 3);
- r = m.insert(m.cend(), M::value_type(3));
- assert(r == std::prev(m.end()));
- assert(m.size() == 3);
- assert(*r == 3);
- }
- {
- typedef std::set<MoveOnly, std::less<MoveOnly>, min_allocator<MoveOnly>> M;
- typedef M::iterator R;
- M m;
- R r = m.insert(m.cend(), M::value_type(2));
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(*r == 2);
+ r = m.insert(m.cend(), M::value_type(3));
+ assert(r == std::prev(m.end()));
+ assert(m.size() == 3);
+ assert(*r == 3);
+ }
+ {
+ typedef std::set<MoveOnly, std::less<MoveOnly>, min_allocator<MoveOnly>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.insert(m.cend(), M::value_type(2));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(*r == 2);
- r = m.insert(m.cend(), M::value_type(1));
- assert(r == m.begin());
- assert(m.size() == 2);
- assert(*r == 1);
+ r = m.insert(m.cend(), M::value_type(1));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(*r == 1);
- r = m.insert(m.cend(), M::value_type(3));
- assert(r == std::prev(m.end()));
- assert(m.size() == 3);
- assert(*r == 3);
+ r = m.insert(m.cend(), M::value_type(3));
+ assert(r == std::prev(m.end()));
+ assert(m.size() == 3);
+ assert(*r == 3);
- r = m.insert(m.cend(), M::value_type(3));
- assert(r == std::prev(m.end()));
- assert(m.size() == 3);
- assert(*r == 3);
- }
+ r = m.insert(m.cend(), M::value_type(3));
+ assert(r == std::prev(m.end()));
+ assert(m.size() == 3);
+ assert(*r == 3);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/set/insert_node_type.pass.cpp b/libcxx/test/std/containers/associative/set/insert_node_type.pass.cpp
index 69caecffef88522..9794b4da989d9d2 100644
--- a/libcxx/test/std/containers/associative/set/insert_node_type.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/insert_node_type.pass.cpp
@@ -42,69 +42,63 @@ void verify_insert_return_type(T&& t) {
}
template <class Container>
-typename Container::node_type
-node_factory(typename Container::key_type const& key)
-{
- static Container c;
- auto p = c.insert(key);
- assert(p.second);
- return c.extract(p.first);
+typename Container::node_type node_factory(typename Container::key_type const& key) {
+ static Container c;
+ auto p = c.insert(key);
+ assert(p.second);
+ return c.extract(p.first);
}
template <class Container>
-void test(Container& c)
-{
- auto* nf = &node_factory<Container>;
-
- for (int i = 0; i != 10; ++i)
- {
- typename Container::node_type node = nf(i);
- assert(!node.empty());
- typename Container::insert_return_type irt = c.insert(std::move(node));
- assert(node.empty());
- assert(irt.inserted);
- assert(irt.node.empty());
- assert(*irt.position == i);
- verify_insert_return_type<Container>(irt);
- }
-
- assert(c.size() == 10);
-
- { // Insert empty node.
- typename Container::node_type def;
- auto irt = c.insert(std::move(def));
- assert(def.empty());
- assert(!irt.inserted);
- assert(irt.node.empty());
- assert(irt.position == c.end());
- verify_insert_return_type<Container>(irt);
- }
-
- { // Insert duplicate node.
- typename Container::node_type dupl = nf(0);
- auto irt = c.insert(std::move(dupl));
- assert(dupl.empty());
- assert(!irt.inserted);
- assert(!irt.node.empty());
- assert(irt.position == c.find(0));
- assert(irt.node.value() == 0);
- verify_insert_return_type<Container>(irt);
- }
-
- assert(c.size() == 10);
-
- for (int i = 0; i != 10; ++i)
- {
- assert(c.count(i) == 1);
- }
+void test(Container& c) {
+ auto* nf = &node_factory<Container>;
+
+ for (int i = 0; i != 10; ++i) {
+ typename Container::node_type node = nf(i);
+ assert(!node.empty());
+ typename Container::insert_return_type irt = c.insert(std::move(node));
+ assert(node.empty());
+ assert(irt.inserted);
+ assert(irt.node.empty());
+ assert(*irt.position == i);
+ verify_insert_return_type<Container>(irt);
+ }
+
+ assert(c.size() == 10);
+
+ { // Insert empty node.
+ typename Container::node_type def;
+ auto irt = c.insert(std::move(def));
+ assert(def.empty());
+ assert(!irt.inserted);
+ assert(irt.node.empty());
+ assert(irt.position == c.end());
+ verify_insert_return_type<Container>(irt);
+ }
+
+ { // Insert duplicate node.
+ typename Container::node_type dupl = nf(0);
+ auto irt = c.insert(std::move(dupl));
+ assert(dupl.empty());
+ assert(!irt.inserted);
+ assert(!irt.node.empty());
+ assert(irt.position == c.find(0));
+ assert(irt.node.value() == 0);
+ verify_insert_return_type<Container>(irt);
+ }
+
+ assert(c.size() == 10);
+
+ for (int i = 0; i != 10; ++i) {
+ assert(c.count(i) == 1);
+ }
}
-int main(int, char**)
-{
- std::set<int> m;
- test(m);
- std::set<int, std::less<int>, min_allocator<int>> m2;
- test(m2);
+int main(int, char**) {
+ std::set<int> m;
+ test(m);
+ std::set<int, std::less<int>, min_allocator<int>> m2;
+ test(m2);
return 0;
}
diff --git a/libcxx/test/std/containers/associative/set/insert_node_type_hint.pass.cpp b/libcxx/test/std/containers/associative/set/insert_node_type_hint.pass.cpp
index 6f4cbe97e2ab6b9..1449be0030fe50b 100644
--- a/libcxx/test/std/containers/associative/set/insert_node_type_hint.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/insert_node_type_hint.pass.cpp
@@ -19,45 +19,39 @@
#include "min_allocator.h"
template <class Container>
-typename Container::node_type
-node_factory(typename Container::key_type const& key)
-{
- static Container c;
- auto p = c.insert(key);
- assert(p.second);
- return c.extract(p.first);
+typename Container::node_type node_factory(typename Container::key_type const& key) {
+ static Container c;
+ auto p = c.insert(key);
+ assert(p.second);
+ return c.extract(p.first);
}
template <class Container>
-void test(Container& c)
-{
- auto* nf = &node_factory<Container>;
-
- for (int i = 0; i != 10; ++i)
- {
- typename Container::node_type node = nf(i);
- assert(!node.empty());
- std::size_t prev = c.size();
- auto it = c.insert(c.end(), std::move(node));
- assert(node.empty());
- assert(prev + 1 == c.size());
- assert(*it == i);
- }
-
- assert(c.size() == 10);
-
- for (int i = 0; i != 10; ++i)
- {
- assert(c.count(i) == 1);
- }
+void test(Container& c) {
+ auto* nf = &node_factory<Container>;
+
+ for (int i = 0; i != 10; ++i) {
+ typename Container::node_type node = nf(i);
+ assert(!node.empty());
+ std::size_t prev = c.size();
+ auto it = c.insert(c.end(), std::move(node));
+ assert(node.empty());
+ assert(prev + 1 == c.size());
+ assert(*it == i);
+ }
+
+ assert(c.size() == 10);
+
+ for (int i = 0; i != 10; ++i) {
+ assert(c.count(i) == 1);
+ }
}
-int main(int, char**)
-{
- std::set<int> m;
- test(m);
- std::set<int, std::less<int>, min_allocator<int>> m2;
- test(m2);
+int main(int, char**) {
+ std::set<int> m;
+ test(m);
+ std::set<int, std::less<int>, min_allocator<int>> m2;
+ test(m2);
return 0;
}
diff --git a/libcxx/test/std/containers/associative/set/insert_rv.pass.cpp b/libcxx/test/std/containers/associative/set/insert_rv.pass.cpp
index 054cdaac899a66f..ec18c4379b58daf 100644
--- a/libcxx/test/std/containers/associative/set/insert_rv.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/insert_rv.pass.cpp
@@ -21,64 +21,63 @@
#include "MoveOnly.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::set<MoveOnly> M;
- typedef std::pair<M::iterator, bool> R;
- M m;
- R r = m.insert(M::value_type(2));
- assert(r.second);
- assert(r.first == m.begin());
- assert(m.size() == 1);
- assert(*r.first == 2);
+int main(int, char**) {
+ {
+ typedef std::set<MoveOnly> M;
+ typedef std::pair<M::iterator, bool> R;
+ M m;
+ R r = m.insert(M::value_type(2));
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 1);
+ assert(*r.first == 2);
- r = m.insert(M::value_type(1));
- assert(r.second);
- assert(r.first == m.begin());
- assert(m.size() == 2);
- assert(*r.first == 1);
+ r = m.insert(M::value_type(1));
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 2);
+ assert(*r.first == 1);
- r = m.insert(M::value_type(3));
- assert(r.second);
- assert(r.first == std::prev(m.end()));
- assert(m.size() == 3);
- assert(*r.first == 3);
+ r = m.insert(M::value_type(3));
+ assert(r.second);
+ assert(r.first == std::prev(m.end()));
+ assert(m.size() == 3);
+ assert(*r.first == 3);
- r = m.insert(M::value_type(3));
- assert(!r.second);
- assert(r.first == std::prev(m.end()));
- assert(m.size() == 3);
- assert(*r.first == 3);
- }
- {
- typedef std::set<MoveOnly, std::less<MoveOnly>, min_allocator<MoveOnly>> M;
- typedef std::pair<M::iterator, bool> R;
- M m;
- R r = m.insert(M::value_type(2));
- assert(r.second);
- assert(r.first == m.begin());
- assert(m.size() == 1);
- assert(*r.first == 2);
+ r = m.insert(M::value_type(3));
+ assert(!r.second);
+ assert(r.first == std::prev(m.end()));
+ assert(m.size() == 3);
+ assert(*r.first == 3);
+ }
+ {
+ typedef std::set<MoveOnly, std::less<MoveOnly>, min_allocator<MoveOnly>> M;
+ typedef std::pair<M::iterator, bool> R;
+ M m;
+ R r = m.insert(M::value_type(2));
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 1);
+ assert(*r.first == 2);
- r = m.insert(M::value_type(1));
- assert(r.second);
- assert(r.first == m.begin());
- assert(m.size() == 2);
- assert(*r.first == 1);
+ r = m.insert(M::value_type(1));
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 2);
+ assert(*r.first == 1);
- r = m.insert(M::value_type(3));
- assert(r.second);
- assert(r.first == std::prev(m.end()));
- assert(m.size() == 3);
- assert(*r.first == 3);
+ r = m.insert(M::value_type(3));
+ assert(r.second);
+ assert(r.first == std::prev(m.end()));
+ assert(m.size() == 3);
+ assert(*r.first == 3);
- r = m.insert(M::value_type(3));
- assert(!r.second);
- assert(r.first == std::prev(m.end()));
- assert(m.size() == 3);
- assert(*r.first == 3);
- }
+ r = m.insert(M::value_type(3));
+ assert(!r.second);
+ assert(r.first == std::prev(m.end()));
+ assert(m.size() == 3);
+ assert(*r.first == 3);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/set/iterator.pass.cpp b/libcxx/test/std/containers/associative/set/iterator.pass.cpp
index 4ac1187dddc71b0..1a18cbc42647855 100644
--- a/libcxx/test/std/containers/associative/set/iterator.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/iterator.pass.cpp
@@ -32,206 +32,101 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef int V;
- V ar[] =
- {
- 1,
- 1,
- 1,
- 2,
- 2,
- 2,
- 3,
- 3,
- 3,
- 4,
- 4,
- 4,
- 5,
- 5,
- 5,
- 6,
- 6,
- 6,
- 7,
- 7,
- 7,
- 8,
- 8,
- 8
- };
- std::set<int> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
- assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
- std::set<int>::iterator i;
- i = m.begin();
- std::set<int>::const_iterator k = i;
- assert(i == k);
- for (int j = 1; j <= static_cast<int>(m.size()); ++j, ++i)
- assert(*i == j);
- assert(i == m.end());
- for (int j = static_cast<int>(m.size()); j >= 1; --j) {
- --i;
- assert(*i == j);
- }
- assert(i == m.begin());
+int main(int, char**) {
+ {
+ typedef int V;
+ V ar[] = {1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8};
+ std::set<int> m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
+ std::set<int>::iterator i;
+ i = m.begin();
+ std::set<int>::const_iterator k = i;
+ assert(i == k);
+ for (int j = 1; j <= static_cast<int>(m.size()); ++j, ++i)
+ assert(*i == j);
+ assert(i == m.end());
+ for (int j = static_cast<int>(m.size()); j >= 1; --j) {
+ --i;
+ assert(*i == j);
}
- {
- typedef int V;
- V ar[] =
- {
- 1,
- 1,
- 1,
- 2,
- 2,
- 2,
- 3,
- 3,
- 3,
- 4,
- 4,
- 4,
- 5,
- 5,
- 5,
- 6,
- 6,
- 6,
- 7,
- 7,
- 7,
- 8,
- 8,
- 8
- };
- const std::set<int> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
- assert(static_cast<std::size_t>(std::distance(m.cbegin(), m.cend())) == m.size());
- assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
- assert(static_cast<std::size_t>(std::distance(m.crbegin(), m.crend())) == m.size());
- std::set<int>::const_iterator i;
- i = m.begin();
- for (int j = 1; j <= static_cast<int>(m.size()); ++j, ++i)
- assert(*i == j);
- assert(i == m.end());
- for (int j = static_cast<int>(m.size()); j >= 1; --j) {
- --i;
- assert(*i == j);
- }
- assert(i == m.begin());
+ assert(i == m.begin());
+ }
+ {
+ typedef int V;
+ V ar[] = {1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8};
+ const std::set<int> m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.cbegin(), m.cend())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.crbegin(), m.crend())) == m.size());
+ std::set<int>::const_iterator i;
+ i = m.begin();
+ for (int j = 1; j <= static_cast<int>(m.size()); ++j, ++i)
+ assert(*i == j);
+ assert(i == m.end());
+ for (int j = static_cast<int>(m.size()); j >= 1; --j) {
+ --i;
+ assert(*i == j);
}
+ assert(i == m.begin());
+ }
#if TEST_STD_VER >= 11
- {
- typedef int V;
- V ar[] =
- {
- 1,
- 1,
- 1,
- 2,
- 2,
- 2,
- 3,
- 3,
- 3,
- 4,
- 4,
- 4,
- 5,
- 5,
- 5,
- 6,
- 6,
- 6,
- 7,
- 7,
- 7,
- 8,
- 8,
- 8
- };
- std::set<int, std::less<int>, min_allocator<int>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
- assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
- std::set<int, std::less<int>, min_allocator<int>>::iterator i;
- i = m.begin();
- std::set<int, std::less<int>, min_allocator<int>>::const_iterator k = i;
- assert(i == k);
- for (int j = 1; j <= static_cast<int>(m.size()); ++j, ++i)
- assert(*i == j);
- assert(i == m.end());
- for (int j = static_cast<int>(m.size()); j >= 1; --j) {
- --i;
- assert(*i == j);
- }
- assert(i == m.begin());
+ {
+ typedef int V;
+ V ar[] = {1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8};
+ std::set<int, std::less<int>, min_allocator<int>> m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
+ std::set<int, std::less<int>, min_allocator<int>>::iterator i;
+ i = m.begin();
+ std::set<int, std::less<int>, min_allocator<int>>::const_iterator k = i;
+ assert(i == k);
+ for (int j = 1; j <= static_cast<int>(m.size()); ++j, ++i)
+ assert(*i == j);
+ assert(i == m.end());
+ for (int j = static_cast<int>(m.size()); j >= 1; --j) {
+ --i;
+ assert(*i == j);
}
- {
- typedef int V;
- V ar[] =
- {
- 1,
- 1,
- 1,
- 2,
- 2,
- 2,
- 3,
- 3,
- 3,
- 4,
- 4,
- 4,
- 5,
- 5,
- 5,
- 6,
- 6,
- 6,
- 7,
- 7,
- 7,
- 8,
- 8,
- 8
- };
- const std::set<int, std::less<int>, min_allocator<int>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
- assert(static_cast<std::size_t>(std::distance(m.cbegin(), m.cend())) == m.size());
- assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
- assert(static_cast<std::size_t>(std::distance(m.crbegin(), m.crend())) == m.size());
- std::set<int, std::less<int>, min_allocator<int>>::const_iterator i;
- i = m.begin();
- for (int j = 1; j <= static_cast<int>(m.size()); ++j, ++i)
- assert(*i == j);
- assert(i == m.end());
- for (int j = static_cast<int>(m.size()); j >= 1; --j) {
- --i;
- assert(*i == j);
- }
- assert(i == m.begin());
+ assert(i == m.begin());
+ }
+ {
+ typedef int V;
+ V ar[] = {1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8};
+ const std::set<int, std::less<int>, min_allocator<int>> m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.cbegin(), m.cend())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.crbegin(), m.crend())) == m.size());
+ std::set<int, std::less<int>, min_allocator<int>>::const_iterator i;
+ i = m.begin();
+ for (int j = 1; j <= static_cast<int>(m.size()); ++j, ++i)
+ assert(*i == j);
+ assert(i == m.end());
+ for (int j = static_cast<int>(m.size()); j >= 1; --j) {
+ --i;
+ assert(*i == j);
}
+ assert(i == m.begin());
+ }
#endif
#if TEST_STD_VER > 11
- { // N3644 testing
- typedef std::set<int> C;
- C::iterator ii1{}, ii2{};
- C::iterator ii4 = ii1;
- C::const_iterator cii{};
- assert ( ii1 == ii2 );
- assert ( ii1 == ii4 );
+ { // N3644 testing
+ typedef std::set<int> C;
+ C::iterator ii1{}, ii2{};
+ C::iterator ii4 = ii1;
+ C::const_iterator cii{};
+ assert(ii1 == ii2);
+ assert(ii1 == ii4);
- assert (!(ii1 != ii2 ));
+ assert(!(ii1 != ii2));
- assert ( (ii1 == cii ));
- assert ( (cii == ii1 ));
- assert (!(ii1 != cii ));
- assert (!(cii != ii1 ));
- }
+ assert((ii1 == cii));
+ assert((cii == ii1));
+ assert(!(ii1 != cii));
+ assert(!(cii != ii1));
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/set/iterator_concept_conformance.compile.pass.cpp b/libcxx/test/std/containers/associative/set/iterator_concept_conformance.compile.pass.cpp
index 049acdfed9ccd82..ac3737cf5cc94dc 100644
--- a/libcxx/test/std/containers/associative/set/iterator_concept_conformance.compile.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/iterator_concept_conformance.compile.pass.cpp
@@ -14,11 +14,11 @@
#include <iterator>
-using iterator = std::set<int>::iterator;
-using const_iterator = std::set<int>::const_iterator;
-using reverse_iterator = std::set<int>::reverse_iterator;
+using iterator = std::set<int>::iterator;
+using const_iterator = std::set<int>::const_iterator;
+using reverse_iterator = std::set<int>::reverse_iterator;
using const_reverse_iterator = std::set<int>::const_reverse_iterator;
-using value_type = int;
+using value_type = int;
static_assert(std::bidirectional_iterator<iterator>);
static_assert(!std::random_access_iterator<iterator>);
diff --git a/libcxx/test/std/containers/associative/set/lower_bound.pass.cpp b/libcxx/test/std/containers/associative/set/lower_bound.pass.cpp
index 3879504b7ffa5d9..2f114685fb84db0 100644
--- a/libcxx/test/std/containers/associative/set/lower_bound.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/lower_bound.pass.cpp
@@ -20,232 +20,181 @@
#include "min_allocator.h"
#include "private_constructor.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef int V;
typedef std::set<int> M;
{
- typedef M::iterator R;
- V ar[] =
- {
- 5,
- 7,
- 9,
- 11,
- 13,
- 15,
- 17,
- 19
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.lower_bound(5);
- assert(r == m.begin());
- r = m.lower_bound(7);
- assert(r == std::next(m.begin()));
- r = m.lower_bound(9);
- assert(r == std::next(m.begin(), 2));
- r = m.lower_bound(11);
- assert(r == std::next(m.begin(), 3));
- r = m.lower_bound(13);
- assert(r == std::next(m.begin(), 4));
- r = m.lower_bound(15);
- assert(r == std::next(m.begin(), 5));
- r = m.lower_bound(17);
- assert(r == std::next(m.begin(), 6));
- r = m.lower_bound(19);
- assert(r == std::next(m.begin(), 7));
- r = m.lower_bound(4);
- assert(r == std::next(m.begin(), 0));
- r = m.lower_bound(6);
- assert(r == std::next(m.begin(), 1));
- r = m.lower_bound(8);
- assert(r == std::next(m.begin(), 2));
- r = m.lower_bound(10);
- assert(r == std::next(m.begin(), 3));
- r = m.lower_bound(12);
- assert(r == std::next(m.begin(), 4));
- r = m.lower_bound(14);
- assert(r == std::next(m.begin(), 5));
- r = m.lower_bound(16);
- assert(r == std::next(m.begin(), 6));
- r = m.lower_bound(18);
- assert(r == std::next(m.begin(), 7));
- r = m.lower_bound(20);
- assert(r == std::next(m.begin(), 8));
+ typedef M::iterator R;
+ V ar[] = {5, 7, 9, 11, 13, 15, 17, 19};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.lower_bound(5);
+ assert(r == m.begin());
+ r = m.lower_bound(7);
+ assert(r == std::next(m.begin()));
+ r = m.lower_bound(9);
+ assert(r == std::next(m.begin(), 2));
+ r = m.lower_bound(11);
+ assert(r == std::next(m.begin(), 3));
+ r = m.lower_bound(13);
+ assert(r == std::next(m.begin(), 4));
+ r = m.lower_bound(15);
+ assert(r == std::next(m.begin(), 5));
+ r = m.lower_bound(17);
+ assert(r == std::next(m.begin(), 6));
+ r = m.lower_bound(19);
+ assert(r == std::next(m.begin(), 7));
+ r = m.lower_bound(4);
+ assert(r == std::next(m.begin(), 0));
+ r = m.lower_bound(6);
+ assert(r == std::next(m.begin(), 1));
+ r = m.lower_bound(8);
+ assert(r == std::next(m.begin(), 2));
+ r = m.lower_bound(10);
+ assert(r == std::next(m.begin(), 3));
+ r = m.lower_bound(12);
+ assert(r == std::next(m.begin(), 4));
+ r = m.lower_bound(14);
+ assert(r == std::next(m.begin(), 5));
+ r = m.lower_bound(16);
+ assert(r == std::next(m.begin(), 6));
+ r = m.lower_bound(18);
+ assert(r == std::next(m.begin(), 7));
+ r = m.lower_bound(20);
+ assert(r == std::next(m.begin(), 8));
}
{
- typedef M::const_iterator R;
- V ar[] =
- {
- 5,
- 7,
- 9,
- 11,
- 13,
- 15,
- 17,
- 19
- };
- const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.lower_bound(5);
- assert(r == m.begin());
- r = m.lower_bound(7);
- assert(r == std::next(m.begin()));
- r = m.lower_bound(9);
- assert(r == std::next(m.begin(), 2));
- r = m.lower_bound(11);
- assert(r == std::next(m.begin(), 3));
- r = m.lower_bound(13);
- assert(r == std::next(m.begin(), 4));
- r = m.lower_bound(15);
- assert(r == std::next(m.begin(), 5));
- r = m.lower_bound(17);
- assert(r == std::next(m.begin(), 6));
- r = m.lower_bound(19);
- assert(r == std::next(m.begin(), 7));
- r = m.lower_bound(4);
- assert(r == std::next(m.begin(), 0));
- r = m.lower_bound(6);
- assert(r == std::next(m.begin(), 1));
- r = m.lower_bound(8);
- assert(r == std::next(m.begin(), 2));
- r = m.lower_bound(10);
- assert(r == std::next(m.begin(), 3));
- r = m.lower_bound(12);
- assert(r == std::next(m.begin(), 4));
- r = m.lower_bound(14);
- assert(r == std::next(m.begin(), 5));
- r = m.lower_bound(16);
- assert(r == std::next(m.begin(), 6));
- r = m.lower_bound(18);
- assert(r == std::next(m.begin(), 7));
- r = m.lower_bound(20);
- assert(r == std::next(m.begin(), 8));
- }
+ typedef M::const_iterator R;
+ V ar[] = {5, 7, 9, 11, 13, 15, 17, 19};
+ const M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.lower_bound(5);
+ assert(r == m.begin());
+ r = m.lower_bound(7);
+ assert(r == std::next(m.begin()));
+ r = m.lower_bound(9);
+ assert(r == std::next(m.begin(), 2));
+ r = m.lower_bound(11);
+ assert(r == std::next(m.begin(), 3));
+ r = m.lower_bound(13);
+ assert(r == std::next(m.begin(), 4));
+ r = m.lower_bound(15);
+ assert(r == std::next(m.begin(), 5));
+ r = m.lower_bound(17);
+ assert(r == std::next(m.begin(), 6));
+ r = m.lower_bound(19);
+ assert(r == std::next(m.begin(), 7));
+ r = m.lower_bound(4);
+ assert(r == std::next(m.begin(), 0));
+ r = m.lower_bound(6);
+ assert(r == std::next(m.begin(), 1));
+ r = m.lower_bound(8);
+ assert(r == std::next(m.begin(), 2));
+ r = m.lower_bound(10);
+ assert(r == std::next(m.begin(), 3));
+ r = m.lower_bound(12);
+ assert(r == std::next(m.begin(), 4));
+ r = m.lower_bound(14);
+ assert(r == std::next(m.begin(), 5));
+ r = m.lower_bound(16);
+ assert(r == std::next(m.begin(), 6));
+ r = m.lower_bound(18);
+ assert(r == std::next(m.begin(), 7));
+ r = m.lower_bound(20);
+ assert(r == std::next(m.begin(), 8));
}
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef int V;
typedef std::set<int, std::less<int>, min_allocator<int>> M;
{
- typedef M::iterator R;
- V ar[] =
- {
- 5,
- 7,
- 9,
- 11,
- 13,
- 15,
- 17,
- 19
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.lower_bound(5);
- assert(r == m.begin());
- r = m.lower_bound(7);
- assert(r == std::next(m.begin()));
- r = m.lower_bound(9);
- assert(r == std::next(m.begin(), 2));
- r = m.lower_bound(11);
- assert(r == std::next(m.begin(), 3));
- r = m.lower_bound(13);
- assert(r == std::next(m.begin(), 4));
- r = m.lower_bound(15);
- assert(r == std::next(m.begin(), 5));
- r = m.lower_bound(17);
- assert(r == std::next(m.begin(), 6));
- r = m.lower_bound(19);
- assert(r == std::next(m.begin(), 7));
- r = m.lower_bound(4);
- assert(r == std::next(m.begin(), 0));
- r = m.lower_bound(6);
- assert(r == std::next(m.begin(), 1));
- r = m.lower_bound(8);
- assert(r == std::next(m.begin(), 2));
- r = m.lower_bound(10);
- assert(r == std::next(m.begin(), 3));
- r = m.lower_bound(12);
- assert(r == std::next(m.begin(), 4));
- r = m.lower_bound(14);
- assert(r == std::next(m.begin(), 5));
- r = m.lower_bound(16);
- assert(r == std::next(m.begin(), 6));
- r = m.lower_bound(18);
- assert(r == std::next(m.begin(), 7));
- r = m.lower_bound(20);
- assert(r == std::next(m.begin(), 8));
+ typedef M::iterator R;
+ V ar[] = {5, 7, 9, 11, 13, 15, 17, 19};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.lower_bound(5);
+ assert(r == m.begin());
+ r = m.lower_bound(7);
+ assert(r == std::next(m.begin()));
+ r = m.lower_bound(9);
+ assert(r == std::next(m.begin(), 2));
+ r = m.lower_bound(11);
+ assert(r == std::next(m.begin(), 3));
+ r = m.lower_bound(13);
+ assert(r == std::next(m.begin(), 4));
+ r = m.lower_bound(15);
+ assert(r == std::next(m.begin(), 5));
+ r = m.lower_bound(17);
+ assert(r == std::next(m.begin(), 6));
+ r = m.lower_bound(19);
+ assert(r == std::next(m.begin(), 7));
+ r = m.lower_bound(4);
+ assert(r == std::next(m.begin(), 0));
+ r = m.lower_bound(6);
+ assert(r == std::next(m.begin(), 1));
+ r = m.lower_bound(8);
+ assert(r == std::next(m.begin(), 2));
+ r = m.lower_bound(10);
+ assert(r == std::next(m.begin(), 3));
+ r = m.lower_bound(12);
+ assert(r == std::next(m.begin(), 4));
+ r = m.lower_bound(14);
+ assert(r == std::next(m.begin(), 5));
+ r = m.lower_bound(16);
+ assert(r == std::next(m.begin(), 6));
+ r = m.lower_bound(18);
+ assert(r == std::next(m.begin(), 7));
+ r = m.lower_bound(20);
+ assert(r == std::next(m.begin(), 8));
}
{
- typedef M::const_iterator R;
- V ar[] =
- {
- 5,
- 7,
- 9,
- 11,
- 13,
- 15,
- 17,
- 19
- };
- const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.lower_bound(5);
- assert(r == m.begin());
- r = m.lower_bound(7);
- assert(r == std::next(m.begin()));
- r = m.lower_bound(9);
- assert(r == std::next(m.begin(), 2));
- r = m.lower_bound(11);
- assert(r == std::next(m.begin(), 3));
- r = m.lower_bound(13);
- assert(r == std::next(m.begin(), 4));
- r = m.lower_bound(15);
- assert(r == std::next(m.begin(), 5));
- r = m.lower_bound(17);
- assert(r == std::next(m.begin(), 6));
- r = m.lower_bound(19);
- assert(r == std::next(m.begin(), 7));
- r = m.lower_bound(4);
- assert(r == std::next(m.begin(), 0));
- r = m.lower_bound(6);
- assert(r == std::next(m.begin(), 1));
- r = m.lower_bound(8);
- assert(r == std::next(m.begin(), 2));
- r = m.lower_bound(10);
- assert(r == std::next(m.begin(), 3));
- r = m.lower_bound(12);
- assert(r == std::next(m.begin(), 4));
- r = m.lower_bound(14);
- assert(r == std::next(m.begin(), 5));
- r = m.lower_bound(16);
- assert(r == std::next(m.begin(), 6));
- r = m.lower_bound(18);
- assert(r == std::next(m.begin(), 7));
- r = m.lower_bound(20);
- assert(r == std::next(m.begin(), 8));
- }
+ typedef M::const_iterator R;
+ V ar[] = {5, 7, 9, 11, 13, 15, 17, 19};
+ const M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.lower_bound(5);
+ assert(r == m.begin());
+ r = m.lower_bound(7);
+ assert(r == std::next(m.begin()));
+ r = m.lower_bound(9);
+ assert(r == std::next(m.begin(), 2));
+ r = m.lower_bound(11);
+ assert(r == std::next(m.begin(), 3));
+ r = m.lower_bound(13);
+ assert(r == std::next(m.begin(), 4));
+ r = m.lower_bound(15);
+ assert(r == std::next(m.begin(), 5));
+ r = m.lower_bound(17);
+ assert(r == std::next(m.begin(), 6));
+ r = m.lower_bound(19);
+ assert(r == std::next(m.begin(), 7));
+ r = m.lower_bound(4);
+ assert(r == std::next(m.begin(), 0));
+ r = m.lower_bound(6);
+ assert(r == std::next(m.begin(), 1));
+ r = m.lower_bound(8);
+ assert(r == std::next(m.begin(), 2));
+ r = m.lower_bound(10);
+ assert(r == std::next(m.begin(), 3));
+ r = m.lower_bound(12);
+ assert(r == std::next(m.begin(), 4));
+ r = m.lower_bound(14);
+ assert(r == std::next(m.begin(), 5));
+ r = m.lower_bound(16);
+ assert(r == std::next(m.begin(), 6));
+ r = m.lower_bound(18);
+ assert(r == std::next(m.begin(), 7));
+ r = m.lower_bound(20);
+ assert(r == std::next(m.begin(), 8));
}
+ }
#endif
#if TEST_STD_VER > 11
- {
+ {
typedef int V;
typedef std::set<V, std::less<>> M;
typedef M::iterator R;
- V ar[] =
- {
- 5,
- 7,
- 9,
- 11,
- 13,
- 15,
- 17,
- 19
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ V ar[] = {5, 7, 9, 11, 13, 15, 17, 19};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
R r = m.lower_bound(5);
assert(r == m.begin());
r = m.lower_bound(7);
@@ -280,22 +229,22 @@ int main(int, char**)
assert(r == std::next(m.begin(), 7));
r = m.lower_bound(20);
assert(r == std::next(m.begin(), 8));
- }
+ }
- {
+ {
typedef PrivateConstructor V;
typedef std::set<V, std::less<>> M;
typedef M::iterator R;
M m;
- m.insert ( V::make ( 5 ));
- m.insert ( V::make ( 7 ));
- m.insert ( V::make ( 9 ));
- m.insert ( V::make ( 11 ));
- m.insert ( V::make ( 13 ));
- m.insert ( V::make ( 15 ));
- m.insert ( V::make ( 17 ));
- m.insert ( V::make ( 19 ));
+ m.insert(V::make(5));
+ m.insert(V::make(7));
+ m.insert(V::make(9));
+ m.insert(V::make(11));
+ m.insert(V::make(13));
+ m.insert(V::make(15));
+ m.insert(V::make(17));
+ m.insert(V::make(19));
R r = m.lower_bound(5);
assert(r == m.begin());
@@ -331,9 +280,8 @@ int main(int, char**)
assert(r == std::next(m.begin(), 7));
r = m.lower_bound(20);
assert(r == std::next(m.begin(), 8));
- }
+ }
#endif
-
return 0;
}
diff --git a/libcxx/test/std/containers/associative/set/max_size.pass.cpp b/libcxx/test/std/containers/associative/set/max_size.pass.cpp
index f921378df21d16e..b00d316c47b3553 100644
--- a/libcxx/test/std/containers/associative/set/max_size.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/max_size.pass.cpp
@@ -20,32 +20,29 @@
#include "test_allocator.h"
#include "test_macros.h"
-int main(int, char**)
-{
- {
- typedef limited_allocator<int, 10> A;
- typedef std::set<int, std::less<int>, A> C;
- C c;
- assert(c.max_size() <= 10);
- LIBCPP_ASSERT(c.max_size() == 10);
- }
- {
- typedef limited_allocator<int, (std::size_t)-1> A;
- typedef std::set<int, std::less<int>, A> C;
- const C::size_type max_dist =
- static_cast<C::size_type>(std::numeric_limits<C::
diff erence_type>::max());
- C c;
- assert(c.max_size() <= max_dist);
- LIBCPP_ASSERT(c.max_size() == max_dist);
- }
- {
- typedef std::set<char> C;
- const C::size_type max_dist =
- static_cast<C::size_type>(std::numeric_limits<C::
diff erence_type>::max());
- C c;
- assert(c.max_size() <= max_dist);
- assert(c.max_size() <= alloc_max_size(c.get_allocator()));
- }
+int main(int, char**) {
+ {
+ typedef limited_allocator<int, 10> A;
+ typedef std::set<int, std::less<int>, A> C;
+ C c;
+ assert(c.max_size() <= 10);
+ LIBCPP_ASSERT(c.max_size() == 10);
+ }
+ {
+ typedef limited_allocator<int, (std::size_t)-1> A;
+ typedef std::set<int, std::less<int>, A> C;
+ const C::size_type max_dist = static_cast<C::size_type>(std::numeric_limits<C::
diff erence_type>::max());
+ C c;
+ assert(c.max_size() <= max_dist);
+ LIBCPP_ASSERT(c.max_size() == max_dist);
+ }
+ {
+ typedef std::set<char> C;
+ const C::size_type max_dist = static_cast<C::size_type>(std::numeric_limits<C::
diff erence_type>::max());
+ C c;
+ assert(c.max_size() <= max_dist);
+ assert(c.max_size() <= alloc_max_size(c.get_allocator()));
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/set/merge.pass.cpp b/libcxx/test/std/containers/associative/set/merge.pass.cpp
index d73487495f1f151..50141d5444b1f33 100644
--- a/libcxx/test/std/containers/associative/set/merge.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/merge.pass.cpp
@@ -27,123 +27,112 @@
#include "Counter.h"
template <class Set>
-bool set_equal(const Set& set, Set other)
-{
- return set == other;
+bool set_equal(const Set& set, Set other) {
+ return set == other;
}
#ifndef TEST_HAS_NO_EXCEPTIONS
-struct throw_comparator
-{
- bool& should_throw_;
+struct throw_comparator {
+ bool& should_throw_;
- throw_comparator(bool& should_throw) : should_throw_(should_throw) {}
+ throw_comparator(bool& should_throw) : should_throw_(should_throw) {}
- template <class T>
- bool operator()(const T& lhs, const T& rhs) const
- {
- if (should_throw_)
- throw 0;
- return lhs < rhs;
- }
+ template <class T>
+ bool operator()(const T& lhs, const T& rhs) const {
+ if (should_throw_)
+ throw 0;
+ return lhs < rhs;
+ }
};
#endif
-int main(int, char**)
-{
- {
- std::set<int> src{1, 3, 5};
- std::set<int> dst{2, 4, 5};
- dst.merge(src);
- assert(set_equal(src, {5}));
- assert(set_equal(dst, {1, 2, 3, 4, 5}));
- }
+int main(int, char**) {
+ {
+ std::set<int> src{1, 3, 5};
+ std::set<int> dst{2, 4, 5};
+ dst.merge(src);
+ assert(set_equal(src, {5}));
+ assert(set_equal(dst, {1, 2, 3, 4, 5}));
+ }
#ifndef TEST_HAS_NO_EXCEPTIONS
- {
- bool do_throw = false;
- typedef std::set<Counter<int>, throw_comparator> set_type;
- set_type src({1, 3, 5}, throw_comparator(do_throw));
- set_type dst({2, 4, 5}, throw_comparator(do_throw));
-
- assert(Counter_base::gConstructed == 6);
-
- do_throw = true;
- try
- {
- dst.merge(src);
- }
- catch (int)
- {
- do_throw = false;
- }
- assert(!do_throw);
- assert(set_equal(src, set_type({1, 3, 5}, throw_comparator(do_throw))));
- assert(set_equal(dst, set_type({2, 4, 5}, throw_comparator(do_throw))));
+ {
+ bool do_throw = false;
+ typedef std::set<Counter<int>, throw_comparator> set_type;
+ set_type src({1, 3, 5}, throw_comparator(do_throw));
+ set_type dst({2, 4, 5}, throw_comparator(do_throw));
+
+ assert(Counter_base::gConstructed == 6);
+
+ do_throw = true;
+ try {
+ dst.merge(src);
+ } catch (int) {
+ do_throw = false;
}
+ assert(!do_throw);
+ assert(set_equal(src, set_type({1, 3, 5}, throw_comparator(do_throw))));
+ assert(set_equal(dst, set_type({2, 4, 5}, throw_comparator(do_throw))));
+ }
#endif
- assert(Counter_base::gConstructed == 0);
- struct comparator
- {
- comparator() = default;
+ assert(Counter_base::gConstructed == 0);
+ struct comparator {
+ comparator() = default;
- bool operator()(const Counter<int>& lhs, const Counter<int>& rhs) const
- {
- return lhs < rhs;
- }
- };
- {
- typedef std::set<Counter<int>, std::less<Counter<int>>> first_set_type;
- typedef std::set<Counter<int>, comparator> second_set_type;
- typedef std::multiset<Counter<int>, comparator> third_set_type;
+ bool operator()(const Counter<int>& lhs, const Counter<int>& rhs) const { return lhs < rhs; }
+ };
+ {
+ typedef std::set<Counter<int>, std::less<Counter<int>>> first_set_type;
+ typedef std::set<Counter<int>, comparator> second_set_type;
+ typedef std::multiset<Counter<int>, comparator> third_set_type;
- {
- first_set_type first{1, 2, 3};
- second_set_type second{2, 3, 4};
- third_set_type third{1, 3};
+ {
+ first_set_type first{1, 2, 3};
+ second_set_type second{2, 3, 4};
+ third_set_type third{1, 3};
- assert(Counter_base::gConstructed == 8);
+ assert(Counter_base::gConstructed == 8);
- first.merge(second);
- first.merge(third);
+ first.merge(second);
+ first.merge(third);
- assert(set_equal(first, {1, 2, 3, 4}));
- assert(set_equal(second, {2, 3}));
- assert(set_equal(third, {1, 3}));
+ assert(set_equal(first, {1, 2, 3, 4}));
+ assert(set_equal(second, {2, 3}));
+ assert(set_equal(third, {1, 3}));
- assert(Counter_base::gConstructed == 8);
- }
- assert(Counter_base::gConstructed == 0);
- {
- first_set_type first{1, 2, 3};
- second_set_type second{2, 3, 4};
- third_set_type third{1, 3};
+ assert(Counter_base::gConstructed == 8);
+ }
+ assert(Counter_base::gConstructed == 0);
+ {
+ first_set_type first{1, 2, 3};
+ second_set_type second{2, 3, 4};
+ third_set_type third{1, 3};
- assert(Counter_base::gConstructed == 8);
+ assert(Counter_base::gConstructed == 8);
- first.merge(std::move(second));
- first.merge(std::move(third));
+ first.merge(std::move(second));
+ first.merge(std::move(third));
- assert(set_equal(first, {1, 2, 3, 4}));
- assert(set_equal(second, {2, 3}));
- assert(set_equal(third, {1, 3}));
+ assert(set_equal(first, {1, 2, 3, 4}));
+ assert(set_equal(second, {2, 3}));
+ assert(set_equal(third, {1, 3}));
- assert(Counter_base::gConstructed == 8);
- }
- assert(Counter_base::gConstructed == 0);
+ assert(Counter_base::gConstructed == 8);
+ }
+ assert(Counter_base::gConstructed == 0);
+ }
+ {
+ std::set<int> first;
+ {
+ std::set<int> second;
+ first.merge(second);
+ first.merge(std::move(second));
}
{
- std::set<int> first;
- {
- std::set<int> second;
- first.merge(second);
- first.merge(std::move(second));
- }
- {
- std::multiset<int> second;
- first.merge(second);
- first.merge(std::move(second));
- }
+ std::multiset<int> second;
+ first.merge(second);
+ first.merge(std::move(second));
}
- return 0;
+ }
+ return 0;
}
diff --git a/libcxx/test/std/containers/associative/set/range_concept_conformance.compile.pass.cpp b/libcxx/test/std/containers/associative/set/range_concept_conformance.compile.pass.cpp
index 16f4de96c776c75..af5217b7507507c 100644
--- a/libcxx/test/std/containers/associative/set/range_concept_conformance.compile.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/range_concept_conformance.compile.pass.cpp
@@ -17,7 +17,6 @@
using range = std::set<int>;
-
static_assert(std::same_as<std::ranges::iterator_t<range>, range::iterator>);
static_assert(std::ranges::bidirectional_range<range>);
static_assert(!std::ranges::random_access_range<range>);
diff --git a/libcxx/test/std/containers/associative/set/set.cons/alloc.pass.cpp b/libcxx/test/std/containers/associative/set/set.cons/alloc.pass.cpp
index 751a5e9ab1f0d79..4321666044a3bab 100644
--- a/libcxx/test/std/containers/associative/set/set.cons/alloc.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/set.cons/alloc.pass.cpp
@@ -18,14 +18,13 @@
#include "test_macros.h"
#include "test_allocator.h"
-int main(int, char**)
-{
- typedef std::less<int> C;
- typedef test_allocator<int> A;
- std::set<int, C, A> m(A(5));
- assert(m.empty());
- assert(m.begin() == m.end());
- assert(m.get_allocator() == A(5));
+int main(int, char**) {
+ typedef std::less<int> C;
+ typedef test_allocator<int> A;
+ std::set<int, C, A> m(A(5));
+ assert(m.empty());
+ assert(m.begin() == m.end());
+ assert(m.get_allocator() == A(5));
return 0;
}
diff --git a/libcxx/test/std/containers/associative/set/set.cons/assign_initializer_list.pass.cpp b/libcxx/test/std/containers/associative/set/set.cons/assign_initializer_list.pass.cpp
index 8b391ad079abf83..d674669fd255969 100644
--- a/libcxx/test/std/containers/associative/set/set.cons/assign_initializer_list.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/set.cons/assign_initializer_list.pass.cpp
@@ -26,7 +26,7 @@ void basic_test() {
typedef std::set<int> C;
typedef C::value_type V;
C m = {10, 8};
- m = {1, 2, 3, 4, 5, 6};
+ m = {1, 2, 3, 4, 5, 6};
assert(m.size() == 6);
assert(std::distance(m.begin(), m.end()) == 6);
C::const_iterator i = m.cbegin();
@@ -41,7 +41,7 @@ void basic_test() {
typedef std::set<int, std::less<int>, min_allocator<int> > C;
typedef C::value_type V;
C m = {10, 8};
- m = {1, 2, 3, 4, 5, 6};
+ m = {1, 2, 3, 4, 5, 6};
assert(m.size() == 6);
assert(std::distance(m.begin(), m.end()) == 6);
C::const_iterator i = m.cbegin();
diff --git a/libcxx/test/std/containers/associative/set/set.cons/compare.pass.cpp b/libcxx/test/std/containers/associative/set/set.cons/compare.pass.cpp
index 4cd3f3067c84168..03452142f5b85ab 100644
--- a/libcxx/test/std/containers/associative/set/set.cons/compare.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/set.cons/compare.pass.cpp
@@ -18,14 +18,13 @@
#include "test_macros.h"
#include "../../../test_compare.h"
-int main(int, char**)
-{
- typedef test_less<int> C;
- const std::set<int, C> m(C(3));
- assert(m.empty());
- assert(m.begin() == m.end());
- assert(m.key_comp() == C(3));
- assert(m.value_comp() == C(3));
+int main(int, char**) {
+ typedef test_less<int> C;
+ const std::set<int, C> m(C(3));
+ assert(m.empty());
+ assert(m.begin() == m.end());
+ assert(m.key_comp() == C(3));
+ assert(m.value_comp() == C(3));
return 0;
}
diff --git a/libcxx/test/std/containers/associative/set/set.cons/compare_alloc.pass.cpp b/libcxx/test/std/containers/associative/set/set.cons/compare_alloc.pass.cpp
index dfd89a16bcd070c..2ae0547054537d2 100644
--- a/libcxx/test/std/containers/associative/set/set.cons/compare_alloc.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/set.cons/compare_alloc.pass.cpp
@@ -19,15 +19,14 @@
#include "../../../test_compare.h"
#include "test_allocator.h"
-int main(int, char**)
-{
- typedef test_less<int> C;
- typedef test_allocator<int> A;
- std::set<int, C, A> m(C(4), A(5));
- assert(m.empty());
- assert(m.begin() == m.end());
- assert(m.key_comp() == C(4));
- assert(m.get_allocator() == A(5));
+int main(int, char**) {
+ typedef test_less<int> C;
+ typedef test_allocator<int> A;
+ std::set<int, C, A> m(C(4), A(5));
+ assert(m.empty());
+ assert(m.begin() == m.end());
+ assert(m.key_comp() == C(4));
+ assert(m.get_allocator() == A(5));
return 0;
}
diff --git a/libcxx/test/std/containers/associative/set/set.cons/compare_copy_constructible.compile.fail.cpp b/libcxx/test/std/containers/associative/set/set.cons/compare_copy_constructible.compile.fail.cpp
index 58f678dd1a415cd..f9ea45ca1756aab 100644
--- a/libcxx/test/std/containers/associative/set/set.cons/compare_copy_constructible.compile.fail.cpp
+++ b/libcxx/test/std/containers/associative/set/set.cons/compare_copy_constructible.compile.fail.cpp
@@ -15,16 +15,16 @@
template <class T>
struct Comp {
- bool operator () (const T& lhs, const T& rhs) const { return lhs < rhs; }
+ bool operator()(const T& lhs, const T& rhs) const { return lhs < rhs; }
- Comp () {}
-private:
- Comp (const Comp &); // declared but not defined
- };
+ Comp() {}
+private:
+ Comp(const Comp&); // declared but not defined
+};
int main(int, char**) {
- std::set<int, Comp<int> > m;
+ std::set<int, Comp<int> > m;
return 0;
}
diff --git a/libcxx/test/std/containers/associative/set/set.cons/copy.pass.cpp b/libcxx/test/std/containers/associative/set/set.cons/copy.pass.cpp
index 1d27cfbd3e722db..01a1b6ab59af00d 100644
--- a/libcxx/test/std/containers/associative/set/set.cons/copy.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/set.cons/copy.pass.cpp
@@ -20,77 +20,54 @@
#include "../../../test_compare.h"
#include "test_allocator.h"
-int main(int, char**)
-{
- {
- typedef int V;
- V ar[] =
- {
- 1,
- 1,
- 1,
- 2,
- 2,
- 2,
- 3,
- 3,
- 3
- };
- typedef test_less<int> C;
- typedef test_allocator<V> A;
- std::set<int, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(7));
- std::set<int, C, A> m = mo;
- assert(m.get_allocator() == A(7));
- assert(m.key_comp() == C(5));
- assert(m.size() == 3);
- assert(std::distance(m.begin(), m.end()) == 3);
- assert(*m.begin() == 1);
- assert(*std::next(m.begin()) == 2);
- assert(*std::next(m.begin(), 2) == 3);
+int main(int, char**) {
+ {
+ typedef int V;
+ V ar[] = {1, 1, 1, 2, 2, 2, 3, 3, 3};
+ typedef test_less<int> C;
+ typedef test_allocator<V> A;
+ std::set<int, C, A> mo(ar, ar + sizeof(ar) / sizeof(ar[0]), C(5), A(7));
+ std::set<int, C, A> m = mo;
+ assert(m.get_allocator() == A(7));
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 3);
+ assert(std::distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == 1);
+ assert(*std::next(m.begin()) == 2);
+ assert(*std::next(m.begin(), 2) == 3);
- assert(mo.get_allocator() == A(7));
- assert(mo.key_comp() == C(5));
- assert(mo.size() == 3);
- assert(std::distance(mo.begin(), mo.end()) == 3);
- assert(*mo.begin() == 1);
- assert(*std::next(mo.begin()) == 2);
- assert(*std::next(mo.begin(), 2) == 3);
- }
+ assert(mo.get_allocator() == A(7));
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 3);
+ assert(std::distance(mo.begin(), mo.end()) == 3);
+ assert(*mo.begin() == 1);
+ assert(*std::next(mo.begin()) == 2);
+ assert(*std::next(mo.begin(), 2) == 3);
+ }
#if TEST_STD_VER >= 11
- {
- typedef int V;
- V ar[] =
- {
- 1,
- 1,
- 1,
- 2,
- 2,
- 2,
- 3,
- 3,
- 3
- };
- typedef test_less<int> C;
- typedef other_allocator<V> A;
- std::set<int, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(7));
- std::set<int, C, A> m = mo;
- assert(m.get_allocator() == A(-2));
- assert(m.key_comp() == C(5));
- assert(m.size() == 3);
- assert(std::distance(m.begin(), m.end()) == 3);
- assert(*m.begin() == 1);
- assert(*std::next(m.begin()) == 2);
- assert(*std::next(m.begin(), 2) == 3);
+ {
+ typedef int V;
+ V ar[] = {1, 1, 1, 2, 2, 2, 3, 3, 3};
+ typedef test_less<int> C;
+ typedef other_allocator<V> A;
+ std::set<int, C, A> mo(ar, ar + sizeof(ar) / sizeof(ar[0]), C(5), A(7));
+ std::set<int, C, A> m = mo;
+ assert(m.get_allocator() == A(-2));
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 3);
+ assert(std::distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == 1);
+ assert(*std::next(m.begin()) == 2);
+ assert(*std::next(m.begin(), 2) == 3);
- assert(mo.get_allocator() == A(7));
- assert(mo.key_comp() == C(5));
- assert(mo.size() == 3);
- assert(std::distance(mo.begin(), mo.end()) == 3);
- assert(*mo.begin() == 1);
- assert(*std::next(mo.begin()) == 2);
- assert(*std::next(mo.begin(), 2) == 3);
- }
+ assert(mo.get_allocator() == A(7));
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 3);
+ assert(std::distance(mo.begin(), mo.end()) == 3);
+ assert(*mo.begin() == 1);
+ assert(*std::next(mo.begin()) == 2);
+ assert(*std::next(mo.begin(), 2) == 3);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/set/set.cons/copy_alloc.pass.cpp b/libcxx/test/std/containers/associative/set/set.cons/copy_alloc.pass.cpp
index 9d988d84a3795c6..8f9dd769329c0f9 100644
--- a/libcxx/test/std/containers/associative/set/set.cons/copy_alloc.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/set.cons/copy_alloc.pass.cpp
@@ -20,40 +20,28 @@
#include "../../../test_compare.h"
#include "test_allocator.h"
-int main(int, char**)
-{
- typedef int V;
- V ar[] =
- {
- 1,
- 1,
- 1,
- 2,
- 2,
- 2,
- 3,
- 3,
- 3
- };
- typedef test_less<int> C;
- typedef test_allocator<V> A;
- std::set<int, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(7));
- std::set<int, C, A> m(mo, A(3));
- assert(m.get_allocator() == A(3));
- assert(m.key_comp() == C(5));
- assert(m.size() == 3);
- assert(std::distance(m.begin(), m.end()) == 3);
- assert(*m.begin() == 1);
- assert(*std::next(m.begin()) == 2);
- assert(*std::next(m.begin(), 2) == 3);
-
- assert(mo.get_allocator() == A(7));
- assert(mo.key_comp() == C(5));
- assert(mo.size() == 3);
- assert(std::distance(mo.begin(), mo.end()) == 3);
- assert(*mo.begin() == 1);
- assert(*std::next(mo.begin()) == 2);
- assert(*std::next(mo.begin(), 2) == 3);
+int main(int, char**) {
+ typedef int V;
+ V ar[] = {1, 1, 1, 2, 2, 2, 3, 3, 3};
+ typedef test_less<int> C;
+ typedef test_allocator<V> A;
+ std::set<int, C, A> mo(ar, ar + sizeof(ar) / sizeof(ar[0]), C(5), A(7));
+ std::set<int, C, A> m(mo, A(3));
+ assert(m.get_allocator() == A(3));
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 3);
+ assert(std::distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == 1);
+ assert(*std::next(m.begin()) == 2);
+ assert(*std::next(m.begin(), 2) == 3);
+
+ assert(mo.get_allocator() == A(7));
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 3);
+ assert(std::distance(mo.begin(), mo.end()) == 3);
+ assert(*mo.begin() == 1);
+ assert(*std::next(mo.begin()) == 2);
+ assert(*std::next(mo.begin(), 2) == 3);
return 0;
}
diff --git a/libcxx/test/std/containers/associative/set/set.cons/copy_assign.pass.cpp b/libcxx/test/std/containers/associative/set/set.cons/copy_assign.pass.cpp
index 7d35ab62effa6ae..e21e07734d888bc 100644
--- a/libcxx/test/std/containers/associative/set/set.cons/copy_assign.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/set.cons/copy_assign.pass.cpp
@@ -20,93 +20,65 @@
#include "../../../test_compare.h"
#include "test_allocator.h"
-int main(int, char**)
-{
- {
- typedef int V;
- V ar[] =
- {
- 1,
- 1,
- 1,
- 2,
- 2,
- 2,
- 3,
- 3,
- 3
- };
- typedef test_less<int> C;
- typedef test_allocator<V> A;
- std::set<int, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(2));
- std::set<int, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0])/2, C(3), A(7));
- m = mo;
- assert(m.get_allocator() == A(7));
- assert(m.key_comp() == C(5));
- assert(m.size() == 3);
- assert(std::distance(m.begin(), m.end()) == 3);
- assert(*m.begin() == 1);
- assert(*std::next(m.begin()) == 2);
- assert(*std::next(m.begin(), 2) == 3);
+int main(int, char**) {
+ {
+ typedef int V;
+ V ar[] = {1, 1, 1, 2, 2, 2, 3, 3, 3};
+ typedef test_less<int> C;
+ typedef test_allocator<V> A;
+ std::set<int, C, A> mo(ar, ar + sizeof(ar) / sizeof(ar[0]), C(5), A(2));
+ std::set<int, C, A> m(ar, ar + sizeof(ar) / sizeof(ar[0]) / 2, C(3), A(7));
+ m = mo;
+ assert(m.get_allocator() == A(7));
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 3);
+ assert(std::distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == 1);
+ assert(*std::next(m.begin()) == 2);
+ assert(*std::next(m.begin(), 2) == 3);
- assert(mo.get_allocator() == A(2));
- assert(mo.key_comp() == C(5));
- assert(mo.size() == 3);
- assert(std::distance(mo.begin(), mo.end()) == 3);
- assert(*mo.begin() == 1);
- assert(*std::next(mo.begin()) == 2);
- assert(*std::next(mo.begin(), 2) == 3);
- }
- {
- typedef int V;
- const V ar[] =
- {
- 1,
- 2,
- 3
- };
- std::set<int> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- std::set<int> *p = &m;
- m = *p;
+ assert(mo.get_allocator() == A(2));
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 3);
+ assert(std::distance(mo.begin(), mo.end()) == 3);
+ assert(*mo.begin() == 1);
+ assert(*std::next(mo.begin()) == 2);
+ assert(*std::next(mo.begin(), 2) == 3);
+ }
+ {
+ typedef int V;
+ const V ar[] = {1, 2, 3};
+ std::set<int> m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ std::set<int>* p = &m;
+ m = *p;
- assert(m.size() == 3);
- assert(std::equal(m.begin(), m.end(), ar));
- }
- {
- typedef int V;
- V ar[] =
- {
- 1,
- 1,
- 1,
- 2,
- 2,
- 2,
- 3,
- 3,
- 3
- };
- typedef test_less<int> C;
- typedef other_allocator<V> A;
- std::set<int, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(2));
- std::set<int, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0])/2, C(3), A(7));
- m = mo;
- assert(m.get_allocator() == A(2));
- assert(m.key_comp() == C(5));
- assert(m.size() == 3);
- assert(std::distance(m.begin(), m.end()) == 3);
- assert(*m.begin() == 1);
- assert(*std::next(m.begin()) == 2);
- assert(*std::next(m.begin(), 2) == 3);
+ assert(m.size() == 3);
+ assert(std::equal(m.begin(), m.end(), ar));
+ }
+ {
+ typedef int V;
+ V ar[] = {1, 1, 1, 2, 2, 2, 3, 3, 3};
+ typedef test_less<int> C;
+ typedef other_allocator<V> A;
+ std::set<int, C, A> mo(ar, ar + sizeof(ar) / sizeof(ar[0]), C(5), A(2));
+ std::set<int, C, A> m(ar, ar + sizeof(ar) / sizeof(ar[0]) / 2, C(3), A(7));
+ m = mo;
+ assert(m.get_allocator() == A(2));
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 3);
+ assert(std::distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == 1);
+ assert(*std::next(m.begin()) == 2);
+ assert(*std::next(m.begin(), 2) == 3);
- assert(mo.get_allocator() == A(2));
- assert(mo.key_comp() == C(5));
- assert(mo.size() == 3);
- assert(std::distance(mo.begin(), mo.end()) == 3);
- assert(*mo.begin() == 1);
- assert(*std::next(mo.begin()) == 2);
- assert(*std::next(mo.begin(), 2) == 3);
- }
+ assert(mo.get_allocator() == A(2));
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 3);
+ assert(std::distance(mo.begin(), mo.end()) == 3);
+ assert(*mo.begin() == 1);
+ assert(*std::next(mo.begin()) == 2);
+ assert(*std::next(mo.begin(), 2) == 3);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/set/set.cons/deduct.pass.cpp b/libcxx/test/std/containers/associative/set/set.cons/deduct.pass.cpp
index 74e72b7b71de501..e26df4503ed415d 100644
--- a/libcxx/test/std/containers/associative/set/set.cons/deduct.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/set.cons/deduct.pass.cpp
@@ -52,37 +52,32 @@ struct NotAnAllocator {
friend bool operator<(NotAnAllocator, NotAnAllocator) { return false; }
};
-int main(int, char **) {
+int main(int, char**) {
{
- const int arr[] = { 1, 2, 1, INT_MAX, 3 };
+ const int arr[] = {1, 2, 1, INT_MAX, 3};
std::set s(std::begin(arr), std::end(arr));
ASSERT_SAME_TYPE(decltype(s), std::set<int>);
- const int expected_s[] = { 1, 2, 3, INT_MAX };
- assert(std::equal(s.begin(), s.end(), std::begin(expected_s),
- std::end(expected_s)));
+ const int expected_s[] = {1, 2, 3, INT_MAX};
+ assert(std::equal(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s)));
}
{
- const int arr[] = { 1, 2, 1, INT_MAX, 3 };
+ const int arr[] = {1, 2, 1, INT_MAX, 3};
std::set s(std::begin(arr), std::end(arr), std::greater<int>());
ASSERT_SAME_TYPE(decltype(s), std::set<int, std::greater<int> >);
- const int expected_s[] = { INT_MAX, 3, 2, 1 };
- assert(std::equal(s.begin(), s.end(), std::begin(expected_s),
- std::end(expected_s)));
+ const int expected_s[] = {INT_MAX, 3, 2, 1};
+ assert(std::equal(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s)));
}
{
- const int arr[] = { 1, 2, 1, INT_MAX, 3 };
- std::set s(std::begin(arr), std::end(arr), std::greater<int>(),
- test_allocator<int>(0, 42));
+ const int arr[] = {1, 2, 1, INT_MAX, 3};
+ std::set s(std::begin(arr), std::end(arr), std::greater<int>(), test_allocator<int>(0, 42));
- ASSERT_SAME_TYPE(decltype(s),
- std::set<int, std::greater<int>, test_allocator<int> >);
- const int expected_s[] = { INT_MAX, 3, 2, 1 };
- assert(std::equal(s.begin(), s.end(), std::begin(expected_s),
- std::end(expected_s)));
+ ASSERT_SAME_TYPE(decltype(s), std::set<int, std::greater<int>, test_allocator<int> >);
+ const int expected_s[] = {INT_MAX, 3, 2, 1};
+ assert(std::equal(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s)));
assert(s.get_allocator().get_id() == 42);
}
@@ -95,7 +90,7 @@ int main(int, char **) {
{
std::set<long> source;
- std::set s{ source }; // braces instead of parens
+ std::set s{source}; // braces instead of parens
ASSERT_SAME_TYPE(decltype(s), std::set<long>);
assert(s.size() == 0);
}
@@ -108,120 +103,111 @@ int main(int, char **) {
}
{
- std::set s{ 1, 2, 1, INT_MAX, 3 };
+ std::set s{1, 2, 1, INT_MAX, 3};
ASSERT_SAME_TYPE(decltype(s), std::set<int>);
- const int expected_s[] = { 1, 2, 3, INT_MAX };
- assert(std::equal(s.begin(), s.end(), std::begin(expected_s),
- std::end(expected_s)));
+ const int expected_s[] = {1, 2, 3, INT_MAX};
+ assert(std::equal(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s)));
}
{
- std::set s({ 1, 2, 1, INT_MAX, 3 }, std::greater<int>());
+ std::set s({1, 2, 1, INT_MAX, 3}, std::greater<int>());
ASSERT_SAME_TYPE(decltype(s), std::set<int, std::greater<int> >);
- const int expected_s[] = { INT_MAX, 3, 2, 1 };
- assert(std::equal(s.begin(), s.end(), std::begin(expected_s),
- std::end(expected_s)));
+ const int expected_s[] = {INT_MAX, 3, 2, 1};
+ assert(std::equal(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s)));
}
{
- std::set s({ 1, 2, 1, INT_MAX, 3 }, std::greater<int>(),
- test_allocator<int>(0, 43));
+ std::set s({1, 2, 1, INT_MAX, 3}, std::greater<int>(), test_allocator<int>(0, 43));
- ASSERT_SAME_TYPE(decltype(s),
- std::set<int, std::greater<int>, test_allocator<int> >);
- const int expected_s[] = { INT_MAX, 3, 2, 1 };
- assert(std::equal(s.begin(), s.end(), std::begin(expected_s),
- std::end(expected_s)));
+ ASSERT_SAME_TYPE(decltype(s), std::set<int, std::greater<int>, test_allocator<int> >);
+ const int expected_s[] = {INT_MAX, 3, 2, 1};
+ assert(std::equal(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s)));
assert(s.get_allocator().get_id() == 43);
}
{
- const int arr[] = { 1, 2, 1, INT_MAX, 3 };
+ const int arr[] = {1, 2, 1, INT_MAX, 3};
std::set s(std::begin(arr), std::end(arr), test_allocator<int>(0, 44));
- ASSERT_SAME_TYPE(decltype(s),
- std::set<int, std::less<int>, test_allocator<int> >);
- const int expected_s[] = { 1, 2, 3, INT_MAX };
- assert(std::equal(s.begin(), s.end(), std::begin(expected_s),
- std::end(expected_s)));
+ ASSERT_SAME_TYPE(decltype(s), std::set<int, std::less<int>, test_allocator<int> >);
+ const int expected_s[] = {1, 2, 3, INT_MAX};
+ assert(std::equal(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s)));
assert(s.get_allocator().get_id() == 44);
}
{
- std::set s({ 1, 2, 1, INT_MAX, 3 }, test_allocator<int>(0, 45));
+ std::set s({1, 2, 1, INT_MAX, 3}, test_allocator<int>(0, 45));
- ASSERT_SAME_TYPE(decltype(s),
- std::set<int, std::less<int>, test_allocator<int> >);
- const int expected_s[] = { 1, 2, 3, INT_MAX };
- assert(std::equal(s.begin(), s.end(), std::begin(expected_s),
- std::end(expected_s)));
+ ASSERT_SAME_TYPE(decltype(s), std::set<int, std::less<int>, test_allocator<int> >);
+ const int expected_s[] = {1, 2, 3, INT_MAX};
+ assert(std::equal(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s)));
assert(s.get_allocator().get_id() == 45);
}
{
NotAnAllocator a;
- std::set s{ a }; // set(initializer_list<NotAnAllocator>)
+ std::set s{a}; // set(initializer_list<NotAnAllocator>)
ASSERT_SAME_TYPE(decltype(s), std::set<NotAnAllocator>);
assert(s.size() == 1);
}
{
std::set<long> source;
- std::set s{ source, source }; // set(initializer_list<set<long>>)
+ std::set s{source, source}; // set(initializer_list<set<long>>)
ASSERT_SAME_TYPE(decltype(s), std::set<std::set<long> >);
assert(s.size() == 1);
}
{
NotAnAllocator a;
- std::set s{ a, a }; // set(initializer_list<NotAnAllocator>)
+ std::set s{a, a}; // set(initializer_list<NotAnAllocator>)
ASSERT_SAME_TYPE(decltype(s), std::set<NotAnAllocator>);
assert(s.size() == 1);
}
{
- int source[3] = { 3, 4, 5 };
+ int source[3] = {3, 4, 5};
std::set s(source, source + 3); // set(InputIterator, InputIterator)
ASSERT_SAME_TYPE(decltype(s), std::set<int>);
assert(s.size() == 3);
}
{
- int source[3] = { 3, 4, 5 };
- std::set s{ source, source + 3 }; // set(initializer_list<int*>)
- ASSERT_SAME_TYPE(decltype(s), std::set<int *>);
+ int source[3] = {3, 4, 5};
+ std::set s{source, source + 3}; // set(initializer_list<int*>)
+ ASSERT_SAME_TYPE(decltype(s), std::set<int*>);
assert(s.size() == 2);
}
#if TEST_STD_VER >= 23
- {
- using Range = std::array<int, 0>;
- using Comp = std::greater<int>;
- using DefaultComp = std::less<int>;
- using Alloc = test_allocator<int>;
-
- { // (from_range, range)
- std::set c(std::from_range, Range());
- static_assert(std::is_same_v<decltype(c), std::set<int>>);
- }
-
- { // (from_range, range, comp)
- std::set c(std::from_range, Range(), Comp());
- static_assert(std::is_same_v<decltype(c), std::set<int, Comp>>);
- }
-
- { // (from_range, range, comp, alloc)
- std::set c(std::from_range, Range(), Comp(), Alloc());
- static_assert(std::is_same_v<decltype(c), std::set<int, Comp, Alloc>>);
- }
-
- { // (from_range, range, alloc)
- std::set c(std::from_range, Range(), Alloc());
- static_assert(std::is_same_v<decltype(c), std::set<int, DefaultComp, Alloc>>);
- }
+ {
+ using Range = std::array<int, 0>;
+ using Comp = std::greater<int>;
+ using DefaultComp = std::less<int>;
+ using Alloc = test_allocator<int>;
+
+ { // (from_range, range)
+ std::set c(std::from_range, Range());
+ static_assert(std::is_same_v<decltype(c), std::set<int>>);
}
+
+ { // (from_range, range, comp)
+ std::set c(std::from_range, Range(), Comp());
+ static_assert(std::is_same_v<decltype(c), std::set<int, Comp>>);
+ }
+
+ { // (from_range, range, comp, alloc)
+ std::set c(std::from_range, Range(), Comp(), Alloc());
+ static_assert(std::is_same_v<decltype(c), std::set<int, Comp, Alloc>>);
+ }
+
+ { // (from_range, range, alloc)
+ std::set c(std::from_range, Range(), Alloc());
+ static_assert(std::is_same_v<decltype(c), std::set<int, DefaultComp, Alloc>>);
+ }
+ }
#endif
AssociativeContainerDeductionGuidesSfinaeAway<std::set, std::set<int>>();
diff --git a/libcxx/test/std/containers/associative/set/set.cons/deduct.verify.cpp b/libcxx/test/std/containers/associative/set/set.cons/deduct.verify.cpp
index 6e250f8fa21e680..8b8d70111e43045 100644
--- a/libcxx/test/std/containers/associative/set/set.cons/deduct.verify.cpp
+++ b/libcxx/test/std/containers/associative/set/set.cons/deduct.verify.cpp
@@ -36,7 +36,7 @@ struct NotAnAllocator {
friend bool operator<(NotAnAllocator, NotAnAllocator) { return false; }
};
-int main(int, char **) {
+int main(int, char**) {
{
// cannot deduce Key from nothing
std::set s;
diff --git a/libcxx/test/std/containers/associative/set/set.cons/default.pass.cpp b/libcxx/test/std/containers/associative/set/set.cons/default.pass.cpp
index 466f5132f3a880b..c41d7c3b9d3bd58 100644
--- a/libcxx/test/std/containers/associative/set/set.cons/default.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/set.cons/default.pass.cpp
@@ -18,38 +18,37 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
std::set<int> m;
assert(m.empty());
assert(m.begin() == m.end());
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
std::set<int, std::less<int>, min_allocator<int>> m;
assert(m.empty());
assert(m.begin() == m.end());
- }
- {
+ }
+ {
typedef explicit_allocator<int> A;
- {
- std::set<int, std::less<int>, A> m;
- assert(m.empty());
- assert(m.begin() == m.end());
- }
- {
- A a;
- std::set<int, std::less<int>, A> m(a);
- assert(m.empty());
- assert(m.begin() == m.end());
- }
+ {
+ std::set<int, std::less<int>, A> m;
+ assert(m.empty());
+ assert(m.begin() == m.end());
}
{
+ A a;
+ std::set<int, std::less<int>, A> m(a);
+ assert(m.empty());
+ assert(m.begin() == m.end());
+ }
+ }
+ {
std::set<int> m = {};
assert(m.empty());
assert(m.begin() == m.end());
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/set/set.cons/default_noexcept.pass.cpp b/libcxx/test/std/containers/associative/set/set.cons/default_noexcept.pass.cpp
index db97fea722bb18f..c01ac3b2fad0bcf 100644
--- a/libcxx/test/std/containers/associative/set/set.cons/default_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/set.cons/default_noexcept.pass.cpp
@@ -26,33 +26,31 @@
#include "test_allocator.h"
template <class T>
-struct some_comp
-{
- typedef T value_type;
- some_comp();
- bool operator()(const T&, const T&) const { return false; }
+struct some_comp {
+ typedef T value_type;
+ some_comp();
+ bool operator()(const T&, const T&) const { return false; }
};
-int main(int, char**)
-{
+int main(int, char**) {
#if defined(_LIBCPP_VERSION)
- {
- typedef std::set<MoveOnly> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
- }
- {
- typedef std::set<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
- }
+ {
+ typedef std::set<MoveOnly> C;
+ static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ }
+ {
+ typedef std::set<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
+ static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ }
#endif // _LIBCPP_VERSION
- {
- typedef std::set<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
- static_assert(!std::is_nothrow_default_constructible<C>::value, "");
- }
- {
- typedef std::set<MoveOnly, some_comp<MoveOnly>> C;
- static_assert(!std::is_nothrow_default_constructible<C>::value, "");
- }
+ {
+ typedef std::set<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
+ static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+ }
+ {
+ typedef std::set<MoveOnly, some_comp<MoveOnly>> C;
+ static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/set/set.cons/dtor_noexcept.pass.cpp b/libcxx/test/std/containers/associative/set/set.cons/dtor_noexcept.pass.cpp
index c9b73731c307819..63c0433477414a4 100644
--- a/libcxx/test/std/containers/associative/set/set.cons/dtor_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/set.cons/dtor_noexcept.pass.cpp
@@ -20,32 +20,30 @@
#include "test_allocator.h"
template <class T>
-struct some_comp
-{
- typedef T value_type;
- ~some_comp() noexcept(false);
- bool operator()(const T&, const T&) const { return false; }
+struct some_comp {
+ typedef T value_type;
+ ~some_comp() noexcept(false);
+ bool operator()(const T&, const T&) const { return false; }
};
-int main(int, char**)
-{
- {
- typedef std::set<MoveOnly> C;
- static_assert(std::is_nothrow_destructible<C>::value, "");
- }
- {
- typedef std::set<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_destructible<C>::value, "");
- }
- {
- typedef std::set<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_destructible<C>::value, "");
- }
+int main(int, char**) {
+ {
+ typedef std::set<MoveOnly> C;
+ static_assert(std::is_nothrow_destructible<C>::value, "");
+ }
+ {
+ typedef std::set<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
+ static_assert(std::is_nothrow_destructible<C>::value, "");
+ }
+ {
+ typedef std::set<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
+ static_assert(std::is_nothrow_destructible<C>::value, "");
+ }
#if defined(_LIBCPP_VERSION)
- {
- typedef std::set<MoveOnly, some_comp<MoveOnly>> C;
- static_assert(!std::is_nothrow_destructible<C>::value, "");
- }
+ {
+ typedef std::set<MoveOnly, some_comp<MoveOnly>> C;
+ static_assert(!std::is_nothrow_destructible<C>::value, "");
+ }
#endif // _LIBCPP_VERSION
return 0;
diff --git a/libcxx/test/std/containers/associative/set/set.cons/from_range.pass.cpp b/libcxx/test/std/containers/associative/set/set.cons/from_range.pass.cpp
index 4c9b4aaf262912d..3590b75065ad9e7 100644
--- a/libcxx/test/std/containers/associative/set/set.cons/from_range.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/set.cons/from_range.pass.cpp
@@ -24,13 +24,9 @@
void test_duplicates() {
using T = KeyValue;
- std::array input = {
- T{1, 'a'}, T{2, 'a'}, T{3, 'a'}, T{3, 'b'}, T{3, 'c'}, T{2, 'b'}, T{4, 'a'}
- };
- std::array expected = {
- T{1, 'a'}, T{2, 'b'}, T{3, 'c'}, T{4, 'a'}
- };
- auto c = std::set<T>(std::from_range, input);
+ std::array input = {T{1, 'a'}, T{2, 'a'}, T{3, 'a'}, T{3, 'b'}, T{3, 'c'}, T{2, 'b'}, T{4, 'a'}};
+ std::array expected = {T{1, 'a'}, T{2, 'b'}, T{3, 'c'}, T{4, 'a'}};
+ auto c = std::set<T>(std::from_range, input);
assert(std::ranges::is_permutation(expected, c));
}
diff --git a/libcxx/test/std/containers/associative/set/set.cons/initializer_list.pass.cpp b/libcxx/test/std/containers/associative/set/set.cons/initializer_list.pass.cpp
index 4d540c061f36924..48495712425be27 100644
--- a/libcxx/test/std/containers/associative/set/set.cons/initializer_list.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/set.cons/initializer_list.pass.cpp
@@ -20,9 +20,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::set<int> C;
typedef C::value_type V;
C m = {1, 2, 3, 4, 5, 6};
@@ -35,8 +34,8 @@ int main(int, char**)
assert(*++i == V(4));
assert(*++i == V(5));
assert(*++i == V(6));
- }
- {
+ }
+ {
typedef std::set<int, std::less<int>, min_allocator<int>> C;
typedef C::value_type V;
C m = {1, 2, 3, 4, 5, 6};
@@ -49,7 +48,7 @@ int main(int, char**)
assert(*++i == V(4));
assert(*++i == V(5));
assert(*++i == V(6));
- }
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/set/set.cons/initializer_list_compare.pass.cpp b/libcxx/test/std/containers/associative/set/set.cons/initializer_list_compare.pass.cpp
index f097ac85495562d..25684966078d685 100644
--- a/libcxx/test/std/containers/associative/set/set.cons/initializer_list_compare.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/set.cons/initializer_list_compare.pass.cpp
@@ -21,22 +21,21 @@
#include "test_macros.h"
#include "../../../test_compare.h"
-int main(int, char**)
-{
- typedef test_less<int> Cmp;
- typedef std::set<int, Cmp> C;
- typedef C::value_type V;
- C m({1, 2, 3, 4, 5, 6}, Cmp(10));
- assert(m.size() == 6);
- assert(std::distance(m.begin(), m.end()) == 6);
- C::const_iterator i = m.cbegin();
- assert(*i == V(1));
- assert(*++i == V(2));
- assert(*++i == V(3));
- assert(*++i == V(4));
- assert(*++i == V(5));
- assert(*++i == V(6));
- assert(m.key_comp() == Cmp(10));
+int main(int, char**) {
+ typedef test_less<int> Cmp;
+ typedef std::set<int, Cmp> C;
+ typedef C::value_type V;
+ C m({1, 2, 3, 4, 5, 6}, Cmp(10));
+ assert(m.size() == 6);
+ assert(std::distance(m.begin(), m.end()) == 6);
+ C::const_iterator i = m.cbegin();
+ assert(*i == V(1));
+ assert(*++i == V(2));
+ assert(*++i == V(3));
+ assert(*++i == V(4));
+ assert(*++i == V(5));
+ assert(*++i == V(6));
+ assert(m.key_comp() == Cmp(10));
return 0;
}
diff --git a/libcxx/test/std/containers/associative/set/set.cons/initializer_list_compare_alloc.pass.cpp b/libcxx/test/std/containers/associative/set/set.cons/initializer_list_compare_alloc.pass.cpp
index 46785ef3310c1bd..48649c3b281f4af 100644
--- a/libcxx/test/std/containers/associative/set/set.cons/initializer_list_compare_alloc.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/set.cons/initializer_list_compare_alloc.pass.cpp
@@ -23,9 +23,8 @@
#include "../../../test_compare.h"
#include "test_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef test_less<int> Cmp;
typedef test_allocator<int> A;
typedef std::set<int, Cmp, A> C;
@@ -42,8 +41,8 @@ int main(int, char**)
assert(*++i == V(6));
assert(m.key_comp() == Cmp(10));
assert(m.get_allocator() == A(4));
- }
- {
+ }
+ {
typedef test_less<int> Cmp;
typedef test_allocator<int> A;
typedef std::set<int, Cmp, A> C;
@@ -59,7 +58,7 @@ int main(int, char**)
assert(*++i == V(5));
assert(*++i == V(6));
assert(m.get_allocator() == A(4));
- }
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/set/set.cons/iter_iter.pass.cpp b/libcxx/test/std/containers/associative/set/set.cons/iter_iter.pass.cpp
index 9871d0f3902b54c..27a4e6a5f527df0 100644
--- a/libcxx/test/std/containers/associative/set/set.cons/iter_iter.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/set.cons/iter_iter.pass.cpp
@@ -20,53 +20,30 @@
#include "test_iterators.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef int V;
- V ar[] =
- {
- 1,
- 1,
- 1,
- 2,
- 2,
- 2,
- 3,
- 3,
- 3
- };
- std::set<V> m(cpp17_input_iterator<const int*>(ar),
- cpp17_input_iterator<const int*>(ar+sizeof(ar)/sizeof(ar[0])));
+ V ar[] = {1, 1, 1, 2, 2, 2, 3, 3, 3};
+ std::set<V> m(
+ cpp17_input_iterator<const int*>(ar), cpp17_input_iterator<const int*>(ar + sizeof(ar) / sizeof(ar[0])));
assert(m.size() == 3);
assert(std::distance(m.begin(), m.end()) == 3);
assert(*m.begin() == 1);
assert(*std::next(m.begin()) == 2);
assert(*std::next(m.begin(), 2) == 3);
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef int V;
- V ar[] =
- {
- 1,
- 1,
- 1,
- 2,
- 2,
- 2,
- 3,
- 3,
- 3
- };
- std::set<V, std::less<int>, min_allocator<int>> m(cpp17_input_iterator<const int*>(ar),
- cpp17_input_iterator<const int*>(ar+sizeof(ar)/sizeof(ar[0])));
+ V ar[] = {1, 1, 1, 2, 2, 2, 3, 3, 3};
+ std::set<V, std::less<int>, min_allocator<int>> m(
+ cpp17_input_iterator<const int*>(ar), cpp17_input_iterator<const int*>(ar + sizeof(ar) / sizeof(ar[0])));
assert(m.size() == 3);
assert(std::distance(m.begin(), m.end()) == 3);
assert(*m.begin() == 1);
assert(*std::next(m.begin()) == 2);
assert(*std::next(m.begin(), 2) == 3);
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/set/set.cons/iter_iter_alloc.pass.cpp b/libcxx/test/std/containers/associative/set/set.cons/iter_iter_alloc.pass.cpp
index 2cdad2adab174b5..dac553073f17773 100644
--- a/libcxx/test/std/containers/associative/set/set.cons/iter_iter_alloc.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/set.cons/iter_iter_alloc.pass.cpp
@@ -26,27 +26,17 @@
#include "../../../test_compare.h"
#include "test_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef int V;
- V ar[] =
- {
- 1,
- 1,
- 1,
- 2,
- 2,
- 2,
- 3,
- 3,
- 3
- };
+ V ar[] = {1, 1, 1, 2, 2, 2, 3, 3, 3};
typedef test_less<V> C;
typedef test_allocator<V> A;
- std::set<V, C, A> m(cpp17_input_iterator<const V*>(ar),
- cpp17_input_iterator<const V*>(ar+sizeof(ar)/sizeof(ar[0])),
- C(5), A(7));
+ std::set<V, C, A> m(
+ cpp17_input_iterator<const V*>(ar),
+ cpp17_input_iterator<const V*>(ar + sizeof(ar) / sizeof(ar[0])),
+ C(5),
+ A(7));
assert(m.value_comp() == C(5));
assert(m.get_allocator() == A(7));
assert(m.size() == 3);
@@ -54,26 +44,15 @@ int main(int, char**)
assert(*m.begin() == 1);
assert(*std::next(m.begin()) == 2);
assert(*std::next(m.begin(), 2) == 3);
- }
+ }
#if TEST_STD_VER > 11
- {
+ {
typedef int V;
- V ar[] =
- {
- 1,
- 1,
- 1,
- 2,
- 2,
- 2,
- 3,
- 3,
- 3
- };
+ V ar[] = {1, 1, 1, 2, 2, 2, 3, 3, 3};
typedef test_allocator<V> A;
typedef test_less<int> C;
A a(7);
- std::set<V, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0]), a);
+ std::set<V, C, A> m(ar, ar + sizeof(ar) / sizeof(ar[0]), a);
assert(m.size() == 3);
assert(std::distance(m.begin(), m.end()) == 3);
@@ -81,7 +60,7 @@ int main(int, char**)
assert(*std::next(m.begin()) == 2);
assert(*std::next(m.begin(), 2) == 3);
assert(m.get_allocator() == a);
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/set/set.cons/iter_iter_comp.pass.cpp b/libcxx/test/std/containers/associative/set/set.cons/iter_iter_comp.pass.cpp
index c783282149a00b7..573bbd316e07328 100644
--- a/libcxx/test/std/containers/associative/set/set.cons/iter_iter_comp.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/set.cons/iter_iter_comp.pass.cpp
@@ -20,30 +20,18 @@
#include "test_iterators.h"
#include "../../../test_compare.h"
-int main(int, char**)
-{
- typedef int V;
- V ar[] =
- {
- 1,
- 1,
- 1,
- 2,
- 2,
- 2,
- 3,
- 3,
- 3
- };
- typedef test_less<V> C;
- std::set<V, C> m(cpp17_input_iterator<const V*>(ar),
- cpp17_input_iterator<const V*>(ar+sizeof(ar)/sizeof(ar[0])), C(5));
- assert(m.value_comp() == C(5));
- assert(m.size() == 3);
- assert(std::distance(m.begin(), m.end()) == 3);
- assert(*m.begin() == 1);
- assert(*std::next(m.begin()) == 2);
- assert(*std::next(m.begin(), 2) == 3);
+int main(int, char**) {
+ typedef int V;
+ V ar[] = {1, 1, 1, 2, 2, 2, 3, 3, 3};
+ typedef test_less<V> C;
+ std::set<V, C> m(
+ cpp17_input_iterator<const V*>(ar), cpp17_input_iterator<const V*>(ar + sizeof(ar) / sizeof(ar[0])), C(5));
+ assert(m.value_comp() == C(5));
+ assert(m.size() == 3);
+ assert(std::distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == 1);
+ assert(*std::next(m.begin()) == 2);
+ assert(*std::next(m.begin(), 2) == 3);
return 0;
}
diff --git a/libcxx/test/std/containers/associative/set/set.cons/move.pass.cpp b/libcxx/test/std/containers/associative/set/set.cons/move.pass.cpp
index 3d6ab89ccf82faf..2c1ec22ab257dce 100644
--- a/libcxx/test/std/containers/associative/set/set.cons/move.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/set.cons/move.pass.cpp
@@ -22,88 +22,65 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef int V;
- typedef test_less<int> C;
- typedef test_allocator<V> A;
- std::set<int, C, A> mo(C(5), A(7));
- std::set<int, C, A> m = std::move(mo);
- assert(m.get_allocator() == A(7));
- assert(m.key_comp() == C(5));
- assert(m.size() == 0);
- assert(std::distance(m.begin(), m.end()) == 0);
+int main(int, char**) {
+ {
+ typedef int V;
+ typedef test_less<int> C;
+ typedef test_allocator<V> A;
+ std::set<int, C, A> mo(C(5), A(7));
+ std::set<int, C, A> m = std::move(mo);
+ assert(m.get_allocator() == A(7));
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 0);
+ assert(std::distance(m.begin(), m.end()) == 0);
- assert(mo.get_allocator() == A(7));
- assert(mo.get_allocator().get_id() == test_alloc_base::moved_value);
- assert(mo.key_comp() == C(5));
- assert(mo.size() == 0);
- assert(std::distance(mo.begin(), mo.end()) == 0);
- }
- {
- typedef int V;
- V ar[] =
- {
- 1,
- 1,
- 1,
- 2,
- 2,
- 2,
- 3,
- 3,
- 3
- };
- typedef test_less<int> C;
- typedef test_allocator<V> A;
- std::set<int, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(7));
- std::set<int, C, A> m = std::move(mo);
- assert(m.get_allocator() == A(7));
- assert(m.key_comp() == C(5));
- assert(m.size() == 3);
- assert(std::distance(m.begin(), m.end()) == 3);
- assert(*m.begin() == 1);
- assert(*std::next(m.begin()) == 2);
- assert(*std::next(m.begin(), 2) == 3);
+ assert(mo.get_allocator() == A(7));
+ assert(mo.get_allocator().get_id() == test_alloc_base::moved_value);
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 0);
+ assert(std::distance(mo.begin(), mo.end()) == 0);
+ }
+ {
+ typedef int V;
+ V ar[] = {1, 1, 1, 2, 2, 2, 3, 3, 3};
+ typedef test_less<int> C;
+ typedef test_allocator<V> A;
+ std::set<int, C, A> mo(ar, ar + sizeof(ar) / sizeof(ar[0]), C(5), A(7));
+ std::set<int, C, A> m = std::move(mo);
+ assert(m.get_allocator() == A(7));
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 3);
+ assert(std::distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == 1);
+ assert(*std::next(m.begin()) == 2);
+ assert(*std::next(m.begin(), 2) == 3);
- assert(mo.get_allocator() == A(7));
- assert(mo.get_allocator().get_id() == test_alloc_base::moved_value);
- assert(mo.key_comp() == C(5));
- assert(mo.size() == 0);
- assert(std::distance(mo.begin(), mo.end()) == 0);
- }
- {
- typedef int V;
- V ar[] =
- {
- 1,
- 1,
- 1,
- 2,
- 2,
- 2,
- 3,
- 3,
- 3
- };
- typedef test_less<int> C;
- typedef min_allocator<V> A;
- std::set<int, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
- std::set<int, C, A> m = std::move(mo);
- assert(m.get_allocator() == A());
- assert(m.key_comp() == C(5));
- assert(m.size() == 3);
- assert(std::distance(m.begin(), m.end()) == 3);
- assert(*m.begin() == 1);
- assert(*std::next(m.begin()) == 2);
- assert(*std::next(m.begin(), 2) == 3);
+ assert(mo.get_allocator() == A(7));
+ assert(mo.get_allocator().get_id() == test_alloc_base::moved_value);
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 0);
+ assert(std::distance(mo.begin(), mo.end()) == 0);
+ }
+ {
+ typedef int V;
+ V ar[] = {1, 1, 1, 2, 2, 2, 3, 3, 3};
+ typedef test_less<int> C;
+ typedef min_allocator<V> A;
+ std::set<int, C, A> mo(ar, ar + sizeof(ar) / sizeof(ar[0]), C(5), A());
+ std::set<int, C, A> m = std::move(mo);
+ assert(m.get_allocator() == A());
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 3);
+ assert(std::distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == 1);
+ assert(*std::next(m.begin()) == 2);
+ assert(*std::next(m.begin(), 2) == 3);
- assert(mo.get_allocator() == A());
- assert(mo.key_comp() == C(5));
- assert(mo.size() == 0);
- assert(std::distance(mo.begin(), mo.end()) == 0);
- }
+ assert(mo.get_allocator() == A());
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 0);
+ assert(std::distance(mo.begin(), mo.end()) == 0);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/set/set.cons/move_alloc.pass.cpp b/libcxx/test/std/containers/associative/set/set.cons/move_alloc.pass.cpp
index 886cad9fa2123aa..c85463bd391ca4c 100644
--- a/libcxx/test/std/containers/associative/set/set.cons/move_alloc.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/set.cons/move_alloc.pass.cpp
@@ -24,171 +24,92 @@
#include "test_allocator.h"
#include "Counter.h"
-int main(int, char**)
-{
+int main(int, char**) {
+ {
+ typedef MoveOnly V;
+ typedef test_less<MoveOnly> C;
+ typedef test_allocator<V> A;
+ typedef std::set<MoveOnly, C, A> M;
+ typedef std::move_iterator<V*> I;
+ V a1[] = {V(1), V(1), V(1), V(2), V(2), V(2), V(3), V(3), V(3)};
+ M m1(I(a1), I(a1 + sizeof(a1) / sizeof(a1[0])), C(5), A(7));
+ V a2[] = {V(1), V(1), V(1), V(2), V(2), V(2), V(3), V(3), V(3)};
+ M m2(I(a2), I(a2 + sizeof(a2) / sizeof(a2[0])), C(5), A(7));
+ M m3(std::move(m1), A(7));
+ assert(m3 == m2);
+ assert(m3.get_allocator() == A(7));
+ assert(m3.key_comp() == C(5));
+ LIBCPP_ASSERT(m1.empty());
+ }
+ {
+ typedef MoveOnly V;
+ typedef test_less<MoveOnly> C;
+ typedef test_allocator<V> A;
+ typedef std::set<MoveOnly, C, A> M;
+ typedef std::move_iterator<V*> I;
+ V a1[] = {V(1), V(1), V(1), V(2), V(2), V(2), V(3), V(3), V(3)};
+ M m1(I(a1), I(a1 + sizeof(a1) / sizeof(a1[0])), C(5), A(7));
+ V a2[] = {V(1), V(1), V(1), V(2), V(2), V(2), V(3), V(3), V(3)};
+ M m2(I(a2), I(a2 + sizeof(a2) / sizeof(a2[0])), C(5), A(7));
+ M m3(std::move(m1), A(5));
+ assert(m3 == m2);
+ assert(m3.get_allocator() == A(5));
+ assert(m3.key_comp() == C(5));
+ LIBCPP_ASSERT(m1.empty());
+ }
+ {
+ typedef MoveOnly V;
+ typedef test_less<MoveOnly> C;
+ typedef other_allocator<V> A;
+ typedef std::set<MoveOnly, C, A> M;
+ typedef std::move_iterator<V*> I;
+ V a1[] = {V(1), V(1), V(1), V(2), V(2), V(2), V(3), V(3), V(3)};
+ M m1(I(a1), I(a1 + sizeof(a1) / sizeof(a1[0])), C(5), A(7));
+ V a2[] = {V(1), V(1), V(1), V(2), V(2), V(2), V(3), V(3), V(3)};
+ M m2(I(a2), I(a2 + sizeof(a2) / sizeof(a2[0])), C(5), A(7));
+ M m3(std::move(m1), A(5));
+ assert(m3 == m2);
+ assert(m3.get_allocator() == A(5));
+ assert(m3.key_comp() == C(5));
+ LIBCPP_ASSERT(m1.empty());
+ }
+ {
+ typedef Counter<int> V;
+ typedef std::less<V> C;
+ typedef test_allocator<V> A;
+ typedef std::set<V, C, A> M;
+ typedef V* I;
+ Counter_base::gConstructed = 0;
{
- typedef MoveOnly V;
- typedef test_less<MoveOnly> C;
- typedef test_allocator<V> A;
- typedef std::set<MoveOnly, C, A> M;
- typedef std::move_iterator<V*> I;
- V a1[] =
- {
- V(1),
- V(1),
- V(1),
- V(2),
- V(2),
- V(2),
- V(3),
- V(3),
- V(3)
- };
- M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A(7));
- V a2[] =
- {
- V(1),
- V(1),
- V(1),
- V(2),
- V(2),
- V(2),
- V(3),
- V(3),
- V(3)
- };
- M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A(7));
- M m3(std::move(m1), A(7));
- assert(m3 == m2);
- assert(m3.get_allocator() == A(7));
- assert(m3.key_comp() == C(5));
- LIBCPP_ASSERT(m1.empty());
- }
- {
- typedef MoveOnly V;
- typedef test_less<MoveOnly> C;
- typedef test_allocator<V> A;
- typedef std::set<MoveOnly, C, A> M;
- typedef std::move_iterator<V*> I;
- V a1[] =
- {
- V(1),
- V(1),
- V(1),
- V(2),
- V(2),
- V(2),
- V(3),
- V(3),
- V(3)
- };
- M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A(7));
- V a2[] =
- {
- V(1),
- V(1),
- V(1),
- V(2),
- V(2),
- V(2),
- V(3),
- V(3),
- V(3)
- };
- M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A(7));
- M m3(std::move(m1), A(5));
- assert(m3 == m2);
- assert(m3.get_allocator() == A(5));
- assert(m3.key_comp() == C(5));
- LIBCPP_ASSERT(m1.empty());
- }
- {
- typedef MoveOnly V;
- typedef test_less<MoveOnly> C;
- typedef other_allocator<V> A;
- typedef std::set<MoveOnly, C, A> M;
- typedef std::move_iterator<V*> I;
- V a1[] =
- {
- V(1),
- V(1),
- V(1),
- V(2),
- V(2),
- V(2),
- V(3),
- V(3),
- V(3)
- };
- M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A(7));
- V a2[] =
- {
- V(1),
- V(1),
- V(1),
- V(2),
- V(2),
- V(2),
- V(3),
- V(3),
- V(3)
- };
- M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A(7));
- M m3(std::move(m1), A(5));
- assert(m3 == m2);
- assert(m3.get_allocator() == A(5));
- assert(m3.key_comp() == C(5));
- LIBCPP_ASSERT(m1.empty());
- }
- {
- typedef Counter<int> V;
- typedef std::less<V> C;
- typedef test_allocator<V> A;
- typedef std::set<V, C, A> M;
- typedef V* I;
- Counter_base::gConstructed = 0;
- {
- V a1[] =
- {
- V(1),
- V(1),
- V(1),
- V(2),
- V(2),
- V(2),
- V(3),
- V(3),
- V(3)
- };
- const std::size_t num = sizeof(a1)/sizeof(a1[0]);
- assert(Counter_base::gConstructed == num);
+ V a1[] = {V(1), V(1), V(1), V(2), V(2), V(2), V(3), V(3), V(3)};
+ const std::size_t num = sizeof(a1) / sizeof(a1[0]);
+ assert(Counter_base::gConstructed == num);
- M m1(I(a1), I(a1+num), C(), A());
- assert(Counter_base::gConstructed == 3+num);
+ M m1(I(a1), I(a1 + num), C(), A());
+ assert(Counter_base::gConstructed == 3 + num);
- M m2(m1);
- assert(m2 == m1);
- assert(Counter_base::gConstructed == 6+num);
+ M m2(m1);
+ assert(m2 == m1);
+ assert(Counter_base::gConstructed == 6 + num);
- M m3(std::move(m1), A());
- assert(m3 == m2);
- LIBCPP_ASSERT(m1.empty());
- assert(Counter_base::gConstructed >= (int)(6+num));
- assert(Counter_base::gConstructed <= (int)(m1.size()+6+num));
+ M m3(std::move(m1), A());
+ assert(m3 == m2);
+ LIBCPP_ASSERT(m1.empty());
+ assert(Counter_base::gConstructed >= (int)(6 + num));
+ assert(Counter_base::gConstructed <= (int)(m1.size() + 6 + num));
- {
- M m4(std::move(m2), A(5));
- assert(Counter_base::gConstructed >= (int)(6+num));
- assert(Counter_base::gConstructed <= (int)(m1.size()+m2.size()+6+num));
- assert(m4 == m3);
- LIBCPP_ASSERT(m2.empty());
- }
- assert(Counter_base::gConstructed >= (int)(3+num));
- assert(Counter_base::gConstructed <= (int)(m1.size()+m2.size()+3+num));
- }
- assert(Counter_base::gConstructed == 0);
+ {
+ M m4(std::move(m2), A(5));
+ assert(Counter_base::gConstructed >= (int)(6 + num));
+ assert(Counter_base::gConstructed <= (int)(m1.size() + m2.size() + 6 + num));
+ assert(m4 == m3);
+ LIBCPP_ASSERT(m2.empty());
+ }
+ assert(Counter_base::gConstructed >= (int)(3 + num));
+ assert(Counter_base::gConstructed <= (int)(m1.size() + m2.size() + 3 + num));
}
-
+ assert(Counter_base::gConstructed == 0);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/set/set.cons/move_assign.pass.cpp b/libcxx/test/std/containers/associative/set/set.cons/move_assign.pass.cpp
index ea85051aa4cc208..bacd58c172a1286 100644
--- a/libcxx/test/std/containers/associative/set/set.cons/move_assign.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/set.cons/move_assign.pass.cpp
@@ -23,164 +23,75 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef MoveOnly V;
- typedef test_less<MoveOnly> C;
- typedef test_allocator<V> A;
- typedef std::set<MoveOnly, C, A> M;
- typedef std::move_iterator<V*> I;
- V a1[] =
- {
- V(1),
- V(1),
- V(1),
- V(2),
- V(2),
- V(2),
- V(3),
- V(3),
- V(3)
- };
- M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A(7));
- V a2[] =
- {
- V(1),
- V(1),
- V(1),
- V(2),
- V(2),
- V(2),
- V(3),
- V(3),
- V(3)
- };
- M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A(7));
- M m3(C(3), A(7));
- m3 = std::move(m1);
- assert(m3 == m2);
- assert(m3.get_allocator() == A(7));
- assert(m3.key_comp() == C(5));
- assert(m1.empty());
- }
- {
- typedef MoveOnly V;
- typedef test_less<MoveOnly> C;
- typedef test_allocator<V> A;
- typedef std::set<MoveOnly, C, A> M;
- typedef std::move_iterator<V*> I;
- V a1[] =
- {
- V(1),
- V(1),
- V(1),
- V(2),
- V(2),
- V(2),
- V(3),
- V(3),
- V(3)
- };
- M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A(7));
- V a2[] =
- {
- V(1),
- V(1),
- V(1),
- V(2),
- V(2),
- V(2),
- V(3),
- V(3),
- V(3)
- };
- M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A(7));
- M m3(C(3), A(5));
- m3 = std::move(m1);
- assert(m3 == m2);
- assert(m3.get_allocator() == A(5));
- assert(m3.key_comp() == C(5));
- LIBCPP_ASSERT(m1.empty());
- }
- {
- typedef MoveOnly V;
- typedef test_less<MoveOnly> C;
- typedef other_allocator<V> A;
- typedef std::set<MoveOnly, C, A> M;
- typedef std::move_iterator<V*> I;
- V a1[] =
- {
- V(1),
- V(1),
- V(1),
- V(2),
- V(2),
- V(2),
- V(3),
- V(3),
- V(3)
- };
- M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A(7));
- V a2[] =
- {
- V(1),
- V(1),
- V(1),
- V(2),
- V(2),
- V(2),
- V(3),
- V(3),
- V(3)
- };
- M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A(7));
- M m3(C(3), A(5));
- m3 = std::move(m1);
- assert(m3 == m2);
- assert(m3.get_allocator() == A(7));
- assert(m3.key_comp() == C(5));
- assert(m1.empty());
- }
- {
- typedef MoveOnly V;
- typedef test_less<MoveOnly> C;
- typedef min_allocator<V> A;
- typedef std::set<MoveOnly, C, A> M;
- typedef std::move_iterator<V*> I;
- V a1[] =
- {
- V(1),
- V(1),
- V(1),
- V(2),
- V(2),
- V(2),
- V(3),
- V(3),
- V(3)
- };
- M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A());
- V a2[] =
- {
- V(1),
- V(1),
- V(1),
- V(2),
- V(2),
- V(2),
- V(3),
- V(3),
- V(3)
- };
- M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A());
- M m3(C(3), A());
- m3 = std::move(m1);
- assert(m3 == m2);
- assert(m3.get_allocator() == A());
- assert(m3.key_comp() == C(5));
- assert(m1.empty());
- }
+int main(int, char**) {
+ {
+ typedef MoveOnly V;
+ typedef test_less<MoveOnly> C;
+ typedef test_allocator<V> A;
+ typedef std::set<MoveOnly, C, A> M;
+ typedef std::move_iterator<V*> I;
+ V a1[] = {V(1), V(1), V(1), V(2), V(2), V(2), V(3), V(3), V(3)};
+ M m1(I(a1), I(a1 + sizeof(a1) / sizeof(a1[0])), C(5), A(7));
+ V a2[] = {V(1), V(1), V(1), V(2), V(2), V(2), V(3), V(3), V(3)};
+ M m2(I(a2), I(a2 + sizeof(a2) / sizeof(a2[0])), C(5), A(7));
+ M m3(C(3), A(7));
+ m3 = std::move(m1);
+ assert(m3 == m2);
+ assert(m3.get_allocator() == A(7));
+ assert(m3.key_comp() == C(5));
+ assert(m1.empty());
+ }
+ {
+ typedef MoveOnly V;
+ typedef test_less<MoveOnly> C;
+ typedef test_allocator<V> A;
+ typedef std::set<MoveOnly, C, A> M;
+ typedef std::move_iterator<V*> I;
+ V a1[] = {V(1), V(1), V(1), V(2), V(2), V(2), V(3), V(3), V(3)};
+ M m1(I(a1), I(a1 + sizeof(a1) / sizeof(a1[0])), C(5), A(7));
+ V a2[] = {V(1), V(1), V(1), V(2), V(2), V(2), V(3), V(3), V(3)};
+ M m2(I(a2), I(a2 + sizeof(a2) / sizeof(a2[0])), C(5), A(7));
+ M m3(C(3), A(5));
+ m3 = std::move(m1);
+ assert(m3 == m2);
+ assert(m3.get_allocator() == A(5));
+ assert(m3.key_comp() == C(5));
+ LIBCPP_ASSERT(m1.empty());
+ }
+ {
+ typedef MoveOnly V;
+ typedef test_less<MoveOnly> C;
+ typedef other_allocator<V> A;
+ typedef std::set<MoveOnly, C, A> M;
+ typedef std::move_iterator<V*> I;
+ V a1[] = {V(1), V(1), V(1), V(2), V(2), V(2), V(3), V(3), V(3)};
+ M m1(I(a1), I(a1 + sizeof(a1) / sizeof(a1[0])), C(5), A(7));
+ V a2[] = {V(1), V(1), V(1), V(2), V(2), V(2), V(3), V(3), V(3)};
+ M m2(I(a2), I(a2 + sizeof(a2) / sizeof(a2[0])), C(5), A(7));
+ M m3(C(3), A(5));
+ m3 = std::move(m1);
+ assert(m3 == m2);
+ assert(m3.get_allocator() == A(7));
+ assert(m3.key_comp() == C(5));
+ assert(m1.empty());
+ }
+ {
+ typedef MoveOnly V;
+ typedef test_less<MoveOnly> C;
+ typedef min_allocator<V> A;
+ typedef std::set<MoveOnly, C, A> M;
+ typedef std::move_iterator<V*> I;
+ V a1[] = {V(1), V(1), V(1), V(2), V(2), V(2), V(3), V(3), V(3)};
+ M m1(I(a1), I(a1 + sizeof(a1) / sizeof(a1[0])), C(5), A());
+ V a2[] = {V(1), V(1), V(1), V(2), V(2), V(2), V(3), V(3), V(3)};
+ M m2(I(a2), I(a2 + sizeof(a2) / sizeof(a2[0])), C(5), A());
+ M m3(C(3), A());
+ m3 = std::move(m1);
+ assert(m3 == m2);
+ assert(m3.get_allocator() == A());
+ assert(m3.key_comp() == C(5));
+ assert(m1.empty());
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/set/set.cons/move_noexcept.pass.cpp b/libcxx/test/std/containers/associative/set/set.cons/move_noexcept.pass.cpp
index d99b853a4011912..9325b8d1f40de75 100644
--- a/libcxx/test/std/containers/associative/set/set.cons/move_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/set.cons/move_noexcept.pass.cpp
@@ -24,33 +24,31 @@
#include "test_allocator.h"
template <class T>
-struct some_comp
-{
- typedef T value_type;
- some_comp(const some_comp&);
- bool operator()(const T&, const T&) const { return false; }
+struct some_comp {
+ typedef T value_type;
+ some_comp(const some_comp&);
+ bool operator()(const T&, const T&) const { return false; }
};
-int main(int, char**)
-{
+int main(int, char**) {
#if defined(_LIBCPP_VERSION)
- {
- typedef std::set<MoveOnly> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
- }
- {
- typedef std::set<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
- }
- {
- typedef std::set<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
- }
+ {
+ typedef std::set<MoveOnly> C;
+ static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ }
+ {
+ typedef std::set<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
+ static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ }
+ {
+ typedef std::set<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
+ static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ }
#endif // _LIBCPP_VERSION
- {
- typedef std::set<MoveOnly, some_comp<MoveOnly>> C;
- static_assert(!std::is_nothrow_move_constructible<C>::value, "");
- }
+ {
+ typedef std::set<MoveOnly, some_comp<MoveOnly>> C;
+ static_assert(!std::is_nothrow_move_constructible<C>::value, "");
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/set/set.erasure/erase_if.pass.cpp b/libcxx/test/std/containers/associative/set/set.erasure/erase_if.pass.cpp
index 2e0f026376ac5ed..b076b310596108f 100644
--- a/libcxx/test/std/containers/associative/set/set.erasure/erase_if.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/set.erasure/erase_if.pass.cpp
@@ -27,41 +27,39 @@ void test0(S s, Pred p, S expected, std::size_t expected_erased_count) {
}
template <typename S>
-void test()
-{
- auto is1 = [](auto v) { return v == 1;};
- auto is2 = [](auto v) { return v == 2;};
- auto is3 = [](auto v) { return v == 3;};
- auto is4 = [](auto v) { return v == 4;};
- auto True = [](auto) { return true; };
- auto False = [](auto) { return false; };
+void test() {
+ auto is1 = [](auto v) { return v == 1; };
+ auto is2 = [](auto v) { return v == 2; };
+ auto is3 = [](auto v) { return v == 3; };
+ auto is4 = [](auto v) { return v == 4; };
+ auto True = [](auto) { return true; };
+ auto False = [](auto) { return false; };
- test0(S(), is1, S(), 0);
+ test0(S(), is1, S(), 0);
- test0(S({1}), is1, S(), 1);
- test0(S({1}), is2, S({1}), 0);
+ test0(S({1}), is1, S(), 1);
+ test0(S({1}), is2, S({1}), 0);
- test0(S({1, 2}), is1, S({2}), 1);
- test0(S({1, 2}), is2, S({1}), 1);
- test0(S({1, 2}), is3, S({1, 2}), 0);
+ test0(S({1, 2}), is1, S({2}), 1);
+ test0(S({1, 2}), is2, S({1}), 1);
+ test0(S({1, 2}), is3, S({1, 2}), 0);
- test0(S({1, 2, 3}), is1, S({2, 3}), 1);
- test0(S({1, 2, 3}), is2, S({1, 3}), 1);
- test0(S({1, 2, 3}), is3, S({1, 2}), 1);
- test0(S({1, 2, 3}), is4, S({1, 2, 3}), 0);
+ test0(S({1, 2, 3}), is1, S({2, 3}), 1);
+ test0(S({1, 2, 3}), is2, S({1, 3}), 1);
+ test0(S({1, 2, 3}), is3, S({1, 2}), 1);
+ test0(S({1, 2, 3}), is4, S({1, 2, 3}), 0);
- test0(S({1, 2, 3}), True, S(), 3);
- test0(S({1, 2, 3}), False, S({1, 2, 3}), 0);
+ test0(S({1, 2, 3}), True, S(), 3);
+ test0(S({1, 2, 3}), False, S({1, 2, 3}), 0);
}
-int main(int, char**)
-{
- test<std::set<int>>();
- test<std::set<int, std::less<int>, min_allocator<int>>> ();
- test<std::set<int, std::less<int>, test_allocator<int>>> ();
+int main(int, char**) {
+ test<std::set<int>>();
+ test<std::set<int, std::less<int>, min_allocator<int>>>();
+ test<std::set<int, std::less<int>, test_allocator<int>>>();
- test<std::set<long>>();
- test<std::set<double>>();
+ test<std::set<long>>();
+ test<std::set<double>>();
return 0;
}
diff --git a/libcxx/test/std/containers/associative/set/set.nonmember/op_compare.pass.cpp b/libcxx/test/std/containers/associative/set/set.nonmember/op_compare.pass.cpp
index cc427fdd85a0fc4..1be07ce88529824 100644
--- a/libcxx/test/std/containers/associative/set/set.nonmember/op_compare.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/set.nonmember/op_compare.pass.cpp
@@ -39,27 +39,27 @@
#include "test_comparisons.h"
int main(int, char**) {
- {
- std::set<int> s1, s2;
- s1.insert(1);
- s2.insert(2);
- const std::set<int>& cs1 = s1, cs2 = s2;
- assert(testComparisons(cs1, cs2, false, true));
- }
- {
- std::set<int> s1, s2;
- s1.insert(1);
- s2.insert(1);
- const std::set<int>& cs1 = s1, cs2 = s2;
- assert(testComparisons(cs1, cs2, true, false));
- }
- {
- std::set<int> s1, s2;
- s1.insert(1);
- s2.insert(1);
- s2.insert(2);
- const std::set<int>& cs1 = s1, cs2 = s2;
- assert(testComparisons(cs1, cs2, false, true));
- }
- return 0;
+ {
+ std::set<int> s1, s2;
+ s1.insert(1);
+ s2.insert(2);
+ const std::set<int>&cs1 = s1, cs2 = s2;
+ assert(testComparisons(cs1, cs2, false, true));
+ }
+ {
+ std::set<int> s1, s2;
+ s1.insert(1);
+ s2.insert(1);
+ const std::set<int>&cs1 = s1, cs2 = s2;
+ assert(testComparisons(cs1, cs2, true, false));
+ }
+ {
+ std::set<int> s1, s2;
+ s1.insert(1);
+ s2.insert(1);
+ s2.insert(2);
+ const std::set<int>&cs1 = s1, cs2 = s2;
+ assert(testComparisons(cs1, cs2, false, true));
+ }
+ return 0;
}
diff --git a/libcxx/test/std/containers/associative/set/set.observers/comp.pass.cpp b/libcxx/test/std/containers/associative/set/set.observers/comp.pass.cpp
index 6f573a50df3d813..019dae3955acba6 100644
--- a/libcxx/test/std/containers/associative/set/set.observers/comp.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/set.observers/comp.pass.cpp
@@ -15,19 +15,19 @@
#include <cassert>
int main(int, char**) {
- typedef std::set<int> set_type;
+ typedef std::set<int> set_type;
- set_type s;
- std::pair<set_type::iterator, bool> p1 = s.insert(1);
- std::pair<set_type::iterator, bool> p2 = s.insert(2);
+ set_type s;
+ std::pair<set_type::iterator, bool> p1 = s.insert(1);
+ std::pair<set_type::iterator, bool> p2 = s.insert(2);
- const set_type& cs = s;
+ const set_type& cs = s;
- assert(cs.key_comp()(*p1.first, *p2.first));
- assert(!cs.key_comp()(*p2.first, *p1.first));
+ assert(cs.key_comp()(*p1.first, *p2.first));
+ assert(!cs.key_comp()(*p2.first, *p1.first));
- assert(cs.value_comp()(*p1.first, *p2.first));
- assert(!cs.value_comp()(*p2.first, *p1.first));
+ assert(cs.value_comp()(*p1.first, *p2.first));
+ assert(!cs.value_comp()(*p2.first, *p1.first));
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/associative/set/set.special/member_swap.pass.cpp b/libcxx/test/std/containers/associative/set/set.special/member_swap.pass.cpp
index ee91ca3bcc34efa..db3dc9831b3dd0c 100644
--- a/libcxx/test/std/containers/associative/set/set.special/member_swap.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/set.special/member_swap.pass.cpp
@@ -18,161 +18,96 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef int V;
typedef std::set<int> M;
{
- M m1;
- M m2;
- M m1_save = m1;
- M m2_save = m2;
- m1.swap(m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
+ M m1;
+ M m2;
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
{
- V ar2[] =
- {
- 5,
- 6,
- 7,
- 8,
- 9,
- 10,
- 11,
- 12
- };
- M m1;
- M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
- M m1_save = m1;
- M m2_save = m2;
- m1.swap(m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
+ V ar2[] = {5, 6, 7, 8, 9, 10, 11, 12};
+ M m1;
+ M m2(ar2, ar2 + sizeof(ar2) / sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
{
- V ar1[] =
- {
- 1,
- 2,
- 3,
- 4
- };
- M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
- M m2;
- M m1_save = m1;
- M m2_save = m2;
- m1.swap(m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
+ V ar1[] = {1, 2, 3, 4};
+ M m1(ar1, ar1 + sizeof(ar1) / sizeof(ar1[0]));
+ M m2;
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
{
- V ar1[] =
- {
- 1,
- 2,
- 3,
- 4
- };
- V ar2[] =
- {
- 5,
- 6,
- 7,
- 8,
- 9,
- 10,
- 11,
- 12
- };
- M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
- M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
- M m1_save = m1;
- M m2_save = m2;
- m1.swap(m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
- }
+ V ar1[] = {1, 2, 3, 4};
+ V ar2[] = {5, 6, 7, 8, 9, 10, 11, 12};
+ M m1(ar1, ar1 + sizeof(ar1) / sizeof(ar1[0]));
+ M m2(ar2, ar2 + sizeof(ar2) / sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef int V;
typedef std::set<int, std::less<int>, min_allocator<int>> M;
{
- M m1;
- M m2;
- M m1_save = m1;
- M m2_save = m2;
- m1.swap(m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
+ M m1;
+ M m2;
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
{
- V ar2[] =
- {
- 5,
- 6,
- 7,
- 8,
- 9,
- 10,
- 11,
- 12
- };
- M m1;
- M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
- M m1_save = m1;
- M m2_save = m2;
- m1.swap(m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
+ V ar2[] = {5, 6, 7, 8, 9, 10, 11, 12};
+ M m1;
+ M m2(ar2, ar2 + sizeof(ar2) / sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
{
- V ar1[] =
- {
- 1,
- 2,
- 3,
- 4
- };
- M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
- M m2;
- M m1_save = m1;
- M m2_save = m2;
- m1.swap(m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
+ V ar1[] = {1, 2, 3, 4};
+ M m1(ar1, ar1 + sizeof(ar1) / sizeof(ar1[0]));
+ M m2;
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
{
- V ar1[] =
- {
- 1,
- 2,
- 3,
- 4
- };
- V ar2[] =
- {
- 5,
- 6,
- 7,
- 8,
- 9,
- 10,
- 11,
- 12
- };
- M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
- M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
- M m1_save = m1;
- M m2_save = m2;
- m1.swap(m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
- }
+ V ar1[] = {1, 2, 3, 4};
+ V ar2[] = {5, 6, 7, 8, 9, 10, 11, 12};
+ M m1(ar1, ar1 + sizeof(ar1) / sizeof(ar1[0]));
+ M m2(ar2, ar2 + sizeof(ar2) / sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/set/set.special/non_member_swap.pass.cpp b/libcxx/test/std/containers/associative/set/set.special/non_member_swap.pass.cpp
index 2c54ecbf4cee3a9..e663a67035ff5bf 100644
--- a/libcxx/test/std/containers/associative/set/set.special/non_member_swap.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/set.special/non_member_swap.pass.cpp
@@ -18,152 +18,87 @@
#include "test_allocator.h"
#include "../../../test_compare.h"
-int main(int, char**)
-{
- typedef int V;
- {
+int main(int, char**) {
+ typedef int V;
+ {
typedef std::set<int> M;
{
- M m1;
- M m2;
- M m1_save = m1;
- M m2_save = m2;
- swap(m1, m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
- }
- {
- V ar2[] =
- {
- 5,
- 6,
- 7,
- 8,
- 9,
- 10,
- 11,
- 12
- };
- M m1;
- M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
- M m1_save = m1;
- M m2_save = m2;
- swap(m1, m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
+ M m1;
+ M m2;
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
{
- V ar1[] =
- {
- 1,
- 2,
- 3,
- 4
- };
- M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
- M m2;
- M m1_save = m1;
- M m2_save = m2;
- swap(m1, m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
- }
- {
- V ar1[] =
- {
- 1,
- 2,
- 3,
- 4
- };
- V ar2[] =
- {
- 5,
- 6,
- 7,
- 8,
- 9,
- 10,
- 11,
- 12
- };
- M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
- M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
- M m1_save = m1;
- M m2_save = m2;
- swap(m1, m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
- }
+ V ar2[] = {5, 6, 7, 8, 9, 10, 11, 12};
+ M m1;
+ M m2(ar2, ar2 + sizeof(ar2) / sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
{
- typedef test_allocator<V> A;
- typedef test_less<int> C;
- typedef std::set<int, C, A> M;
- V ar1[] =
- {
- 1,
- 2,
- 3,
- 4
- };
- V ar2[] =
- {
- 5,
- 6,
- 7,
- 8,
- 9,
- 10,
- 11,
- 12
- };
- M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A(1, 1));
- M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A(1, 2));
- M m1_save = m1;
- M m2_save = m2;
- swap(m1, m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
- assert(m1.key_comp() == C(2));
- assert(m1.get_allocator().get_id() == 1);
- assert(m2.key_comp() == C(1));
- assert(m2.get_allocator().get_id() == 2);
+ V ar1[] = {1, 2, 3, 4};
+ M m1(ar1, ar1 + sizeof(ar1) / sizeof(ar1[0]));
+ M m2;
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
{
- typedef other_allocator<V> A;
- typedef test_less<int> C;
- typedef std::set<int, C, A> M;
- V ar1[] =
- {
- 1,
- 2,
- 3,
- 4
- };
- V ar2[] =
- {
- 5,
- 6,
- 7,
- 8,
- 9,
- 10,
- 11,
- 12
- };
- M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A(1));
- M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A(2));
- M m1_save = m1;
- M m2_save = m2;
- swap(m1, m2);
- assert(m1 == m2_save);
- assert(m2 == m1_save);
- assert(m1.key_comp() == C(2));
- assert(m1.get_allocator() == A(2));
- assert(m2.key_comp() == C(1));
- assert(m2.get_allocator() == A(1));
+ V ar1[] = {1, 2, 3, 4};
+ V ar2[] = {5, 6, 7, 8, 9, 10, 11, 12};
+ M m1(ar1, ar1 + sizeof(ar1) / sizeof(ar1[0]));
+ M m2(ar2, ar2 + sizeof(ar2) / sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
}
+ }
+ {
+ typedef test_allocator<V> A;
+ typedef test_less<int> C;
+ typedef std::set<int, C, A> M;
+ V ar1[] = {1, 2, 3, 4};
+ V ar2[] = {5, 6, 7, 8, 9, 10, 11, 12};
+ M m1(ar1, ar1 + sizeof(ar1) / sizeof(ar1[0]), C(1), A(1, 1));
+ M m2(ar2, ar2 + sizeof(ar2) / sizeof(ar2[0]), C(2), A(1, 2));
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ assert(m1.key_comp() == C(2));
+ assert(m1.get_allocator().get_id() == 1);
+ assert(m2.key_comp() == C(1));
+ assert(m2.get_allocator().get_id() == 2);
+ }
+ {
+ typedef other_allocator<V> A;
+ typedef test_less<int> C;
+ typedef std::set<int, C, A> M;
+ V ar1[] = {1, 2, 3, 4};
+ V ar2[] = {5, 6, 7, 8, 9, 10, 11, 12};
+ M m1(ar1, ar1 + sizeof(ar1) / sizeof(ar1[0]), C(1), A(1));
+ M m2(ar2, ar2 + sizeof(ar2) / sizeof(ar2[0]), C(2), A(2));
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ assert(m1.key_comp() == C(2));
+ assert(m1.get_allocator() == A(2));
+ assert(m2.key_comp() == C(1));
+ assert(m2.get_allocator() == A(1));
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/associative/set/set.special/swap_noexcept.pass.cpp b/libcxx/test/std/containers/associative/set/set.special/swap_noexcept.pass.cpp
index b04c77b8a8642bf..36ab989b7604356 100644
--- a/libcxx/test/std/containers/associative/set/set.special/swap_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/set.special/swap_noexcept.pass.cpp
@@ -29,23 +29,21 @@
#include "test_allocator.h"
template <class T>
-struct some_comp
-{
- typedef T value_type;
+struct some_comp {
+ typedef T value_type;
- some_comp() {}
- some_comp(const some_comp&) {}
- bool operator()(const T&, const T&) const { return false; }
+ some_comp() {}
+ some_comp(const some_comp&) {}
+ bool operator()(const T&, const T&) const { return false; }
};
template <class T>
-struct some_comp2
-{
- typedef T value_type;
+struct some_comp2 {
+ typedef T value_type;
- some_comp2() {}
- some_comp2(const some_comp2&) {}
- bool operator()(const T&, const T&) const { return false; }
+ some_comp2() {}
+ some_comp2(const some_comp2&) {}
+ bool operator()(const T&, const T&) const { return false; }
};
#if TEST_STD_VER >= 14
@@ -54,89 +52,84 @@ void swap(some_comp2<T>&, some_comp2<T>&) noexcept {}
#endif
template <class T>
-struct some_alloc
-{
- typedef T value_type;
+struct some_alloc {
+ typedef T value_type;
- some_alloc() {}
- some_alloc(const some_alloc&);
- void deallocate(void*, unsigned) {}
+ some_alloc() {}
+ some_alloc(const some_alloc&);
+ void deallocate(void*, unsigned) {}
- typedef std::true_type propagate_on_container_swap;
+ typedef std::true_type propagate_on_container_swap;
};
template <class T>
-struct some_alloc2
-{
- typedef T value_type;
+struct some_alloc2 {
+ typedef T value_type;
- some_alloc2() {}
- some_alloc2(const some_alloc2&);
- void deallocate(void*, unsigned) {}
+ some_alloc2() {}
+ some_alloc2(const some_alloc2&);
+ void deallocate(void*, unsigned) {}
- typedef std::false_type propagate_on_container_swap;
- typedef std::true_type is_always_equal;
+ typedef std::false_type propagate_on_container_swap;
+ typedef std::true_type is_always_equal;
};
template <class T>
-struct some_alloc3
-{
- typedef T value_type;
+struct some_alloc3 {
+ typedef T value_type;
- some_alloc3() {}
- some_alloc3(const some_alloc3&);
- void deallocate(void*, unsigned) {}
+ some_alloc3() {}
+ some_alloc3(const some_alloc3&);
+ void deallocate(void*, unsigned) {}
- typedef std::false_type propagate_on_container_swap;
- typedef std::false_type is_always_equal;
+ typedef std::false_type propagate_on_container_swap;
+ typedef std::false_type is_always_equal;
};
-int main(int, char**)
-{
- {
- typedef std::set<MoveOnly> C;
- static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
+int main(int, char**) {
+ {
+ typedef std::set<MoveOnly> C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
#if defined(_LIBCPP_VERSION)
- {
- typedef std::set<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
- static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- {
- typedef std::set<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
- static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
+ {
+ typedef std::set<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
+ {
+ typedef std::set<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
#endif // _LIBCPP_VERSION
- {
- typedef std::set<MoveOnly, some_comp<MoveOnly>> C;
- static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
+ {
+ typedef std::set<MoveOnly, some_comp<MoveOnly>> C;
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
#if TEST_STD_VER >= 14
- { // POCS allocator, throwable swap for comp
- typedef std::set<MoveOnly, some_comp <MoveOnly>, some_alloc <MoveOnly>> C;
+ { // POCS allocator, throwable swap for comp
+ typedef std::set<MoveOnly, some_comp<MoveOnly>, some_alloc<MoveOnly>> C;
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- { // always equal allocator, throwable swap for comp
- typedef std::set<MoveOnly, some_comp <MoveOnly>, some_alloc2<MoveOnly>> C;
+ }
+ { // always equal allocator, throwable swap for comp
+ typedef std::set<MoveOnly, some_comp<MoveOnly>, some_alloc2<MoveOnly>> C;
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- { // POCS allocator, nothrow swap for comp
- typedef std::set<MoveOnly, some_comp2<MoveOnly>, some_alloc <MoveOnly>> C;
- static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- { // always equal allocator, nothrow swap for comp
+ }
+ { // POCS allocator, nothrow swap for comp
+ typedef std::set<MoveOnly, some_comp2<MoveOnly>, some_alloc<MoveOnly>> C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
+ { // always equal allocator, nothrow swap for comp
typedef std::set<MoveOnly, some_comp2<MoveOnly>, some_alloc2<MoveOnly>> C;
- static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
-#if defined(_LIBCPP_VERSION)
- { // NOT always equal allocator, nothrow swap for comp
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
+# if defined(_LIBCPP_VERSION)
+ { // NOT always equal allocator, nothrow swap for comp
typedef std::set<MoveOnly, some_comp2<MoveOnly>, some_alloc3<MoveOnly>> C;
- static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
-#endif // _LIBCPP_VERSION
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
+# endif // _LIBCPP_VERSION
#endif
-
return 0;
}
diff --git a/libcxx/test/std/containers/associative/set/size.pass.cpp b/libcxx/test/std/containers/associative/set/size.pass.cpp
index bdce58e98f3fea5..1672e1f055c6ca4 100644
--- a/libcxx/test/std/containers/associative/set/size.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/size.pass.cpp
@@ -18,9 +18,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::set<int> M;
M m;
assert(m.size() == 0);
@@ -36,9 +35,9 @@ int main(int, char**)
assert(m.size() == 1);
m.erase(m.begin());
assert(m.size() == 0);
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::set<int, std::less<int>, min_allocator<int>> M;
M m;
assert(m.size() == 0);
@@ -54,7 +53,7 @@ int main(int, char**)
assert(m.size() == 1);
m.erase(m.begin());
assert(m.size() == 0);
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/set/types.pass.cpp b/libcxx/test/std/containers/associative/set/types.pass.cpp
index 2d29a800f9c39f8..a7c30244a540ba6 100644
--- a/libcxx/test/std/containers/associative/set/types.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/types.pass.cpp
@@ -34,9 +34,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::set<int> C;
static_assert((std::is_same<C::key_type, int>::value), "");
static_assert((std::is_same<C::value_type, int>::value), "");
@@ -49,9 +48,9 @@ int main(int, char**)
static_assert((std::is_same<C::const_pointer, const int*>::value), "");
static_assert((std::is_same<C::size_type, std::size_t>::value), "");
static_assert((std::is_same<C::
diff erence_type, std::ptr
diff _t>::value), "");
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::set<int, std::less<int>, min_allocator<int>> C;
static_assert((std::is_same<C::key_type, int>::value), "");
static_assert((std::is_same<C::value_type, int>::value), "");
@@ -62,10 +61,10 @@ int main(int, char**)
static_assert((std::is_same<C::const_reference, const int&>::value), "");
static_assert((std::is_same<C::pointer, min_pointer<int>>::value), "");
static_assert((std::is_same<C::const_pointer, min_pointer<const int>>::value), "");
-// min_allocator doesn't have a size_type, so one gets synthesized
+ // min_allocator doesn't have a size_type, so one gets synthesized
static_assert((std::is_same<C::size_type, std::make_unsigned<C::
diff erence_type>::type>::value), "");
static_assert((std::is_same<C::
diff erence_type, std::ptr
diff _t>::value), "");
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/associative/set/upper_bound.pass.cpp b/libcxx/test/std/containers/associative/set/upper_bound.pass.cpp
index 9dec9507ebae739..3543879e07940c5 100644
--- a/libcxx/test/std/containers/associative/set/upper_bound.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/upper_bound.pass.cpp
@@ -20,232 +20,181 @@
#include "min_allocator.h"
#include "private_constructor.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef int V;
typedef std::set<int> M;
{
- typedef M::iterator R;
- V ar[] =
- {
- 5,
- 7,
- 9,
- 11,
- 13,
- 15,
- 17,
- 19
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.upper_bound(5);
- assert(r == std::next(m.begin(), 1));
- r = m.upper_bound(7);
- assert(r == std::next(m.begin(), 2));
- r = m.upper_bound(9);
- assert(r == std::next(m.begin(), 3));
- r = m.upper_bound(11);
- assert(r == std::next(m.begin(), 4));
- r = m.upper_bound(13);
- assert(r == std::next(m.begin(), 5));
- r = m.upper_bound(15);
- assert(r == std::next(m.begin(), 6));
- r = m.upper_bound(17);
- assert(r == std::next(m.begin(), 7));
- r = m.upper_bound(19);
- assert(r == std::next(m.begin(), 8));
- r = m.upper_bound(4);
- assert(r == std::next(m.begin(), 0));
- r = m.upper_bound(6);
- assert(r == std::next(m.begin(), 1));
- r = m.upper_bound(8);
- assert(r == std::next(m.begin(), 2));
- r = m.upper_bound(10);
- assert(r == std::next(m.begin(), 3));
- r = m.upper_bound(12);
- assert(r == std::next(m.begin(), 4));
- r = m.upper_bound(14);
- assert(r == std::next(m.begin(), 5));
- r = m.upper_bound(16);
- assert(r == std::next(m.begin(), 6));
- r = m.upper_bound(18);
- assert(r == std::next(m.begin(), 7));
- r = m.upper_bound(20);
- assert(r == std::next(m.begin(), 8));
+ typedef M::iterator R;
+ V ar[] = {5, 7, 9, 11, 13, 15, 17, 19};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.upper_bound(5);
+ assert(r == std::next(m.begin(), 1));
+ r = m.upper_bound(7);
+ assert(r == std::next(m.begin(), 2));
+ r = m.upper_bound(9);
+ assert(r == std::next(m.begin(), 3));
+ r = m.upper_bound(11);
+ assert(r == std::next(m.begin(), 4));
+ r = m.upper_bound(13);
+ assert(r == std::next(m.begin(), 5));
+ r = m.upper_bound(15);
+ assert(r == std::next(m.begin(), 6));
+ r = m.upper_bound(17);
+ assert(r == std::next(m.begin(), 7));
+ r = m.upper_bound(19);
+ assert(r == std::next(m.begin(), 8));
+ r = m.upper_bound(4);
+ assert(r == std::next(m.begin(), 0));
+ r = m.upper_bound(6);
+ assert(r == std::next(m.begin(), 1));
+ r = m.upper_bound(8);
+ assert(r == std::next(m.begin(), 2));
+ r = m.upper_bound(10);
+ assert(r == std::next(m.begin(), 3));
+ r = m.upper_bound(12);
+ assert(r == std::next(m.begin(), 4));
+ r = m.upper_bound(14);
+ assert(r == std::next(m.begin(), 5));
+ r = m.upper_bound(16);
+ assert(r == std::next(m.begin(), 6));
+ r = m.upper_bound(18);
+ assert(r == std::next(m.begin(), 7));
+ r = m.upper_bound(20);
+ assert(r == std::next(m.begin(), 8));
}
{
- typedef M::const_iterator R;
- V ar[] =
- {
- 5,
- 7,
- 9,
- 11,
- 13,
- 15,
- 17,
- 19
- };
- const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.upper_bound(5);
- assert(r == std::next(m.begin(), 1));
- r = m.upper_bound(7);
- assert(r == std::next(m.begin(), 2));
- r = m.upper_bound(9);
- assert(r == std::next(m.begin(), 3));
- r = m.upper_bound(11);
- assert(r == std::next(m.begin(), 4));
- r = m.upper_bound(13);
- assert(r == std::next(m.begin(), 5));
- r = m.upper_bound(15);
- assert(r == std::next(m.begin(), 6));
- r = m.upper_bound(17);
- assert(r == std::next(m.begin(), 7));
- r = m.upper_bound(19);
- assert(r == std::next(m.begin(), 8));
- r = m.upper_bound(4);
- assert(r == std::next(m.begin(), 0));
- r = m.upper_bound(6);
- assert(r == std::next(m.begin(), 1));
- r = m.upper_bound(8);
- assert(r == std::next(m.begin(), 2));
- r = m.upper_bound(10);
- assert(r == std::next(m.begin(), 3));
- r = m.upper_bound(12);
- assert(r == std::next(m.begin(), 4));
- r = m.upper_bound(14);
- assert(r == std::next(m.begin(), 5));
- r = m.upper_bound(16);
- assert(r == std::next(m.begin(), 6));
- r = m.upper_bound(18);
- assert(r == std::next(m.begin(), 7));
- r = m.upper_bound(20);
- assert(r == std::next(m.begin(), 8));
- }
+ typedef M::const_iterator R;
+ V ar[] = {5, 7, 9, 11, 13, 15, 17, 19};
+ const M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.upper_bound(5);
+ assert(r == std::next(m.begin(), 1));
+ r = m.upper_bound(7);
+ assert(r == std::next(m.begin(), 2));
+ r = m.upper_bound(9);
+ assert(r == std::next(m.begin(), 3));
+ r = m.upper_bound(11);
+ assert(r == std::next(m.begin(), 4));
+ r = m.upper_bound(13);
+ assert(r == std::next(m.begin(), 5));
+ r = m.upper_bound(15);
+ assert(r == std::next(m.begin(), 6));
+ r = m.upper_bound(17);
+ assert(r == std::next(m.begin(), 7));
+ r = m.upper_bound(19);
+ assert(r == std::next(m.begin(), 8));
+ r = m.upper_bound(4);
+ assert(r == std::next(m.begin(), 0));
+ r = m.upper_bound(6);
+ assert(r == std::next(m.begin(), 1));
+ r = m.upper_bound(8);
+ assert(r == std::next(m.begin(), 2));
+ r = m.upper_bound(10);
+ assert(r == std::next(m.begin(), 3));
+ r = m.upper_bound(12);
+ assert(r == std::next(m.begin(), 4));
+ r = m.upper_bound(14);
+ assert(r == std::next(m.begin(), 5));
+ r = m.upper_bound(16);
+ assert(r == std::next(m.begin(), 6));
+ r = m.upper_bound(18);
+ assert(r == std::next(m.begin(), 7));
+ r = m.upper_bound(20);
+ assert(r == std::next(m.begin(), 8));
}
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef int V;
typedef std::set<int, std::less<int>, min_allocator<int>> M;
{
- typedef M::iterator R;
- V ar[] =
- {
- 5,
- 7,
- 9,
- 11,
- 13,
- 15,
- 17,
- 19
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.upper_bound(5);
- assert(r == std::next(m.begin(), 1));
- r = m.upper_bound(7);
- assert(r == std::next(m.begin(), 2));
- r = m.upper_bound(9);
- assert(r == std::next(m.begin(), 3));
- r = m.upper_bound(11);
- assert(r == std::next(m.begin(), 4));
- r = m.upper_bound(13);
- assert(r == std::next(m.begin(), 5));
- r = m.upper_bound(15);
- assert(r == std::next(m.begin(), 6));
- r = m.upper_bound(17);
- assert(r == std::next(m.begin(), 7));
- r = m.upper_bound(19);
- assert(r == std::next(m.begin(), 8));
- r = m.upper_bound(4);
- assert(r == std::next(m.begin(), 0));
- r = m.upper_bound(6);
- assert(r == std::next(m.begin(), 1));
- r = m.upper_bound(8);
- assert(r == std::next(m.begin(), 2));
- r = m.upper_bound(10);
- assert(r == std::next(m.begin(), 3));
- r = m.upper_bound(12);
- assert(r == std::next(m.begin(), 4));
- r = m.upper_bound(14);
- assert(r == std::next(m.begin(), 5));
- r = m.upper_bound(16);
- assert(r == std::next(m.begin(), 6));
- r = m.upper_bound(18);
- assert(r == std::next(m.begin(), 7));
- r = m.upper_bound(20);
- assert(r == std::next(m.begin(), 8));
+ typedef M::iterator R;
+ V ar[] = {5, 7, 9, 11, 13, 15, 17, 19};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.upper_bound(5);
+ assert(r == std::next(m.begin(), 1));
+ r = m.upper_bound(7);
+ assert(r == std::next(m.begin(), 2));
+ r = m.upper_bound(9);
+ assert(r == std::next(m.begin(), 3));
+ r = m.upper_bound(11);
+ assert(r == std::next(m.begin(), 4));
+ r = m.upper_bound(13);
+ assert(r == std::next(m.begin(), 5));
+ r = m.upper_bound(15);
+ assert(r == std::next(m.begin(), 6));
+ r = m.upper_bound(17);
+ assert(r == std::next(m.begin(), 7));
+ r = m.upper_bound(19);
+ assert(r == std::next(m.begin(), 8));
+ r = m.upper_bound(4);
+ assert(r == std::next(m.begin(), 0));
+ r = m.upper_bound(6);
+ assert(r == std::next(m.begin(), 1));
+ r = m.upper_bound(8);
+ assert(r == std::next(m.begin(), 2));
+ r = m.upper_bound(10);
+ assert(r == std::next(m.begin(), 3));
+ r = m.upper_bound(12);
+ assert(r == std::next(m.begin(), 4));
+ r = m.upper_bound(14);
+ assert(r == std::next(m.begin(), 5));
+ r = m.upper_bound(16);
+ assert(r == std::next(m.begin(), 6));
+ r = m.upper_bound(18);
+ assert(r == std::next(m.begin(), 7));
+ r = m.upper_bound(20);
+ assert(r == std::next(m.begin(), 8));
}
{
- typedef M::const_iterator R;
- V ar[] =
- {
- 5,
- 7,
- 9,
- 11,
- 13,
- 15,
- 17,
- 19
- };
- const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.upper_bound(5);
- assert(r == std::next(m.begin(), 1));
- r = m.upper_bound(7);
- assert(r == std::next(m.begin(), 2));
- r = m.upper_bound(9);
- assert(r == std::next(m.begin(), 3));
- r = m.upper_bound(11);
- assert(r == std::next(m.begin(), 4));
- r = m.upper_bound(13);
- assert(r == std::next(m.begin(), 5));
- r = m.upper_bound(15);
- assert(r == std::next(m.begin(), 6));
- r = m.upper_bound(17);
- assert(r == std::next(m.begin(), 7));
- r = m.upper_bound(19);
- assert(r == std::next(m.begin(), 8));
- r = m.upper_bound(4);
- assert(r == std::next(m.begin(), 0));
- r = m.upper_bound(6);
- assert(r == std::next(m.begin(), 1));
- r = m.upper_bound(8);
- assert(r == std::next(m.begin(), 2));
- r = m.upper_bound(10);
- assert(r == std::next(m.begin(), 3));
- r = m.upper_bound(12);
- assert(r == std::next(m.begin(), 4));
- r = m.upper_bound(14);
- assert(r == std::next(m.begin(), 5));
- r = m.upper_bound(16);
- assert(r == std::next(m.begin(), 6));
- r = m.upper_bound(18);
- assert(r == std::next(m.begin(), 7));
- r = m.upper_bound(20);
- assert(r == std::next(m.begin(), 8));
- }
+ typedef M::const_iterator R;
+ V ar[] = {5, 7, 9, 11, 13, 15, 17, 19};
+ const M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
+ R r = m.upper_bound(5);
+ assert(r == std::next(m.begin(), 1));
+ r = m.upper_bound(7);
+ assert(r == std::next(m.begin(), 2));
+ r = m.upper_bound(9);
+ assert(r == std::next(m.begin(), 3));
+ r = m.upper_bound(11);
+ assert(r == std::next(m.begin(), 4));
+ r = m.upper_bound(13);
+ assert(r == std::next(m.begin(), 5));
+ r = m.upper_bound(15);
+ assert(r == std::next(m.begin(), 6));
+ r = m.upper_bound(17);
+ assert(r == std::next(m.begin(), 7));
+ r = m.upper_bound(19);
+ assert(r == std::next(m.begin(), 8));
+ r = m.upper_bound(4);
+ assert(r == std::next(m.begin(), 0));
+ r = m.upper_bound(6);
+ assert(r == std::next(m.begin(), 1));
+ r = m.upper_bound(8);
+ assert(r == std::next(m.begin(), 2));
+ r = m.upper_bound(10);
+ assert(r == std::next(m.begin(), 3));
+ r = m.upper_bound(12);
+ assert(r == std::next(m.begin(), 4));
+ r = m.upper_bound(14);
+ assert(r == std::next(m.begin(), 5));
+ r = m.upper_bound(16);
+ assert(r == std::next(m.begin(), 6));
+ r = m.upper_bound(18);
+ assert(r == std::next(m.begin(), 7));
+ r = m.upper_bound(20);
+ assert(r == std::next(m.begin(), 8));
}
+ }
#endif
#if TEST_STD_VER > 11
- {
+ {
typedef int V;
typedef std::set<V, std::less<>> M;
typedef M::iterator R;
- V ar[] =
- {
- 5,
- 7,
- 9,
- 11,
- 13,
- 15,
- 17,
- 19
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ V ar[] = {5, 7, 9, 11, 13, 15, 17, 19};
+ M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
R r = m.upper_bound(5);
assert(r == std::next(m.begin(), 1));
r = m.upper_bound(7);
@@ -280,22 +229,22 @@ int main(int, char**)
assert(r == std::next(m.begin(), 7));
r = m.upper_bound(20);
assert(r == std::next(m.begin(), 8));
- }
+ }
- {
+ {
typedef PrivateConstructor V;
typedef std::set<V, std::less<>> M;
typedef M::iterator R;
M m;
- m.insert ( V::make ( 5 ));
- m.insert ( V::make ( 7 ));
- m.insert ( V::make ( 9 ));
- m.insert ( V::make ( 11 ));
- m.insert ( V::make ( 13 ));
- m.insert ( V::make ( 15 ));
- m.insert ( V::make ( 17 ));
- m.insert ( V::make ( 19 ));
+ m.insert(V::make(5));
+ m.insert(V::make(7));
+ m.insert(V::make(9));
+ m.insert(V::make(11));
+ m.insert(V::make(13));
+ m.insert(V::make(15));
+ m.insert(V::make(17));
+ m.insert(V::make(19));
R r = m.upper_bound(5);
assert(r == std::next(m.begin(), 1));
@@ -331,7 +280,7 @@ int main(int, char**)
assert(r == std::next(m.begin(), 7));
r = m.upper_bound(20);
assert(r == std::next(m.begin(), 8));
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/check_consecutive.h b/libcxx/test/std/containers/check_consecutive.h
index 0fe46e7f19557bf..2930e7dbcea980a 100644
--- a/libcxx/test/std/containers/check_consecutive.h
+++ b/libcxx/test/std/containers/check_consecutive.h
@@ -18,30 +18,29 @@
// Check consecutive equal values in an unordered_multiset iterator
template <typename Iter>
-void CheckConsecutiveValues(Iter pos, Iter end, typename Iter::value_type value, std::size_t count)
-{
- for ( std::size_t i = 0; i < count; ++i )
- {
- assert(pos != end);
- assert(*pos == value);
- ++pos;
- }
- assert(pos == end || *pos != value);
+void CheckConsecutiveValues(Iter pos, Iter end, typename Iter::value_type value, std::size_t count) {
+ for (std::size_t i = 0; i < count; ++i) {
+ assert(pos != end);
+ assert(*pos == value);
+ ++pos;
+ }
+ assert(pos == end || *pos != value);
}
// Check consecutive equal keys in an unordered_multimap iterator
template <typename Iter>
-void CheckConsecutiveKeys(Iter pos, Iter end, typename Iter::value_type::first_type key, std::multiset<typename Iter::value_type::second_type>& values)
-{
- while (!values.empty())
- {
- assert(pos != end);
- assert(pos->first == key);
- assert(values.find(pos->second) != values.end());
- values.erase(values.find(pos->second));
- ++pos;
- }
- assert(pos == end || pos->first != key);
+void CheckConsecutiveKeys(Iter pos,
+ Iter end,
+ typename Iter::value_type::first_type key,
+ std::multiset<typename Iter::value_type::second_type>& values) {
+ while (!values.empty()) {
+ assert(pos != end);
+ assert(pos->first == key);
+ assert(values.find(pos->second) != values.end());
+ values.erase(values.find(pos->second));
+ ++pos;
+ }
+ assert(pos == end || pos->first != key);
}
#endif
diff --git a/libcxx/test/std/containers/container.adaptors/flat.map.syn/sorted_unique.pass.cpp b/libcxx/test/std/containers/container.adaptors/flat.map.syn/sorted_unique.pass.cpp
index c602d2d3d38f794..864fd992c66eec0 100644
--- a/libcxx/test/std/containers/container.adaptors/flat.map.syn/sorted_unique.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/flat.map.syn/sorted_unique.pass.cpp
@@ -29,9 +29,15 @@ static_assert(std::is_trivially_default_constructible_v<std::sorted_unique_t>);
static_assert(!HasImplicitDefaultCtor<std::sorted_unique_t>);
constexpr bool test() {
- { [[maybe_unused]] std::sorted_unique_t s; }
- { [[maybe_unused]] std::same_as<const std::sorted_unique_t&> decltype(auto) s = (std::sorted_unique); }
- { [[maybe_unused]] std::same_as<const std::sorted_unique_t> decltype(auto) copy = std::sorted_unique; }
+ {
+ [[maybe_unused]] std::sorted_unique_t s;
+ }
+ {
+ [[maybe_unused]] std::same_as<const std::sorted_unique_t&> decltype(auto) s = (std::sorted_unique);
+ }
+ {
+ [[maybe_unused]] std::same_as<const std::sorted_unique_t> decltype(auto) copy = std::sorted_unique;
+ }
return true;
}
diff --git a/libcxx/test/std/containers/container.adaptors/from_range_container_adaptors.h b/libcxx/test/std/containers/container.adaptors/from_range_container_adaptors.h
index 1bb34fb54252218..7c864ce3791e8bc 100644
--- a/libcxx/test/std/containers/container.adaptors/from_range_container_adaptors.h
+++ b/libcxx/test/std/containers/container.adaptors/from_range_container_adaptors.h
@@ -26,7 +26,7 @@
#include "unwrap_container_adaptor.h"
template <class Container, class Range>
-concept HasFromRangeCtr = requires (Range&& range) {
+concept HasFromRangeCtr = requires(Range&& range) {
Container(std::from_range, std::forward<Range>(range));
Container(std::from_range, std::forward<Range>(range), std::allocator<typename Container::value_type>());
};
@@ -47,8 +47,8 @@ constexpr bool test_constraints() {
return true;
}
-template <template <class ...> class Adaptor,
- template <class ...> class UnderlyingContainer,
+template <template <class...> class Adaptor,
+ template <class...> class UnderlyingContainer,
class T,
class Iter,
class Sent,
@@ -80,12 +80,7 @@ constexpr void test_container_adaptor_with_input(std::vector<T>&& input) {
}
}
-template <template <class ...> class UnderlyingContainer,
- class T,
- class Iter,
- class Sent,
- class Comp,
- class Alloc>
+template <template <class...> class UnderlyingContainer, class T, class Iter, class Sent, class Comp, class Alloc>
constexpr void test_priority_queue_with_input(std::vector<T>&& input) {
{ // (range)
std::ranges::subrange in(Iter(input.data()), Sent(Iter(input.data() + input.size())));
@@ -146,8 +141,8 @@ constexpr void test_priority_queue_with_input(std::vector<T>&& input) {
}
}
-template <template <class ...> class Adaptor,
- template <class ...> class UnderlyingContainer,
+template <template <class...> class Adaptor,
+ template <class...> class UnderlyingContainer,
class T,
class Iter,
class Sent,
@@ -163,12 +158,7 @@ constexpr void test_container_adaptor() {
test_with_input({5});
}
-template <template <class ...> class UnderlyingContainer,
- class T,
- class Iter,
- class Sent,
- class Comp,
- class Alloc>
+template <template <class...> class UnderlyingContainer, class T, class Iter, class Sent, class Comp, class Alloc>
constexpr void test_priority_queue() {
auto test_with_input = &test_priority_queue_with_input<UnderlyingContainer, T, Iter, Sent, Comp, Alloc>;
@@ -180,7 +170,7 @@ constexpr void test_priority_queue() {
test_with_input({5});
}
-template <template <class ...> class Container>
+template <template <class...> class Container>
constexpr void test_container_adaptor_move_only() {
MoveOnly input[5];
std::ranges::subrange in(std::move_iterator{input}, std::move_iterator{input + 5});
@@ -188,18 +178,18 @@ constexpr void test_container_adaptor_move_only() {
[[maybe_unused]] Container<MoveOnly> c(std::from_range, in);
}
-template <template <class ...> class Adaptor>
+template <template <class...> class Adaptor>
void test_exception_safety_throwing_copy() {
#if !defined(TEST_HAS_NO_EXCEPTIONS)
constexpr int ThrowOn = 3;
- using T = ThrowingCopy<ThrowOn>;
+ using T = ThrowingCopy<ThrowOn>;
test_exception_safety_throwing_copy<ThrowOn, /*Size=*/5>([](T* from, T* to) {
[[maybe_unused]] Adaptor<T, std::vector<T>> c(std::from_range, std::ranges::subrange(from, to));
});
#endif
}
-template <template <class ...> class Adaptor, class T>
+template <template <class...> class Adaptor, class T>
void test_exception_safety_throwing_allocator() {
#if !defined(TEST_HAS_NO_EXCEPTIONS)
T in[] = {0, 1};
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_alloc.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_alloc.pass.cpp
index 07b4f46e65dea4c..903a4ca2c2b4b8f 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_alloc.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_alloc.pass.cpp
@@ -18,33 +18,29 @@
#include "test_allocator.h"
template <class T>
-struct test
- : public std::priority_queue<T, std::vector<T, test_allocator<T> > >
-{
- typedef std::priority_queue<T, std::vector<T, test_allocator<T> > > base;
- typedef typename base::container_type container_type;
- typedef typename base::value_compare value_compare;
-
- explicit test(const test_allocator<int>& a) : base(a) {}
- test(const value_compare& comp, const test_allocator<int>& a)
- : base(comp, c, a) {}
- test(const value_compare& comp, const container_type& container,
- const test_allocator<int>& a) : base(comp, container, a) {}
+struct test : public std::priority_queue<T, std::vector<T, test_allocator<T> > > {
+ typedef std::priority_queue<T, std::vector<T, test_allocator<T> > > base;
+ typedef typename base::container_type container_type;
+ typedef typename base::value_compare value_compare;
+
+ explicit test(const test_allocator<int>& a) : base(a) {}
+ test(const value_compare& comp, const test_allocator<int>& a) : base(comp, c, a) {}
+ test(const value_compare& comp, const container_type& container, const test_allocator<int>& a)
+ : base(comp, container, a) {}
#if TEST_STD_VER >= 11
- test(const value_compare& comp, container_type&& container,
- const test_allocator<int>& a) : base(comp, std::move(container), a) {}
- test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
+ test(const value_compare& comp, container_type&& container, const test_allocator<int>& a)
+ : base(comp, std::move(container), a) {}
+ test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
#endif
- test_allocator<int> get_allocator() {return c.get_allocator();}
+ test_allocator<int> get_allocator() { return c.get_allocator(); }
- using base::c;
+ using base::c;
};
-int main(int, char**)
-{
- test<int> q((test_allocator<int>(3)));
- assert(q.c.get_allocator() == test_allocator<int>(3));
- assert(q.c.size() == 0);
+int main(int, char**) {
+ test<int> q((test_allocator<int>(3)));
+ assert(q.c.get_allocator() == test_allocator<int>(3));
+ assert(q.c.size() == 0);
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_alloc.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_alloc.pass.cpp
index 87b9ada9b703c64..439b19377abab49 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_alloc.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_alloc.pass.cpp
@@ -18,33 +18,29 @@
#include "test_allocator.h"
template <class T>
-struct test
- : public std::priority_queue<T, std::vector<T, test_allocator<T> > >
-{
- typedef std::priority_queue<T, std::vector<T, test_allocator<T> > > base;
- typedef typename base::container_type container_type;
- typedef typename base::value_compare value_compare;
-
- explicit test(const test_allocator<int>& a) : base(a) {}
- test(const value_compare& compare, const test_allocator<int>& a)
- : base(compare, a) {}
- test(const value_compare& compare, const container_type& container,
- const test_allocator<int>& a) : base(compare, container, a) {}
+struct test : public std::priority_queue<T, std::vector<T, test_allocator<T> > > {
+ typedef std::priority_queue<T, std::vector<T, test_allocator<T> > > base;
+ typedef typename base::container_type container_type;
+ typedef typename base::value_compare value_compare;
+
+ explicit test(const test_allocator<int>& a) : base(a) {}
+ test(const value_compare& compare, const test_allocator<int>& a) : base(compare, a) {}
+ test(const value_compare& compare, const container_type& container, const test_allocator<int>& a)
+ : base(compare, container, a) {}
#if TEST_STD_VER >= 11
- test(const value_compare& compare, container_type&& container,
- const test_allocator<int>& a) : base(compare, std::move(container), a) {}
- test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
+ test(const value_compare& compare, container_type&& container, const test_allocator<int>& a)
+ : base(compare, std::move(container), a) {}
+ test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
#endif
- test_allocator<int> get_allocator() {return c.get_allocator();}
+ test_allocator<int> get_allocator() { return c.get_allocator(); }
- using base::c;
+ using base::c;
};
-int main(int, char**)
-{
- test<int> q(std::less<int>(), test_allocator<int>(3));
- assert(q.c.get_allocator() == test_allocator<int>(3));
- assert(q.c.size() == 0);
+int main(int, char**) {
+ test<int> q(std::less<int>(), test_allocator<int>(3));
+ assert(q.c.get_allocator() == test_allocator<int>(3));
+ assert(q.c.size() == 0);
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_cont_alloc.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_cont_alloc.pass.cpp
index afec77139679952..dddc11c88689b7f 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_cont_alloc.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_cont_alloc.pass.cpp
@@ -19,46 +19,40 @@
#include "test_allocator.h"
template <class C>
-C
-make(int n)
-{
- C c;
- for (int i = 0; i < n; ++i)
- c.push_back(i);
- return c;
+C make(int n) {
+ C c;
+ for (int i = 0; i < n; ++i)
+ c.push_back(i);
+ return c;
}
template <class T>
-struct test
- : public std::priority_queue<T, std::vector<T, test_allocator<T> > >
-{
- typedef std::priority_queue<T, std::vector<T, test_allocator<T> > > base;
- typedef typename base::container_type container_type;
- typedef typename base::value_compare value_compare;
-
- explicit test(const test_allocator<int>& a) : base(a) {}
- test(const value_compare& compare, const test_allocator<int>& a)
- : base(compare, a) {}
- test(const value_compare& compare, const container_type& container,
- const test_allocator<int>& a) : base(compare, container, a) {}
+struct test : public std::priority_queue<T, std::vector<T, test_allocator<T> > > {
+ typedef std::priority_queue<T, std::vector<T, test_allocator<T> > > base;
+ typedef typename base::container_type container_type;
+ typedef typename base::value_compare value_compare;
+
+ explicit test(const test_allocator<int>& a) : base(a) {}
+ test(const value_compare& compare, const test_allocator<int>& a) : base(compare, a) {}
+ test(const value_compare& compare, const container_type& container, const test_allocator<int>& a)
+ : base(compare, container, a) {}
#if TEST_STD_VER >= 11 // testing rvalue constructor
- test(const value_compare& compare, container_type&& container,
- const test_allocator<int>& a) : base(compare, std::move(container), a) {}
- test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
+ test(const value_compare& compare, container_type&& container, const test_allocator<int>& a)
+ : base(compare, std::move(container), a) {}
+ test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
#endif
- test_allocator<int> get_allocator() {return c.get_allocator();}
+ test_allocator<int> get_allocator() { return c.get_allocator(); }
- using base::c;
+ using base::c;
};
-int main(int, char**)
-{
- typedef std::vector<int, test_allocator<int> > C;
- C v = make<C>(5);
- test<int> q(std::less<int>(), v, test_allocator<int>(3));
- assert(q.c.get_allocator() == test_allocator<int>(3));
- assert(q.size() == 5);
- assert(q.top() == 4);
+int main(int, char**) {
+ typedef std::vector<int, test_allocator<int> > C;
+ C v = make<C>(5);
+ test<int> q(std::less<int>(), v, test_allocator<int>(3));
+ assert(q.c.get_allocator() == test_allocator<int>(3));
+ assert(q.size() == 5);
+ assert(q.top() == 4);
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_rcont_alloc.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_rcont_alloc.pass.cpp
index 7ddb5f4d5a3c0b0..bdb84a5f274da8a 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_rcont_alloc.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_rcont_alloc.pass.cpp
@@ -19,45 +19,39 @@
#include "test_allocator.h"
template <class C>
-C
-make(int n)
-{
- C c;
- for (int i = 0; i < n; ++i)
- c.push_back(i);
- return c;
+C make(int n) {
+ C c;
+ for (int i = 0; i < n; ++i)
+ c.push_back(i);
+ return c;
}
template <class T>
-struct test
- : public std::priority_queue<T, std::vector<T, test_allocator<T> > >
-{
- typedef std::priority_queue<T, std::vector<T, test_allocator<T> > > base;
- typedef typename base::container_type container_type;
- typedef typename base::value_compare value_compare;
-
- explicit test(const test_allocator<int>& a) : base(a) {}
- test(const value_compare& compare, const test_allocator<int>& a)
- : base(compare, a) {}
- test(const value_compare& compare, const container_type& container,
- const test_allocator<int>& a) : base(compare, container, a) {}
+struct test : public std::priority_queue<T, std::vector<T, test_allocator<T> > > {
+ typedef std::priority_queue<T, std::vector<T, test_allocator<T> > > base;
+ typedef typename base::container_type container_type;
+ typedef typename base::value_compare value_compare;
+
+ explicit test(const test_allocator<int>& a) : base(a) {}
+ test(const value_compare& compare, const test_allocator<int>& a) : base(compare, a) {}
+ test(const value_compare& compare, const container_type& container, const test_allocator<int>& a)
+ : base(compare, container, a) {}
#if TEST_STD_VER >= 11 // testing rvalue ctor
- test(const value_compare& compare, container_type&& container,
- const test_allocator<int>& a) : base(compare, std::move(container), a) {}
- test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
+ test(const value_compare& compare, container_type&& container, const test_allocator<int>& a)
+ : base(compare, std::move(container), a) {}
+ test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
#endif
- test_allocator<int> get_allocator() {return c.get_allocator();}
+ test_allocator<int> get_allocator() { return c.get_allocator(); }
- using base::c;
+ using base::c;
};
-int main(int, char**)
-{
- typedef std::vector<int, test_allocator<int> > C;
- test<int> q(std::less<int>(), make<C>(5), test_allocator<int>(3));
- assert(q.c.get_allocator() == test_allocator<int>(3));
- assert(q.size() == 5);
- assert(q.top() == 4);
+int main(int, char**) {
+ typedef std::vector<int, test_allocator<int> > C;
+ test<int> q(std::less<int>(), make<C>(5), test_allocator<int>(3));
+ assert(q.c.get_allocator() == test_allocator<int>(3));
+ assert(q.size() == 5);
+ assert(q.top() == 4);
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_copy_alloc.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_copy_alloc.pass.cpp
index 77c9989e91c51d7..e658d6ce874f226 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_copy_alloc.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_copy_alloc.pass.cpp
@@ -15,46 +15,38 @@
#include <cassert>
template <class C>
-C
-make(int n)
-{
- C c;
- for (int i = 0; i < n; ++i)
- c.push_back(i);
- return c;
+C make(int n) {
+ C c;
+ for (int i = 0; i < n; ++i)
+ c.push_back(i);
+ return c;
}
#include "test_macros.h"
#include "test_allocator.h"
template <class T>
-struct test
- : public std::priority_queue<T, std::vector<T, test_allocator<T> > >
-{
- typedef std::priority_queue<T, std::vector<T, test_allocator<T> > > base;
- typedef typename base::container_type container_type;
- typedef typename base::value_compare value_compare;
-
- explicit test(const test_allocator<int>& a) : base(a) {}
- test(const value_compare& compare, const test_allocator<int>& a)
- : base(compare, c, a) {}
- test(const value_compare& compare, const container_type& container,
- const test_allocator<int>& a) : base(compare, container, a) {}
- test(const test& q, const test_allocator<int>& a) : base(q, a) {}
- test_allocator<int> get_allocator() {return c.get_allocator();}
-
- using base::c;
+struct test : public std::priority_queue<T, std::vector<T, test_allocator<T> > > {
+ typedef std::priority_queue<T, std::vector<T, test_allocator<T> > > base;
+ typedef typename base::container_type container_type;
+ typedef typename base::value_compare value_compare;
+
+ explicit test(const test_allocator<int>& a) : base(a) {}
+ test(const value_compare& compare, const test_allocator<int>& a) : base(compare, c, a) {}
+ test(const value_compare& compare, const container_type& container, const test_allocator<int>& a)
+ : base(compare, container, a) {}
+ test(const test& q, const test_allocator<int>& a) : base(q, a) {}
+ test_allocator<int> get_allocator() { return c.get_allocator(); }
+
+ using base::c;
};
-int main(int, char**)
-{
- test<int> qo(std::less<int>(),
- make<std::vector<int, test_allocator<int> > >(5),
- test_allocator<int>(2));
- test<int> q(qo, test_allocator<int>(6));
- assert(q.size() == 5);
- assert(q.c.get_allocator() == test_allocator<int>(6));
- assert(q.top() == int(4));
+int main(int, char**) {
+ test<int> qo(std::less<int>(), make<std::vector<int, test_allocator<int> > >(5), test_allocator<int>(2));
+ test<int> q(qo, test_allocator<int>(6));
+ assert(q.size() == 5);
+ assert(q.c.get_allocator() == test_allocator<int>(6));
+ assert(q.top() == int(4));
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_iter_iter_alloc.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_iter_iter_alloc.pass.cpp
index e413cb5921465d8..4786629d46a4157 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_iter_iter_alloc.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_iter_iter_alloc.pass.cpp
@@ -18,24 +18,23 @@
#include "test_macros.h"
#include "test_allocator.h"
-template<class T, class Cont, class Comp = std::less<T> >
+template <class T, class Cont, class Comp = std::less<T> >
struct PQ : std::priority_queue<T, Cont, Comp> {
- typedef std::priority_queue<T, Cont, Comp> base;
+ typedef std::priority_queue<T, Cont, Comp> base;
- template<class It, class Alloc>
- explicit PQ(It first, It last, const Alloc& a) : base(first, last, a) {}
+ template <class It, class Alloc>
+ explicit PQ(It first, It last, const Alloc& a) : base(first, last, a) {}
- using base::c;
+ using base::c;
};
-int main(int, char**)
-{
- int a[] = {3, 5, 2, 0, 6, 8, 1};
- typedef test_allocator<int> Alloc;
- PQ<int, std::vector<int, Alloc> > q(a, a+7, Alloc(2));
- assert(q.size() == 7);
- assert(q.top() == 8);
- assert(q.c.get_allocator() == Alloc(2));
+int main(int, char**) {
+ int a[] = {3, 5, 2, 0, 6, 8, 1};
+ typedef test_allocator<int> Alloc;
+ PQ<int, std::vector<int, Alloc> > q(a, a + 7, Alloc(2));
+ assert(q.size() == 7);
+ assert(q.top() == 8);
+ assert(q.c.get_allocator() == Alloc(2));
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_iter_iter_comp_alloc.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_iter_iter_comp_alloc.pass.cpp
index 5bea9312f61e093..d3e11b30b1f1655 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_iter_iter_comp_alloc.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_iter_iter_comp_alloc.pass.cpp
@@ -19,24 +19,23 @@
#include "test_macros.h"
#include "test_allocator.h"
-template<class T, class Cont, class Comp = std::less<T> >
+template <class T, class Cont, class Comp = std::less<T> >
struct PQ : std::priority_queue<T, Cont, Comp> {
- typedef std::priority_queue<T, Cont, Comp> base;
+ typedef std::priority_queue<T, Cont, Comp> base;
- template<class It, class Alloc>
- explicit PQ(It first, It last, const Comp& compare, const Alloc& a) : base(first, last, compare, a) {}
+ template <class It, class Alloc>
+ explicit PQ(It first, It last, const Comp& compare, const Alloc& a) : base(first, last, compare, a) {}
- using base::c;
+ using base::c;
};
-int main(int, char**)
-{
- int a[] = {3, 5, 2, 0, 6, 8, 1};
- typedef test_allocator<int> Alloc;
- PQ<int, std::vector<int, Alloc>, std::greater<int> > q(a, a+7, std::greater<int>(), Alloc(2));
- assert(q.size() == 7);
- assert(q.top() == 0);
- assert(q.c.get_allocator() == Alloc(2));
+int main(int, char**) {
+ int a[] = {3, 5, 2, 0, 6, 8, 1};
+ typedef test_allocator<int> Alloc;
+ PQ<int, std::vector<int, Alloc>, std::greater<int> > q(a, a + 7, std::greater<int>(), Alloc(2));
+ assert(q.size() == 7);
+ assert(q.top() == 0);
+ assert(q.c.get_allocator() == Alloc(2));
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_iter_iter_comp_cont_alloc.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_iter_iter_comp_cont_alloc.pass.cpp
index 1a7288e3305b08f..a989ca1559630d0 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_iter_iter_comp_cont_alloc.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_iter_iter_comp_cont_alloc.pass.cpp
@@ -18,25 +18,25 @@
#include "test_macros.h"
#include "test_allocator.h"
-template<class T, class Cont, class Comp = std::less<T> >
+template <class T, class Cont, class Comp = std::less<T> >
struct PQ : std::priority_queue<T, Cont, Comp> {
- typedef std::priority_queue<T, Cont, Comp> base;
+ typedef std::priority_queue<T, Cont, Comp> base;
- template<class It, class Alloc>
- explicit PQ(It first, It last, const Comp& compare, const Cont& v, const Alloc& a) : base(first, last, compare, v, a) {}
+ template <class It, class Alloc>
+ explicit PQ(It first, It last, const Comp& compare, const Cont& v, const Alloc& a)
+ : base(first, last, compare, v, a) {}
- using base::c;
+ using base::c;
};
-int main(int, char**)
-{
- typedef test_allocator<int> Alloc;
- int a[] = {3, 5, 2, 0, 6, 8, 1};
- std::vector<int, Alloc> v(a, a+3);
- PQ<int, std::vector<int, Alloc> > q(a+3, a+7, std::less<int>(), v, Alloc(2));
- assert(q.size() == 7);
- assert(q.top() == 8);
- assert(q.c.get_allocator() == Alloc(2));
-
- return 0;
+int main(int, char**) {
+ typedef test_allocator<int> Alloc;
+ int a[] = {3, 5, 2, 0, 6, 8, 1};
+ std::vector<int, Alloc> v(a, a + 3);
+ PQ<int, std::vector<int, Alloc> > q(a + 3, a + 7, std::less<int>(), v, Alloc(2));
+ assert(q.size() == 7);
+ assert(q.top() == 8);
+ assert(q.c.get_allocator() == Alloc(2));
+
+ return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_iter_iter_comp_rcont_alloc.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_iter_iter_comp_rcont_alloc.pass.cpp
index 31595f478be1bc4..bd373629955edc4 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_iter_iter_comp_rcont_alloc.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_iter_iter_comp_rcont_alloc.pass.cpp
@@ -21,26 +21,25 @@
#include "test_allocator.h"
#include "MoveOnly.h"
-template<class T, class Cont, class Comp = std::less<T> >
+template <class T, class Cont, class Comp = std::less<T> >
struct PQ : std::priority_queue<T, Cont, Comp> {
- typedef std::priority_queue<T, Cont, Comp> base;
+ typedef std::priority_queue<T, Cont, Comp> base;
- template<class It, class Alloc>
- explicit PQ(It first, It last, const Comp& compare, Cont&& v, const Alloc& a) : base(first, last, compare, std::move(v), a) {}
+ template <class It, class Alloc>
+ explicit PQ(It first, It last, const Comp& compare, Cont&& v, const Alloc& a)
+ : base(first, last, compare, std::move(v), a) {}
- using base::c;
+ using base::c;
};
-int main(int, char**)
-{
- using Alloc = test_allocator<MoveOnly>;
- int a[] = {3, 5, 2, 0, 6, 8, 1};
- PQ<MoveOnly, std::vector<MoveOnly, Alloc>> q(
- a+3, a+7, std::less<MoveOnly>(),
- std::vector<MoveOnly, Alloc>(a, a+3), Alloc(2));
- assert(q.size() == 7);
- assert(q.top() == MoveOnly(8));
- assert(q.c.get_allocator() == Alloc(2));
-
- return 0;
+int main(int, char**) {
+ using Alloc = test_allocator<MoveOnly>;
+ int a[] = {3, 5, 2, 0, 6, 8, 1};
+ PQ<MoveOnly, std::vector<MoveOnly, Alloc>> q(
+ a + 3, a + 7, std::less<MoveOnly>(), std::vector<MoveOnly, Alloc>(a, a + 3), Alloc(2));
+ assert(q.size() == 7);
+ assert(q.top() == MoveOnly(8));
+ assert(q.c.get_allocator() == Alloc(2));
+
+ return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_move_alloc.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_move_alloc.pass.cpp
index c1c05808606ab73..95c88cf877a596c 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_move_alloc.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_move_alloc.pass.cpp
@@ -19,50 +19,41 @@
#include "test_macros.h"
#include "MoveOnly.h"
-
template <class C>
-C
-make(int n)
-{
- C c;
- for (int i = 0; i < n; ++i)
- c.push_back(MoveOnly(i));
- return c;
+C make(int n) {
+ C c;
+ for (int i = 0; i < n; ++i)
+ c.push_back(MoveOnly(i));
+ return c;
}
#include "test_allocator.h"
template <class T>
-struct test
- : public std::priority_queue<T, std::vector<T, test_allocator<T> > >
-{
- typedef std::priority_queue<T, std::vector<T, test_allocator<T> > > base;
- typedef typename base::container_type container_type;
- typedef typename base::value_compare value_compare;
-
- explicit test(const test_allocator<int>& a) : base(a) {}
- test(const value_compare& compare, const test_allocator<int>& a)
- : base(compare, c, a) {}
- test(const value_compare& compare, const container_type& container,
- const test_allocator<int>& a) : base(compare, container, a) {}
- test(const value_compare& compare, container_type&& container,
- const test_allocator<int>& a) : base(compare, std::move(container), a) {}
- test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
- test_allocator<int> get_allocator() {return c.get_allocator();}
-
- using base::c;
+struct test : public std::priority_queue<T, std::vector<T, test_allocator<T> > > {
+ typedef std::priority_queue<T, std::vector<T, test_allocator<T> > > base;
+ typedef typename base::container_type container_type;
+ typedef typename base::value_compare value_compare;
+
+ explicit test(const test_allocator<int>& a) : base(a) {}
+ test(const value_compare& compare, const test_allocator<int>& a) : base(compare, c, a) {}
+ test(const value_compare& compare, const container_type& container, const test_allocator<int>& a)
+ : base(compare, container, a) {}
+ test(const value_compare& compare, container_type&& container, const test_allocator<int>& a)
+ : base(compare, std::move(container), a) {}
+ test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
+ test_allocator<int> get_allocator() { return c.get_allocator(); }
+
+ using base::c;
};
-
-int main(int, char**)
-{
- test<MoveOnly> qo(std::less<MoveOnly>(),
- make<std::vector<MoveOnly, test_allocator<MoveOnly> > >(5),
- test_allocator<MoveOnly>(2));
- test<MoveOnly> q(std::move(qo), test_allocator<MoveOnly>(6));
- assert(q.size() == 5);
- assert(q.c.get_allocator() == test_allocator<MoveOnly>(6));
- assert(q.top() == MoveOnly(4));
+int main(int, char**) {
+ test<MoveOnly> qo(
+ std::less<MoveOnly>(), make<std::vector<MoveOnly, test_allocator<MoveOnly> > >(5), test_allocator<MoveOnly>(2));
+ test<MoveOnly> q(std::move(qo), test_allocator<MoveOnly>(6));
+ assert(q.size() == 5);
+ assert(q.c.get_allocator() == test_allocator<MoveOnly>(6));
+ assert(q.top() == MoveOnly(4));
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/assign_copy.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/assign_copy.pass.cpp
index 8bbee85a75983e4..6acc8aef3456994 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/assign_copy.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/assign_copy.pass.cpp
@@ -17,23 +17,20 @@
#include "test_macros.h"
template <class C>
-C
-make(int n)
-{
- C c;
- for (int i = 0; i < n; ++i)
- c.push_back(i);
- return c;
+C make(int n) {
+ C c;
+ for (int i = 0; i < n; ++i)
+ c.push_back(i);
+ return c;
}
-int main(int, char**)
-{
- std::vector<int> v = make<std::vector<int> >(5);
- std::priority_queue<int, std::vector<int>, std::greater<int> > qo(std::greater<int>(), v);
- std::priority_queue<int, std::vector<int>, std::greater<int> > q;
- q = qo;
- assert(q.size() == 5);
- assert(q.top() == 0);
+int main(int, char**) {
+ std::vector<int> v = make<std::vector<int> >(5);
+ std::priority_queue<int, std::vector<int>, std::greater<int> > qo(std::greater<int>(), v);
+ std::priority_queue<int, std::vector<int>, std::greater<int> > q;
+ q = qo;
+ assert(q.size() == 5);
+ assert(q.top() == 0);
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/assign_move.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/assign_move.pass.cpp
index 84c3deadd7f2fe7..fbdc07f53066238 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/assign_move.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/assign_move.pass.cpp
@@ -18,25 +18,20 @@
#include "test_macros.h"
#include "MoveOnly.h"
-
template <class C>
-C
-make(int n)
-{
- C c;
- for (int i = 0; i < n; ++i)
- c.push_back(MoveOnly(i));
- return c;
+C make(int n) {
+ C c;
+ for (int i = 0; i < n; ++i)
+ c.push_back(MoveOnly(i));
+ return c;
}
-
-int main(int, char**)
-{
- std::priority_queue<MoveOnly> qo(std::less<MoveOnly>(), make<std::vector<MoveOnly> >(5));
- std::priority_queue<MoveOnly> q;
- q = std::move(qo);
- assert(q.size() == 5);
- assert(q.top() == MoveOnly(4));
+int main(int, char**) {
+ std::priority_queue<MoveOnly> qo(std::less<MoveOnly>(), make<std::vector<MoveOnly> >(5));
+ std::priority_queue<MoveOnly> q;
+ q = std::move(qo);
+ assert(q.size() == 5);
+ assert(q.top() == MoveOnly(4));
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp.pass.cpp
index 5c2fc5d89e9ed37..8e56ea6234e6164 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp.pass.cpp
@@ -16,24 +16,23 @@
#include "test_macros.h"
#include "test_allocator.h"
#if TEST_STD_VER >= 11
-#include "test_convertible.h"
+# include "test_convertible.h"
#endif
-int main(int, char**)
-{
- typedef std::vector<int, limited_allocator<int, 10> > Container;
- typedef std::less<int> Compare;
- typedef std::priority_queue<int, Container> Q;
- Q q((Compare()));
- assert(q.size() == 0);
- q.push(1);
- q.push(2);
- assert(q.size() == 2);
- assert(q.top() == 2);
+int main(int, char**) {
+ typedef std::vector<int, limited_allocator<int, 10> > Container;
+ typedef std::less<int> Compare;
+ typedef std::priority_queue<int, Container> Q;
+ Q q((Compare()));
+ assert(q.size() == 0);
+ q.push(1);
+ q.push(2);
+ assert(q.size() == 2);
+ assert(q.top() == 2);
#if TEST_STD_VER >= 11
- static_assert(!test_convertible<Q, const Compare&>(), "");
+ static_assert(!test_convertible<Q, const Compare&>(), "");
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_container.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_container.pass.cpp
index 07c50e38968a99e..08e74a790f9052b 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_container.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_container.pass.cpp
@@ -16,33 +16,30 @@
#include "test_macros.h"
#if TEST_STD_VER >= 11
-#include "test_convertible.h"
+# include "test_convertible.h"
#endif
template <class C>
-C
-make(int n)
-{
- C c;
- for (int i = 0; i < n; ++i)
- c.push_back(i);
- return c;
+C make(int n) {
+ C c;
+ for (int i = 0; i < n; ++i)
+ c.push_back(i);
+ return c;
}
-int main(int, char**)
-{
- typedef std::vector<int> Container;
- typedef std::greater<int> Compare;
- typedef std::priority_queue<int, Container, Compare> Q;
- Container v = make<Container>(5);
- Q q(Compare(), v);
- assert(q.size() == 5);
- assert(q.top() == 0);
+int main(int, char**) {
+ typedef std::vector<int> Container;
+ typedef std::greater<int> Compare;
+ typedef std::priority_queue<int, Container, Compare> Q;
+ Container v = make<Container>(5);
+ Q q(Compare(), v);
+ assert(q.size() == 5);
+ assert(q.top() == 0);
#if TEST_STD_VER >= 11
- // It should be explicit, so not convertible before C++20.
- static_assert(test_convertible<Q, const Compare&, const Container&>(), "");
+ // It should be explicit, so not convertible before C++20.
+ static_assert(test_convertible<Q, const Compare&, const Container&>(), "");
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_rcontainer.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_rcontainer.pass.cpp
index d555ecab549cdd7..f0b0eaef2f3d53f 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_rcontainer.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_rcontainer.pass.cpp
@@ -21,25 +21,22 @@
#include "test_convertible.h"
template <class C>
-C
-make(int n)
-{
- C c;
- for (int i = 0; i < n; ++i)
- c.push_back(MoveOnly(i));
- return c;
+C make(int n) {
+ C c;
+ for (int i = 0; i < n; ++i)
+ c.push_back(MoveOnly(i));
+ return c;
}
-int main(int, char**)
-{
- typedef std::vector<MoveOnly> Container;
- typedef std::less<MoveOnly> Compare;
- typedef std::priority_queue<MoveOnly> Q;
- Q q(Compare(), make<Container>(5));
- assert(q.size() == 5);
- assert(q.top() == MoveOnly(4));
+int main(int, char**) {
+ typedef std::vector<MoveOnly> Container;
+ typedef std::less<MoveOnly> Compare;
+ typedef std::priority_queue<MoveOnly> Q;
+ Q q(Compare(), make<Container>(5));
+ assert(q.size() == 5);
+ assert(q.top() == MoveOnly(4));
- static_assert(test_convertible<Q, const Compare&, Container&&>(), "");
+ static_assert(test_convertible<Q, const Compare&, Container&&>(), "");
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_copy.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_copy.pass.cpp
index 5ab4337f8152bd6..0e9f58ec8b9c922 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_copy.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_copy.pass.cpp
@@ -17,22 +17,19 @@
#include "test_macros.h"
template <class C>
-C
-make(int n)
-{
- C c;
- for (int i = 0; i < n; ++i)
- c.push_back(i);
- return c;
+C make(int n) {
+ C c;
+ for (int i = 0; i < n; ++i)
+ c.push_back(i);
+ return c;
}
-int main(int, char**)
-{
- std::vector<int> v = make<std::vector<int> >(5);
- std::priority_queue<int, std::vector<int>, std::greater<int> > qo(std::greater<int>(), v);
- std::priority_queue<int, std::vector<int>, std::greater<int> > q = qo;
- assert(q.size() == 5);
- assert(q.top() == 0);
+int main(int, char**) {
+ std::vector<int> v = make<std::vector<int> >(5);
+ std::priority_queue<int, std::vector<int>, std::greater<int> > qo(std::greater<int>(), v);
+ std::priority_queue<int, std::vector<int>, std::greater<int> > q = qo;
+ assert(q.size() == 5);
+ assert(q.top() == 0);
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_default.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_default.pass.cpp
index e483763ab7b6e38..c25caee07ff49c8 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_default.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_default.pass.cpp
@@ -18,24 +18,23 @@
#include "test_macros.h"
#include "test_allocator.h"
#if TEST_STD_VER >= 11
-#include "test_convertible.h"
+# include "test_convertible.h"
#endif
-int main(int, char**)
-{
- typedef std::vector<int, limited_allocator<int, 10> > Container;
- typedef std::priority_queue<int, Container> Q;
- Q q;
- assert(q.size() == 0);
- q.push(1);
- q.push(2);
- assert(q.size() == 2);
- assert(q.top() == 2);
+int main(int, char**) {
+ typedef std::vector<int, limited_allocator<int, 10> > Container;
+ typedef std::priority_queue<int, Container> Q;
+ Q q;
+ assert(q.size() == 0);
+ q.push(1);
+ q.push(2);
+ assert(q.size() == 2);
+ assert(q.top() == 2);
#if TEST_STD_VER >= 11
- // It should be explicit, so not convertible before C++20.
- static_assert(test_convertible<Q>(), "");
+ // It should be explicit, so not convertible before C++20.
+ static_assert(test_convertible<Q>(), "");
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_constraint.compile.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_constraint.compile.pass.cpp
index 283cbc02883cd0f..913e944b3f04cd1 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_constraint.compile.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_constraint.compile.pass.cpp
@@ -30,30 +30,46 @@
#include <vector>
// Sanity-check that std::vector is constructible from two ints...
-static_assert( std::is_constructible<std::vector<int>, int*, int*>::value, "");
-static_assert( std::is_constructible<std::vector<int>, int , int >::value, "");
+static_assert(std::is_constructible<std::vector<int>, int*, int*>::value, "");
+static_assert(std::is_constructible<std::vector<int>, int, int >::value, "");
// ...but std::priority_queue is not.
-static_assert( std::is_constructible<std::priority_queue<int>, int*, int*>::value, "");
-static_assert(!std::is_constructible<std::priority_queue<int>, int , int >::value, "");
+static_assert(std::is_constructible<std::priority_queue<int>, int*, int*>::value, "");
+static_assert(!std::is_constructible<std::priority_queue<int>, int, int >::value, "");
-static_assert( std::is_constructible<std::priority_queue<int>, int*, int*, std::less<int>>::value, "");
-static_assert(!std::is_constructible<std::priority_queue<int>, int , int , std::less<int>>::value, "");
+static_assert(std::is_constructible<std::priority_queue<int>, int*, int*, std::less<int>>::value, "");
+static_assert(!std::is_constructible<std::priority_queue<int>, int, int, std::less<int>>::value, "");
-static_assert( std::is_constructible<std::priority_queue<int>, int*, int*, std::less<int>, std::vector<int>>::value, "");
-static_assert(!std::is_constructible<std::priority_queue<int>, int , int , std::less<int>, std::vector<int>>::value, "");
+static_assert(std::is_constructible<std::priority_queue<int>, int*, int*, std::less<int>, std::vector<int>>::value, "");
+static_assert(!std::is_constructible<std::priority_queue<int>, int, int, std::less<int>, std::vector<int>>::value, "");
-static_assert( std::is_constructible<std::priority_queue<int>, int*, int*, std::less<int>, std::vector<int>&>::value, "");
-static_assert(!std::is_constructible<std::priority_queue<int>, int , int , std::less<int>, std::vector<int>&>::value, "");
+static_assert(std::is_constructible<std::priority_queue<int>, int*, int*, std::less<int>, std::vector<int>&>::value,
+ "");
+static_assert(!std::is_constructible<std::priority_queue<int>, int, int, std::less<int>, std::vector<int>&>::value, "");
-static_assert( std::is_constructible<std::priority_queue<int>, int*, int*, std::allocator<int>>::value, "");
-static_assert(!std::is_constructible<std::priority_queue<int>, int , int , std::allocator<int>>::value, "");
+static_assert(std::is_constructible<std::priority_queue<int>, int*, int*, std::allocator<int>>::value, "");
+static_assert(!std::is_constructible<std::priority_queue<int>, int, int, std::allocator<int>>::value, "");
-static_assert( std::is_constructible<std::priority_queue<int>, int*, int*, std::less<int>, std::allocator<int>>::value, "");
-static_assert(!std::is_constructible<std::priority_queue<int>, int , int , std::less<int>, std::allocator<int>>::value, "");
+static_assert(std::is_constructible<std::priority_queue<int>, int*, int*, std::less<int>, std::allocator<int>>::value,
+ "");
+static_assert(!std::is_constructible<std::priority_queue<int>, int, int, std::less<int>, std::allocator<int>>::value,
+ "");
-static_assert( std::is_constructible<std::priority_queue<int>, int*, int*, std::less<int>, std::vector<int>, std::allocator<int>>::value, "");
-static_assert(!std::is_constructible<std::priority_queue<int>, int , int , std::less<int>, std::vector<int>, std::allocator<int>>::value, "");
+static_assert(
+ std::is_constructible<std::priority_queue<int>, int*, int*, std::less<int>, std::vector<int>, std::allocator<int>>::
+ value,
+ "");
+static_assert(
+ !std::is_constructible<std::priority_queue<int>, int, int, std::less<int>, std::vector<int>, std::allocator<int>>::
+ value,
+ "");
-static_assert( std::is_constructible<std::priority_queue<int>, int*, int*, std::less<int>, std::vector<int>&, std::allocator<int>>::value, "");
-static_assert(!std::is_constructible<std::priority_queue<int>, int , int , std::less<int>, std::vector<int>&, std::allocator<int>>::value, "");
+static_assert(
+ std::
+ is_constructible<std::priority_queue<int>, int*, int*, std::less<int>, std::vector<int>&, std::allocator<int>>::
+ value,
+ "");
+static_assert(
+ !std::is_constructible<std::priority_queue<int>, int, int, std::less<int>, std::vector<int>&, std::allocator<int>>::
+ value,
+ "");
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter.pass.cpp
index c3838fc97b8cdf8..9566c18193fbbcc 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter.pass.cpp
@@ -17,13 +17,12 @@
#include "test_macros.h"
-int main(int, char**)
-{
- int a[] = {3, 5, 2, 0, 6, 8, 1};
- int* an = a + sizeof(a)/sizeof(a[0]);
- std::priority_queue<int> q(a, an);
- assert(q.size() == static_cast<std::size_t>(an - a));
- assert(q.top() == 8);
+int main(int, char**) {
+ int a[] = {3, 5, 2, 0, 6, 8, 1};
+ int* an = a + sizeof(a) / sizeof(a[0]);
+ std::priority_queue<int> q(a, an);
+ assert(q.size() == static_cast<std::size_t>(an - a));
+ assert(q.top() == 8);
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp.pass.cpp
index 0ae3d102e6e3c1d..aa3e31b9195728b 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp.pass.cpp
@@ -18,14 +18,12 @@
#include "test_macros.h"
-int main(int, char**)
-{
- int a[] = {3, 5, 2, 0, 6, 8, 1};
- int* an = a + sizeof(a)/sizeof(a[0]);
- std::priority_queue<int, std::vector<int>, std::greater<int> >
- q(a, an, std::greater<int>());
- assert(q.size() == static_cast<std::size_t>(an - a));
- assert(q.top() == 0);
+int main(int, char**) {
+ int a[] = {3, 5, 2, 0, 6, 8, 1};
+ int* an = a + sizeof(a) / sizeof(a[0]);
+ std::priority_queue<int, std::vector<int>, std::greater<int> > q(a, an, std::greater<int>());
+ assert(q.size() == static_cast<std::size_t>(an - a));
+ assert(q.top() == 0);
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp_cont.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp_cont.pass.cpp
index adba98aac85f262..49518488f6c9907 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp_cont.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp_cont.pass.cpp
@@ -17,14 +17,13 @@
#include "test_macros.h"
-int main(int, char**)
-{
- int a[] = {3, 5, 2, 0, 6, 8, 1};
- const int n = sizeof(a)/sizeof(a[0]);
- std::vector<int> v(a, a+n/2);
- std::priority_queue<int> q(a+n/2, a+n, std::less<int>(), v);
- assert(q.size() == n);
- assert(q.top() == 8);
+int main(int, char**) {
+ int a[] = {3, 5, 2, 0, 6, 8, 1};
+ const int n = sizeof(a) / sizeof(a[0]);
+ std::vector<int> v(a, a + n / 2);
+ std::priority_queue<int> q(a + n / 2, a + n, std::less<int>(), v);
+ assert(q.size() == n);
+ assert(q.top() == 8);
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp_rcont.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp_rcont.pass.cpp
index e09cb687d2589ae..85e31054babc829 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp_rcont.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp_rcont.pass.cpp
@@ -20,15 +20,12 @@
#include "test_macros.h"
#include "MoveOnly.h"
-int main(int, char**)
-{
- int a[] = {3, 5, 2, 0, 6, 8, 1};
- const int n = sizeof(a)/sizeof(a[0]);
- std::priority_queue<MoveOnly> q(a+n/2, a+n,
- std::less<MoveOnly>(),
- std::vector<MoveOnly>(a, a+n/2));
- assert(q.size() == n);
- assert(q.top() == MoveOnly(8));
+int main(int, char**) {
+ int a[] = {3, 5, 2, 0, 6, 8, 1};
+ const int n = sizeof(a) / sizeof(a[0]);
+ std::priority_queue<MoveOnly> q(a + n / 2, a + n, std::less<MoveOnly>(), std::vector<MoveOnly>(a, a + n / 2));
+ assert(q.size() == n);
+ assert(q.top() == MoveOnly(8));
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_move.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_move.pass.cpp
index 88a8573c9daf3a5..74213881e98f371 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_move.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_move.pass.cpp
@@ -18,24 +18,19 @@
#include "test_macros.h"
#include "MoveOnly.h"
-
template <class C>
-C
-make(int n)
-{
- C c;
- for (int i = 0; i < n; ++i)
- c.push_back(MoveOnly(i));
- return c;
+C make(int n) {
+ C c;
+ for (int i = 0; i < n; ++i)
+ c.push_back(MoveOnly(i));
+ return c;
}
-
-int main(int, char**)
-{
- std::priority_queue<MoveOnly> qo(std::less<MoveOnly>(), make<std::vector<MoveOnly> >(5));
- std::priority_queue<MoveOnly> q = std::move(qo);
- assert(q.size() == 5);
- assert(q.top() == MoveOnly(4));
+int main(int, char**) {
+ std::priority_queue<MoveOnly> qo(std::less<MoveOnly>(), make<std::vector<MoveOnly> >(5));
+ std::priority_queue<MoveOnly> q = std::move(qo);
+ assert(q.size() == 5);
+ assert(q.top() == MoveOnly(4));
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/deduct.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/deduct.pass.cpp
index 51954b2e8512381..b0099719d84f05c 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/deduct.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/deduct.pass.cpp
@@ -52,378 +52,381 @@
struct A {};
-int main(int, char**)
-{
-
-// Test the explicit deduction guides
- {
- std::vector<int> v{0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
+int main(int, char**) {
+ // Test the explicit deduction guides
+ {
+ std::vector<int> v{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
std::priority_queue pri(std::greater<int>(), v); // priority_queue(Compare, Container)
static_assert(std::is_same_v<decltype(pri), std::priority_queue<int, std::vector<int>, std::greater<int>>>, "");
assert(pri.size() == v.size());
assert(pri.top() == 0);
- }
+ }
- {
- std::vector<long, test_allocator<long>> v{10, 11, 12, 13, 14, 15, 16, 17, 18, 19 };
- std::priority_queue pri(std::greater<long>(), v, test_allocator<long>(2)); // priority_queue(Compare, Container, Allocator)
+ {
+ std::vector<long, test_allocator<long>> v{10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
+ std::priority_queue pri(
+ std::greater<long>(), v, test_allocator<long>(2)); // priority_queue(Compare, Container, Allocator)
- static_assert(std::is_same_v<decltype(pri),
- std::priority_queue<long, std::vector<long, test_allocator<long>>, std::greater<long>>>, "");
+ static_assert(
+ std::is_same_v<decltype(pri),
+ std::priority_queue<long, std::vector<long, test_allocator<long>>, std::greater<long>>>,
+ "");
assert(pri.size() == v.size());
assert(pri.top() == 10);
- }
+ }
- {
- std::vector<short> v{10, 11, 12, 13, 14, 15, 28, 17, 18, 19 };
+ {
+ std::vector<short> v{10, 11, 12, 13, 14, 15, 28, 17, 18, 19};
std::priority_queue pri(v.begin(), v.end()); // priority_queue(Iter, Iter)
static_assert(std::is_same_v<decltype(pri), std::priority_queue<short>>, "");
assert(pri.size() == v.size());
assert(pri.top() == 28);
- }
+ }
- {
- std::vector<double> v{10, 11, 12, 13, 6, 15, 28, 17, 18, 19 };
+ {
+ std::vector<double> v{10, 11, 12, 13, 6, 15, 28, 17, 18, 19};
std::priority_queue pri(v.begin(), v.end(), std::greater<double>()); // priority_queue(Iter, Iter, Comp)
- static_assert(std::is_same_v<decltype(pri), std::priority_queue<double, std::vector<double>, std::greater<double>>>, "");
+ static_assert(
+ std::is_same_v<decltype(pri), std::priority_queue<double, std::vector<double>, std::greater<double>>>, "");
assert(pri.size() == v.size());
assert(pri.top() == 6);
- }
+ }
- {
- std::vector<double> v{10, 6, 15, 28, 4, 18, 19 };
+ {
+ std::vector<double> v{10, 6, 15, 28, 4, 18, 19};
std::deque<double> deq;
- std::priority_queue pri(v.begin(), v.end(), std::greater<double>(), deq); // priority_queue(Iter, Iter, Comp, Container)
+ std::priority_queue pri(
+ v.begin(), v.end(), std::greater<double>(), deq); // priority_queue(Iter, Iter, Comp, Container)
- static_assert(std::is_same_v<decltype(pri), std::priority_queue<double, std::deque<double>, std::greater<double>>>, "");
+ static_assert(
+ std::is_same_v<decltype(pri), std::priority_queue<double, std::deque<double>, std::greater<double>>>, "");
assert(pri.size() == v.size());
assert(pri.top() == 4);
- }
+ }
-// Test the implicit deduction guides
- {
-// We don't expect this one to work - no way to implicitly get value_type
-// std::priority_queue pri(std::allocator<int>()); // queue (allocator &)
- }
+ // Test the implicit deduction guides
+ {
+ // We don't expect this one to work - no way to implicitly get value_type
+ // std::priority_queue pri(std::allocator<int>()); // queue (allocator &)
+ }
- {
+ {
std::priority_queue<float> source;
std::priority_queue pri(source); // priority_queue(priority_queue &)
static_assert(std::is_same_v<decltype(pri)::value_type, float>, "");
static_assert(std::is_same_v<decltype(pri)::container_type, std::vector<float>>, "");
assert(pri.size() == 0);
+ }
+
+ {
+ typedef short T;
+ typedef std::greater<T> Comp;
+ typedef test_allocator<T> Alloc;
+ typedef std::deque<T, Alloc> Cont;
+ typedef test_allocator<int> ConvertibleToAlloc;
+ static_assert(std::uses_allocator_v<Cont, ConvertibleToAlloc> &&
+ !std::is_same_v<typename Cont::allocator_type, ConvertibleToAlloc>);
+
+ {
+ Comp comp;
+ Cont cont;
+ std::priority_queue pri(comp, cont, Alloc(2));
+ static_assert(std::is_same_v<decltype(pri), std::priority_queue<T, Cont, Comp>>);
+ }
+
+ {
+ Comp comp;
+ Cont cont;
+ std::priority_queue pri(comp, cont, ConvertibleToAlloc(2));
+ static_assert(std::is_same_v<decltype(pri), std::priority_queue<T, Cont, Comp>>);
}
{
- typedef short T;
- typedef std::greater<T> Comp;
- typedef test_allocator<T> Alloc;
- typedef std::deque<T, Alloc> Cont;
- typedef test_allocator<int> ConvertibleToAlloc;
- static_assert(std::uses_allocator_v<Cont, ConvertibleToAlloc> &&
- !std::is_same_v<typename Cont::allocator_type, ConvertibleToAlloc>);
-
- {
- Comp comp;
- Cont cont;
- std::priority_queue pri(comp, cont, Alloc(2));
- static_assert(std::is_same_v<decltype(pri), std::priority_queue<T, Cont, Comp>>);
- }
-
- {
- Comp comp;
- Cont cont;
- std::priority_queue pri(comp, cont, ConvertibleToAlloc(2));
- static_assert(std::is_same_v<decltype(pri), std::priority_queue<T, Cont, Comp>>);
- }
-
- {
- Comp comp;
- Cont cont;
- std::priority_queue pri(comp, std::move(cont), Alloc(2));
- static_assert(std::is_same_v<decltype(pri), std::priority_queue<T, Cont, Comp>>);
- }
-
- {
- Comp comp;
- Cont cont;
- std::priority_queue pri(comp, std::move(cont), ConvertibleToAlloc(2));
- static_assert(std::is_same_v<decltype(pri), std::priority_queue<T, Cont, Comp>>);
- }
+ Comp comp;
+ Cont cont;
+ std::priority_queue pri(comp, std::move(cont), Alloc(2));
+ static_assert(std::is_same_v<decltype(pri), std::priority_queue<T, Cont, Comp>>);
}
{
- typedef short T;
- typedef signed char ConvertibleToT;
- typedef std::greater<T> Comp;
- typedef test_allocator<T> Alloc;
- typedef std::deque<T, Alloc> Cont;
- typedef test_allocator<int> ConvertibleToAlloc;
- static_assert(std::uses_allocator_v<Cont, ConvertibleToAlloc> &&
- !std::is_same_v<typename Cont::allocator_type, ConvertibleToAlloc>);
-
- {
- std::priority_queue<T, Cont, Comp> source;
- std::priority_queue pri(source, Alloc(2));
- static_assert(std::is_same_v<decltype(pri), std::priority_queue<T, Cont, Comp>>);
- }
-
- {
- std::priority_queue<T, Cont, Comp> source;
- std::priority_queue pri(source, ConvertibleToAlloc(2));
- static_assert(std::is_same_v<decltype(pri), std::priority_queue<T, Cont, Comp>>);
- }
-
- {
- std::priority_queue<T, Cont, Comp> source;
- std::priority_queue pri(std::move(source), Alloc(2));
- static_assert(std::is_same_v<decltype(pri), std::priority_queue<T, Cont, Comp>>);
- }
-
- {
- std::priority_queue<T, Cont, Comp> source;
- std::priority_queue pri(std::move(source), ConvertibleToAlloc(2));
- static_assert(std::is_same_v<decltype(pri), std::priority_queue<T, Cont, Comp>>);
- }
-
- {
- Cont cont;
- std::priority_queue pri(Comp(), cont, Alloc(2));
- static_assert(std::is_same_v<decltype(pri), std::priority_queue<T, Cont, Comp>>);
- }
-
- {
- Cont cont;
- std::priority_queue pri(Comp(), cont, ConvertibleToAlloc(2));
- static_assert(std::is_same_v<decltype(pri), std::priority_queue<T, Cont, Comp>>);
- }
-
- {
- Cont cont;
- std::priority_queue pri(Comp(), std::move(cont), Alloc(2));
- static_assert(std::is_same_v<decltype(pri), std::priority_queue<T, Cont, Comp>>);
- }
-
- {
- Cont cont;
- std::priority_queue pri(Comp(), std::move(cont), ConvertibleToAlloc(2));
- static_assert(std::is_same_v<decltype(pri), std::priority_queue<T, Cont, Comp>>);
- }
-
- {
- T a[2] = {};
- std::priority_queue pri(a, a+2, Alloc(2));
- static_assert(std::is_same_v<decltype(pri), std::priority_queue<T, std::vector<T, Alloc>>>);
- }
-
- {
- T a[2] = {};
- std::priority_queue pri(a, a+2, Comp(), Alloc(2));
- static_assert(std::is_same_v<decltype(pri), std::priority_queue<T, std::vector<T, Alloc>, Comp>>);
- }
-
- {
- Cont cont;
- ConvertibleToT a[2] = {};
- std::priority_queue pri(a, a+2, Comp(), cont, Alloc(2));
- static_assert(std::is_same_v<decltype(pri), std::priority_queue<T, Cont, Comp>>);
- }
-
- {
- Cont cont;
- ConvertibleToT a[2] = {};
- std::priority_queue pri(a, a+2, Comp(), cont, ConvertibleToAlloc(2));
- static_assert(std::is_same_v<decltype(pri), std::priority_queue<T, Cont, Comp>>);
- }
-
- {
- Cont cont;
- ConvertibleToT a[2] = {};
- std::priority_queue pri(a, a+2, Comp(), std::move(cont), Alloc(2));
- static_assert(std::is_same_v<decltype(pri), std::priority_queue<T, Cont, Comp>>);
- }
-
- {
- Cont cont;
- ConvertibleToT a[2] = {};
- std::priority_queue pri(a, a+2, Comp(), std::move(cont), ConvertibleToAlloc(2));
- static_assert(std::is_same_v<decltype(pri), std::priority_queue<T, Cont, Comp>>);
- }
+ Comp comp;
+ Cont cont;
+ std::priority_queue pri(comp, std::move(cont), ConvertibleToAlloc(2));
+ static_assert(std::is_same_v<decltype(pri), std::priority_queue<T, Cont, Comp>>);
+ }
+ }
+
+ {
+ typedef short T;
+ typedef signed char ConvertibleToT;
+ typedef std::greater<T> Comp;
+ typedef test_allocator<T> Alloc;
+ typedef std::deque<T, Alloc> Cont;
+ typedef test_allocator<int> ConvertibleToAlloc;
+ static_assert(std::uses_allocator_v<Cont, ConvertibleToAlloc> &&
+ !std::is_same_v<typename Cont::allocator_type, ConvertibleToAlloc>);
-#if TEST_STD_VER >= 23
- { // (from_range, range)
- std::priority_queue c(std::from_range, Cont());
- static_assert(std::is_same_v<decltype(c), std::priority_queue<T>>);
- }
-
- { // (from_range, range, compare)
- std::priority_queue c(std::from_range, Cont(), Comp());
- static_assert(std::is_same_v<decltype(c), std::priority_queue<T, std::vector<T>, Comp>>);
- }
-
- { // (from_range, range, compare, alloc)
- std::priority_queue c(std::from_range, Cont(), Comp(), Alloc(2));
- static_assert(std::is_same_v<decltype(c), std::priority_queue<T, std::vector<T, Alloc>, Comp>>);
- }
-
- { // (from_range, range, alloc)
- std::priority_queue c(std::from_range, Cont(), Alloc(2));
- static_assert(std::is_same_v<decltype(c), std::priority_queue<T, std::vector<T, Alloc>>>);
- }
-#endif // TEST_STD_VER >= 23
+ {
+ std::priority_queue<T, Cont, Comp> source;
+ std::priority_queue pri(source, Alloc(2));
+ static_assert(std::is_same_v<decltype(pri), std::priority_queue<T, Cont, Comp>>);
+ }
+
+ {
+ std::priority_queue<T, Cont, Comp> source;
+ std::priority_queue pri(source, ConvertibleToAlloc(2));
+ static_assert(std::is_same_v<decltype(pri), std::priority_queue<T, Cont, Comp>>);
+ }
+
+ {
+ std::priority_queue<T, Cont, Comp> source;
+ std::priority_queue pri(std::move(source), Alloc(2));
+ static_assert(std::is_same_v<decltype(pri), std::priority_queue<T, Cont, Comp>>);
+ }
+
+ {
+ std::priority_queue<T, Cont, Comp> source;
+ std::priority_queue pri(std::move(source), ConvertibleToAlloc(2));
+ static_assert(std::is_same_v<decltype(pri), std::priority_queue<T, Cont, Comp>>);
+ }
+
+ {
+ Cont cont;
+ std::priority_queue pri(Comp(), cont, Alloc(2));
+ static_assert(std::is_same_v<decltype(pri), std::priority_queue<T, Cont, Comp>>);
}
- // Deduction guides should be SFINAE'd away when given:
- // - "bad" input iterators (that is, a type not qualifying as an input
- // iterator);
- // - a bad allocator;
- // - an allocator instead of a comparator;
- // - an allocator instead of a container;
- // - an allocator and a container that uses a
diff erent allocator.
{
- using Comp = std::less<int>;
- using Cont = std::vector<int>;
- using Alloc = std::allocator<int>;
- using Iter = int*;
-
- // The only requirement in the Standard is that integral types cannot be
- // considered input iterators, beyond that it is unspecified.
- using BadIter = int;
+ Cont cont;
+ std::priority_queue pri(Comp(), cont, ConvertibleToAlloc(2));
+ static_assert(std::is_same_v<decltype(pri), std::priority_queue<T, Cont, Comp>>);
+ }
+
+ {
+ Cont cont;
+ std::priority_queue pri(Comp(), std::move(cont), Alloc(2));
+ static_assert(std::is_same_v<decltype(pri), std::priority_queue<T, Cont, Comp>>);
+ }
+
+ {
+ Cont cont;
+ std::priority_queue pri(Comp(), std::move(cont), ConvertibleToAlloc(2));
+ static_assert(std::is_same_v<decltype(pri), std::priority_queue<T, Cont, Comp>>);
+ }
+
+ {
+ T a[2] = {};
+ std::priority_queue pri(a, a + 2, Alloc(2));
+ static_assert(std::is_same_v<decltype(pri), std::priority_queue<T, std::vector<T, Alloc>>>);
+ }
+
+ {
+ T a[2] = {};
+ std::priority_queue pri(a, a + 2, Comp(), Alloc(2));
+ static_assert(std::is_same_v<decltype(pri), std::priority_queue<T, std::vector<T, Alloc>, Comp>>);
+ }
+
+ {
+ Cont cont;
+ ConvertibleToT a[2] = {};
+ std::priority_queue pri(a, a + 2, Comp(), cont, Alloc(2));
+ static_assert(std::is_same_v<decltype(pri), std::priority_queue<T, Cont, Comp>>);
+ }
+
+ {
+ Cont cont;
+ ConvertibleToT a[2] = {};
+ std::priority_queue pri(a, a + 2, Comp(), cont, ConvertibleToAlloc(2));
+ static_assert(std::is_same_v<decltype(pri), std::priority_queue<T, Cont, Comp>>);
+ }
+
+ {
+ Cont cont;
+ ConvertibleToT a[2] = {};
+ std::priority_queue pri(a, a + 2, Comp(), std::move(cont), Alloc(2));
+ static_assert(std::is_same_v<decltype(pri), std::priority_queue<T, Cont, Comp>>);
+ }
+
+ {
+ Cont cont;
+ ConvertibleToT a[2] = {};
+ std::priority_queue pri(a, a + 2, Comp(), std::move(cont), ConvertibleToAlloc(2));
+ static_assert(std::is_same_v<decltype(pri), std::priority_queue<T, Cont, Comp>>);
+ }
+
+#if TEST_STD_VER >= 23
+ { // (from_range, range)
+ std::priority_queue c(std::from_range, Cont());
+ static_assert(std::is_same_v<decltype(c), std::priority_queue<T>>);
+ }
+
+ { // (from_range, range, compare)
+ std::priority_queue c(std::from_range, Cont(), Comp());
+ static_assert(std::is_same_v<decltype(c), std::priority_queue<T, std::vector<T>, Comp>>);
+ }
+
+ { // (from_range, range, compare, alloc)
+ std::priority_queue c(std::from_range, Cont(), Comp(), Alloc(2));
+ static_assert(std::is_same_v<decltype(c), std::priority_queue<T, std::vector<T, Alloc>, Comp>>);
+ }
+
+ { // (from_range, range, alloc)
+ std::priority_queue c(std::from_range, Cont(), Alloc(2));
+ static_assert(std::is_same_v<decltype(c), std::priority_queue<T, std::vector<T, Alloc>>>);
+ }
+#endif // TEST_STD_VER >= 23
+ }
+
+ // Deduction guides should be SFINAE'd away when given:
+ // - "bad" input iterators (that is, a type not qualifying as an input
+ // iterator);
+ // - a bad allocator;
+ // - an allocator instead of a comparator;
+ // - an allocator instead of a container;
+ // - an allocator and a container that uses a
diff erent allocator.
+ {
+ using Comp = std::less<int>;
+ using Cont = std::vector<int>;
+ using Alloc = std::allocator<int>;
+ using Iter = int*;
+
+ // The only requirement in the Standard is that integral types cannot be
+ // considered input iterators, beyond that it is unspecified.
+ using BadIter = int;
#ifdef _LIBCPP_VERSION
- struct OutputIter {
- using iterator_category = std::output_iterator_tag;
- using value_type = void;
- using
diff erence_type = void;
- using pointer = void;
- using reference = void;
-
- const OutputIter& operator*() const { return *this; }
- const OutputIter& operator++() { return *this; }
- OutputIter operator++(int) const { return *this; }
- };
+ struct OutputIter {
+ using iterator_category = std::output_iterator_tag;
+ using value_type = void;
+ using
diff erence_type = void;
+ using pointer = void;
+ using reference = void;
+
+ const OutputIter& operator*() const { return *this; }
+ const OutputIter& operator++() { return *this; }
+ OutputIter operator++(int) const { return *this; }
+ };
#endif // _LIBCPP_VERSION
- struct BadAlloc {};
- using AllocAsComp = Alloc;
- using AllocAsCont = Alloc;
- using DiffAlloc = test_allocator<int>;
-
- // (iter, iter)
- //
- // Cannot deduce from (BAD_iter, BAD_iter)
- static_assert(SFINAEs_away<std::priority_queue, BadIter, BadIter>);
- // Note: (OutputIter, OutputIter) is interpreted as (comp, cont) and fails on accessing
- // non-existent typedefs in `OutputIter` (as if it were a container). There is no
- // requirement to SFINAE away bad containers.
-
- // (iter, iter, comp)
- //
- // Cannot deduce from (BAD_iter, BAD_iter, comp)
- static_assert(SFINAEs_away<std::priority_queue, BadIter, BadIter, Comp>);
- LIBCPP_STATIC_ASSERT(SFINAEs_away<std::priority_queue, OutputIter, OutputIter, Comp>);
- // Note: (iter, iter, ALLOC_as_comp) is allowed -- it just calls (iter, iter, alloc).
-
- // (iter, iter, comp, cont)
- //
- // Cannot deduce from (BAD_iter, BAD_iter, comp, cont)
- static_assert(SFINAEs_away<std::priority_queue, BadIter, BadIter, Comp, Cont>);
- LIBCPP_STATIC_ASSERT(SFINAEs_away<std::priority_queue, OutputIter, OutputIter, Comp, Cont>);
- // Cannot deduce from (iter, iter, ALLOC_as_comp, cont)
- static_assert(SFINAEs_away<std::priority_queue, Iter, Iter, AllocAsComp, Cont>);
- // Note: (iter, iter, comp, ALLOC_as_cont) is allowed -- it just calls (iter, iter, comp,
- // alloc).
-
- // (iter, iter, alloc)
- //
- // Cannot deduce from (BAD_iter, BAD_iter, alloc)
- static_assert(SFINAEs_away<std::priority_queue, BadIter, BadIter, Alloc>);
- LIBCPP_STATIC_ASSERT(SFINAEs_away<std::priority_queue, OutputIter, OutputIter, Alloc>);
- // Note: (iter, iter, BAD_alloc) is interpreted as (iter, iter, comp) instead and fails upon
- // instantiation. There is no requirement to SFINAE away bad comparators.
-
- // (iter, iter, comp, alloc)
- //
- // Cannot deduce from (iter, iter, ALLOC_as_comp, alloc)
- static_assert(SFINAEs_away<std::priority_queue, Iter, Iter, AllocAsComp, Alloc>);
- // Note: (iter, iter, comp, BAD_alloc) is interpreted as (iter, iter, comp, cont) instead
- // and fails upon instantiation. There is no requirement to SFINAE away bad containers.
-
- // (iter, iter, comp, cont, alloc)
- //
- // Cannot deduce from (BAD_iter, BAD_iter, comp, cont, alloc)
- static_assert(SFINAEs_away<std::priority_queue, BadIter, BadIter, Comp, Cont, Alloc>);
- LIBCPP_STATIC_ASSERT(
- SFINAEs_away<std::priority_queue, OutputIter, OutputIter, Comp, Cont, Alloc>);
- // Cannot deduce from (iter, iter, ALLOC_as_comp, cont, alloc)
- static_assert(SFINAEs_away<std::priority_queue, Iter, Iter, AllocAsComp, Cont, Alloc>);
- // Cannot deduce from (iter, iter, comp, ALLOC_as_cont, alloc)
- static_assert(SFINAEs_away<std::priority_queue, Iter, Iter, Comp, AllocAsCont, Alloc>);
- // Cannot deduce from (iter, iter, comp, cont, BAD_alloc)
- static_assert(SFINAEs_away<std::priority_queue, Iter, Iter, Comp, Cont, BadAlloc>);
- // Cannot deduce from (iter, iter, comp, cont, DIFFERENT_alloc)
- static_assert(SFINAEs_away<std::priority_queue, Iter, Iter, Comp, Cont, DiffAlloc>);
-
- // (comp, alloc)
- //
- // Cannot deduce from (ALLOC_as_comp, alloc)
- static_assert(SFINAEs_away<std::priority_queue, AllocAsComp, Alloc>);
- // Cannot deduce from (comp, BAD_alloc)
- static_assert(SFINAEs_away<std::priority_queue, Comp, BadAlloc>);
-
- // (comp, cont, alloc)
- //
- // Cannot deduce from (ALLOC_as_comp, cont, alloc)
- static_assert(SFINAEs_away<std::priority_queue, AllocAsComp, Cont, Alloc>);
- // Cannot deduce from (comp, ALLOC_as_cont, alloc)
- static_assert(SFINAEs_away<std::priority_queue, Comp, AllocAsCont, Alloc>);
- // Cannot deduce from (comp, cont, BAD_alloc)
- static_assert(SFINAEs_away<std::priority_queue, Comp, Cont, BadAlloc>);
- // Cannot deduce from (comp, cont, DIFFERENT_alloc)
- static_assert(SFINAEs_away<std::priority_queue, Comp, Cont, DiffAlloc>);
-
- // (comp, cont)
- //
- // Cannot deduce from (ALLOC_as_comp, cont)
- static_assert(SFINAEs_away<std::priority_queue, AllocAsComp, Cont>);
- // Cannot deduce from (comp, ALLOC_as_cont)
- static_assert(SFINAEs_away<std::priority_queue, Comp, AllocAsCont>);
+ struct BadAlloc {};
+ using AllocAsComp = Alloc;
+ using AllocAsCont = Alloc;
+ using DiffAlloc = test_allocator<int>;
+
+ // (iter, iter)
+ //
+ // Cannot deduce from (BAD_iter, BAD_iter)
+ static_assert(SFINAEs_away<std::priority_queue, BadIter, BadIter>);
+ // Note: (OutputIter, OutputIter) is interpreted as (comp, cont) and fails on accessing
+ // non-existent typedefs in `OutputIter` (as if it were a container). There is no
+ // requirement to SFINAE away bad containers.
+
+ // (iter, iter, comp)
+ //
+ // Cannot deduce from (BAD_iter, BAD_iter, comp)
+ static_assert(SFINAEs_away<std::priority_queue, BadIter, BadIter, Comp>);
+ LIBCPP_STATIC_ASSERT(SFINAEs_away<std::priority_queue, OutputIter, OutputIter, Comp>);
+ // Note: (iter, iter, ALLOC_as_comp) is allowed -- it just calls (iter, iter, alloc).
+
+ // (iter, iter, comp, cont)
+ //
+ // Cannot deduce from (BAD_iter, BAD_iter, comp, cont)
+ static_assert(SFINAEs_away<std::priority_queue, BadIter, BadIter, Comp, Cont>);
+ LIBCPP_STATIC_ASSERT(SFINAEs_away<std::priority_queue, OutputIter, OutputIter, Comp, Cont>);
+ // Cannot deduce from (iter, iter, ALLOC_as_comp, cont)
+ static_assert(SFINAEs_away<std::priority_queue, Iter, Iter, AllocAsComp, Cont>);
+ // Note: (iter, iter, comp, ALLOC_as_cont) is allowed -- it just calls (iter, iter, comp,
+ // alloc).
+
+ // (iter, iter, alloc)
+ //
+ // Cannot deduce from (BAD_iter, BAD_iter, alloc)
+ static_assert(SFINAEs_away<std::priority_queue, BadIter, BadIter, Alloc>);
+ LIBCPP_STATIC_ASSERT(SFINAEs_away<std::priority_queue, OutputIter, OutputIter, Alloc>);
+ // Note: (iter, iter, BAD_alloc) is interpreted as (iter, iter, comp) instead and fails upon
+ // instantiation. There is no requirement to SFINAE away bad comparators.
+
+ // (iter, iter, comp, alloc)
+ //
+ // Cannot deduce from (iter, iter, ALLOC_as_comp, alloc)
+ static_assert(SFINAEs_away<std::priority_queue, Iter, Iter, AllocAsComp, Alloc>);
+ // Note: (iter, iter, comp, BAD_alloc) is interpreted as (iter, iter, comp, cont) instead
+ // and fails upon instantiation. There is no requirement to SFINAE away bad containers.
+
+ // (iter, iter, comp, cont, alloc)
+ //
+ // Cannot deduce from (BAD_iter, BAD_iter, comp, cont, alloc)
+ static_assert(SFINAEs_away<std::priority_queue, BadIter, BadIter, Comp, Cont, Alloc>);
+ LIBCPP_STATIC_ASSERT(SFINAEs_away<std::priority_queue, OutputIter, OutputIter, Comp, Cont, Alloc>);
+ // Cannot deduce from (iter, iter, ALLOC_as_comp, cont, alloc)
+ static_assert(SFINAEs_away<std::priority_queue, Iter, Iter, AllocAsComp, Cont, Alloc>);
+ // Cannot deduce from (iter, iter, comp, ALLOC_as_cont, alloc)
+ static_assert(SFINAEs_away<std::priority_queue, Iter, Iter, Comp, AllocAsCont, Alloc>);
+ // Cannot deduce from (iter, iter, comp, cont, BAD_alloc)
+ static_assert(SFINAEs_away<std::priority_queue, Iter, Iter, Comp, Cont, BadAlloc>);
+ // Cannot deduce from (iter, iter, comp, cont, DIFFERENT_alloc)
+ static_assert(SFINAEs_away<std::priority_queue, Iter, Iter, Comp, Cont, DiffAlloc>);
+
+ // (comp, alloc)
+ //
+ // Cannot deduce from (ALLOC_as_comp, alloc)
+ static_assert(SFINAEs_away<std::priority_queue, AllocAsComp, Alloc>);
+ // Cannot deduce from (comp, BAD_alloc)
+ static_assert(SFINAEs_away<std::priority_queue, Comp, BadAlloc>);
+
+ // (comp, cont, alloc)
+ //
+ // Cannot deduce from (ALLOC_as_comp, cont, alloc)
+ static_assert(SFINAEs_away<std::priority_queue, AllocAsComp, Cont, Alloc>);
+ // Cannot deduce from (comp, ALLOC_as_cont, alloc)
+ static_assert(SFINAEs_away<std::priority_queue, Comp, AllocAsCont, Alloc>);
+ // Cannot deduce from (comp, cont, BAD_alloc)
+ static_assert(SFINAEs_away<std::priority_queue, Comp, Cont, BadAlloc>);
+ // Cannot deduce from (comp, cont, DIFFERENT_alloc)
+ static_assert(SFINAEs_away<std::priority_queue, Comp, Cont, DiffAlloc>);
+
+ // (comp, cont)
+ //
+ // Cannot deduce from (ALLOC_as_comp, cont)
+ static_assert(SFINAEs_away<std::priority_queue, AllocAsComp, Cont>);
+ // Cannot deduce from (comp, ALLOC_as_cont)
+ static_assert(SFINAEs_away<std::priority_queue, Comp, AllocAsCont>);
#if TEST_STD_VER >= 23
- using Range = RangeT<int>;
- using BadRange = BadRangeT<int>;
-
- // (from_range, range)
- //
- // Cannot deduce from (from_range, BAD_range)
- static_assert(SFINAEs_away<std::priority_queue, BadRange>);
-
- // (from_range, range, compare)
- //
- // Cannot deduce from (from_range, BAD_range, compare)
- static_assert(SFINAEs_away<std::priority_queue, BadRange, Comp>);
-
- // (from_range, range, compare, alloc)
- //
- // Cannot deduce from (from_range, BAD_range, compare, alloc)
- static_assert(SFINAEs_away<std::priority_queue, BadRange, Comp, Alloc>);
- // Cannot deduce from (from_range, range, compare, BAD_alloc)
- static_assert(SFINAEs_away<std::priority_queue, Range, Comp, BadAlloc>);
- // Cannot deduce from (from_range, range, compare, DIFFERENT_alloc)
- static_assert(SFINAEs_away<std::priority_queue, Range, Comp, DiffAlloc>);
-
- // (from_range, range, alloc)
- //
- // Cannot deduce from (from_range, BAD_range, alloc)
- static_assert(SFINAEs_away<std::priority_queue, BadRange, Alloc>);
- // Cannot deduce from (from_range, range, BAD_alloc)
- static_assert(SFINAEs_away<std::priority_queue, Range, BadAlloc>);
- // Cannot deduce from (from_range, range, DIFFERENT_alloc)
- static_assert(SFINAEs_away<std::priority_queue, Range, DiffAlloc>);
+ using Range = RangeT<int>;
+ using BadRange = BadRangeT<int>;
+
+ // (from_range, range)
+ //
+ // Cannot deduce from (from_range, BAD_range)
+ static_assert(SFINAEs_away<std::priority_queue, BadRange>);
+
+ // (from_range, range, compare)
+ //
+ // Cannot deduce from (from_range, BAD_range, compare)
+ static_assert(SFINAEs_away<std::priority_queue, BadRange, Comp>);
+
+ // (from_range, range, compare, alloc)
+ //
+ // Cannot deduce from (from_range, BAD_range, compare, alloc)
+ static_assert(SFINAEs_away<std::priority_queue, BadRange, Comp, Alloc>);
+ // Cannot deduce from (from_range, range, compare, BAD_alloc)
+ static_assert(SFINAEs_away<std::priority_queue, Range, Comp, BadAlloc>);
+ // Cannot deduce from (from_range, range, compare, DIFFERENT_alloc)
+ static_assert(SFINAEs_away<std::priority_queue, Range, Comp, DiffAlloc>);
+
+ // (from_range, range, alloc)
+ //
+ // Cannot deduce from (from_range, BAD_range, alloc)
+ static_assert(SFINAEs_away<std::priority_queue, BadRange, Alloc>);
+ // Cannot deduce from (from_range, range, BAD_alloc)
+ static_assert(SFINAEs_away<std::priority_queue, Range, BadAlloc>);
+ // Cannot deduce from (from_range, range, DIFFERENT_alloc)
+ static_assert(SFINAEs_away<std::priority_queue, Range, DiffAlloc>);
#endif // TEST_STD_VER >= 23
- }
+ }
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/deduct.verify.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/deduct.verify.cpp
index 73487597ca56eb7..057b06b4d3fd725 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/deduct.verify.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/deduct.verify.cpp
@@ -15,44 +15,46 @@
#include <cassert>
#include <cstddef>
-
-int main(int, char**)
-{
-// Test the explicit deduction guides
- {
-// queue(Compare, Container, const Alloc);
-// The '45' is not an allocator
- std::priority_queue pri(std::greater<int>(), std::deque<int>({1,2,3}), 45); // expected-error-re {{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}priority_queue'}}
- }
-
- {
-// queue(const queue&, const Alloc&);
-// The '45' is not an allocator
+int main(int, char**) {
+ // Test the explicit deduction guides
+ {
+ // queue(Compare, Container, const Alloc);
+ // The '45' is not an allocator
+ std::priority_queue pri(std::greater<int>(), std::deque<int>({1, 2, 3}), 45);
+ // expected-error-re at -1 {{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}priority_queue'}}
+ }
+
+ {
+ // queue(const queue&, const Alloc&);
+ // The '45' is not an allocator
std::priority_queue<int> source;
- std::priority_queue pri(source, 45); // expected-error-re {{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}priority_queue'}}
- }
-
- {
-// priority_queue(Iter, Iter, Comp)
-// int is not an iterator
- std::priority_queue pri(15, 17, std::greater<double>()); // expected-error-re {{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}priority_queue'}}
- }
-
- {
-// priority_queue(Iter, Iter, Comp, Container)
-// float is not an iterator
- std::priority_queue pri(23.f, 2.f, std::greater<float>(), std::deque<float>()); // expected-error-re {{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}priority_queue'}}
- }
-
-// Test the implicit deduction guides
- {
-// priority_queue (allocator &)
- std::priority_queue pri((std::allocator<int>())); // expected-error-re {{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}priority_queue'}}
-// Note: The extra parens are necessary, since otherwise clang decides it is a function declaration.
-// Also, we can't use {} instead of parens, because that constructs a
-// stack<allocator<int>, allocator<allocator<int>>>
- }
-
+ std::priority_queue pri(source, 45);
+ // expected-error-re at -1 {{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}priority_queue'}}
+ }
+
+ {
+ // priority_queue(Iter, Iter, Comp)
+ // int is not an iterator
+ std::priority_queue pri(15, 17, std::greater< double>());
+ // expected-error-re at -1 {{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}priority_queue'}}
+ }
+
+ {
+ // priority_queue(Iter, Iter, Comp, Container)
+ // float is not an iterator
+ std::priority_queue pri(23.f, 2.f, std::greater<float>(), std::deque< float>());
+ // expected-error-re at -1 {{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}priority_queue'}}
+ }
+
+ // Test the implicit deduction guides
+ {
+ // priority_queue (allocator &)
+ std::priority_queue pri((std::allocator< int>()));
+ // expected-error-re at -1 {{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}priority_queue'}}
+ // Note: The extra parens are necessary, since otherwise clang decides it is a function declaration.
+ // Also, we can't use {} instead of parens, because that constructs a
+ // stack<allocator<int>, allocator<allocator<int>>>
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/default_noexcept.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/default_noexcept.pass.cpp
index 80af575a5209788..620938b5b714981 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/default_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/default_noexcept.pass.cpp
@@ -16,20 +16,18 @@
// This tests a conforming extension
-
#include <queue>
#include <cassert>
#include "test_macros.h"
#include "MoveOnly.h"
-int main(int, char**)
-{
+int main(int, char**) {
#if defined(_LIBCPP_VERSION)
- {
- typedef std::priority_queue<MoveOnly> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
- }
+ {
+ typedef std::priority_queue<MoveOnly> C;
+ static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/dtor_noexcept.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/dtor_noexcept.pass.cpp
index 147e70ef27b9590..d292dd24312dd22 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/dtor_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/dtor_noexcept.pass.cpp
@@ -19,12 +19,11 @@
#include "test_macros.h"
#include "MoveOnly.h"
-int main(int, char**)
-{
- {
- typedef std::priority_queue<MoveOnly> C;
- static_assert(std::is_nothrow_destructible<C>::value, "");
- }
+int main(int, char**) {
+ {
+ typedef std::priority_queue<MoveOnly> C;
+ static_assert(std::is_nothrow_destructible<C>::value, "");
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/from_range.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/from_range.pass.cpp
index de453f72dc8b3f2..7d3cc2eb6b343b2 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/from_range.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/from_range.pass.cpp
@@ -22,7 +22,7 @@
// priority_queue(from_range_t, R&& rg, const Alloc&); // since C++23
template <class Range>
-concept PriorityQueueHasFromRangeCtr = requires (Range&& range) {
+concept PriorityQueueHasFromRangeCtr = requires(Range&& range) {
std::priority_queue<int>(std::from_range, std::forward<Range>(range));
std::priority_queue<int>(std::from_range, std::forward<Range>(range), std::less<int>());
std::priority_queue<int>(std::from_range, std::forward<Range>(range), std::less<int>(), std::allocator<int>());
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/move_assign_noexcept.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/move_assign_noexcept.pass.cpp
index b24a5e77b27f7f7..18412d705c9c028 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/move_assign_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/move_assign_noexcept.pass.cpp
@@ -22,12 +22,11 @@
#include "test_macros.h"
#include "MoveOnly.h"
-int main(int, char**)
-{
- {
- typedef std::priority_queue<MoveOnly> C;
- static_assert(std::is_nothrow_move_assignable<C>::value, "");
- }
+int main(int, char**) {
+ {
+ typedef std::priority_queue<MoveOnly> C;
+ static_assert(std::is_nothrow_move_assignable<C>::value, "");
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/move_noexcept.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/move_noexcept.pass.cpp
index 582556cea24f08a..8dd6de7480b8829 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/move_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/move_noexcept.pass.cpp
@@ -22,12 +22,11 @@
#include "test_macros.h"
#include "MoveOnly.h"
-int main(int, char**)
-{
- {
- typedef std::priority_queue<MoveOnly> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
- }
+int main(int, char**) {
+ {
+ typedef std::priority_queue<MoveOnly> C;
+ static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/emplace.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/emplace.pass.cpp
index 4d2c716583e253a..f9f88fd84308252 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/emplace.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/emplace.pass.cpp
@@ -20,15 +20,14 @@
#include "test_macros.h"
#include "../../../Emplaceable.h"
-int main(int, char**)
-{
- std::priority_queue<Emplaceable> q;
- q.emplace(1, 2.5);
- assert(q.top() == Emplaceable(1, 2.5));
- q.emplace(3, 4.5);
- assert(q.top() == Emplaceable(3, 4.5));
- q.emplace(2, 3.5);
- assert(q.top() == Emplaceable(3, 4.5));
+int main(int, char**) {
+ std::priority_queue<Emplaceable> q;
+ q.emplace(1, 2.5);
+ assert(q.top() == Emplaceable(1, 2.5));
+ q.emplace(3, 4.5);
+ assert(q.top() == Emplaceable(3, 4.5));
+ q.emplace(2, 3.5);
+ assert(q.top() == Emplaceable(3, 4.5));
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/empty.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/empty.pass.cpp
index 9629bd9b16de763..758c5354aea4d13 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/empty.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/empty.pass.cpp
@@ -17,14 +17,13 @@
#include "test_macros.h"
-int main(int, char**)
-{
- std::priority_queue<int> q;
- assert(q.empty());
- q.push(1);
- assert(!q.empty());
- q.pop();
- assert(q.empty());
+int main(int, char**) {
+ std::priority_queue<int> q;
+ assert(q.empty());
+ q.push(1);
+ assert(!q.empty());
+ q.pop();
+ assert(q.empty());
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/empty.verify.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/empty.verify.cpp
index 793f47d12c20a1c..5202710846e8b28 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/empty.verify.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/empty.verify.cpp
@@ -17,6 +17,6 @@
#include <queue>
void f() {
- std::priority_queue<int> c;
- c.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::priority_queue<int> c;
+ c.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/pop.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/pop.pass.cpp
index fcba8329d7e6307..dba6614ad5b6982 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/pop.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/pop.pass.cpp
@@ -17,21 +17,20 @@
#include "test_macros.h"
-int main(int, char**)
-{
- std::priority_queue<int> q;
- q.push(1);
- assert(q.top() == 1);
- q.push(3);
- assert(q.top() == 3);
- q.push(2);
- assert(q.top() == 3);
- q.pop();
- assert(q.top() == 2);
- q.pop();
- assert(q.top() == 1);
- q.pop();
- assert(q.empty());
+int main(int, char**) {
+ std::priority_queue<int> q;
+ q.push(1);
+ assert(q.top() == 1);
+ q.push(3);
+ assert(q.top() == 3);
+ q.push(2);
+ assert(q.top() == 3);
+ q.pop();
+ assert(q.top() == 2);
+ q.pop();
+ assert(q.top() == 1);
+ q.pop();
+ assert(q.empty());
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/push.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/push.pass.cpp
index 039087c45211cf1..36ba7d241c5ba10 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/push.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/push.pass.cpp
@@ -17,15 +17,14 @@
#include "test_macros.h"
-int main(int, char**)
-{
- std::priority_queue<int> q;
- q.push(1);
- assert(q.top() == 1);
- q.push(3);
- assert(q.top() == 3);
- q.push(2);
- assert(q.top() == 3);
+int main(int, char**) {
+ std::priority_queue<int> q;
+ q.push(1);
+ assert(q.top() == 1);
+ q.push(3);
+ assert(q.top() == 3);
+ q.push(2);
+ assert(q.top() == 3);
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/push_range.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/push_range.pass.cpp
index 9a57d930e69d9e1..26ce56ff5daf6a6 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/push_range.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/push_range.pass.cpp
@@ -30,4 +30,3 @@ int main(int, char**) {
return 0;
}
-
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/push_rvalue.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/push_rvalue.pass.cpp
index 2f6e7a7b025ef14..7700b641a429b00 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/push_rvalue.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/push_rvalue.pass.cpp
@@ -20,15 +20,14 @@
#include "test_macros.h"
#include "MoveOnly.h"
-int main(int, char**)
-{
- std::priority_queue<MoveOnly> q;
- q.push(1);
- assert(q.top() == 1);
- q.push(3);
- assert(q.top() == 3);
- q.push(2);
- assert(q.top() == 3);
+int main(int, char**) {
+ std::priority_queue<MoveOnly> q;
+ q.push(1);
+ assert(q.top() == 1);
+ q.push(3);
+ assert(q.top() == 3);
+ q.push(2);
+ assert(q.top() == 3);
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/size.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/size.pass.cpp
index 6fa21279637d49c..2c6b00b87c6ba28 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/size.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/size.pass.cpp
@@ -17,14 +17,13 @@
#include "test_macros.h"
-int main(int, char**)
-{
- std::priority_queue<int> q;
- assert(q.size() == 0);
- q.push(1);
- assert(q.size() == 1);
- q.pop();
- assert(q.size() == 0);
+int main(int, char**) {
+ std::priority_queue<int> q;
+ assert(q.size() == 0);
+ q.push(1);
+ assert(q.size() == 1);
+ q.pop();
+ assert(q.size() == 0);
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/swap.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/swap.pass.cpp
index 295eaf08e0e3a5e..87e6722d79e35ed 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/swap.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/swap.pass.cpp
@@ -17,17 +17,16 @@
#include "test_macros.h"
-int main(int, char**)
-{
- std::priority_queue<int> q1;
- std::priority_queue<int> q2;
- q1.push(1);
- q1.push(3);
- q1.push(2);
- q1.swap(q2);
- assert(q1.empty());
- assert(q2.size() == 3);
- assert(q2.top() == 3);
+int main(int, char**) {
+ std::priority_queue<int> q1;
+ std::priority_queue<int> q2;
+ q1.push(1);
+ q1.push(3);
+ q1.push(2);
+ q1.swap(q2);
+ assert(q1.empty());
+ assert(q2.size() == 3);
+ assert(q2.top() == 3);
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/top.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/top.pass.cpp
index 72153bc532f7ffe..8b046bc3ccca5fe 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/top.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/top.pass.cpp
@@ -17,15 +17,14 @@
#include "test_macros.h"
-int main(int, char**)
-{
- std::priority_queue<int> q;
- q.push(1);
- assert(q.top() == 1);
- q.push(3);
- assert(q.top() == 3);
- q.push(2);
- assert(q.top() == 3);
+int main(int, char**) {
+ std::priority_queue<int> q;
+ q.push(1);
+ assert(q.top() == 1);
+ q.push(3);
+ assert(q.top() == 3);
+ q.push(2);
+ assert(q.top() == 3);
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.special/swap.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.special/swap.pass.cpp
index 1f5b86dc0ecf9e1..c280601baf17d12 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.special/swap.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.special/swap.pass.cpp
@@ -19,17 +19,16 @@
#include "test_macros.h"
-int main(int, char**)
-{
- std::priority_queue<int> q1;
- std::priority_queue<int> q2;
- q1.push(1);
- q1.push(3);
- q1.push(2);
- swap(q1, q2);
- assert(q1.empty());
- assert(q2.size() == 3);
- assert(q2.top() == 3);
+int main(int, char**) {
+ std::priority_queue<int> q1;
+ std::priority_queue<int> q2;
+ q1.push(1);
+ q1.push(3);
+ q1.push(2);
+ swap(q1, q2);
+ assert(q1.empty());
+ assert(q2.size() == 3);
+ assert(q2.top() == 3);
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.special/swap_noexcept.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.special/swap_noexcept.pass.cpp
index 579ec0aba770887..7b4678053fcff30 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.special/swap_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.special/swap_noexcept.pass.cpp
@@ -23,12 +23,11 @@
#include "test_macros.h"
#include "MoveOnly.h"
-int main(int, char**)
-{
- {
- typedef std::priority_queue<MoveOnly> C;
- static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
+int main(int, char**) {
+ {
+ typedef std::priority_queue<MoveOnly> C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/types.compile.fail.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/types.compile.fail.cpp
index 244028e444d3aa4..0dfbe06cf183912 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/types.compile.fail.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/types.compile.fail.cpp
@@ -27,10 +27,9 @@
#include <cassert>
#include <type_traits>
-int main(int, char**)
-{
-// LWG#2566 says that the first template param must match the second one's value type
- std::priority_queue<double, std::deque<int>> t;
+int main(int, char**) {
+ // LWG#2566 says that the first template param must match the second one's value type
+ std::priority_queue<double, std::deque<int>> t;
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/types.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/types.pass.cpp
index fb801d831e9e8e8..d90933925a73b67 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/types.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/types.pass.cpp
@@ -34,38 +34,37 @@
#include "test_macros.h"
-struct test
- : private std::priority_queue<int>
-{
- test()
- {
- c.push_back(1);
- assert(comp(1, 2));
- }
+struct test : private std::priority_queue<int> {
+ test() {
+ c.push_back(1);
+ assert(comp(1, 2));
+ }
};
-struct C
-{
- typedef int value_type;
- typedef int& reference;
- typedef const int& const_reference;
- typedef int size_type;
+struct C {
+ typedef int value_type;
+ typedef int& reference;
+ typedef const int& const_reference;
+ typedef int size_type;
};
-int main(int, char**)
-{
- static_assert(( std::is_same<std::priority_queue<int>::container_type, std::vector<int> >::value), "");
- static_assert(( std::is_same<std::priority_queue<int, std::deque<int> >::container_type, std::deque<int> >::value), "");
- static_assert(( std::is_same<std::priority_queue<int, std::deque<int> >::value_type, int>::value), "");
- static_assert(( std::is_same<std::priority_queue<int>::reference, std::vector<int>::reference>::value), "");
- static_assert(( std::is_same<std::priority_queue<int>::const_reference, std::vector<int>::const_reference>::value), "");
- static_assert(( std::is_same<std::priority_queue<int>::size_type, std::vector<int>::size_type>::value), "");
- static_assert(( std::is_same<std::priority_queue<int>::value_compare, std::less<int> >::value), "");
- static_assert(( std::is_same<std::priority_queue<int, std::deque<int> >::value_compare, std::less<int> >::value), "");
- static_assert(( std::is_same<std::priority_queue<int, std::deque<int>, std::greater<int> >::value_compare, std::greater<int> >::value), "");
- static_assert(( std::uses_allocator<std::priority_queue<int>, std::allocator<int> >::value), "");
- static_assert((!std::uses_allocator<std::priority_queue<int, C>, std::allocator<int> >::value), "");
- test t;
+int main(int, char**) {
+ static_assert((std::is_same<std::priority_queue<int>::container_type, std::vector<int> >::value), "");
+ static_assert(
+ (std::is_same<std::priority_queue<int, std::deque<int> >::container_type, std::deque<int> >::value), "");
+ static_assert((std::is_same<std::priority_queue<int, std::deque<int> >::value_type, int>::value), "");
+ static_assert((std::is_same<std::priority_queue<int>::reference, std::vector<int>::reference>::value), "");
+ static_assert(
+ (std::is_same<std::priority_queue<int>::const_reference, std::vector<int>::const_reference>::value), "");
+ static_assert((std::is_same<std::priority_queue<int>::size_type, std::vector<int>::size_type>::value), "");
+ static_assert((std::is_same<std::priority_queue<int>::value_compare, std::less<int> >::value), "");
+ static_assert((std::is_same<std::priority_queue<int, std::deque<int> >::value_compare, std::less<int> >::value), "");
+ static_assert((std::is_same<std::priority_queue<int, std::deque<int>, std::greater<int> >::value_compare,
+ std::greater<int> >::value),
+ "");
+ static_assert((std::uses_allocator<std::priority_queue<int>, std::allocator<int> >::value), "");
+ static_assert((!std::uses_allocator<std::priority_queue<int, C>, std::allocator<int> >::value), "");
+ test t;
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/push_range_container_adaptors.h b/libcxx/test/std/containers/container.adaptors/push_range_container_adaptors.h
index 19e63d23884b272..adf439081a35585 100644
--- a/libcxx/test/std/containers/container.adaptors/push_range_container_adaptors.h
+++ b/libcxx/test/std/containers/container.adaptors/push_range_container_adaptors.h
@@ -32,9 +32,7 @@
#include "unwrap_container_adaptor.h"
template <class Container, class Range>
-concept HasPushRange = requires (Container& c, Range&& range) {
- c.push_range(range);
-};
+concept HasPushRange = requires(Container& c, Range&& range) { c.push_range(range); };
template <template <class...> class Container, class T, class U>
constexpr bool test_constraints_push_range() {
@@ -55,55 +53,48 @@ constexpr bool test_constraints_push_range() {
// Empty container.
template <class T>
-TestCase<T> constexpr EmptyContainer_EmptyRange {
- .initial = {}, .input = {}, .expected = {}
-};
+TestCase<T> constexpr EmptyContainer_EmptyRange{.initial = {}, .input = {}, .expected = {}};
-template <class T> constexpr TestCase<T> EmptyContainer_OneElementRange {
- .initial = {}, .input = {5}, .expected = {5}
-};
+template <class T>
+constexpr TestCase<T> EmptyContainer_OneElementRange{.initial = {}, .input = {5}, .expected = {5}};
-template <class T> constexpr TestCase<T> EmptyContainer_MidRange {
- .initial = {}, .input = {5, 3, 1, 7, 9}, .expected = {5, 3, 1, 7, 9}
-};
+template <class T>
+constexpr TestCase<T> EmptyContainer_MidRange{.initial = {}, .input = {5, 3, 1, 7, 9}, .expected = {5, 3, 1, 7, 9}};
// One-element container.
-template <class T> constexpr TestCase<T> OneElementContainer_EmptyRange {
- .initial = {3}, .input = {}, .expected = {3}
-};
+template <class T>
+constexpr TestCase<T> OneElementContainer_EmptyRange{.initial = {3}, .input = {}, .expected = {3}};
-template <class T> constexpr TestCase<T> OneElementContainer_OneElementRange {
- .initial = {3}, .input = {-5}, .expected = {3, -5}
-};
+template <class T>
+constexpr TestCase<T> OneElementContainer_OneElementRange{.initial = {3}, .input = {-5}, .expected = {3, -5}};
-template <class T> constexpr TestCase<T> OneElementContainer_MidRange {
- .initial = {3}, .input = {-5, -3, -1, -7, -9}, .expected = {3, -5, -3, -1, -7, -9}
-};
+template <class T>
+constexpr TestCase<T> OneElementContainer_MidRange{
+ .initial = {3}, .input = {-5, -3, -1, -7, -9}, .expected = {3, -5, -3, -1, -7, -9}};
// Full container.
-template <class T> constexpr TestCase<T> FullContainer_EmptyRange {
- .initial = {11, 29, 35, 14, 84}, .input = {}, .expected = {11, 29, 35, 14, 84}
-};
+template <class T>
+constexpr TestCase<T> FullContainer_EmptyRange{
+ .initial = {11, 29, 35, 14, 84}, .input = {}, .expected = {11, 29, 35, 14, 84}};
-template <class T> constexpr TestCase<T> FullContainer_OneElementRange {
- .initial = {11, 29, 35, 14, 84}, .input = {-5}, .expected = {11, 29, 35, 14, 84, -5}
-};
+template <class T>
+constexpr TestCase<T> FullContainer_OneElementRange{
+ .initial = {11, 29, 35, 14, 84}, .input = {-5}, .expected = {11, 29, 35, 14, 84, -5}};
-template <class T> constexpr TestCase<T> FullContainer_MidRange {
- .initial = {11, 29, 35, 14, 84},
- .input = {-5, -3, -1, -7, -9},
- .expected = {11, 29, 35, 14, 84, -5, -3, -1, -7, -9}
-};
+template <class T>
+constexpr TestCase<T> FullContainer_MidRange{
+ .initial = {11, 29, 35, 14, 84},
+ .input = {-5, -3, -1, -7, -9},
+ .expected = {11, 29, 35, 14, 84, -5, -3, -1, -7, -9}};
-template <class T> constexpr TestCase<T> FullContainer_LongRange {
- .initial = {11, 29, 35, 14, 84},
- .input = {-5, -3, -1, -7, -9, -19, -48, -56, -13, -14, -29, -88, -17, -1, -5, -11, -89, -21, -33, -48},
- .expected = {
- 11, 29, 35, 14, 84, -5, -3, -1, -7, -9, -19, -48, -56, -13, -14, -29, -88, -17, -1, -5, -11, -89, -21, -33, -48
- }
-};
+template <class T>
+constexpr TestCase<T> FullContainer_LongRange{
+ .initial = {11, 29, 35, 14, 84},
+ .input = {-5, -3, -1, -7, -9, -19, -48, -56, -13, -14, -29, -88, -17, -1, -5, -11, -89, -21, -33, -48},
+ .expected = {11, 29, 35, 14, 84, -5, -3, -1, -7, -9, -19, -48, -56,
+ -13, -14, -29, -88, -17, -1, -5, -11, -89, -21, -33, -48}};
// Container adaptors tests.
@@ -159,7 +150,7 @@ constexpr void test_push_range(bool is_result_heapified = false) {
// Move-only types.
-template <template <class ...> class Container>
+template <template <class...> class Container>
constexpr void test_push_range_move_only() {
MoveOnly input[5];
std::ranges::subrange in(std::move_iterator{input}, std::move_iterator{input + 5});
@@ -170,25 +161,21 @@ constexpr void test_push_range_move_only() {
// Check that `append_range` is preferred if available and `push_back` is used as a fallback.
-enum class InserterChoice {
- Invalid,
- PushBack,
- AppendRange
-};
+enum class InserterChoice { Invalid, PushBack, AppendRange };
template <class T, InserterChoice Inserter>
struct Container {
InserterChoice inserter_choice = InserterChoice::Invalid;
- using value_type = T;
- using iterator = T*;
- using reference = T&;
+ using value_type = T;
+ using iterator = T*;
+ using reference = T&;
using const_reference = const T&;
- using size_type = std::size_t;
+ using size_type = std::size_t;
static constexpr int Capacity = 8;
- int size_ = 0;
- value_type buffer_[Capacity] = {};
+ int size_ = 0;
+ value_type buffer_[Capacity] = {};
iterator begin() { return buffer_; }
iterator end() { return buffer_ + size_; }
@@ -196,15 +183,17 @@ struct Container {
template <class U>
void push_back(U val)
- requires (Inserter >= InserterChoice::PushBack) {
+ requires(Inserter >= InserterChoice::PushBack)
+ {
inserter_choice = InserterChoice::PushBack;
- buffer_[size_] = val;
+ buffer_[size_] = val;
++size_;
}
template <std::ranges::input_range Range>
void append_range(Range&& range)
- requires (Inserter >= InserterChoice::AppendRange) {
+ requires(Inserter >= InserterChoice::AppendRange)
+ {
assert(size() + std::ranges::distance(range) <= Capacity);
inserter_choice = InserterChoice::AppendRange;
@@ -218,12 +207,12 @@ struct Container {
friend bool operator==(const Container&, const Container&) = default;
};
-template <template <class ...> class AdaptorT, class T>
+template <template <class...> class AdaptorT, class T>
void test_push_range_inserter_choice(bool is_result_heapified = false) {
{ // `append_range` is preferred if available.
using BaseContainer = Container<T, InserterChoice::AppendRange>;
- using Adaptor = AdaptorT<T, BaseContainer>;
- T in[] = {1, 2, 3, 4, 5};
+ using Adaptor = AdaptorT<T, BaseContainer>;
+ T in[] = {1, 2, 3, 4, 5};
Adaptor adaptor;
adaptor.push_range(in);
@@ -241,8 +230,8 @@ void test_push_range_inserter_choice(bool is_result_heapified = false) {
{ // `push_back` is used as a fallback (via `back_inserter`).
using BaseContainer = Container<T, InserterChoice::PushBack>;
- using Adaptor = AdaptorT<T, BaseContainer>;
- T in[] = {1, 2, 3, 4, 5};
+ using Adaptor = AdaptorT<T, BaseContainer>;
+ T in[] = {1, 2, 3, 4, 5};
Adaptor adaptor;
adaptor.push_range(in);
@@ -261,11 +250,11 @@ void test_push_range_inserter_choice(bool is_result_heapified = false) {
// Exception safety.
-template <template <class ...> class Container>
+template <template <class...> class Container>
void test_push_range_exception_safety_throwing_copy() {
#if !defined(TEST_HAS_NO_EXCEPTIONS)
constexpr int ThrowOn = 3;
- using T = ThrowingCopy<ThrowOn>;
+ using T = ThrowingCopy<ThrowOn>;
test_exception_safety_throwing_copy<ThrowOn, /*Size=*/5>([](auto* from, auto* to) {
Container<T> c;
c.push_range(std::ranges::subrange(from, to));
@@ -273,7 +262,7 @@ void test_push_range_exception_safety_throwing_copy() {
#endif
}
-template <template <class ...> class Adaptor, template <class ...> class BaseContainer, class T>
+template <template <class...> class Adaptor, template <class...> class BaseContainer, class T>
void test_push_range_exception_safety_throwing_allocator() {
#if !defined(TEST_HAS_NO_EXCEPTIONS)
T in[] = {0, 1};
diff --git a/libcxx/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_alloc.pass.cpp b/libcxx/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_alloc.pass.cpp
index 197256051dc3ac9..c64d14edb13329f 100644
--- a/libcxx/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_alloc.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_alloc.pass.cpp
@@ -17,24 +17,21 @@
#include "test_macros.h"
#include "test_allocator.h"
-struct test
- : private std::queue<int, std::deque<int, test_allocator<int> > >
-{
- typedef std::queue<int, std::deque<int, test_allocator<int> > > base;
+struct test : private std::queue<int, std::deque<int, test_allocator<int> > > {
+ typedef std::queue<int, std::deque<int, test_allocator<int> > > base;
- explicit test(const test_allocator<int>& a) : base(a) {}
- test(const container_type& container, const test_allocator<int>& a) : base(container, a) {}
+ explicit test(const test_allocator<int>& a) : base(a) {}
+ test(const container_type& container, const test_allocator<int>& a) : base(container, a) {}
#if TEST_STD_VER >= 11
- test(container_type&& container, const test_allocator<int>& a) : base(std::move(container), a) {}
- test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
+ test(container_type&& container, const test_allocator<int>& a) : base(std::move(container), a) {}
+ test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
#endif
- test_allocator<int> get_allocator() {return c.get_allocator();}
+ test_allocator<int> get_allocator() { return c.get_allocator(); }
};
-int main(int, char**)
-{
- test q(test_allocator<int>(3));
- assert(q.get_allocator() == test_allocator<int>(3));
+int main(int, char**) {
+ test q(test_allocator<int>(3));
+ assert(q.get_allocator() == test_allocator<int>(3));
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_container_alloc.pass.cpp b/libcxx/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_container_alloc.pass.cpp
index 674fc6c243f0fc6..d5611bc017643a6 100644
--- a/libcxx/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_container_alloc.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_container_alloc.pass.cpp
@@ -19,42 +19,36 @@
#include "test_allocator.h"
template <class C>
-C
-make(int n)
-{
- C c;
- for (int i = 0; i < n; ++i)
- c.push_back(i);
- return c;
+C make(int n) {
+ C c;
+ for (int i = 0; i < n; ++i)
+ c.push_back(i);
+ return c;
}
typedef std::deque<int, test_allocator<int> > C;
-struct test
- : public std::queue<int, C>
-{
- typedef std::queue<int, C> base;
+struct test : public std::queue<int, C> {
+ typedef std::queue<int, C> base;
- explicit test(const test_allocator<int>& a) : base(a) {}
- test(const container_type& container, const test_allocator<int>& a) : base(container, a) {}
+ explicit test(const test_allocator<int>& a) : base(a) {}
+ test(const container_type& container, const test_allocator<int>& a) : base(container, a) {}
#if TEST_STD_VER >= 11
- test(container_type&& container, const test_allocator<int>& a) : base(std::move(container), a) {}
- test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
+ test(container_type&& container, const test_allocator<int>& a) : base(std::move(container), a) {}
+ test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
#endif
- test_allocator<int> get_allocator() {return c.get_allocator();}
+ test_allocator<int> get_allocator() { return c.get_allocator(); }
};
-int main(int, char**)
-{
- C d = make<C>(5);
- test q(d, test_allocator<int>(4));
- assert(q.get_allocator() == test_allocator<int>(4));
- assert(q.size() == 5);
- for (C::size_type i = 0; i < d.size(); ++i)
- {
- assert(q.front() == d[i]);
- q.pop();
- }
+int main(int, char**) {
+ C d = make<C>(5);
+ test q(d, test_allocator<int>(4));
+ assert(q.get_allocator() == test_allocator<int>(4));
+ assert(q.size() == 5);
+ for (C::size_type i = 0; i < d.size(); ++i) {
+ assert(q.front() == d[i]);
+ q.pop();
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_queue_alloc.pass.cpp b/libcxx/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_queue_alloc.pass.cpp
index a9107f25822dc92..a5dc73767b00499 100644
--- a/libcxx/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_queue_alloc.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_queue_alloc.pass.cpp
@@ -18,37 +18,32 @@
#include "test_allocator.h"
template <class C>
-C
-make(int n)
-{
- C c;
- for (int i = 0; i < n; ++i)
- c.push_back(i);
- return c;
+C make(int n) {
+ C c;
+ for (int i = 0; i < n; ++i)
+ c.push_back(i);
+ return c;
}
typedef std::deque<int, test_allocator<int> > C;
template <class T>
-struct test
- : public std::queue<T, C>
-{
- typedef std::queue<T, C> base;
- typedef test_allocator<int> allocator_type;
- typedef typename base::container_type container_type;
-
- explicit test(const allocator_type& a) : base(a) {}
- test(const container_type& container, const allocator_type& a) : base(container, a) {}
- test(const test& q, const allocator_type& a) : base(q, a) {}
- allocator_type get_allocator() {return this->c.get_allocator();}
+struct test : public std::queue<T, C> {
+ typedef std::queue<T, C> base;
+ typedef test_allocator<int> allocator_type;
+ typedef typename base::container_type container_type;
+
+ explicit test(const allocator_type& a) : base(a) {}
+ test(const container_type& container, const allocator_type& a) : base(container, a) {}
+ test(const test& q, const allocator_type& a) : base(q, a) {}
+ allocator_type get_allocator() { return this->c.get_allocator(); }
};
-int main(int, char**)
-{
- test<int> q(make<C>(5), test_allocator<int>(4));
- test<int> q2(q, test_allocator<int>(5));
- assert(q2.get_allocator() == test_allocator<int>(5));
- assert(q2.size() == 5);
+int main(int, char**) {
+ test<int> q(make<C>(5), test_allocator<int>(4));
+ test<int> q2(q, test_allocator<int>(5));
+ assert(q2.get_allocator() == test_allocator<int>(5));
+ assert(q2.size() == 5);
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_rcontainer_alloc.pass.cpp b/libcxx/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_rcontainer_alloc.pass.cpp
index 5e78c33df8bbc6f..b10db553d64fe5e 100644
--- a/libcxx/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_rcontainer_alloc.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_rcontainer_alloc.pass.cpp
@@ -20,40 +20,33 @@
#include "test_allocator.h"
#include "MoveOnly.h"
-
template <class C>
-C
-make(int n)
-{
- C c;
- for (int i = 0; i < n; ++i)
- c.push_back(MoveOnly(i));
- return c;
+C make(int n) {
+ C c;
+ for (int i = 0; i < n; ++i)
+ c.push_back(MoveOnly(i));
+ return c;
}
typedef std::deque<MoveOnly, test_allocator<MoveOnly> > C;
template <class T>
-struct test
- : public std::queue<T, C>
-{
- typedef std::queue<T, C> base;
- typedef test_allocator<MoveOnly> allocator_type;
- typedef typename base::container_type container_type;
-
- explicit test(const allocator_type& a) : base(a) {}
- test(const container_type& container, const allocator_type& a) : base(container, a) {}
- test(container_type&& container, const allocator_type& a) : base(std::move(container), a) {}
- test(test&& q, const allocator_type& a) : base(std::move(q), a) {}
- allocator_type get_allocator() {return this->c.get_allocator();}
+struct test : public std::queue<T, C> {
+ typedef std::queue<T, C> base;
+ typedef test_allocator<MoveOnly> allocator_type;
+ typedef typename base::container_type container_type;
+
+ explicit test(const allocator_type& a) : base(a) {}
+ test(const container_type& container, const allocator_type& a) : base(container, a) {}
+ test(container_type&& container, const allocator_type& a) : base(std::move(container), a) {}
+ test(test&& q, const allocator_type& a) : base(std::move(q), a) {}
+ allocator_type get_allocator() { return this->c.get_allocator(); }
};
-
-int main(int, char**)
-{
- test<MoveOnly> q(make<C>(5), test_allocator<MoveOnly>(4));
- assert(q.get_allocator() == test_allocator<MoveOnly>(4));
- assert(q.size() == 5);
+int main(int, char**) {
+ test<MoveOnly> q(make<C>(5), test_allocator<MoveOnly>(4));
+ assert(q.get_allocator() == test_allocator<MoveOnly>(4));
+ assert(q.size() == 5);
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_rqueue_alloc.pass.cpp b/libcxx/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_rqueue_alloc.pass.cpp
index b0604ced6163fa7..24aef3d79d50a9e 100644
--- a/libcxx/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_rqueue_alloc.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_rqueue_alloc.pass.cpp
@@ -20,41 +20,34 @@
#include "test_allocator.h"
#include "MoveOnly.h"
-
template <class C>
-C
-make(int n)
-{
- C c;
- for (int i = 0; i < n; ++i)
- c.push_back(MoveOnly(i));
- return c;
+C make(int n) {
+ C c;
+ for (int i = 0; i < n; ++i)
+ c.push_back(MoveOnly(i));
+ return c;
}
typedef std::deque<MoveOnly, test_allocator<MoveOnly> > C;
template <class T>
-struct test
- : public std::queue<T, C>
-{
- typedef std::queue<T, C> base;
- typedef test_allocator<MoveOnly> allocator_type;
- typedef typename base::container_type container_type;
-
- explicit test(const allocator_type& a) : base(a) {}
- test(const container_type& container, const allocator_type& a) : base(container, a) {}
- test(container_type&& container, const allocator_type& a) : base(std::move(container), a) {}
- test(test&& q, const allocator_type& a) : base(std::move(q), a) {}
- allocator_type get_allocator() {return this->c.get_allocator();}
+struct test : public std::queue<T, C> {
+ typedef std::queue<T, C> base;
+ typedef test_allocator<MoveOnly> allocator_type;
+ typedef typename base::container_type container_type;
+
+ explicit test(const allocator_type& a) : base(a) {}
+ test(const container_type& container, const allocator_type& a) : base(container, a) {}
+ test(container_type&& container, const allocator_type& a) : base(std::move(container), a) {}
+ test(test&& q, const allocator_type& a) : base(std::move(q), a) {}
+ allocator_type get_allocator() { return this->c.get_allocator(); }
};
-
-int main(int, char**)
-{
- test<MoveOnly> q(make<C>(5), test_allocator<MoveOnly>(4));
- test<MoveOnly> q2(std::move(q), test_allocator<MoveOnly>(5));
- assert(q2.get_allocator() == test_allocator<MoveOnly>(5));
- assert(q2.size() == 5);
+int main(int, char**) {
+ test<MoveOnly> q(make<C>(5), test_allocator<MoveOnly>(4));
+ test<MoveOnly> q2(std::move(q), test_allocator<MoveOnly>(5));
+ assert(q2.get_allocator() == test_allocator<MoveOnly>(5));
+ assert(q2.size() == 5);
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/queue/queue.cons/ctor_container.pass.cpp b/libcxx/test/std/containers/container.adaptors/queue/queue.cons/ctor_container.pass.cpp
index 588ed696c8f01a4..aa32da19099c720 100644
--- a/libcxx/test/std/containers/container.adaptors/queue/queue.cons/ctor_container.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/queue/queue.cons/ctor_container.pass.cpp
@@ -16,35 +16,31 @@
#include "test_macros.h"
#if TEST_STD_VER >= 11
-#include "test_convertible.h"
+# include "test_convertible.h"
#endif
template <class C>
-C
-make(int n)
-{
- C c;
- for (int i = 0; i < n; ++i)
- c.push_back(i);
- return c;
+C make(int n) {
+ C c;
+ for (int i = 0; i < n; ++i)
+ c.push_back(i);
+ return c;
}
-int main(int, char**)
-{
- typedef std::deque<int> Container;
- typedef std::queue<int> Q;
- Container d = make<Container>(5);
- Q q(d);
- assert(q.size() == 5);
- for (std::size_t i = 0; i < d.size(); ++i)
- {
- assert(q.front() == d[i]);
- q.pop();
- }
+int main(int, char**) {
+ typedef std::deque<int> Container;
+ typedef std::queue<int> Q;
+ Container d = make<Container>(5);
+ Q q(d);
+ assert(q.size() == 5);
+ for (std::size_t i = 0; i < d.size(); ++i) {
+ assert(q.front() == d[i]);
+ q.pop();
+ }
#if TEST_STD_VER >= 11
- static_assert(!test_convertible<Q, const Container&>(), "");
+ static_assert(!test_convertible<Q, const Container&>(), "");
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/queue/queue.cons/ctor_copy.pass.cpp b/libcxx/test/std/containers/container.adaptors/queue/queue.cons/ctor_copy.pass.cpp
index 5c9c012b617a0e5..8d538f3aa020472 100644
--- a/libcxx/test/std/containers/container.adaptors/queue/queue.cons/ctor_copy.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/queue/queue.cons/ctor_copy.pass.cpp
@@ -16,20 +16,17 @@
#include "test_macros.h"
template <class C>
-C
-make(int n)
-{
- C c;
- for (int i = 0; i < n; ++i)
- c.push_back(i);
- return c;
+C make(int n) {
+ C c;
+ for (int i = 0; i < n; ++i)
+ c.push_back(i);
+ return c;
}
-int main(int, char**)
-{
- std::queue<int> q(make<std::deque<int> >(5));
- std::queue<int> q2 = q;
- assert(q2 == q);
+int main(int, char**) {
+ std::queue<int> q(make<std::deque<int> >(5));
+ std::queue<int> q2 = q;
+ assert(q2 == q);
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/queue/queue.cons/ctor_default.pass.cpp b/libcxx/test/std/containers/container.adaptors/queue/queue.cons/ctor_default.pass.cpp
index 17cb4a7936d21a7..a4ec4364575474a 100644
--- a/libcxx/test/std/containers/container.adaptors/queue/queue.cons/ctor_default.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/queue/queue.cons/ctor_default.pass.cpp
@@ -18,25 +18,24 @@
#include "test_macros.h"
#include "test_allocator.h"
#if TEST_STD_VER >= 11
-#include "test_convertible.h"
+# include "test_convertible.h"
#endif
-int main(int, char**)
-{
- typedef std::vector<int, limited_allocator<int, 10> > Container;
- typedef std::queue<int, Container> Q;
- Q q;
- assert(q.size() == 0);
- q.push(1);
- q.push(2);
- assert(q.size() == 2);
- assert(q.front() == 1);
- assert(q.back() == 2);
+int main(int, char**) {
+ typedef std::vector<int, limited_allocator<int, 10> > Container;
+ typedef std::queue<int, Container> Q;
+ Q q;
+ assert(q.size() == 0);
+ q.push(1);
+ q.push(2);
+ assert(q.size() == 2);
+ assert(q.front() == 1);
+ assert(q.back() == 2);
#if TEST_STD_VER >= 11
- // It should be explicit, so not convertible before C++20.
- static_assert(test_convertible<Q>(), "");
+ // It should be explicit, so not convertible before C++20.
+ static_assert(test_convertible<Q>(), "");
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/queue/queue.cons/ctor_iterators.pass.cpp b/libcxx/test/std/containers/container.adaptors/queue/queue.cons/ctor_iterators.pass.cpp
index 5b4a77e90754cd0..bde15456ebd587e 100644
--- a/libcxx/test/std/containers/container.adaptors/queue/queue.cons/ctor_iterators.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/queue/queue.cons/ctor_iterators.pass.cpp
@@ -21,8 +21,10 @@
static_assert(!std::is_constructible_v<std::queue<int>, int, int, std::allocator<int>>);
static_assert(!std::is_constructible_v<std::queue<int>, int*, int*, int>);
-static_assert( std::is_constructible_v<std::queue<int, std::deque<int, test_allocator<int>>>, int*, int*, test_allocator<int>>);
-static_assert(!std::is_constructible_v<std::queue<int, std::deque<int, test_allocator<int>>>, int*, int*, std::allocator<int>>);
+static_assert(
+ std::is_constructible_v<std::queue<int, std::deque<int, test_allocator<int>>>, int*, int*, test_allocator<int>>);
+static_assert(
+ !std::is_constructible_v<std::queue<int, std::deque<int, test_allocator<int>>>, int*, int*, std::allocator<int>>);
template <class T>
struct alloc : test_allocator<T> {
diff --git a/libcxx/test/std/containers/container.adaptors/queue/queue.cons/ctor_move.pass.cpp b/libcxx/test/std/containers/container.adaptors/queue/queue.cons/ctor_move.pass.cpp
index 0f11733851eed7b..6d6d495b8e8d78c 100644
--- a/libcxx/test/std/containers/container.adaptors/queue/queue.cons/ctor_move.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/queue/queue.cons/ctor_move.pass.cpp
@@ -18,24 +18,19 @@
#include "test_macros.h"
#include "MoveOnly.h"
-
template <class C>
-C
-make(int n)
-{
- C c;
- for (int i = 0; i < n; ++i)
- c.push_back(MoveOnly(i));
- return c;
+C make(int n) {
+ C c;
+ for (int i = 0; i < n; ++i)
+ c.push_back(MoveOnly(i));
+ return c;
}
-
-int main(int, char**)
-{
- std::queue<MoveOnly> q(make<std::deque<MoveOnly> >(5));
- std::queue<MoveOnly> q2 = std::move(q);
- assert(q2.size() == 5);
- assert(q.empty());
+int main(int, char**) {
+ std::queue<MoveOnly> q(make<std::deque<MoveOnly> >(5));
+ std::queue<MoveOnly> q2 = std::move(q);
+ assert(q2.size() == 5);
+ assert(q.empty());
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/queue/queue.cons/ctor_rcontainer.pass.cpp b/libcxx/test/std/containers/container.adaptors/queue/queue.cons/ctor_rcontainer.pass.cpp
index 22470e5c68c0b25..f4f14acbd8a2bb2 100644
--- a/libcxx/test/std/containers/container.adaptors/queue/queue.cons/ctor_rcontainer.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/queue/queue.cons/ctor_rcontainer.pass.cpp
@@ -20,29 +20,26 @@
#include "test_macros.h"
#include "MoveOnly.h"
#if TEST_STD_VER >= 11
-#include "test_convertible.h"
+# include "test_convertible.h"
#endif
template <class C>
-C
-make(int n)
-{
- C c;
- for (int i = 0; i < n; ++i)
- c.push_back(MoveOnly(i));
- return c;
+C make(int n) {
+ C c;
+ for (int i = 0; i < n; ++i)
+ c.push_back(MoveOnly(i));
+ return c;
}
-int main(int, char**)
-{
- typedef std::deque<MoveOnly> Container;
- typedef std::queue<MoveOnly> Q;
- Q q(make<std::deque<MoveOnly> >(5));
- assert(q.size() == 5);
+int main(int, char**) {
+ typedef std::deque<MoveOnly> Container;
+ typedef std::queue<MoveOnly> Q;
+ Q q(make<std::deque<MoveOnly> >(5));
+ assert(q.size() == 5);
#if TEST_STD_VER >= 11
- static_assert(!test_convertible<Q, Container&&>(), "");
+ static_assert(!test_convertible<Q, Container&&>(), "");
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/queue/queue.cons/deduct.pass.cpp b/libcxx/test/std/containers/container.adaptors/queue/queue.cons/deduct.pass.cpp
index 630d444cbff86e7..0703248ca531531 100644
--- a/libcxx/test/std/containers/container.adaptors/queue/queue.cons/deduct.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/queue/queue.cons/deduct.pass.cpp
@@ -36,140 +36,138 @@
struct A {};
-int main(int, char**)
-{
-
-// Test the explicit deduction guides
- {
- std::list<int> l{0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
+int main(int, char**) {
+ // Test the explicit deduction guides
+ {
+ std::list<int> l{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
std::queue que(l);
static_assert(std::is_same_v<decltype(que), std::queue<int, std::list<int>>>, "");
assert(que.size() == l.size());
assert(que.back() == l.back());
- }
+ }
- {
- std::list<long, test_allocator<long>> l{10, 11, 12, 13, 14, 15, 16, 17, 18, 19 };
- std::queue que(l, test_allocator<long>(0,2)); //
diff erent allocator
+ {
+ std::list<long, test_allocator<long>> l{10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
+ std::queue que(l, test_allocator<long>(0, 2)); //
diff erent allocator
static_assert(std::is_same_v<decltype(que)::container_type, std::list<long, test_allocator<long>>>, "");
static_assert(std::is_same_v<decltype(que)::value_type, long>, "");
assert(que.size() == 10);
assert(que.back() == 19);
-// I'd like to assert that we've gotten the right allocator in the queue, but
-// I don't know how to get at the underlying container.
- }
+ // I'd like to assert that we've gotten the right allocator in the queue, but
+ // I don't know how to get at the underlying container.
+ }
-// Test the implicit deduction guides
- {
-// We don't expect this one to work - no way to implicitly get value_type
-// std::queue que(std::allocator<int>()); // queue (allocator &)
- }
+ // Test the implicit deduction guides
+ {
+ // We don't expect this one to work - no way to implicitly get value_type
+ // std::queue que(std::allocator<int>()); // queue (allocator &)
+ }
- {
+ {
std::queue<A> source;
std::queue que(source); // queue(queue &)
static_assert(std::is_same_v<decltype(que)::value_type, A>, "");
static_assert(std::is_same_v<decltype(que)::container_type, std::deque<A>>, "");
assert(que.size() == 0);
+ }
+
+ {
+ typedef short T;
+ typedef test_allocator<T> Alloc;
+ typedef std::list<T, Alloc> Cont;
+ typedef test_allocator<int> ConvertibleToAlloc;
+ static_assert(std::uses_allocator_v<Cont, ConvertibleToAlloc> &&
+ !std::is_same_v<typename Cont::allocator_type, ConvertibleToAlloc>);
+
+ {
+ Cont cont;
+ std::queue que(cont, Alloc(2));
+ static_assert(std::is_same_v<decltype(que), std::queue<T, Cont>>);
+ }
+
+ {
+ Cont cont;
+ std::queue que(cont, ConvertibleToAlloc(2));
+ static_assert(std::is_same_v<decltype(que), std::queue<T, Cont>>);
+ }
+
+ {
+ Cont cont;
+ std::queue que(std::move(cont), Alloc(2));
+ static_assert(std::is_same_v<decltype(que), std::queue<T, Cont>>);
+ }
+
+ {
+ Cont cont;
+ std::queue que(std::move(cont), ConvertibleToAlloc(2));
+ static_assert(std::is_same_v<decltype(que), std::queue<T, Cont>>);
+ }
+ }
+
+ {
+ typedef short T;
+ typedef test_allocator<T> Alloc;
+ typedef std::list<T, Alloc> Cont;
+ typedef test_allocator<int> ConvertibleToAlloc;
+ static_assert(std::uses_allocator_v<Cont, ConvertibleToAlloc> &&
+ !std::is_same_v<typename Cont::allocator_type, ConvertibleToAlloc>);
+
+ {
+ std::queue<T, Cont> source;
+ std::queue que(source, Alloc(2));
+ static_assert(std::is_same_v<decltype(que), std::queue<T, Cont>>);
}
{
- typedef short T;
- typedef test_allocator<T> Alloc;
- typedef std::list<T, Alloc> Cont;
- typedef test_allocator<int> ConvertibleToAlloc;
- static_assert(std::uses_allocator_v<Cont, ConvertibleToAlloc> &&
- !std::is_same_v<typename Cont::allocator_type, ConvertibleToAlloc>);
-
- {
- Cont cont;
- std::queue que(cont, Alloc(2));
- static_assert(std::is_same_v<decltype(que), std::queue<T, Cont>>);
- }
-
- {
- Cont cont;
- std::queue que(cont, ConvertibleToAlloc(2));
- static_assert(std::is_same_v<decltype(que), std::queue<T, Cont>>);
- }
-
- {
- Cont cont;
- std::queue que(std::move(cont), Alloc(2));
- static_assert(std::is_same_v<decltype(que), std::queue<T, Cont>>);
- }
-
- {
- Cont cont;
- std::queue que(std::move(cont), ConvertibleToAlloc(2));
- static_assert(std::is_same_v<decltype(que), std::queue<T, Cont>>);
- }
+ std::queue<T, Cont> source;
+ std::queue que(source, ConvertibleToAlloc(2));
+ static_assert(std::is_same_v<decltype(que), std::queue<T, Cont>>);
}
{
- typedef short T;
- typedef test_allocator<T> Alloc;
- typedef std::list<T, Alloc> Cont;
- typedef test_allocator<int> ConvertibleToAlloc;
- static_assert(std::uses_allocator_v<Cont, ConvertibleToAlloc> &&
- !std::is_same_v<typename Cont::allocator_type, ConvertibleToAlloc>);
-
- {
- std::queue<T, Cont> source;
- std::queue que(source, Alloc(2));
- static_assert(std::is_same_v<decltype(que), std::queue<T, Cont>>);
- }
-
- {
- std::queue<T, Cont> source;
- std::queue que(source, ConvertibleToAlloc(2));
- static_assert(std::is_same_v<decltype(que), std::queue<T, Cont>>);
- }
-
- {
- std::queue<T, Cont> source;
- std::queue que(std::move(source), Alloc(2));
- static_assert(std::is_same_v<decltype(que), std::queue<T, Cont>>);
- }
-
- {
- std::queue<T, Cont> source;
- std::queue que(std::move(source), ConvertibleToAlloc(2));
- static_assert(std::is_same_v<decltype(que), std::queue<T, Cont>>);
- }
+ std::queue<T, Cont> source;
+ std::queue que(std::move(source), Alloc(2));
+ static_assert(std::is_same_v<decltype(que), std::queue<T, Cont>>);
}
+ {
+ std::queue<T, Cont> source;
+ std::queue que(std::move(source), ConvertibleToAlloc(2));
+ static_assert(std::is_same_v<decltype(que), std::queue<T, Cont>>);
+ }
+ }
+
#if TEST_STD_VER >= 23
+ {
+ typedef short T;
+ typedef test_allocator<T> Alloc;
+ std::list<T> a;
+ {
+ std::queue q(a.begin(), a.end());
+ static_assert(std::is_same_v<decltype(q), std::queue<T>>);
+ }
+ {
+ std::queue q(a.begin(), a.end(), Alloc());
+ static_assert(std::is_same_v<decltype(q), std::queue<T, std::deque<T, Alloc>>>);
+ }
+ }
+
+ {
{
- typedef short T;
- typedef test_allocator<T> Alloc;
- std::list<T> a;
- {
- std::queue q(a.begin(), a.end());
- static_assert(std::is_same_v<decltype(q), std::queue<T>>);
- }
- {
- std::queue q(a.begin(), a.end(), Alloc());
- static_assert(std::is_same_v<decltype(q), std::queue<T, std::deque<T, Alloc>>>);
- }
+ std::queue c(std::from_range, std::array<int, 0>());
+ static_assert(std::is_same_v<decltype(c), std::queue<int>>);
}
{
- {
- std::queue c(std::from_range, std::array<int, 0>());
- static_assert(std::is_same_v<decltype(c), std::queue<int>>);
- }
-
- {
- using Alloc = test_allocator<int>;
- std::queue c(std::from_range, std::array<int, 0>(), Alloc());
- static_assert(std::is_same_v<decltype(c), std::queue<int, std::deque<int, Alloc>>>);
- }
+ using Alloc = test_allocator<int>;
+ std::queue c(std::from_range, std::array<int, 0>(), Alloc());
+ static_assert(std::is_same_v<decltype(c), std::queue<int, std::deque<int, Alloc>>>);
}
+ }
#endif
- ContainerAdaptorDeductionGuidesSfinaeAway<std::queue, std::queue<int>>();
+ ContainerAdaptorDeductionGuidesSfinaeAway<std::queue, std::queue<int>>();
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/queue/queue.cons/deduct.verify.cpp b/libcxx/test/std/containers/container.adaptors/queue/queue.cons/deduct.verify.cpp
index f85b2cbeb249cff..2216fcf306c4cff 100644
--- a/libcxx/test/std/containers/container.adaptors/queue/queue.cons/deduct.verify.cpp
+++ b/libcxx/test/std/containers/container.adaptors/queue/queue.cons/deduct.verify.cpp
@@ -15,32 +15,32 @@
#include <cassert>
#include <cstddef>
-
-int main(int, char**)
-{
-// Test the explicit deduction guides
- {
-// queue(const Container&, const Alloc&);
-// The '45' is not an allocator
- std::queue que(std::list<int>{1,2,3}, 45); // expected-error-re {{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}queue'}}
- }
-
- {
-// queue(const queue&, const Alloc&);
-// The '45' is not an allocator
+int main(int, char**) {
+ // Test the explicit deduction guides
+ {
+ // queue(const Container&, const Alloc&);
+ // The '45' is not an allocator
+ std::queue que(std::list<int>{1, 2, 3}, 45);
+ // expected-error-re at -1 {{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}queue'}}
+ }
+
+ {
+ // queue(const queue&, const Alloc&);
+ // The '45' is not an allocator
std::queue<int> source;
- std::queue que(source, 45); // expected-error-re {{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}queue'}}
- }
-
-// Test the implicit deduction guides
- {
-// queue (allocator &)
- std::queue que((std::allocator<int>())); // expected-error-re {{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}queue'}}
-// Note: The extra parens are necessary, since otherwise clang decides it is a function declaration.
-// Also, we can't use {} instead of parens, because that constructs a
-// stack<allocator<int>, allocator<allocator<int>>>
- }
-
+ std::queue que(source, 45);
+ // expected-error-re at -1 {{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}queue'}}
+ }
+
+ // Test the implicit deduction guides
+ {
+ // queue (allocator &)
+ std::queue que((std::allocator< int>()));
+ // expected-error-re at -1 {{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}queue'}}
+ // Note: The extra parens are necessary, since otherwise clang decides it is a function declaration.
+ // Also, we can't use {} instead of parens, because that constructs a
+ // stack<allocator<int>, allocator<allocator<int>>>
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/queue/queue.cons/default_noexcept.pass.cpp b/libcxx/test/std/containers/container.adaptors/queue/queue.cons/default_noexcept.pass.cpp
index 416e4e38795d36f..91c64c33f620785 100644
--- a/libcxx/test/std/containers/container.adaptors/queue/queue.cons/default_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/queue/queue.cons/default_noexcept.pass.cpp
@@ -21,13 +21,12 @@
#include "test_macros.h"
#include "MoveOnly.h"
-int main(int, char**)
-{
+int main(int, char**) {
#if defined(_LIBCPP_VERSION)
- {
- typedef std::queue<MoveOnly> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
- }
+ {
+ typedef std::queue<MoveOnly> C;
+ static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/container.adaptors/queue/queue.cons/dtor_noexcept.pass.cpp b/libcxx/test/std/containers/container.adaptors/queue/queue.cons/dtor_noexcept.pass.cpp
index 0d53f47961f84a6..35e1f557f243290 100644
--- a/libcxx/test/std/containers/container.adaptors/queue/queue.cons/dtor_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/queue/queue.cons/dtor_noexcept.pass.cpp
@@ -19,12 +19,11 @@
#include "test_macros.h"
#include "MoveOnly.h"
-int main(int, char**)
-{
- {
- typedef std::queue<MoveOnly> C;
- static_assert(std::is_nothrow_destructible<C>::value, "");
- }
+int main(int, char**) {
+ {
+ typedef std::queue<MoveOnly> C;
+ static_assert(std::is_nothrow_destructible<C>::value, "");
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/queue/queue.cons/move_assign_noexcept.pass.cpp b/libcxx/test/std/containers/container.adaptors/queue/queue.cons/move_assign_noexcept.pass.cpp
index 55bd9b463663703..bee13a98a62f784 100644
--- a/libcxx/test/std/containers/container.adaptors/queue/queue.cons/move_assign_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/queue/queue.cons/move_assign_noexcept.pass.cpp
@@ -21,12 +21,11 @@
#include "test_macros.h"
#include "MoveOnly.h"
-int main(int, char**)
-{
- {
- typedef std::queue<MoveOnly> C;
- static_assert(std::is_nothrow_move_assignable<C>::value, "");
- }
+int main(int, char**) {
+ {
+ typedef std::queue<MoveOnly> C;
+ static_assert(std::is_nothrow_move_assignable<C>::value, "");
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/queue/queue.cons/move_noexcept.pass.cpp b/libcxx/test/std/containers/container.adaptors/queue/queue.cons/move_noexcept.pass.cpp
index 5a2fd037a009e98..8584e8cdabff644 100644
--- a/libcxx/test/std/containers/container.adaptors/queue/queue.cons/move_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/queue/queue.cons/move_noexcept.pass.cpp
@@ -15,20 +15,18 @@
// This tests a conforming extension
-
#include <queue>
#include <cassert>
#include "test_macros.h"
#include "MoveOnly.h"
-int main(int, char**)
-{
+int main(int, char**) {
#if defined(_LIBCPP_VERSION)
- {
- typedef std::queue<MoveOnly> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
- }
+ {
+ typedef std::queue<MoveOnly> C;
+ static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/container.adaptors/queue/queue.defn/assign_copy.pass.cpp b/libcxx/test/std/containers/container.adaptors/queue/queue.defn/assign_copy.pass.cpp
index 8e1f82f1b05f061..311f4ed2eeb28dc 100644
--- a/libcxx/test/std/containers/container.adaptors/queue/queue.defn/assign_copy.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/queue/queue.defn/assign_copy.pass.cpp
@@ -16,21 +16,18 @@
#include "test_macros.h"
template <class C>
-C
-make(int n)
-{
- C c;
- for (int i = 0; i < n; ++i)
- c.push_back(i);
- return c;
+C make(int n) {
+ C c;
+ for (int i = 0; i < n; ++i)
+ c.push_back(i);
+ return c;
}
-int main(int, char**)
-{
- std::queue<int> q(make<std::deque<int> >(5));
- std::queue<int> q2;
- q2 = q;
- assert(q2 == q);
+int main(int, char**) {
+ std::queue<int> q(make<std::deque<int> >(5));
+ std::queue<int> q2;
+ q2 = q;
+ assert(q2 == q);
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/queue/queue.defn/assign_move.pass.cpp b/libcxx/test/std/containers/container.adaptors/queue/queue.defn/assign_move.pass.cpp
index d3a7083d0c337d3..9caaf117176603c 100644
--- a/libcxx/test/std/containers/container.adaptors/queue/queue.defn/assign_move.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/queue/queue.defn/assign_move.pass.cpp
@@ -18,25 +18,20 @@
#include "test_macros.h"
#include "MoveOnly.h"
-
template <class C>
-C
-make(int n)
-{
- C c;
- for (int i = 0; i < n; ++i)
- c.push_back(MoveOnly(i));
- return c;
+C make(int n) {
+ C c;
+ for (int i = 0; i < n; ++i)
+ c.push_back(MoveOnly(i));
+ return c;
}
-
-int main(int, char**)
-{
- std::queue<MoveOnly> q(make<std::deque<MoveOnly> >(5));
- std::queue<MoveOnly> q2;
- q2 = std::move(q);
- assert(q2.size() == 5);
- assert(q.empty());
+int main(int, char**) {
+ std::queue<MoveOnly> q(make<std::deque<MoveOnly> >(5));
+ std::queue<MoveOnly> q2;
+ q2 = std::move(q);
+ assert(q2.size() == 5);
+ assert(q.empty());
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/queue/queue.defn/back.pass.cpp b/libcxx/test/std/containers/container.adaptors/queue/queue.defn/back.pass.cpp
index 2fa537cae1cd9c2..d0edb154bdb5cca 100644
--- a/libcxx/test/std/containers/container.adaptors/queue/queue.defn/back.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/queue/queue.defn/back.pass.cpp
@@ -15,15 +15,14 @@
#include "test_macros.h"
-int main(int, char**)
-{
- std::queue<int> q;
- assert(q.size() == 0);
- q.push(1);
- q.push(2);
- q.push(3);
- int& ir = q.back();
- assert(ir == 3);
+int main(int, char**) {
+ std::queue<int> q;
+ assert(q.size() == 0);
+ q.push(1);
+ q.push(2);
+ q.push(3);
+ int& ir = q.back();
+ assert(ir == 3);
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/queue/queue.defn/back_const.pass.cpp b/libcxx/test/std/containers/container.adaptors/queue/queue.defn/back_const.pass.cpp
index 822d7dbf08bae53..4dc0fa94474a682 100644
--- a/libcxx/test/std/containers/container.adaptors/queue/queue.defn/back_const.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/queue/queue.defn/back_const.pass.cpp
@@ -15,16 +15,15 @@
#include "test_macros.h"
-int main(int, char**)
-{
- std::queue<int> q;
- assert(q.size() == 0);
- q.push(1);
- q.push(2);
- q.push(3);
- const std::queue<int>& cqr = q;
- const int& cir = cqr.back();
- assert(cir == 3);
+int main(int, char**) {
+ std::queue<int> q;
+ assert(q.size() == 0);
+ q.push(1);
+ q.push(2);
+ q.push(3);
+ const std::queue<int>& cqr = q;
+ const int& cir = cqr.back();
+ assert(cir == 3);
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/queue/queue.defn/emplace.pass.cpp b/libcxx/test/std/containers/container.adaptors/queue/queue.defn/emplace.pass.cpp
index bdfd9df7978c436..8aea824b11ac42a 100644
--- a/libcxx/test/std/containers/container.adaptors/queue/queue.defn/emplace.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/queue/queue.defn/emplace.pass.cpp
@@ -14,7 +14,6 @@
// return type is 'decltype(auto)' in C++17; 'void' before
// whatever the return type of the underlying container's emplace_back() returns.
-
#include <queue>
#include <cassert>
#include <list>
@@ -25,42 +24,41 @@
template <typename Queue>
void test_return_type() {
- typedef typename Queue::container_type Container;
- typedef typename Container::value_type value_type;
- typedef decltype(std::declval<Queue>().emplace(std::declval<value_type &>())) queue_return_type;
+ typedef typename Queue::container_type Container;
+ typedef typename Container::value_type value_type;
+ typedef decltype(std::declval<Queue>().emplace(std::declval<value_type&>())) queue_return_type;
#if TEST_STD_VER > 14
- typedef decltype(std::declval<Container>().emplace_back(std::declval<value_type>())) container_return_type;
- static_assert(std::is_same<queue_return_type, container_return_type>::value, "");
+ typedef decltype(std::declval<Container>().emplace_back(std::declval<value_type>())) container_return_type;
+ static_assert(std::is_same<queue_return_type, container_return_type>::value, "");
#else
- static_assert(std::is_same<queue_return_type, void>::value, "");
+ static_assert(std::is_same<queue_return_type, void>::value, "");
#endif
}
-int main(int, char**)
-{
- test_return_type<std::queue<int> > ();
- test_return_type<std::queue<int, std::list<int> > > ();
+int main(int, char**) {
+ test_return_type<std::queue<int> >();
+ test_return_type<std::queue<int, std::list<int> > >();
- std::queue<Emplaceable> q;
+ std::queue<Emplaceable> q;
#if TEST_STD_VER > 14
- typedef Emplaceable T;
- T& r1 = q.emplace(1, 2.5);
- assert(&r1 == &q.back());
- T& r2 = q.emplace(2, 3.5);
- assert(&r2 == &q.back());
- T& r3 = q.emplace(3, 4.5);
- assert(&r3 == &q.back());
- assert(&r1 == &q.front());
+ typedef Emplaceable T;
+ T& r1 = q.emplace(1, 2.5);
+ assert(&r1 == &q.back());
+ T& r2 = q.emplace(2, 3.5);
+ assert(&r2 == &q.back());
+ T& r3 = q.emplace(3, 4.5);
+ assert(&r3 == &q.back());
+ assert(&r1 == &q.front());
#else
- q.emplace(1, 2.5);
- q.emplace(2, 3.5);
- q.emplace(3, 4.5);
+ q.emplace(1, 2.5);
+ q.emplace(2, 3.5);
+ q.emplace(3, 4.5);
#endif
- assert(q.size() == 3);
- assert(q.front() == Emplaceable(1, 2.5));
- assert(q.back() == Emplaceable(3, 4.5));
+ assert(q.size() == 3);
+ assert(q.front() == Emplaceable(1, 2.5));
+ assert(q.back() == Emplaceable(3, 4.5));
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/queue/queue.defn/empty.pass.cpp b/libcxx/test/std/containers/container.adaptors/queue/queue.defn/empty.pass.cpp
index 844e7ce8e9638dc..225ae11a0c9dae0 100644
--- a/libcxx/test/std/containers/container.adaptors/queue/queue.defn/empty.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/queue/queue.defn/empty.pass.cpp
@@ -15,14 +15,13 @@
#include "test_macros.h"
-int main(int, char**)
-{
- std::queue<int> q;
- assert(q.empty());
- q.push(1);
- assert(!q.empty());
- q.pop();
- assert(q.empty());
+int main(int, char**) {
+ std::queue<int> q;
+ assert(q.empty());
+ q.push(1);
+ assert(!q.empty());
+ q.pop();
+ assert(q.empty());
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/queue/queue.defn/empty.verify.cpp b/libcxx/test/std/containers/container.adaptors/queue/queue.defn/empty.verify.cpp
index 5f24ef0e77fc925..27c99b0f379e9a6 100644
--- a/libcxx/test/std/containers/container.adaptors/queue/queue.defn/empty.verify.cpp
+++ b/libcxx/test/std/containers/container.adaptors/queue/queue.defn/empty.verify.cpp
@@ -17,6 +17,6 @@
#include <queue>
void f() {
- std::queue<int> c;
- c.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::queue<int> c;
+ c.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}
diff --git a/libcxx/test/std/containers/container.adaptors/queue/queue.defn/front.pass.cpp b/libcxx/test/std/containers/container.adaptors/queue/queue.defn/front.pass.cpp
index d4cbf1e913fa147..fa6c6b58671016c 100644
--- a/libcxx/test/std/containers/container.adaptors/queue/queue.defn/front.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/queue/queue.defn/front.pass.cpp
@@ -15,15 +15,14 @@
#include "test_macros.h"
-int main(int, char**)
-{
- std::queue<int> q;
- assert(q.size() == 0);
- q.push(1);
- q.push(2);
- q.push(3);
- int& ir = q.front();
- assert(ir == 1);
+int main(int, char**) {
+ std::queue<int> q;
+ assert(q.size() == 0);
+ q.push(1);
+ q.push(2);
+ q.push(3);
+ int& ir = q.front();
+ assert(ir == 1);
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/queue/queue.defn/front_const.pass.cpp b/libcxx/test/std/containers/container.adaptors/queue/queue.defn/front_const.pass.cpp
index 4e0fc103780afe9..630f05a22a6e76f 100644
--- a/libcxx/test/std/containers/container.adaptors/queue/queue.defn/front_const.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/queue/queue.defn/front_const.pass.cpp
@@ -15,16 +15,15 @@
#include "test_macros.h"
-int main(int, char**)
-{
- std::queue<int> q;
- assert(q.size() == 0);
- q.push(1);
- q.push(2);
- q.push(3);
- const std::queue<int>& cqr = q;
- const int& cir = cqr.front();
- assert(cir == 1);
+int main(int, char**) {
+ std::queue<int> q;
+ assert(q.size() == 0);
+ q.push(1);
+ q.push(2);
+ q.push(3);
+ const std::queue<int>& cqr = q;
+ const int& cir = cqr.front();
+ assert(cir == 1);
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/queue/queue.defn/pop.pass.cpp b/libcxx/test/std/containers/container.adaptors/queue/queue.defn/pop.pass.cpp
index 218bec3bcc5364e..0d6541e8de8f82a 100644
--- a/libcxx/test/std/containers/container.adaptors/queue/queue.defn/pop.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/queue/queue.defn/pop.pass.cpp
@@ -15,26 +15,25 @@
#include "test_macros.h"
-int main(int, char**)
-{
- std::queue<int> q;
- assert(q.size() == 0);
- q.push(1);
- q.push(2);
- q.push(3);
- assert(q.size() == 3);
- assert(q.front() == 1);
- assert(q.back() == 3);
- q.pop();
- assert(q.size() == 2);
- assert(q.front() == 2);
- assert(q.back() == 3);
- q.pop();
- assert(q.size() == 1);
- assert(q.front() == 3);
- assert(q.back() == 3);
- q.pop();
- assert(q.size() == 0);
+int main(int, char**) {
+ std::queue<int> q;
+ assert(q.size() == 0);
+ q.push(1);
+ q.push(2);
+ q.push(3);
+ assert(q.size() == 3);
+ assert(q.front() == 1);
+ assert(q.back() == 3);
+ q.pop();
+ assert(q.size() == 2);
+ assert(q.front() == 2);
+ assert(q.back() == 3);
+ q.pop();
+ assert(q.size() == 1);
+ assert(q.front() == 3);
+ assert(q.back() == 3);
+ q.pop();
+ assert(q.size() == 0);
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/queue/queue.defn/push.pass.cpp b/libcxx/test/std/containers/container.adaptors/queue/queue.defn/push.pass.cpp
index d772307e36933f9..901b26a203d98e4 100644
--- a/libcxx/test/std/containers/container.adaptors/queue/queue.defn/push.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/queue/queue.defn/push.pass.cpp
@@ -15,21 +15,20 @@
#include "test_macros.h"
-int main(int, char**)
-{
- std::queue<int> q;
- q.push(1);
- assert(q.size() == 1);
- assert(q.front() == 1);
- assert(q.back() == 1);
- q.push(2);
- assert(q.size() == 2);
- assert(q.front() == 1);
- assert(q.back() == 2);
- q.push(3);
- assert(q.size() == 3);
- assert(q.front() == 1);
- assert(q.back() == 3);
+int main(int, char**) {
+ std::queue<int> q;
+ q.push(1);
+ assert(q.size() == 1);
+ assert(q.front() == 1);
+ assert(q.back() == 1);
+ q.push(2);
+ assert(q.size() == 2);
+ assert(q.front() == 1);
+ assert(q.back() == 2);
+ q.push(3);
+ assert(q.size() == 3);
+ assert(q.front() == 1);
+ assert(q.back() == 3);
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/queue/queue.defn/push_rv.pass.cpp b/libcxx/test/std/containers/container.adaptors/queue/queue.defn/push_rv.pass.cpp
index 2a75668a3a4b8ba..4a99c6846dfd244 100644
--- a/libcxx/test/std/containers/container.adaptors/queue/queue.defn/push_rv.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/queue/queue.defn/push_rv.pass.cpp
@@ -18,21 +18,20 @@
#include "test_macros.h"
#include "MoveOnly.h"
-int main(int, char**)
-{
- std::queue<MoveOnly> q;
- q.push(MoveOnly(1));
- assert(q.size() == 1);
- assert(q.front() == MoveOnly(1));
- assert(q.back() == MoveOnly(1));
- q.push(MoveOnly(2));
- assert(q.size() == 2);
- assert(q.front() == MoveOnly(1));
- assert(q.back() == MoveOnly(2));
- q.push(MoveOnly(3));
- assert(q.size() == 3);
- assert(q.front() == MoveOnly(1));
- assert(q.back() == MoveOnly(3));
+int main(int, char**) {
+ std::queue<MoveOnly> q;
+ q.push(MoveOnly(1));
+ assert(q.size() == 1);
+ assert(q.front() == MoveOnly(1));
+ assert(q.back() == MoveOnly(1));
+ q.push(MoveOnly(2));
+ assert(q.size() == 2);
+ assert(q.front() == MoveOnly(1));
+ assert(q.back() == MoveOnly(2));
+ q.push(MoveOnly(3));
+ assert(q.size() == 3);
+ assert(q.front() == MoveOnly(1));
+ assert(q.back() == MoveOnly(3));
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/queue/queue.defn/size.pass.cpp b/libcxx/test/std/containers/container.adaptors/queue/queue.defn/size.pass.cpp
index de53c5d669d1f3d..1824b635e359246 100644
--- a/libcxx/test/std/containers/container.adaptors/queue/queue.defn/size.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/queue/queue.defn/size.pass.cpp
@@ -15,12 +15,11 @@
#include "test_macros.h"
-int main(int, char**)
-{
- std::queue<int> q;
- assert(q.size() == 0);
- q.push(1);
- assert(q.size() == 1);
+int main(int, char**) {
+ std::queue<int> q;
+ assert(q.size() == 0);
+ q.push(1);
+ assert(q.size() == 1);
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/queue/queue.defn/swap.pass.cpp b/libcxx/test/std/containers/container.adaptors/queue/queue.defn/swap.pass.cpp
index e342aeb558a8954..2bccea2f5f65a4b 100644
--- a/libcxx/test/std/containers/container.adaptors/queue/queue.defn/swap.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/queue/queue.defn/swap.pass.cpp
@@ -16,24 +16,21 @@
#include "test_macros.h"
template <class C>
-C
-make(int n)
-{
- C c;
- for (int i = 0; i < n; ++i)
- c.push(i);
- return c;
+C make(int n) {
+ C c;
+ for (int i = 0; i < n; ++i)
+ c.push(i);
+ return c;
}
-int main(int, char**)
-{
- std::queue<int> q1 = make<std::queue<int> >(5);
- std::queue<int> q2 = make<std::queue<int> >(10);
- std::queue<int> q1_save = q1;
- std::queue<int> q2_save = q2;
- q1.swap(q2);
- assert(q1 == q2_save);
- assert(q2 == q1_save);
+int main(int, char**) {
+ std::queue<int> q1 = make<std::queue<int> >(5);
+ std::queue<int> q2 = make<std::queue<int> >(10);
+ std::queue<int> q1_save = q1;
+ std::queue<int> q2_save = q2;
+ q1.swap(q2);
+ assert(q1 == q2_save);
+ assert(q2 == q1_save);
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/queue/queue.defn/types.compile.fail.cpp b/libcxx/test/std/containers/container.adaptors/queue/queue.defn/types.compile.fail.cpp
index 041008ce6aa2025..daec08ef62bc6d3 100644
--- a/libcxx/test/std/containers/container.adaptors/queue/queue.defn/types.compile.fail.cpp
+++ b/libcxx/test/std/containers/container.adaptors/queue/queue.defn/types.compile.fail.cpp
@@ -12,10 +12,9 @@
#include <cassert>
#include <type_traits>
-int main(int, char**)
-{
-// LWG#2566 says that the first template param must match the second one's value type
- std::queue<double, std::deque<int>> t;
+int main(int, char**) {
+ // LWG#2566 says that the first template param must match the second one's value type
+ std::queue<double, std::deque<int>> t;
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/queue/queue.defn/types.pass.cpp b/libcxx/test/std/containers/container.adaptors/queue/queue.defn/types.pass.cpp
index bef4060db2da8dd..782067c56c72d74 100644
--- a/libcxx/test/std/containers/container.adaptors/queue/queue.defn/types.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/queue/queue.defn/types.pass.cpp
@@ -28,34 +28,27 @@
#include "test_macros.h"
-struct test
- : private std::queue<int>
-{
- test()
- {
- c.push_back(1);
- }
+struct test : private std::queue<int> {
+ test() { c.push_back(1); }
};
-struct C
-{
- typedef int value_type;
- typedef int& reference;
- typedef const int& const_reference;
- typedef int size_type;
+struct C {
+ typedef int value_type;
+ typedef int& reference;
+ typedef const int& const_reference;
+ typedef int size_type;
};
-int main(int, char**)
-{
- static_assert(( std::is_same<std::queue<int>::container_type, std::deque<int> >::value), "");
- static_assert(( std::is_same<std::queue<int, std::vector<int> >::container_type, std::vector<int> >::value), "");
- static_assert(( std::is_same<std::queue<int, std::vector<int> >::value_type, int>::value), "");
- static_assert(( std::is_same<std::queue<int>::reference, std::deque<int>::reference>::value), "");
- static_assert(( std::is_same<std::queue<int>::const_reference, std::deque<int>::const_reference>::value), "");
- static_assert(( std::is_same<std::queue<int>::size_type, std::deque<int>::size_type>::value), "");
- static_assert(( std::uses_allocator<std::queue<int>, std::allocator<int> >::value), "");
- static_assert((!std::uses_allocator<std::queue<int, C>, std::allocator<int> >::value), "");
- test t;
+int main(int, char**) {
+ static_assert((std::is_same<std::queue<int>::container_type, std::deque<int> >::value), "");
+ static_assert((std::is_same<std::queue<int, std::vector<int> >::container_type, std::vector<int> >::value), "");
+ static_assert((std::is_same<std::queue<int, std::vector<int> >::value_type, int>::value), "");
+ static_assert((std::is_same<std::queue<int>::reference, std::deque<int>::reference>::value), "");
+ static_assert((std::is_same<std::queue<int>::const_reference, std::deque<int>::const_reference>::value), "");
+ static_assert((std::is_same<std::queue<int>::size_type, std::deque<int>::size_type>::value), "");
+ static_assert((std::uses_allocator<std::queue<int>, std::allocator<int> >::value), "");
+ static_assert((!std::uses_allocator<std::queue<int, C>, std::allocator<int> >::value), "");
+ test t;
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/queue/queue.ops/eq.pass.cpp b/libcxx/test/std/containers/container.adaptors/queue/queue.ops/eq.pass.cpp
index 8e7825b3fef176b..1b1d01fa26d4679 100644
--- a/libcxx/test/std/containers/container.adaptors/queue/queue.ops/eq.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/queue/queue.ops/eq.pass.cpp
@@ -20,24 +20,21 @@
#include "test_macros.h"
template <class C>
-C
-make(int n)
-{
- C c;
- for (int i = 0; i < n; ++i)
- c.push(i);
- return c;
+C make(int n) {
+ C c;
+ for (int i = 0; i < n; ++i)
+ c.push(i);
+ return c;
}
-int main(int, char**)
-{
- std::queue<int> q1 = make<std::queue<int> >(5);
- std::queue<int> q2 = make<std::queue<int> >(10);
- std::queue<int> q1_save = q1;
- std::queue<int> q2_save = q2;
- assert(q1 == q1_save);
- assert(q1 != q2);
- assert(q2 == q2_save);
+int main(int, char**) {
+ std::queue<int> q1 = make<std::queue<int> >(5);
+ std::queue<int> q2 = make<std::queue<int> >(10);
+ std::queue<int> q1_save = q1;
+ std::queue<int> q2_save = q2;
+ assert(q1 == q1_save);
+ assert(q1 != q2);
+ assert(q2 == q2_save);
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/queue/queue.ops/lt.pass.cpp b/libcxx/test/std/containers/container.adaptors/queue/queue.ops/lt.pass.cpp
index 246632f75b4def9..eb1c8aa3481f528 100644
--- a/libcxx/test/std/containers/container.adaptors/queue/queue.ops/lt.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/queue/queue.ops/lt.pass.cpp
@@ -26,23 +26,20 @@
#include "test_macros.h"
template <class C>
-C
-make(int n)
-{
- C c;
- for (int i = 0; i < n; ++i)
- c.push(i);
- return c;
+C make(int n) {
+ C c;
+ for (int i = 0; i < n; ++i)
+ c.push(i);
+ return c;
}
-int main(int, char**)
-{
- std::queue<int> q1 = make<std::queue<int> >(5);
- std::queue<int> q2 = make<std::queue<int> >(10);
- assert(q1 < q2);
- assert(q2 > q1);
- assert(q1 <= q2);
- assert(q2 >= q1);
+int main(int, char**) {
+ std::queue<int> q1 = make<std::queue<int> >(5);
+ std::queue<int> q2 = make<std::queue<int> >(10);
+ assert(q1 < q2);
+ assert(q2 > q1);
+ assert(q1 <= q2);
+ assert(q2 >= q1);
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/queue/queue.special/swap.pass.cpp b/libcxx/test/std/containers/container.adaptors/queue/queue.special/swap.pass.cpp
index 56fbb7418ac9bc2..1988fba5850ab47 100644
--- a/libcxx/test/std/containers/container.adaptors/queue/queue.special/swap.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/queue/queue.special/swap.pass.cpp
@@ -17,24 +17,21 @@
#include "test_macros.h"
template <class C>
-C
-make(int n)
-{
- C c;
- for (int i = 0; i < n; ++i)
- c.push(i);
- return c;
+C make(int n) {
+ C c;
+ for (int i = 0; i < n; ++i)
+ c.push(i);
+ return c;
}
-int main(int, char**)
-{
- std::queue<int> q1 = make<std::queue<int> >(5);
- std::queue<int> q2 = make<std::queue<int> >(10);
- std::queue<int> q1_save = q1;
- std::queue<int> q2_save = q2;
- swap(q1, q2);
- assert(q1 == q2_save);
- assert(q2 == q1_save);
+int main(int, char**) {
+ std::queue<int> q1 = make<std::queue<int> >(5);
+ std::queue<int> q2 = make<std::queue<int> >(10);
+ std::queue<int> q1_save = q1;
+ std::queue<int> q2_save = q2;
+ swap(q1, q2);
+ assert(q1 == q2_save);
+ assert(q2 == q1_save);
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/queue/queue.special/swap_noexcept.pass.cpp b/libcxx/test/std/containers/container.adaptors/queue/queue.special/swap_noexcept.pass.cpp
index 7d07a52cd123d38..4d642a29639f716 100644
--- a/libcxx/test/std/containers/container.adaptors/queue/queue.special/swap_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/queue/queue.special/swap_noexcept.pass.cpp
@@ -22,12 +22,11 @@
#include "test_macros.h"
#include "MoveOnly.h"
-int main(int, char**)
-{
- {
- typedef std::queue<MoveOnly> C;
- static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
+int main(int, char**) {
+ {
+ typedef std::queue<MoveOnly> C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_alloc.pass.cpp b/libcxx/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_alloc.pass.cpp
index 8ec90a50aa80957..d756956df872847 100644
--- a/libcxx/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_alloc.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_alloc.pass.cpp
@@ -17,24 +17,21 @@
#include "test_macros.h"
#include "test_allocator.h"
-struct test
- : private std::stack<int, std::deque<int, test_allocator<int> > >
-{
- typedef std::stack<int, std::deque<int, test_allocator<int> > > base;
+struct test : private std::stack<int, std::deque<int, test_allocator<int> > > {
+ typedef std::stack<int, std::deque<int, test_allocator<int> > > base;
- explicit test(const test_allocator<int>& a) : base(a) {}
- test(const container_type& cont, const test_allocator<int>& a) : base(cont, a) {}
+ explicit test(const test_allocator<int>& a) : base(a) {}
+ test(const container_type& cont, const test_allocator<int>& a) : base(cont, a) {}
#if TEST_STD_VER >= 11
- test(container_type&& cont, const test_allocator<int>& a) : base(std::move(cont), a) {}
- test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
+ test(container_type&& cont, const test_allocator<int>& a) : base(std::move(cont), a) {}
+ test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
#endif
- test_allocator<int> get_allocator() {return c.get_allocator();}
+ test_allocator<int> get_allocator() { return c.get_allocator(); }
};
-int main(int, char**)
-{
- test q(test_allocator<int>(3));
- assert(q.get_allocator() == test_allocator<int>(3));
+int main(int, char**) {
+ test q(test_allocator<int>(3));
+ assert(q.get_allocator() == test_allocator<int>(3));
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_container_alloc.pass.cpp b/libcxx/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_container_alloc.pass.cpp
index 05e48eecb6adb16..27a5e187d3d469f 100644
--- a/libcxx/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_container_alloc.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_container_alloc.pass.cpp
@@ -19,42 +19,36 @@
#include "test_allocator.h"
template <class C>
-C
-make(int n)
-{
- C c;
- for (int i = 0; i < n; ++i)
- c.push_back(i);
- return c;
+C make(int n) {
+ C c;
+ for (int i = 0; i < n; ++i)
+ c.push_back(i);
+ return c;
}
typedef std::deque<int, test_allocator<int> > C;
-struct test
- : public std::stack<int, C>
-{
- typedef std::stack<int, C> base;
+struct test : public std::stack<int, C> {
+ typedef std::stack<int, C> base;
- explicit test(const test_allocator<int>& a) : base(a) {}
- test(const container_type& cont, const test_allocator<int>& a) : base(cont, a) {}
+ explicit test(const test_allocator<int>& a) : base(a) {}
+ test(const container_type& cont, const test_allocator<int>& a) : base(cont, a) {}
#if TEST_STD_VER >= 11
- test(container_type&& cont, const test_allocator<int>& a) : base(std::move(cont), a) {}
- test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
+ test(container_type&& cont, const test_allocator<int>& a) : base(std::move(cont), a) {}
+ test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
#endif
- test_allocator<int> get_allocator() {return c.get_allocator();}
+ test_allocator<int> get_allocator() { return c.get_allocator(); }
};
-int main(int, char**)
-{
- C d = make<C>(5);
- test q(d, test_allocator<int>(4));
- assert(q.get_allocator() == test_allocator<int>(4));
- assert(q.size() == 5);
- for (C::size_type i = 0; i < d.size(); ++i)
- {
- assert(q.top() == d[d.size() - i - 1]);
- q.pop();
- }
+int main(int, char**) {
+ C d = make<C>(5);
+ test q(d, test_allocator<int>(4));
+ assert(q.get_allocator() == test_allocator<int>(4));
+ assert(q.size() == 5);
+ for (C::size_type i = 0; i < d.size(); ++i) {
+ assert(q.top() == d[d.size() - i - 1]);
+ q.pop();
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_copy_alloc.pass.cpp b/libcxx/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_copy_alloc.pass.cpp
index 499a3fd2cbf4f97..79428cee6faf6f8 100644
--- a/libcxx/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_copy_alloc.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_copy_alloc.pass.cpp
@@ -18,37 +18,32 @@
#include "test_allocator.h"
template <class C>
-C
-make(int n)
-{
- C c;
- for (int i = 0; i < n; ++i)
- c.push_back(int(i));
- return c;
+C make(int n) {
+ C c;
+ for (int i = 0; i < n; ++i)
+ c.push_back(int(i));
+ return c;
}
typedef std::deque<int, test_allocator<int> > C;
template <class T>
-struct test
- : public std::stack<T, C>
-{
- typedef std::stack<T, C> base;
- typedef test_allocator<int> allocator_type;
- typedef typename base::container_type container_type;
-
- explicit test(const allocator_type& a) : base(a) {}
- test(const container_type& cont, const allocator_type& a) : base(cont, a) {}
- test(const test& q, const allocator_type& a) : base(q, a) {}
- allocator_type get_allocator() {return this->c.get_allocator();}
+struct test : public std::stack<T, C> {
+ typedef std::stack<T, C> base;
+ typedef test_allocator<int> allocator_type;
+ typedef typename base::container_type container_type;
+
+ explicit test(const allocator_type& a) : base(a) {}
+ test(const container_type& cont, const allocator_type& a) : base(cont, a) {}
+ test(const test& q, const allocator_type& a) : base(q, a) {}
+ allocator_type get_allocator() { return this->c.get_allocator(); }
};
-int main(int, char**)
-{
- test<int> q(make<C>(5), test_allocator<int>(4));
- test<int> q2(q, test_allocator<int>(5));
- assert(q2.get_allocator() == test_allocator<int>(5));
- assert(q2.size() == 5);
+int main(int, char**) {
+ test<int> q(make<C>(5), test_allocator<int>(4));
+ test<int> q2(q, test_allocator<int>(5));
+ assert(q2.get_allocator() == test_allocator<int>(5));
+ assert(q2.size() == 5);
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rcontainer_alloc.pass.cpp b/libcxx/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rcontainer_alloc.pass.cpp
index eb3a1ac1bf67c88..7e453e5f2f99823 100644
--- a/libcxx/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rcontainer_alloc.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rcontainer_alloc.pass.cpp
@@ -20,40 +20,33 @@
#include "test_allocator.h"
#include "MoveOnly.h"
-
template <class C>
-C
-make(int n)
-{
- C c;
- for (int i = 0; i < n; ++i)
- c.push_back(MoveOnly(i));
- return c;
+C make(int n) {
+ C c;
+ for (int i = 0; i < n; ++i)
+ c.push_back(MoveOnly(i));
+ return c;
}
typedef std::deque<MoveOnly, test_allocator<MoveOnly> > C;
template <class T>
-struct test
- : public std::stack<T, C>
-{
- typedef std::stack<T, C> base;
- typedef test_allocator<MoveOnly> allocator_type;
- typedef typename base::container_type container_type;
-
- explicit test(const allocator_type& a) : base(a) {}
- test(const container_type& cont, const allocator_type& a) : base(cont, a) {}
- test(container_type&& cont, const allocator_type& a) : base(std::move(cont), a) {}
- test(test&& q, const allocator_type& a) : base(std::move(q), a) {}
- allocator_type get_allocator() {return this->c.get_allocator();}
+struct test : public std::stack<T, C> {
+ typedef std::stack<T, C> base;
+ typedef test_allocator<MoveOnly> allocator_type;
+ typedef typename base::container_type container_type;
+
+ explicit test(const allocator_type& a) : base(a) {}
+ test(const container_type& cont, const allocator_type& a) : base(cont, a) {}
+ test(container_type&& cont, const allocator_type& a) : base(std::move(cont), a) {}
+ test(test&& q, const allocator_type& a) : base(std::move(q), a) {}
+ allocator_type get_allocator() { return this->c.get_allocator(); }
};
-
-int main(int, char**)
-{
- test<MoveOnly> q(make<C>(5), test_allocator<MoveOnly>(4));
- assert(q.get_allocator() == test_allocator<MoveOnly>(4));
- assert(q.size() == 5);
+int main(int, char**) {
+ test<MoveOnly> q(make<C>(5), test_allocator<MoveOnly>(4));
+ assert(q.get_allocator() == test_allocator<MoveOnly>(4));
+ assert(q.size() == 5);
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rqueue_alloc.pass.cpp b/libcxx/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rqueue_alloc.pass.cpp
index 849ad046898a7e6..598a7782d81f8be 100644
--- a/libcxx/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rqueue_alloc.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rqueue_alloc.pass.cpp
@@ -20,41 +20,34 @@
#include "test_allocator.h"
#include "MoveOnly.h"
-
template <class C>
-C
-make(int n)
-{
- C c;
- for (int i = 0; i < n; ++i)
- c.push_back(MoveOnly(i));
- return c;
+C make(int n) {
+ C c;
+ for (int i = 0; i < n; ++i)
+ c.push_back(MoveOnly(i));
+ return c;
}
typedef std::deque<MoveOnly, test_allocator<MoveOnly> > C;
template <class T>
-struct test
- : public std::stack<T, C>
-{
- typedef std::stack<T, C> base;
- typedef test_allocator<MoveOnly> allocator_type;
- typedef typename base::container_type container_type;
-
- explicit test(const allocator_type& a) : base(a) {}
- test(const container_type& cont, const allocator_type& a) : base(cont, a) {}
- test(container_type&& cont, const allocator_type& a) : base(std::move(cont), a) {}
- test(test&& q, const allocator_type& a) : base(std::move(q), a) {}
- allocator_type get_allocator() {return this->c.get_allocator();}
+struct test : public std::stack<T, C> {
+ typedef std::stack<T, C> base;
+ typedef test_allocator<MoveOnly> allocator_type;
+ typedef typename base::container_type container_type;
+
+ explicit test(const allocator_type& a) : base(a) {}
+ test(const container_type& cont, const allocator_type& a) : base(cont, a) {}
+ test(container_type&& cont, const allocator_type& a) : base(std::move(cont), a) {}
+ test(test&& q, const allocator_type& a) : base(std::move(q), a) {}
+ allocator_type get_allocator() { return this->c.get_allocator(); }
};
-
-int main(int, char**)
-{
- test<MoveOnly> q(make<C>(5), test_allocator<MoveOnly>(4));
- test<MoveOnly> q2(std::move(q), test_allocator<MoveOnly>(5));
- assert(q2.get_allocator() == test_allocator<MoveOnly>(5));
- assert(q2.size() == 5);
+int main(int, char**) {
+ test<MoveOnly> q(make<C>(5), test_allocator<MoveOnly>(4));
+ test<MoveOnly> q2(std::move(q), test_allocator<MoveOnly>(5));
+ assert(q2.get_allocator() == test_allocator<MoveOnly>(5));
+ assert(q2.size() == 5);
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/stack/stack.cons/ctor_container.pass.cpp b/libcxx/test/std/containers/container.adaptors/stack/stack.cons/ctor_container.pass.cpp
index b77660d4c875096..2bbea6f91c0cc34 100644
--- a/libcxx/test/std/containers/container.adaptors/stack/stack.cons/ctor_container.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/stack/stack.cons/ctor_container.pass.cpp
@@ -16,35 +16,31 @@
#include "test_macros.h"
#if TEST_STD_VER >= 11
-#include "test_convertible.h"
+# include "test_convertible.h"
#endif
template <class C>
-C
-make(int n)
-{
- C c;
- for (int i = 0; i < n; ++i)
- c.push_back(i);
- return c;
+C make(int n) {
+ C c;
+ for (int i = 0; i < n; ++i)
+ c.push_back(i);
+ return c;
}
-int main(int, char**)
-{
- typedef std::deque<int> Container;
- typedef std::stack<int> Q;
- Container d = make<Container>(5);
- Q q(d);
- assert(q.size() == 5);
- for (std::size_t i = 0; i < d.size(); ++i)
- {
- assert(q.top() == d[d.size() - i - 1]);
- q.pop();
- }
+int main(int, char**) {
+ typedef std::deque<int> Container;
+ typedef std::stack<int> Q;
+ Container d = make<Container>(5);
+ Q q(d);
+ assert(q.size() == 5);
+ for (std::size_t i = 0; i < d.size(); ++i) {
+ assert(q.top() == d[d.size() - i - 1]);
+ q.pop();
+ }
#if TEST_STD_VER >= 11
- static_assert(!test_convertible<Q, const Container&>(), "");
+ static_assert(!test_convertible<Q, const Container&>(), "");
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/stack/stack.cons/ctor_copy.pass.cpp b/libcxx/test/std/containers/container.adaptors/stack/stack.cons/ctor_copy.pass.cpp
index e38c12b91b0e9a4..794ae6fc49b3f70 100644
--- a/libcxx/test/std/containers/container.adaptors/stack/stack.cons/ctor_copy.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/stack/stack.cons/ctor_copy.pass.cpp
@@ -16,20 +16,17 @@
#include "test_macros.h"
template <class C>
-C
-make(int n)
-{
- C c;
- for (int i = 0; i < n; ++i)
- c.push_back(i);
- return c;
+C make(int n) {
+ C c;
+ for (int i = 0; i < n; ++i)
+ c.push_back(i);
+ return c;
}
-int main(int, char**)
-{
- std::stack<int> q(make<std::deque<int> >(5));
- std::stack<int> q2 = q;
- assert(q2 == q);
+int main(int, char**) {
+ std::stack<int> q(make<std::deque<int> >(5));
+ std::stack<int> q2 = q;
+ assert(q2 == q);
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/stack/stack.cons/ctor_default.pass.cpp b/libcxx/test/std/containers/container.adaptors/stack/stack.cons/ctor_default.pass.cpp
index 4d5aa88e4578ad3..98fa904adb7ed14 100644
--- a/libcxx/test/std/containers/container.adaptors/stack/stack.cons/ctor_default.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/stack/stack.cons/ctor_default.pass.cpp
@@ -19,24 +19,23 @@
#include "test_macros.h"
#include "test_allocator.h"
#if TEST_STD_VER >= 11
-#include "test_convertible.h"
+# include "test_convertible.h"
#endif
-int main(int, char**)
-{
- typedef std::vector<int, limited_allocator<int, 10> > Container;
- typedef std::stack<int, Container> Q;
- Q q;
- assert(q.size() == 0);
- q.push(1);
- q.push(2);
- assert(q.size() == 2);
- assert(q.top() == 2);
+int main(int, char**) {
+ typedef std::vector<int, limited_allocator<int, 10> > Container;
+ typedef std::stack<int, Container> Q;
+ Q q;
+ assert(q.size() == 0);
+ q.push(1);
+ q.push(2);
+ assert(q.size() == 2);
+ assert(q.top() == 2);
#if TEST_STD_VER >= 11
- // It should be explicit, so not convertible before C++20.
- static_assert(test_convertible<Q>(), "");
+ // It should be explicit, so not convertible before C++20.
+ static_assert(test_convertible<Q>(), "");
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/stack/stack.cons/ctor_iterators.pass.cpp b/libcxx/test/std/containers/container.adaptors/stack/stack.cons/ctor_iterators.pass.cpp
index e458b139baaba98..5981f9189dbfb02 100644
--- a/libcxx/test/std/containers/container.adaptors/stack/stack.cons/ctor_iterators.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/stack/stack.cons/ctor_iterators.pass.cpp
@@ -20,8 +20,10 @@
static_assert(!std::is_constructible_v<std::stack<int>, int, int, std::allocator<int>>);
static_assert(!std::is_constructible_v<std::stack<int>, int*, int*, int>);
-static_assert( std::is_constructible_v<std::stack<int, std::deque<int, test_allocator<int>>>, int*, int*, test_allocator<int>>);
-static_assert(!std::is_constructible_v<std::stack<int, std::deque<int, test_allocator<int>>>, int*, int*, std::allocator<int>>);
+static_assert(
+ std::is_constructible_v<std::stack<int, std::deque<int, test_allocator<int>>>, int*, int*, test_allocator<int>>);
+static_assert(
+ !std::is_constructible_v<std::stack<int, std::deque<int, test_allocator<int>>>, int*, int*, std::allocator<int>>);
template <class T>
struct alloc : test_allocator<T> {
diff --git a/libcxx/test/std/containers/container.adaptors/stack/stack.cons/ctor_move.pass.cpp b/libcxx/test/std/containers/container.adaptors/stack/stack.cons/ctor_move.pass.cpp
index 39801e9c1c0b890..25318eb37187d9c 100644
--- a/libcxx/test/std/containers/container.adaptors/stack/stack.cons/ctor_move.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/stack/stack.cons/ctor_move.pass.cpp
@@ -18,24 +18,19 @@
#include "test_macros.h"
#include "MoveOnly.h"
-
template <class C>
-C
-make(int n)
-{
- C c;
- for (int i = 0; i < n; ++i)
- c.push_back(MoveOnly(i));
- return c;
+C make(int n) {
+ C c;
+ for (int i = 0; i < n; ++i)
+ c.push_back(MoveOnly(i));
+ return c;
}
-
-int main(int, char**)
-{
- std::stack<MoveOnly> q(make<std::deque<MoveOnly> >(5));
- std::stack<MoveOnly> q2 = std::move(q);
- assert(q2.size() == 5);
- assert(q.empty());
+int main(int, char**) {
+ std::stack<MoveOnly> q(make<std::deque<MoveOnly> >(5));
+ std::stack<MoveOnly> q2 = std::move(q);
+ assert(q2.size() == 5);
+ assert(q.empty());
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/stack/stack.cons/ctor_rcontainer.pass.cpp b/libcxx/test/std/containers/container.adaptors/stack/stack.cons/ctor_rcontainer.pass.cpp
index 56dc40e4ed86bc5..3989685e6788417 100644
--- a/libcxx/test/std/containers/container.adaptors/stack/stack.cons/ctor_rcontainer.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/stack/stack.cons/ctor_rcontainer.pass.cpp
@@ -20,28 +20,25 @@
#include "test_macros.h"
#include "MoveOnly.h"
#if TEST_STD_VER >= 11
-#include "test_convertible.h"
+# include "test_convertible.h"
#endif
template <class C>
-C
-make(int n)
-{
- C c;
- for (int i = 0; i < n; ++i)
- c.push_back(MoveOnly(i));
- return c;
+C make(int n) {
+ C c;
+ for (int i = 0; i < n; ++i)
+ c.push_back(MoveOnly(i));
+ return c;
}
-int main(int, char**)
-{
- typedef std::deque<MoveOnly> Container;
- typedef std::stack<MoveOnly> Q;
- Q q(make<Container>(5));
- assert(q.size() == 5);
+int main(int, char**) {
+ typedef std::deque<MoveOnly> Container;
+ typedef std::stack<MoveOnly> Q;
+ Q q(make<Container>(5));
+ assert(q.size() == 5);
#if TEST_STD_VER >= 11
- static_assert(!test_convertible<Q, Container&&>(), "");
+ static_assert(!test_convertible<Q, Container&&>(), "");
#endif
return 0;
diff --git a/libcxx/test/std/containers/container.adaptors/stack/stack.cons/deduct.pass.cpp b/libcxx/test/std/containers/container.adaptors/stack/stack.cons/deduct.pass.cpp
index bc0c594a3c6416d..2970d732265a1f0 100644
--- a/libcxx/test/std/containers/container.adaptors/stack/stack.cons/deduct.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/stack/stack.cons/deduct.pass.cpp
@@ -39,141 +39,139 @@
struct A {};
-int main(int, char**)
-{
-
-// Test the explicit deduction guides
- {
- std::vector<int> v{0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
+int main(int, char**) {
+ // Test the explicit deduction guides
+ {
+ std::vector<int> v{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
std::stack stk(v);
static_assert(std::is_same_v<decltype(stk), std::stack<int, std::vector<int>>>, "");
assert(stk.size() == v.size());
assert(stk.top() == v.back());
- }
+ }
- {
- std::list<long, test_allocator<long>> l{10, 11, 12, 13, 14, 15, 16, 17, 18, 19 };
- std::stack stk(l, test_allocator<long>(0,2)); //
diff erent allocator
+ {
+ std::list<long, test_allocator<long>> l{10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
+ std::stack stk(l, test_allocator<long>(0, 2)); //
diff erent allocator
static_assert(std::is_same_v<decltype(stk)::container_type, std::list<long, test_allocator<long>>>, "");
static_assert(std::is_same_v<decltype(stk)::value_type, long>, "");
assert(stk.size() == 10);
assert(stk.top() == 19);
-// I'd like to assert that we've gotten the right allocator in the stack, but
-// I don't know how to get at the underlying container.
- }
+ // I'd like to assert that we've gotten the right allocator in the stack, but
+ // I don't know how to get at the underlying container.
+ }
-// Test the implicit deduction guides
+ // Test the implicit deduction guides
- {
-// We don't expect this one to work - no way to implicitly get value_type
-// std::stack stk(std::allocator<int>()); // stack (allocator &)
- }
+ {
+ // We don't expect this one to work - no way to implicitly get value_type
+ // std::stack stk(std::allocator<int>()); // stack (allocator &)
+ }
- {
+ {
std::stack<A> source;
std::stack stk(source); // stack(stack &)
static_assert(std::is_same_v<decltype(stk)::value_type, A>, "");
static_assert(std::is_same_v<decltype(stk)::container_type, std::deque<A>>, "");
assert(stk.size() == 0);
+ }
+
+ {
+ typedef short T;
+ typedef test_allocator<T> Alloc;
+ typedef std::list<T, Alloc> Cont;
+ typedef test_allocator<int> ConvertibleToAlloc;
+ static_assert(std::uses_allocator_v<Cont, ConvertibleToAlloc> &&
+ !std::is_same_v<typename Cont::allocator_type, ConvertibleToAlloc>);
+
+ {
+ Cont cont;
+ std::stack stk(cont, Alloc(2));
+ static_assert(std::is_same_v<decltype(stk), std::stack<T, Cont>>);
+ }
+
+ {
+ Cont cont;
+ std::stack stk(cont, ConvertibleToAlloc(2));
+ static_assert(std::is_same_v<decltype(stk), std::stack<T, Cont>>);
+ }
+
+ {
+ Cont cont;
+ std::stack stk(std::move(cont), Alloc(2));
+ static_assert(std::is_same_v<decltype(stk), std::stack<T, Cont>>);
+ }
+
+ {
+ Cont cont;
+ std::stack stk(std::move(cont), ConvertibleToAlloc(2));
+ static_assert(std::is_same_v<decltype(stk), std::stack<T, Cont>>);
+ }
+ }
+
+ {
+ typedef short T;
+ typedef test_allocator<T> Alloc;
+ typedef std::list<T, Alloc> Cont;
+ typedef test_allocator<int> ConvertibleToAlloc;
+ static_assert(std::uses_allocator_v<Cont, ConvertibleToAlloc> &&
+ !std::is_same_v<typename Cont::allocator_type, ConvertibleToAlloc>);
+
+ {
+ std::stack<T, Cont> source;
+ std::stack stk(source, Alloc(2));
+ static_assert(std::is_same_v<decltype(stk), std::stack<T, Cont>>);
}
{
- typedef short T;
- typedef test_allocator<T> Alloc;
- typedef std::list<T, Alloc> Cont;
- typedef test_allocator<int> ConvertibleToAlloc;
- static_assert(std::uses_allocator_v<Cont, ConvertibleToAlloc> &&
- !std::is_same_v<typename Cont::allocator_type, ConvertibleToAlloc>);
-
- {
- Cont cont;
- std::stack stk(cont, Alloc(2));
- static_assert(std::is_same_v<decltype(stk), std::stack<T, Cont>>);
- }
-
- {
- Cont cont;
- std::stack stk(cont, ConvertibleToAlloc(2));
- static_assert(std::is_same_v<decltype(stk), std::stack<T, Cont>>);
- }
-
- {
- Cont cont;
- std::stack stk(std::move(cont), Alloc(2));
- static_assert(std::is_same_v<decltype(stk), std::stack<T, Cont>>);
- }
-
- {
- Cont cont;
- std::stack stk(std::move(cont), ConvertibleToAlloc(2));
- static_assert(std::is_same_v<decltype(stk), std::stack<T, Cont>>);
- }
+ std::stack<T, Cont> source;
+ std::stack stk(source, ConvertibleToAlloc(2));
+ static_assert(std::is_same_v<decltype(stk), std::stack<T, Cont>>);
}
{
- typedef short T;
- typedef test_allocator<T> Alloc;
- typedef std::list<T, Alloc> Cont;
- typedef test_allocator<int> ConvertibleToAlloc;
- static_assert(std::uses_allocator_v<Cont, ConvertibleToAlloc> &&
- !std::is_same_v<typename Cont::allocator_type, ConvertibleToAlloc>);
-
- {
- std::stack<T, Cont> source;
- std::stack stk(source, Alloc(2));
- static_assert(std::is_same_v<decltype(stk), std::stack<T, Cont>>);
- }
-
- {
- std::stack<T, Cont> source;
- std::stack stk(source, ConvertibleToAlloc(2));
- static_assert(std::is_same_v<decltype(stk), std::stack<T, Cont>>);
- }
-
- {
- std::stack<T, Cont> source;
- std::stack stk(std::move(source), Alloc(2));
- static_assert(std::is_same_v<decltype(stk), std::stack<T, Cont>>);
- }
-
- {
- std::stack<T, Cont> source;
- std::stack stk(std::move(source), ConvertibleToAlloc(2));
- static_assert(std::is_same_v<decltype(stk), std::stack<T, Cont>>);
- }
+ std::stack<T, Cont> source;
+ std::stack stk(std::move(source), Alloc(2));
+ static_assert(std::is_same_v<decltype(stk), std::stack<T, Cont>>);
}
+ {
+ std::stack<T, Cont> source;
+ std::stack stk(std::move(source), ConvertibleToAlloc(2));
+ static_assert(std::is_same_v<decltype(stk), std::stack<T, Cont>>);
+ }
+ }
+
#if TEST_STD_VER >= 23
+ {
+ typedef short T;
+ typedef test_allocator<T> Alloc;
+ std::list<T> a;
+ {
+ std::stack s(a.begin(), a.end());
+ static_assert(std::is_same_v<decltype(s), std::stack<T>>);
+ }
+ {
+ std::stack s(a.begin(), a.end(), Alloc());
+ static_assert(std::is_same_v<decltype(s), std::stack<T, std::deque<T, Alloc>>>);
+ }
+ }
+
+ {
{
- typedef short T;
- typedef test_allocator<T> Alloc;
- std::list<T> a;
- {
- std::stack s(a.begin(), a.end());
- static_assert(std::is_same_v<decltype(s), std::stack<T>>);
- }
- {
- std::stack s(a.begin(), a.end(), Alloc());
- static_assert(std::is_same_v<decltype(s), std::stack<T, std::deque<T, Alloc>>>);
- }
+ std::stack c(std::from_range, std::array<int, 0>());
+ static_assert(std::is_same_v<decltype(c), std::stack<int>>);
}
{
- {
- std::stack c(std::from_range, std::array<int, 0>());
- static_assert(std::is_same_v<decltype(c), std::stack<int>>);
- }
-
- {
- using Alloc = test_allocator<int>;
- std::stack c(std::from_range, std::array<int, 0>(), Alloc());
- static_assert(std::is_same_v<decltype(c), std::stack<int, std::deque<int, Alloc>>>);
- }
+ using Alloc = test_allocator<int>;
+ std::stack c(std::from_range, std::array<int, 0>(), Alloc());
+ static_assert(std::is_same_v<decltype(c), std::stack<int, std::deque<int, Alloc>>>);
}
+ }
#endif
- ContainerAdaptorDeductionGuidesSfinaeAway<std::stack, std::stack<int>>();
+ ContainerAdaptorDeductionGuidesSfinaeAway<std::stack, std::stack<int>>();
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/stack/stack.cons/deduct.verify.cpp b/libcxx/test/std/containers/container.adaptors/stack/stack.cons/deduct.verify.cpp
index 390df86dd0f5ab4..dbc0e6c915a6d0b 100644
--- a/libcxx/test/std/containers/container.adaptors/stack/stack.cons/deduct.verify.cpp
+++ b/libcxx/test/std/containers/container.adaptors/stack/stack.cons/deduct.verify.cpp
@@ -14,39 +14,38 @@
// -> vector<typename iterator_traits<InputIterator>::value_type, Allocator>;
//
-
#include <stack>
#include <list>
#include <iterator>
#include <cassert>
#include <cstddef>
-
-int main(int, char**)
-{
-// Test the explicit deduction guides
- {
-// stack(const Container&, const Alloc&);
-// The '45' is not an allocator
- std::stack stk(std::list<int>({1,2,3}), 45); // expected-error-re {{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}stack'}}
- }
-
- {
-// stack(const stack&, const Alloc&);
-// The '45' is not an allocator
+int main(int, char**) {
+ // Test the explicit deduction guides
+ {
+ // stack(const Container&, const Alloc&);
+ // The '45' is not an allocator
+ std::stack stk(std::list<int>({1, 2, 3}), 45);
+ // expected-error-re at -1 {{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}stack'}}
+ }
+
+ {
+ // stack(const stack&, const Alloc&);
+ // The '45' is not an allocator
std::stack<int> source;
- std::stack stk(source, 45); // expected-error-re {{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}stack'}}
- }
-
-// Test the implicit deduction guides
- {
-// stack (allocator &)
- std::stack stk((std::allocator<int>())); // expected-error-re {{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}stack'}}
-// Note: The extra parens are necessary, since otherwise clang decides it is a function declaration.
-// Also, we can't use {} instead of parens, because that constructs a
-// stack<allocator<int>, allocator<allocator<int>>>
- }
-
+ std::stack stk(source, 45);
+ // expected-error-re at -1 {{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}stack'}}
+ }
+
+ // Test the implicit deduction guides
+ {
+ // stack (allocator &)
+ std::stack stk((std::allocator< int>()));
+ // expected-error-re at -1 {{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}stack'}}
+ // Note: The extra parens are necessary, since otherwise clang decides it is a function declaration.
+ // Also, we can't use {} instead of parens, because that constructs a
+ // stack<allocator<int>, allocator<allocator<int>>>
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/stack/stack.cons/default_noexcept.pass.cpp b/libcxx/test/std/containers/container.adaptors/stack/stack.cons/default_noexcept.pass.cpp
index 9cf79a81f9485ee..2967bbf35426f15 100644
--- a/libcxx/test/std/containers/container.adaptors/stack/stack.cons/default_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/stack/stack.cons/default_noexcept.pass.cpp
@@ -15,20 +15,18 @@
// This tests a conforming extension
-
#include <stack>
#include <cassert>
#include "test_macros.h"
#include "MoveOnly.h"
-int main(int, char**)
-{
+int main(int, char**) {
#if defined(_LIBCPP_VERSION)
- {
- typedef std::stack<MoveOnly> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
- }
+ {
+ typedef std::stack<MoveOnly> C;
+ static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/container.adaptors/stack/stack.cons/dtor_noexcept.pass.cpp b/libcxx/test/std/containers/container.adaptors/stack/stack.cons/dtor_noexcept.pass.cpp
index b6015c1e1ac3102..e3dfba01a500742 100644
--- a/libcxx/test/std/containers/container.adaptors/stack/stack.cons/dtor_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/stack/stack.cons/dtor_noexcept.pass.cpp
@@ -19,12 +19,11 @@
#include "test_macros.h"
#include "MoveOnly.h"
-int main(int, char**)
-{
- {
- typedef std::stack<MoveOnly> C;
- static_assert(std::is_nothrow_destructible<C>::value, "");
- }
+int main(int, char**) {
+ {
+ typedef std::stack<MoveOnly> C;
+ static_assert(std::is_nothrow_destructible<C>::value, "");
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/stack/stack.cons/move_assign_noexcept.pass.cpp b/libcxx/test/std/containers/container.adaptors/stack/stack.cons/move_assign_noexcept.pass.cpp
index d4da48e835dc453..c00ea2057f5efca 100644
--- a/libcxx/test/std/containers/container.adaptors/stack/stack.cons/move_assign_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/stack/stack.cons/move_assign_noexcept.pass.cpp
@@ -21,12 +21,11 @@
#include "test_macros.h"
#include "MoveOnly.h"
-int main(int, char**)
-{
- {
- typedef std::stack<MoveOnly> C;
- static_assert(std::is_nothrow_move_assignable<C>::value, "");
- }
+int main(int, char**) {
+ {
+ typedef std::stack<MoveOnly> C;
+ static_assert(std::is_nothrow_move_assignable<C>::value, "");
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/stack/stack.cons/move_noexcept.pass.cpp b/libcxx/test/std/containers/container.adaptors/stack/stack.cons/move_noexcept.pass.cpp
index 24e66a7076e8628..d0f69a2e7bf2789 100644
--- a/libcxx/test/std/containers/container.adaptors/stack/stack.cons/move_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/stack/stack.cons/move_noexcept.pass.cpp
@@ -21,13 +21,12 @@
#include "test_macros.h"
#include "MoveOnly.h"
-int main(int, char**)
-{
+int main(int, char**) {
#if defined(_LIBCPP_VERSION)
- {
- typedef std::stack<MoveOnly> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
- }
+ {
+ typedef std::stack<MoveOnly> C;
+ static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/container.adaptors/stack/stack.defn/assign_copy.pass.cpp b/libcxx/test/std/containers/container.adaptors/stack/stack.defn/assign_copy.pass.cpp
index 81ba10e1dfc474e..ee2007ce6b3bc51 100644
--- a/libcxx/test/std/containers/container.adaptors/stack/stack.defn/assign_copy.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/stack/stack.defn/assign_copy.pass.cpp
@@ -16,21 +16,18 @@
#include "test_macros.h"
template <class C>
-C
-make(int n)
-{
- C c;
- for (int i = 0; i < n; ++i)
- c.push_back(i);
- return c;
+C make(int n) {
+ C c;
+ for (int i = 0; i < n; ++i)
+ c.push_back(i);
+ return c;
}
-int main(int, char**)
-{
- std::stack<int> q(make<std::deque<int> >(5));
- std::stack<int> q2;
- q2 = q;
- assert(q2 == q);
+int main(int, char**) {
+ std::stack<int> q(make<std::deque<int> >(5));
+ std::stack<int> q2;
+ q2 = q;
+ assert(q2 == q);
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/stack/stack.defn/assign_move.pass.cpp b/libcxx/test/std/containers/container.adaptors/stack/stack.defn/assign_move.pass.cpp
index 81273882244dc7f..c5c92e6e46356d2 100644
--- a/libcxx/test/std/containers/container.adaptors/stack/stack.defn/assign_move.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/stack/stack.defn/assign_move.pass.cpp
@@ -18,25 +18,20 @@
#include "test_macros.h"
#include "MoveOnly.h"
-
template <class C>
-C
-make(int n)
-{
- C c;
- for (int i = 0; i < n; ++i)
- c.push_back(MoveOnly(i));
- return c;
+C make(int n) {
+ C c;
+ for (int i = 0; i < n; ++i)
+ c.push_back(MoveOnly(i));
+ return c;
}
-
-int main(int, char**)
-{
- std::stack<MoveOnly> q(make<std::deque<MoveOnly> >(5));
- std::stack<MoveOnly> q2;
- q2 = std::move(q);
- assert(q2.size() == 5);
- assert(q.empty());
+int main(int, char**) {
+ std::stack<MoveOnly> q(make<std::deque<MoveOnly> >(5));
+ std::stack<MoveOnly> q2;
+ q2 = std::move(q);
+ assert(q2.size() == 5);
+ assert(q.empty());
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/stack/stack.defn/emplace.pass.cpp b/libcxx/test/std/containers/container.adaptors/stack/stack.defn/emplace.pass.cpp
index 5ce2127a443a36b..2a4d9d47e1fba4f 100644
--- a/libcxx/test/std/containers/container.adaptors/stack/stack.defn/emplace.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/stack/stack.defn/emplace.pass.cpp
@@ -24,39 +24,38 @@
template <typename Stack>
void test_return_type() {
- typedef typename Stack::container_type Container;
- typedef typename Container::value_type value_type;
- typedef decltype(std::declval<Stack>().emplace(std::declval<value_type &>())) stack_return_type;
+ typedef typename Stack::container_type Container;
+ typedef typename Container::value_type value_type;
+ typedef decltype(std::declval<Stack>().emplace(std::declval<value_type&>())) stack_return_type;
#if TEST_STD_VER > 14
- typedef decltype(std::declval<Container>().emplace_back(std::declval<value_type>())) container_return_type;
- static_assert(std::is_same<stack_return_type, container_return_type>::value, "");
+ typedef decltype(std::declval<Container>().emplace_back(std::declval<value_type>())) container_return_type;
+ static_assert(std::is_same<stack_return_type, container_return_type>::value, "");
#else
- static_assert(std::is_same<stack_return_type, void>::value, "");
+ static_assert(std::is_same<stack_return_type, void>::value, "");
#endif
}
-int main(int, char**)
-{
- test_return_type<std::stack<int> > ();
- test_return_type<std::stack<int, std::vector<int> > > ();
+int main(int, char**) {
+ test_return_type<std::stack<int> >();
+ test_return_type<std::stack<int, std::vector<int> > >();
- std::stack<Emplaceable> q;
+ std::stack<Emplaceable> q;
#if TEST_STD_VER > 14
- typedef Emplaceable T;
- T& r1 = q.emplace(1, 2.5);
- assert(&r1 == &q.top());
- T& r2 = q.emplace(2, 3.5);
- assert(&r2 == &q.top());
- T& r3 = q.emplace(3, 4.5);
- assert(&r3 == &q.top());
+ typedef Emplaceable T;
+ T& r1 = q.emplace(1, 2.5);
+ assert(&r1 == &q.top());
+ T& r2 = q.emplace(2, 3.5);
+ assert(&r2 == &q.top());
+ T& r3 = q.emplace(3, 4.5);
+ assert(&r3 == &q.top());
#else
- q.emplace(1, 2.5);
- q.emplace(2, 3.5);
- q.emplace(3, 4.5);
+ q.emplace(1, 2.5);
+ q.emplace(2, 3.5);
+ q.emplace(3, 4.5);
#endif
- assert(q.size() == 3);
- assert(q.top() == Emplaceable(3, 4.5));
+ assert(q.size() == 3);
+ assert(q.top() == Emplaceable(3, 4.5));
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/stack/stack.defn/empty.pass.cpp b/libcxx/test/std/containers/container.adaptors/stack/stack.defn/empty.pass.cpp
index e278c4a4c7a1dd5..d66c16a56fd0c7d 100644
--- a/libcxx/test/std/containers/container.adaptors/stack/stack.defn/empty.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/stack/stack.defn/empty.pass.cpp
@@ -15,14 +15,13 @@
#include "test_macros.h"
-int main(int, char**)
-{
- std::stack<int> q;
- assert(q.empty());
- q.push(1);
- assert(!q.empty());
- q.pop();
- assert(q.empty());
+int main(int, char**) {
+ std::stack<int> q;
+ assert(q.empty());
+ q.push(1);
+ assert(!q.empty());
+ q.pop();
+ assert(q.empty());
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/stack/stack.defn/empty.verify.cpp b/libcxx/test/std/containers/container.adaptors/stack/stack.defn/empty.verify.cpp
index e9af144c858b1de..9100bc2a03e06fa 100644
--- a/libcxx/test/std/containers/container.adaptors/stack/stack.defn/empty.verify.cpp
+++ b/libcxx/test/std/containers/container.adaptors/stack/stack.defn/empty.verify.cpp
@@ -17,6 +17,6 @@
#include <stack>
void f() {
- std::stack<int> c;
- c.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::stack<int> c;
+ c.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}
diff --git a/libcxx/test/std/containers/container.adaptors/stack/stack.defn/pop.pass.cpp b/libcxx/test/std/containers/container.adaptors/stack/stack.defn/pop.pass.cpp
index d97dd8f37e08573..4af23fa911a0cdc 100644
--- a/libcxx/test/std/containers/container.adaptors/stack/stack.defn/pop.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/stack/stack.defn/pop.pass.cpp
@@ -15,23 +15,22 @@
#include "test_macros.h"
-int main(int, char**)
-{
- std::stack<int> q;
- assert(q.size() == 0);
- q.push(1);
- q.push(2);
- q.push(3);
- assert(q.size() == 3);
- assert(q.top() == 3);
- q.pop();
- assert(q.size() == 2);
- assert(q.top() == 2);
- q.pop();
- assert(q.size() == 1);
- assert(q.top() == 1);
- q.pop();
- assert(q.size() == 0);
+int main(int, char**) {
+ std::stack<int> q;
+ assert(q.size() == 0);
+ q.push(1);
+ q.push(2);
+ q.push(3);
+ assert(q.size() == 3);
+ assert(q.top() == 3);
+ q.pop();
+ assert(q.size() == 2);
+ assert(q.top() == 2);
+ q.pop();
+ assert(q.size() == 1);
+ assert(q.top() == 1);
+ q.pop();
+ assert(q.size() == 0);
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/stack/stack.defn/push.pass.cpp b/libcxx/test/std/containers/container.adaptors/stack/stack.defn/push.pass.cpp
index 91e08bf98a33e0e..b514033b65242d6 100644
--- a/libcxx/test/std/containers/container.adaptors/stack/stack.defn/push.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/stack/stack.defn/push.pass.cpp
@@ -15,18 +15,17 @@
#include "test_macros.h"
-int main(int, char**)
-{
- std::stack<int> q;
- q.push(1);
- assert(q.size() == 1);
- assert(q.top() == 1);
- q.push(2);
- assert(q.size() == 2);
- assert(q.top() == 2);
- q.push(3);
- assert(q.size() == 3);
- assert(q.top() == 3);
+int main(int, char**) {
+ std::stack<int> q;
+ q.push(1);
+ assert(q.size() == 1);
+ assert(q.top() == 1);
+ q.push(2);
+ assert(q.size() == 2);
+ assert(q.top() == 2);
+ q.push(3);
+ assert(q.size() == 3);
+ assert(q.top() == 3);
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/stack/stack.defn/push_rv.pass.cpp b/libcxx/test/std/containers/container.adaptors/stack/stack.defn/push_rv.pass.cpp
index 7eeaba7c8685a08..12771feccd16289 100644
--- a/libcxx/test/std/containers/container.adaptors/stack/stack.defn/push_rv.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/stack/stack.defn/push_rv.pass.cpp
@@ -18,18 +18,17 @@
#include "test_macros.h"
#include "MoveOnly.h"
-int main(int, char**)
-{
- std::stack<MoveOnly> q;
- q.push(MoveOnly(1));
- assert(q.size() == 1);
- assert(q.top() == MoveOnly(1));
- q.push(MoveOnly(2));
- assert(q.size() == 2);
- assert(q.top() == MoveOnly(2));
- q.push(MoveOnly(3));
- assert(q.size() == 3);
- assert(q.top() == MoveOnly(3));
+int main(int, char**) {
+ std::stack<MoveOnly> q;
+ q.push(MoveOnly(1));
+ assert(q.size() == 1);
+ assert(q.top() == MoveOnly(1));
+ q.push(MoveOnly(2));
+ assert(q.size() == 2);
+ assert(q.top() == MoveOnly(2));
+ q.push(MoveOnly(3));
+ assert(q.size() == 3);
+ assert(q.top() == MoveOnly(3));
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/stack/stack.defn/size.pass.cpp b/libcxx/test/std/containers/container.adaptors/stack/stack.defn/size.pass.cpp
index 893984ae2297db7..8a25d059d26f7f8 100644
--- a/libcxx/test/std/containers/container.adaptors/stack/stack.defn/size.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/stack/stack.defn/size.pass.cpp
@@ -15,12 +15,11 @@
#include "test_macros.h"
-int main(int, char**)
-{
- std::stack<int> q;
- assert(q.size() == 0);
- q.push(1);
- assert(q.size() == 1);
+int main(int, char**) {
+ std::stack<int> q;
+ assert(q.size() == 0);
+ q.push(1);
+ assert(q.size() == 1);
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/stack/stack.defn/swap.pass.cpp b/libcxx/test/std/containers/container.adaptors/stack/stack.defn/swap.pass.cpp
index 560cc823d44fa00..736a02ef98d38e5 100644
--- a/libcxx/test/std/containers/container.adaptors/stack/stack.defn/swap.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/stack/stack.defn/swap.pass.cpp
@@ -16,24 +16,21 @@
#include "test_macros.h"
template <class C>
-C
-make(int n)
-{
- C c;
- for (int i = 0; i < n; ++i)
- c.push(i);
- return c;
+C make(int n) {
+ C c;
+ for (int i = 0; i < n; ++i)
+ c.push(i);
+ return c;
}
-int main(int, char**)
-{
- std::stack<int> q1 = make<std::stack<int> >(5);
- std::stack<int> q2 = make<std::stack<int> >(10);
- std::stack<int> q1_save = q1;
- std::stack<int> q2_save = q2;
- q1.swap(q2);
- assert(q1 == q2_save);
- assert(q2 == q1_save);
+int main(int, char**) {
+ std::stack<int> q1 = make<std::stack<int> >(5);
+ std::stack<int> q2 = make<std::stack<int> >(10);
+ std::stack<int> q1_save = q1;
+ std::stack<int> q2_save = q2;
+ q1.swap(q2);
+ assert(q1 == q2_save);
+ assert(q2 == q1_save);
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/stack/stack.defn/top.pass.cpp b/libcxx/test/std/containers/container.adaptors/stack/stack.defn/top.pass.cpp
index c5ef96dc2bab85b..2226bc557ab5a8c 100644
--- a/libcxx/test/std/containers/container.adaptors/stack/stack.defn/top.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/stack/stack.defn/top.pass.cpp
@@ -15,15 +15,14 @@
#include "test_macros.h"
-int main(int, char**)
-{
- std::stack<int> q;
- assert(q.size() == 0);
- q.push(1);
- q.push(2);
- q.push(3);
- int& ir = q.top();
- assert(ir == 3);
+int main(int, char**) {
+ std::stack<int> q;
+ assert(q.size() == 0);
+ q.push(1);
+ q.push(2);
+ q.push(3);
+ int& ir = q.top();
+ assert(ir == 3);
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/stack/stack.defn/top_const.pass.cpp b/libcxx/test/std/containers/container.adaptors/stack/stack.defn/top_const.pass.cpp
index 974e3419c262d73..59f2a4b7495f2e4 100644
--- a/libcxx/test/std/containers/container.adaptors/stack/stack.defn/top_const.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/stack/stack.defn/top_const.pass.cpp
@@ -15,16 +15,15 @@
#include "test_macros.h"
-int main(int, char**)
-{
- std::stack<int> q;
- assert(q.size() == 0);
- q.push(1);
- q.push(2);
- q.push(3);
- const std::stack<int>& cqr = q;
- const int& cir = cqr.top();
- assert(cir == 3);
+int main(int, char**) {
+ std::stack<int> q;
+ assert(q.size() == 0);
+ q.push(1);
+ q.push(2);
+ q.push(3);
+ const std::stack<int>& cqr = q;
+ const int& cir = cqr.top();
+ assert(cir == 3);
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/stack/stack.defn/types.compile.fail.cpp b/libcxx/test/std/containers/container.adaptors/stack/stack.defn/types.compile.fail.cpp
index d5fe97fd5d75f53..ddccbe090afe2d8 100644
--- a/libcxx/test/std/containers/container.adaptors/stack/stack.defn/types.compile.fail.cpp
+++ b/libcxx/test/std/containers/container.adaptors/stack/stack.defn/types.compile.fail.cpp
@@ -27,10 +27,9 @@
#include <cassert>
#include <type_traits>
-int main(int, char**)
-{
-// LWG#2566 says that the first template param must match the second one's value type
- std::stack<double, std::deque<int>> t;
+int main(int, char**) {
+ // LWG#2566 says that the first template param must match the second one's value type
+ std::stack<double, std::deque<int>> t;
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/stack/stack.defn/types.pass.cpp b/libcxx/test/std/containers/container.adaptors/stack/stack.defn/types.pass.cpp
index 944fd42ecccbfb1..0eae4da418f9a40 100644
--- a/libcxx/test/std/containers/container.adaptors/stack/stack.defn/types.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/stack/stack.defn/types.pass.cpp
@@ -29,34 +29,27 @@
#include "test_macros.h"
-struct test
- : private std::stack<int>
-{
- test()
- {
- c.push_back(1);
- }
+struct test : private std::stack<int> {
+ test() { c.push_back(1); }
};
-struct C
-{
- typedef int value_type;
- typedef int& reference;
- typedef const int& const_reference;
- typedef int size_type;
+struct C {
+ typedef int value_type;
+ typedef int& reference;
+ typedef const int& const_reference;
+ typedef int size_type;
};
-int main(int, char**)
-{
- static_assert(( std::is_same<std::stack<int>::container_type, std::deque<int> >::value), "");
- static_assert(( std::is_same<std::stack<int, std::vector<int> >::container_type, std::vector<int> >::value), "");
- static_assert(( std::is_same<std::stack<int, std::vector<int> >::value_type, int>::value), "");
- static_assert(( std::is_same<std::stack<int>::reference, std::deque<int>::reference>::value), "");
- static_assert(( std::is_same<std::stack<int>::const_reference, std::deque<int>::const_reference>::value), "");
- static_assert(( std::is_same<std::stack<int>::size_type, std::deque<int>::size_type>::value), "");
- static_assert(( std::uses_allocator<std::stack<int>, std::allocator<int> >::value), "");
- static_assert((!std::uses_allocator<std::stack<int, C>, std::allocator<int> >::value), "");
- test t;
+int main(int, char**) {
+ static_assert((std::is_same<std::stack<int>::container_type, std::deque<int> >::value), "");
+ static_assert((std::is_same<std::stack<int, std::vector<int> >::container_type, std::vector<int> >::value), "");
+ static_assert((std::is_same<std::stack<int, std::vector<int> >::value_type, int>::value), "");
+ static_assert((std::is_same<std::stack<int>::reference, std::deque<int>::reference>::value), "");
+ static_assert((std::is_same<std::stack<int>::const_reference, std::deque<int>::const_reference>::value), "");
+ static_assert((std::is_same<std::stack<int>::size_type, std::deque<int>::size_type>::value), "");
+ static_assert((std::uses_allocator<std::stack<int>, std::allocator<int> >::value), "");
+ static_assert((!std::uses_allocator<std::stack<int, C>, std::allocator<int> >::value), "");
+ test t;
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/stack/stack.ops/eq.pass.cpp b/libcxx/test/std/containers/container.adaptors/stack/stack.ops/eq.pass.cpp
index c826046da96aa8d..31c15af27faaf0e 100644
--- a/libcxx/test/std/containers/container.adaptors/stack/stack.ops/eq.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/stack/stack.ops/eq.pass.cpp
@@ -20,24 +20,21 @@
#include "test_macros.h"
template <class C>
-C
-make(int n)
-{
- C c;
- for (int i = 0; i < n; ++i)
- c.push(i);
- return c;
+C make(int n) {
+ C c;
+ for (int i = 0; i < n; ++i)
+ c.push(i);
+ return c;
}
-int main(int, char**)
-{
- std::stack<int> q1 = make<std::stack<int> >(5);
- std::stack<int> q2 = make<std::stack<int> >(10);
- std::stack<int> q1_save = q1;
- std::stack<int> q2_save = q2;
- assert(q1 == q1_save);
- assert(q1 != q2);
- assert(q2 == q2_save);
+int main(int, char**) {
+ std::stack<int> q1 = make<std::stack<int> >(5);
+ std::stack<int> q2 = make<std::stack<int> >(10);
+ std::stack<int> q1_save = q1;
+ std::stack<int> q2_save = q2;
+ assert(q1 == q1_save);
+ assert(q1 != q2);
+ assert(q2 == q2_save);
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/stack/stack.ops/lt.pass.cpp b/libcxx/test/std/containers/container.adaptors/stack/stack.ops/lt.pass.cpp
index 5ac440e8e024704..51259aa59e4c167 100644
--- a/libcxx/test/std/containers/container.adaptors/stack/stack.ops/lt.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/stack/stack.ops/lt.pass.cpp
@@ -26,23 +26,20 @@
#include "test_macros.h"
template <class C>
-C
-make(int n)
-{
- C c;
- for (int i = 0; i < n; ++i)
- c.push(i);
- return c;
+C make(int n) {
+ C c;
+ for (int i = 0; i < n; ++i)
+ c.push(i);
+ return c;
}
-int main(int, char**)
-{
- std::stack<int> q1 = make<std::stack<int> >(5);
- std::stack<int> q2 = make<std::stack<int> >(10);
- assert(q1 < q2);
- assert(q2 > q1);
- assert(q1 <= q2);
- assert(q2 >= q1);
+int main(int, char**) {
+ std::stack<int> q1 = make<std::stack<int> >(5);
+ std::stack<int> q2 = make<std::stack<int> >(10);
+ assert(q1 < q2);
+ assert(q2 > q1);
+ assert(q1 <= q2);
+ assert(q2 >= q1);
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/stack/stack.special/swap.pass.cpp b/libcxx/test/std/containers/container.adaptors/stack/stack.special/swap.pass.cpp
index 1f4a382eaaaa3bb..16e91d1e1ef064d 100644
--- a/libcxx/test/std/containers/container.adaptors/stack/stack.special/swap.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/stack/stack.special/swap.pass.cpp
@@ -17,24 +17,21 @@
#include "test_macros.h"
template <class C>
-C
-make(int n)
-{
- C c;
- for (int i = 0; i < n; ++i)
- c.push(i);
- return c;
+C make(int n) {
+ C c;
+ for (int i = 0; i < n; ++i)
+ c.push(i);
+ return c;
}
-int main(int, char**)
-{
- std::stack<int> q1 = make<std::stack<int> >(5);
- std::stack<int> q2 = make<std::stack<int> >(10);
- std::stack<int> q1_save = q1;
- std::stack<int> q2_save = q2;
- swap(q1, q2);
- assert(q1 == q2_save);
- assert(q2 == q1_save);
+int main(int, char**) {
+ std::stack<int> q1 = make<std::stack<int> >(5);
+ std::stack<int> q2 = make<std::stack<int> >(10);
+ std::stack<int> q1_save = q1;
+ std::stack<int> q2_save = q2;
+ swap(q1, q2);
+ assert(q1 == q2_save);
+ assert(q2 == q1_save);
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/stack/stack.special/swap_noexcept.pass.cpp b/libcxx/test/std/containers/container.adaptors/stack/stack.special/swap_noexcept.pass.cpp
index 041944b30355427..f2e6be77f16f576 100644
--- a/libcxx/test/std/containers/container.adaptors/stack/stack.special/swap_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/stack/stack.special/swap_noexcept.pass.cpp
@@ -22,12 +22,11 @@
#include "test_macros.h"
#include "MoveOnly.h"
-int main(int, char**)
-{
- {
- typedef std::stack<MoveOnly> C;
- static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
+int main(int, char**) {
+ {
+ typedef std::stack<MoveOnly> C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/container.node/node_handle.nodiscard.verify.cpp b/libcxx/test/std/containers/container.node/node_handle.nodiscard.verify.cpp
index 4c47563f6c4467c..8d01c8edd8f5242 100644
--- a/libcxx/test/std/containers/container.node/node_handle.nodiscard.verify.cpp
+++ b/libcxx/test/std/containers/container.node/node_handle.nodiscard.verify.cpp
@@ -21,37 +21,37 @@
void test() {
#if TEST_STD_VER >= 17
- {
- std::map<int, int>::node_type node;
- node.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- }
- {
- std::multimap<int, int>::node_type node;
- node.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- }
+ {
+ std::map<int, int>::node_type node;
+ node.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ }
+ {
+ std::multimap<int, int>::node_type node;
+ node.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ }
#endif // TEST_STD_VER >= 17
- {
- std::set<int> node;
- node.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- }
- {
- std::multiset<int> node;
- node.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- }
- {
- std::unordered_map<int, int> node;
- node.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- }
- {
- std::unordered_multimap<int, int> node;
- node.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- }
- {
- std::unordered_set<int> node;
- node.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- }
- {
- std::unordered_multiset<int> node;
- node.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- }
+ {
+ std::set<int> node;
+ node.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ }
+ {
+ std::multiset<int> node;
+ node.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ }
+ {
+ std::unordered_map<int, int> node;
+ node.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ }
+ {
+ std::unordered_multimap<int, int> node;
+ node.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ }
+ {
+ std::unordered_set<int> node;
+ node.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ }
+ {
+ std::unordered_multiset<int> node;
+ node.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ }
}
diff --git a/libcxx/test/std/containers/container.node/node_handle.pass.cpp b/libcxx/test/std/containers/container.node/node_handle.pass.cpp
index de9564261a04f3b..3b1552cdaa5d48a 100644
--- a/libcxx/test/std/containers/container.node/node_handle.pass.cpp
+++ b/libcxx/test/std/containers/container.node/node_handle.pass.cpp
@@ -17,46 +17,46 @@
// [container.node.overview] Table 83.
template <class K, class T, class C1, class C2, class H1, class H2, class E1, class E2, class A_set, class A_map>
-struct node_compatibility_table
-{
- static constexpr bool value =
- std::is_same_v<typename std::map<K, T, C1, A_map>::node_type, typename std::map<K, T, C2, A_map>::node_type> &&
- std::is_same_v<typename std::map<K, T, C1, A_map>::node_type, typename std::multimap<K, T, C2, A_map>::node_type> &&
- std::is_same_v<typename std::set<K, C1, A_set>::node_type, typename std::set<K, C2, A_set>::node_type> &&
- std::is_same_v<typename std::set<K, C1, A_set>::node_type, typename std::multiset<K, C2, A_set>::node_type> &&
- std::is_same_v<typename std::unordered_map<K, T, H1, E1, A_map>::node_type, typename std::unordered_map<K, T, H2, E2, A_map>::node_type> &&
- std::is_same_v<typename std::unordered_map<K, T, H1, E1, A_map>::node_type, typename std::unordered_multimap<K, T, H2, E2, A_map>::node_type> &&
- std::is_same_v<typename std::unordered_set<K, H1, E1, A_set>::node_type, typename std::unordered_set<K, H2, E2, A_set>::node_type> &&
- std::is_same_v<typename std::unordered_set<K, H1, E1, A_set>::node_type, typename std::unordered_multiset<K, H2, E2, A_set>::node_type>;
+struct node_compatibility_table {
+ // clang-format off
+ static constexpr bool value =
+ std::is_same_v<typename std::map<K, T, C1, A_map>::node_type, typename std::map<K, T, C2, A_map>::node_type> &&
+ std::is_same_v<typename std::map<K, T, C1, A_map>::node_type, typename std::multimap<K, T, C2, A_map>::node_type> &&
+ std::is_same_v<typename std::set<K, C1, A_set>::node_type, typename std::set<K, C2, A_set>::node_type> &&
+ std::is_same_v<typename std::set<K, C1, A_set>::node_type, typename std::multiset<K, C2, A_set>::node_type> &&
+ std::is_same_v<typename std::unordered_map<K, T, H1, E1, A_map>::node_type, typename std::unordered_map<K, T, H2, E2, A_map>::node_type> &&
+ std::is_same_v<typename std::unordered_map<K, T, H1, E1, A_map>::node_type, typename std::unordered_multimap<K, T, H2, E2, A_map>::node_type> &&
+ std::is_same_v<typename std::unordered_set<K, H1, E1, A_set>::node_type, typename std::unordered_set<K, H2, E2, A_set>::node_type> &&
+ std::is_same_v<typename std::unordered_set<K, H1, E1, A_set>::node_type, typename std::unordered_multiset<K, H2, E2, A_set>::node_type>;
+ // clang-format on
};
-template <class T> struct my_hash
-{
- using argument_type = T;
- using result_type = std::size_t;
- my_hash() = default;
- std::size_t operator()(const T&) const {return 0;}
+template <class T>
+struct my_hash {
+ using argument_type = T;
+ using result_type = std::size_t;
+ my_hash() = default;
+ std::size_t operator()(const T&) const { return 0; }
};
-template <class T> struct my_compare
-{
- my_compare() = default;
- bool operator()(const T&, const T&) const {return true;}
+template <class T>
+struct my_compare {
+ my_compare() = default;
+ bool operator()(const T&, const T&) const { return true; }
};
-template <class T> struct my_equal
-{
- my_equal() = default;
- bool operator()(const T&, const T&) const {return true;}
+template <class T>
+struct my_equal {
+ my_equal() = default;
+ bool operator()(const T&, const T&) const { return true; }
};
-struct Static
-{
- Static() = default;
- Static(const Static&) = delete;
- Static(Static&&) = delete;
- Static& operator=(const Static&) = delete;
- Static& operator=(Static&&) = delete;
+struct Static {
+ Static() = default;
+ Static(const Static&) = delete;
+ Static(Static&&) = delete;
+ Static& operator=(const Static&) = delete;
+ Static& operator=(Static&&) = delete;
};
template <>
@@ -67,78 +67,93 @@ struct std::hash<Static> {
std::size_t operator()(const Static&) const;
};
-static_assert(node_compatibility_table<
- int, int, std::less<int>, std::less<int>, std::hash<int>,
- std::hash<int>, std::equal_to<int>, std::equal_to<int>,
- std::allocator<int>,
- std::allocator<std::pair<const int, int>>>::value,
- "");
+static_assert(
+ node_compatibility_table< int,
+ int,
+ std::less<int>,
+ std::less<int>,
+ std::hash<int>,
+ std::hash<int>,
+ std::equal_to<int>,
+ std::equal_to<int>,
+ std::allocator<int>,
+ std::allocator<std::pair<const int, int>>>::value,
+ "");
static_assert(
- node_compatibility_table<int, int, std::less<int>, my_compare<int>,
- std::hash<int>, my_hash<int>, std::equal_to<int>,
- my_equal<int>, std::allocator<int>,
+ node_compatibility_table<int,
+ int,
+ std::less<int>,
+ my_compare<int>,
+ std::hash<int>,
+ my_hash<int>,
+ std::equal_to<int>,
+ my_equal<int>,
+ std::allocator<int>,
std::allocator<std::pair<const int, int>>>::value,
"");
-static_assert(node_compatibility_table<
- Static, int, my_compare<Static>, std::less<Static>,
- my_hash<Static>, std::hash<Static>, my_equal<Static>,
- std::equal_to<Static>, min_allocator<Static>,
- min_allocator<std::pair<const Static, int>>>::value,
- "");
+static_assert(
+ node_compatibility_table< Static,
+ int,
+ my_compare<Static>,
+ std::less<Static>,
+ my_hash<Static>,
+ std::hash<Static>,
+ my_equal<Static>,
+ std::equal_to<Static>,
+ min_allocator<Static>,
+ min_allocator<std::pair<const Static, int>>>::value,
+ "");
template <class Container>
-void test_node_handle_operations()
-{
- Container c;
-
- typename Container::node_type nt1, nt2 = c.extract(c.emplace().first);
- assert(nt2.get_allocator() == c.get_allocator());
- assert(!nt2.empty());
- assert(nt1.empty());
- std::swap(nt1, nt2);
- assert(nt1.get_allocator() == c.get_allocator());
- assert(nt2.empty());
+void test_node_handle_operations() {
+ Container c;
+
+ typename Container::node_type nt1, nt2 = c.extract(c.emplace().first);
+ assert(nt2.get_allocator() == c.get_allocator());
+ assert(!nt2.empty());
+ assert(nt1.empty());
+ std::swap(nt1, nt2);
+ assert(nt1.get_allocator() == c.get_allocator());
+ assert(nt2.empty());
}
template <class Container>
-void test_node_handle_operations_multi()
-{
- Container c;
-
- typename Container::node_type nt1, nt2 = c.extract(c.emplace());
- assert(nt2.get_allocator() == c.get_allocator());
- assert(!nt2.empty());
- assert(nt1.empty());
- std::swap(nt1, nt2);
- assert(nt1.get_allocator() == c.get_allocator());
- assert(nt2.empty());
+void test_node_handle_operations_multi() {
+ Container c;
+
+ typename Container::node_type nt1, nt2 = c.extract(c.emplace());
+ assert(nt2.get_allocator() == c.get_allocator());
+ assert(!nt2.empty());
+ assert(nt1.empty());
+ std::swap(nt1, nt2);
+ assert(nt1.get_allocator() == c.get_allocator());
+ assert(nt2.empty());
}
-template <class> void test_typedef() {}
+template <class>
+void test_typedef() {}
template <class Container>
-void test_insert_return_type()
-{
- test_typedef<typename Container::insert_return_type>();
+void test_insert_return_type() {
+ test_typedef<typename Container::insert_return_type>();
}
-int main(int, char**)
-{
- test_node_handle_operations<std::map<int, int>>();
- test_node_handle_operations_multi<std::multimap<int, int>>();
- test_node_handle_operations<std::set<int>>();
- test_node_handle_operations_multi<std::multiset<int>>();
- test_node_handle_operations<std::unordered_map<int, int>>();
- test_node_handle_operations_multi<std::unordered_multimap<int, int>>();
- test_node_handle_operations<std::unordered_set<int>>();
- test_node_handle_operations_multi<std::unordered_multiset<int>>();
-
- test_insert_return_type<std::map<int, int>>();
- test_insert_return_type<std::set<int>>();
- test_insert_return_type<std::unordered_map<int, int>>();
- test_insert_return_type<std::unordered_set<int>>();
+int main(int, char**) {
+ test_node_handle_operations<std::map<int, int>>();
+ test_node_handle_operations_multi<std::multimap<int, int>>();
+ test_node_handle_operations<std::set<int>>();
+ test_node_handle_operations_multi<std::multiset<int>>();
+ test_node_handle_operations<std::unordered_map<int, int>>();
+ test_node_handle_operations_multi<std::unordered_multimap<int, int>>();
+ test_node_handle_operations<std::unordered_set<int>>();
+ test_node_handle_operations_multi<std::unordered_multiset<int>>();
+
+ test_insert_return_type<std::map<int, int>>();
+ test_insert_return_type<std::set<int>>();
+ test_insert_return_type<std::unordered_map<int, int>>();
+ test_insert_return_type<std::unordered_set<int>>();
return 0;
}
diff --git a/libcxx/test/std/containers/container.requirements/associative.reqmts/associative.reqmts.except/nothing_to_do.pass.cpp b/libcxx/test/std/containers/container.requirements/associative.reqmts/associative.reqmts.except/nothing_to_do.pass.cpp
index 1f764da05d6b5f5..3e0d2a6570f42de 100644
--- a/libcxx/test/std/containers/container.requirements/associative.reqmts/associative.reqmts.except/nothing_to_do.pass.cpp
+++ b/libcxx/test/std/containers/container.requirements/associative.reqmts/associative.reqmts.except/nothing_to_do.pass.cpp
@@ -6,8 +6,4 @@
//
//===----------------------------------------------------------------------===//
-int main(int, char**)
-{
-
- return 0;
-}
+int main(int, char**) { return 0; }
diff --git a/libcxx/test/std/containers/container.requirements/container.requirements.dataraces/nothing_to_do.pass.cpp b/libcxx/test/std/containers/container.requirements/container.requirements.dataraces/nothing_to_do.pass.cpp
index 1f764da05d6b5f5..3e0d2a6570f42de 100644
--- a/libcxx/test/std/containers/container.requirements/container.requirements.dataraces/nothing_to_do.pass.cpp
+++ b/libcxx/test/std/containers/container.requirements/container.requirements.dataraces/nothing_to_do.pass.cpp
@@ -6,8 +6,4 @@
//
//===----------------------------------------------------------------------===//
-int main(int, char**)
-{
-
- return 0;
-}
+int main(int, char**) { return 0; }
diff --git a/libcxx/test/std/containers/container.requirements/container.requirements.general/allocator_move.pass.cpp b/libcxx/test/std/containers/container.requirements/container.requirements.general/allocator_move.pass.cpp
index 5f2f3cfe16588d5..5de5579d13067cf 100644
--- a/libcxx/test/std/containers/container.requirements/container.requirements.general/allocator_move.pass.cpp
+++ b/libcxx/test/std/containers/container.requirements/container.requirements.general/allocator_move.pass.cpp
@@ -93,16 +93,13 @@ int main(int, char**) {
#else
int stored_allocators = 1;
#endif
- test<std::unordered_set<int, std::hash<int>, std::equal_to<int>,
- test_allocator<int> > >(stored_allocators);
- test<std::unordered_multiset<int, std::hash<int>, std::equal_to<int>,
- test_allocator<int> > >(stored_allocators);
+ test<std::unordered_set<int, std::hash<int>, std::equal_to<int>, test_allocator<int> > >(stored_allocators);
+ test<std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, test_allocator<int> > >(stored_allocators);
using KV = std::pair<const int, int>;
- test<std::unordered_map<int, int, std::hash<int>, std::equal_to<int>,
- test_allocator<KV> > >(stored_allocators);
- test<std::unordered_multimap<int, int, std::hash<int>, std::equal_to<int>,
- test_allocator<KV> > >(stored_allocators);
+ test<std::unordered_map<int, int, std::hash<int>, std::equal_to<int>, test_allocator<KV> > >(stored_allocators);
+ test<std::unordered_multimap<int, int, std::hash<int>, std::equal_to<int>, test_allocator<KV> > >(
+ stored_allocators);
}
return 0;
diff --git a/libcxx/test/std/containers/container.requirements/sequence.reqmts/nothing_to_do.pass.cpp b/libcxx/test/std/containers/container.requirements/sequence.reqmts/nothing_to_do.pass.cpp
index 1f764da05d6b5f5..3e0d2a6570f42de 100644
--- a/libcxx/test/std/containers/container.requirements/sequence.reqmts/nothing_to_do.pass.cpp
+++ b/libcxx/test/std/containers/container.requirements/sequence.reqmts/nothing_to_do.pass.cpp
@@ -6,8 +6,4 @@
//
//===----------------------------------------------------------------------===//
-int main(int, char**)
-{
-
- return 0;
-}
+int main(int, char**) { return 0; }
diff --git a/libcxx/test/std/containers/container.requirements/unord.req/unord.req.except/nothing_to_do.pass.cpp b/libcxx/test/std/containers/container.requirements/unord.req/unord.req.except/nothing_to_do.pass.cpp
index 1f764da05d6b5f5..3e0d2a6570f42de 100644
--- a/libcxx/test/std/containers/container.requirements/unord.req/unord.req.except/nothing_to_do.pass.cpp
+++ b/libcxx/test/std/containers/container.requirements/unord.req/unord.req.except/nothing_to_do.pass.cpp
@@ -6,8 +6,4 @@
//
//===----------------------------------------------------------------------===//
-int main(int, char**)
-{
-
- return 0;
-}
+int main(int, char**) { return 0; }
diff --git a/libcxx/test/std/containers/containers.general/nothing_to_do.pass.cpp b/libcxx/test/std/containers/containers.general/nothing_to_do.pass.cpp
index 1f764da05d6b5f5..3e0d2a6570f42de 100644
--- a/libcxx/test/std/containers/containers.general/nothing_to_do.pass.cpp
+++ b/libcxx/test/std/containers/containers.general/nothing_to_do.pass.cpp
@@ -6,8 +6,4 @@
//
//===----------------------------------------------------------------------===//
-int main(int, char**)
-{
-
- return 0;
-}
+int main(int, char**) { return 0; }
diff --git a/libcxx/test/std/containers/exception_safety_helpers.h b/libcxx/test/std/containers/exception_safety_helpers.h
index 08884160d19c9c7..da247571d303f38 100644
--- a/libcxx/test/std/containers/exception_safety_helpers.h
+++ b/libcxx/test/std/containers/exception_safety_helpers.h
@@ -25,9 +25,7 @@ struct ThrowingCopy {
ThrowingCopy() = default;
ThrowingCopy(int value) : x(value) {}
- ~ThrowingCopy() {
- ++destroyed;
- }
+ ~ThrowingCopy() { ++destroyed; }
ThrowingCopy(const ThrowingCopy& other) : x(other.x) {
++created_by_copying;
@@ -45,9 +43,7 @@ struct ThrowingCopy {
friend bool operator==(const ThrowingCopy& lhs, const ThrowingCopy& rhs) { return lhs.x == rhs.x; }
friend bool operator<(const ThrowingCopy& lhs, const ThrowingCopy& rhs) { return lhs.x < rhs.x; }
- static void reset() {
- created_by_copying = destroyed = 0;
- }
+ static void reset() { created_by_copying = destroyed = 0; }
};
template <int N>
@@ -59,9 +55,7 @@ int ThrowingCopy<N>::destroyed = 0;
template <int N>
struct std::hash<ThrowingCopy<N>> {
- std::size_t operator()(const ThrowingCopy<N>& value) const {
- return value.x;
- }
+ std::size_t operator()(const ThrowingCopy<N>& value) const { return value.x; }
};
template <int ThrowOn, int Size, class Func>
@@ -84,7 +78,7 @@ void test_exception_safety_throwing_copy(Func&& func) {
// complicate asserting that the expected number of elements was destroyed).
template <class Container, int ThrowOn, int Size, class Func>
void test_exception_safety_throwing_copy_container(Func&& func) {
- using T = ThrowingCopy<ThrowOn>;
+ using T = ThrowingCopy<ThrowOn>;
T::throwing_enabled = false;
T in[Size];
Container c(in, in + Size);
diff --git a/libcxx/test/std/containers/from_range_helpers.h b/libcxx/test/std/containers/from_range_helpers.h
index e17ea247618bc2e..edf1d6ce528d787 100644
--- a/libcxx/test/std/containers/from_range_helpers.h
+++ b/libcxx/test/std/containers/from_range_helpers.h
@@ -51,7 +51,7 @@ constexpr auto wrap_input(std::vector<T>& input) {
}
struct KeyValue {
- int key; // Only the key is considered for equality comparison.
+ int key; // Only the key is considered for equality comparison.
char value; // Allows distinguishing equivalent instances.
bool operator<(const KeyValue& other) const { return key < other.key; }
@@ -60,17 +60,15 @@ struct KeyValue {
template <>
struct std::hash<KeyValue> {
- std::size_t operator()(const KeyValue& kv) const {
- return kv.key;
- }
+ std::size_t operator()(const KeyValue& kv) const { return kv.key; }
};
#if !defined(TEST_HAS_NO_EXCEPTIONS)
template <class T>
struct ThrowingAllocator {
- using value_type = T;
- using char_type = T;
+ using value_type = T;
+ using char_type = T;
using is_always_equal = std::false_type;
ThrowingAllocator() = default;
@@ -90,14 +88,13 @@ struct ThrowingAllocator {
template <class T, class Func>
constexpr void for_all_iterators_and_allocators(Func f) {
- using Iterators = types::type_list<
- cpp20_input_iterator<T*>,
- forward_iterator<T*>,
- bidirectional_iterator<T*>,
- random_access_iterator<T*>,
- contiguous_iterator<T*>,
- T*
- >;
+ using Iterators =
+ types::type_list< cpp20_input_iterator<T*>,
+ forward_iterator<T*>,
+ bidirectional_iterator<T*>,
+ random_access_iterator<T*>,
+ contiguous_iterator<T*>,
+ T* >;
types::for_each(Iterators{}, [=]<class Iter>() {
f.template operator()<Iter, sentinel_wrapper<Iter>, std::allocator<T>>();
diff --git a/libcxx/test/std/containers/insert_range_helpers.h b/libcxx/test/std/containers/insert_range_helpers.h
index 531a7df10c7f9f1..d7d89f5ea650395 100644
--- a/libcxx/test/std/containers/insert_range_helpers.h
+++ b/libcxx/test/std/containers/insert_range_helpers.h
@@ -33,7 +33,7 @@
// `std::vector`).
template <class T, std::size_t N = 32>
class Buffer {
- public:
+public:
constexpr Buffer() = default;
constexpr Buffer(std::initializer_list<T> input) {
@@ -45,8 +45,9 @@ class Buffer {
// Makes initializing `Buffer<char>` nicer -- allows writing `buf = "abc"` instead of `buf = {'a', 'b', 'c'}`.
// To make the two forms equivalent, omits the terminating null.
template <std::size_t N2>
- constexpr Buffer(const char (&input) [N2])
- requires std::same_as<T, char> {
+ constexpr Buffer(const char (&input)[N2])
+ requires std::same_as<T, char>
+ {
static_assert(N2 <= N);
std::ranges::copy(input, data_);
// Omit the terminating null.
@@ -57,9 +58,9 @@ class Buffer {
constexpr const T* end() const { return data_ + size_; }
constexpr std::size_t size() const { return size_; }
- private:
+private:
std::size_t size_ = 0;
- T data_[N] = {};
+ T data_[N] = {};
};
template <class T>
@@ -72,14 +73,13 @@ struct TestCase {
template <class T, class PtrT, class Func>
constexpr void for_all_iterators_and_allocators(Func f) {
- using Iterators = types::type_list<
- cpp20_input_iterator<PtrT>,
- forward_iterator<PtrT>,
- bidirectional_iterator<PtrT>,
- random_access_iterator<PtrT>,
- contiguous_iterator<PtrT>,
- PtrT
- >;
+ using Iterators =
+ types::type_list< cpp20_input_iterator<PtrT>,
+ forward_iterator<PtrT>,
+ bidirectional_iterator<PtrT>,
+ random_access_iterator<PtrT>,
+ contiguous_iterator<PtrT>,
+ PtrT >;
types::for_each(Iterators{}, [=]<class Iter>() {
f.template operator()<Iter, sentinel_wrapper<Iter>, std::allocator<T>>();
@@ -100,11 +100,7 @@ constexpr void for_all_iterators_and_allocators(Func f) {
// too long.
template <class T, class PtrT, class Func>
constexpr void for_all_iterators_and_allocators_constexpr(Func f) {
- using Iterators = types::type_list<
- cpp20_input_iterator<PtrT>,
- forward_iterator<PtrT>,
- PtrT
- >;
+ using Iterators = types::type_list< cpp20_input_iterator<PtrT>, forward_iterator<PtrT>, PtrT >;
types::for_each(Iterators{}, [=]<class Iter>() {
f.template operator()<Iter, sentinel_wrapper<Iter>, std::allocator<T>>();
diff --git a/libcxx/test/std/containers/insert_range_maps_sets.h b/libcxx/test/std/containers/insert_range_maps_sets.h
index 82fea93b68fe370..6e344d8ad3b0f1a 100644
--- a/libcxx/test/std/containers/insert_range_maps_sets.h
+++ b/libcxx/test/std/containers/insert_range_maps_sets.h
@@ -31,9 +31,7 @@
#include "type_algorithms.h"
template <class Container, class Range>
-concept HasInsertRange = requires (Container& c, Range&& range) {
- c.insert_range(range);
-};
+concept HasInsertRange = requires(Container& c, Range&& range) { c.insert_range(range); };
template <template <class...> class Container, class T, class U>
constexpr bool test_set_constraints_insert_range() {
@@ -79,141 +77,127 @@ struct TestCaseMapSet {
// Empty container.
template <class T>
-TestCaseMapSet<T> constexpr EmptyContainer_EmptyRange {
- .initial = {}, .input = {}, .expected = {}
-};
+TestCaseMapSet<T> constexpr EmptyContainer_EmptyRange{.initial = {}, .input = {}, .expected = {}};
template <class T>
-TestCaseMapSet<T> constexpr EmptyContainer_OneElementRange {
- .initial = {}, .input = {1}, .expected = {1}
-};
-template <class K, class V> TestCaseMapSet<std::pair<K, V>>
-constexpr EmptyContainer_OneElementRange<std::pair<K, V>> {
- .initial = {}, .input = {{1, 'a'}}, .expected = {{1, 'a'}}
-};
+TestCaseMapSet<T> constexpr EmptyContainer_OneElementRange{.initial = {}, .input = {1}, .expected = {1}};
+template <class K, class V>
+TestCaseMapSet<std::pair<K, V>> constexpr EmptyContainer_OneElementRange<std::pair<K, V>>{
+ .initial = {}, .input = {{1, 'a'}}, .expected = {{1, 'a'}}};
template <class T>
-TestCaseMapSet<T> constexpr EmptyContainer_RangeNoDuplicates {
- .initial = {}, .input = {5, 1, 3, 8, 6}, .expected = {5, 1, 3, 8, 6}
-};
-template <class K, class V> TestCaseMapSet<std::pair<K, V>>
-constexpr EmptyContainer_RangeNoDuplicates<std::pair<K, V>> {
- .initial = {}, .input = {{5, 'a'}, {1, 'e'}, {3, 'i'}, {8, 'o'}, {6, 'u'}},
- .expected = {{5, 'a'}, {1, 'e'}, {3, 'i'}, {8, 'o'}, {6, 'u'}}
-};
+TestCaseMapSet<T> constexpr EmptyContainer_RangeNoDuplicates{
+ .initial = {}, .input = {5, 1, 3, 8, 6}, .expected = {5, 1, 3, 8, 6}};
+template <class K, class V>
+TestCaseMapSet<std::pair<K, V>> constexpr EmptyContainer_RangeNoDuplicates<std::pair<K, V>>{
+ .initial = {},
+ .input = {{5, 'a'}, {1, 'e'}, {3, 'i'}, {8, 'o'}, {6, 'u'}},
+ .expected = {{5, 'a'}, {1, 'e'}, {3, 'i'}, {8, 'o'}, {6, 'u'}}};
template <class T>
-TestCaseMapSet<T> constexpr EmptyContainer_RangeWithDuplicates {
- .initial = {},
- .input = {5, 1, 1, 3, 5, 8, 5, 6, 10},
- .expected = {5, 1, 3, 8, 6, 10},
- .expected_multi = {5, 1, 1, 3, 5, 8, 5, 6, 10}
-};
-template <class K, class V> TestCaseMapSet<std::pair<K, V>>
-constexpr EmptyContainer_RangeWithDuplicates<std::pair<K, V>> {
- .initial = {},
- .input = {{5, 'a'}, {1, 'a'}, {1, 'b'}, {3, 'a'}, {5, 'b'}, {8, 'a'}, {5, 'c'}, {6, 'a'}, {10, 'b'}},
- .expected = {{5, 'a'}, {1, 'a'}, {3, 'a'}, {8, 'a'}, {6, 'a'}, {10, 'b'}},
- .expected_multi = {{5, 'a'}, {1, 'a'}, {1, 'b'}, {3, 'a'}, {5, 'b'}, {8, 'a'}, {5, 'c'}, {6, 'a'}, {10, 'b'}}
-};
+TestCaseMapSet<T> constexpr EmptyContainer_RangeWithDuplicates{
+ .initial = {},
+ .input = {5, 1, 1, 3, 5, 8, 5, 6, 10},
+ .expected = {5, 1, 3, 8, 6, 10},
+ .expected_multi = {5, 1, 1, 3, 5, 8, 5, 6, 10}};
+template <class K, class V>
+TestCaseMapSet<std::pair<K, V>> constexpr EmptyContainer_RangeWithDuplicates<std::pair<K, V>>{
+ .initial = {},
+ .input = {{5, 'a'}, {1, 'a'}, {1, 'b'}, {3, 'a'}, {5, 'b'}, {8, 'a'}, {5, 'c'}, {6, 'a'}, {10, 'b'}},
+ .expected = {{5, 'a'}, {1, 'a'}, {3, 'a'}, {8, 'a'}, {6, 'a'}, {10, 'b'}},
+ .expected_multi = {{5, 'a'}, {1, 'a'}, {1, 'b'}, {3, 'a'}, {5, 'b'}, {8, 'a'}, {5, 'c'}, {6, 'a'}, {10, 'b'}}};
// One-element container.
template <class T>
-TestCaseMapSet<T> constexpr OneElementContainer_EmptyRange {
- .initial = {10}, .input = {}, .expected = {10}
-};
-template <class K, class V> TestCaseMapSet<std::pair<K, V>>
-constexpr OneElementContainer_EmptyRange<std::pair<K, V>> {
- .initial = {{10, 'A'}}, .input = {}, .expected = {{10, 'A'}}
-};
+TestCaseMapSet<T> constexpr OneElementContainer_EmptyRange{.initial = {10}, .input = {}, .expected = {10}};
+template <class K, class V>
+TestCaseMapSet<std::pair<K, V>> constexpr OneElementContainer_EmptyRange<std::pair<K, V>>{
+ .initial = {{10, 'A'}}, .input = {}, .expected = {{10, 'A'}}};
template <class T>
-TestCaseMapSet<T> constexpr OneElementContainer_OneElementRange {
- .initial = {10}, .input = {1}, .expected = {1, 10}
-};
-template <class K, class V> TestCaseMapSet<std::pair<K, V>>
-constexpr OneElementContainer_OneElementRange<std::pair<K, V>> {
- .initial = {{10, 'A'}}, .input = {{1, 'a'}}, .expected = {{1, 'a'}, {10, 'A'}}
-};
+TestCaseMapSet<T> constexpr OneElementContainer_OneElementRange{.initial = {10}, .input = {1}, .expected = {1, 10}};
+template <class K, class V>
+TestCaseMapSet<std::pair<K, V>> constexpr OneElementContainer_OneElementRange<std::pair<K, V>>{
+ .initial = {{10, 'A'}}, .input = {{1, 'a'}}, .expected = {{1, 'a'}, {10, 'A'}}};
template <class T>
-TestCaseMapSet<T> constexpr OneElementContainer_RangeNoDuplicates {
- .initial = {10}, .input = {5, 1, 3, 8, 6}, .expected = {5, 1, 3, 8, 6, 10}
-};
-template <class K, class V> TestCaseMapSet<std::pair<K, V>>
-constexpr OneElementContainer_RangeNoDuplicates<std::pair<K, V>> {
- .initial = {{10, 'A'}}, .input = {{5, 'a'}, {1, 'e'}, {3, 'i'}, {8, 'o'}, {6, 'u'}},
- .expected = {{5, 'a'}, {1, 'e'}, {3, 'i'}, {8, 'o'}, {6, 'u'}, {10, 'A'}}
-};
+TestCaseMapSet<T> constexpr OneElementContainer_RangeNoDuplicates{
+ .initial = {10}, .input = {5, 1, 3, 8, 6}, .expected = {5, 1, 3, 8, 6, 10}};
+template <class K, class V>
+TestCaseMapSet<std::pair<K, V>> constexpr OneElementContainer_RangeNoDuplicates<std::pair<K, V>>{
+ .initial = {{10, 'A'}},
+ .input = {{5, 'a'}, {1, 'e'}, {3, 'i'}, {8, 'o'}, {6, 'u'}},
+ .expected = {{5, 'a'}, {1, 'e'}, {3, 'i'}, {8, 'o'}, {6, 'u'}, {10, 'A'}}};
template <class T>
-TestCaseMapSet<T> constexpr OneElementContainer_RangeWithDuplicates {
- .initial = {10},
- .input = {5, 1, 1, 3, 5, 8, 5, 6, 10},
- .expected = {5, 1, 3, 8, 6, 10},
- .expected_multi = {5, 1, 1, 3, 5, 8, 5, 6, 10, 10}
-};
-template <class K, class V> TestCaseMapSet<std::pair<K, V>>
-constexpr OneElementContainer_RangeWithDuplicates<std::pair<K, V>> {
- .initial = {{10, 'A'}},
- .input = {{5, 'a'}, {1, 'a'}, {1, 'b'}, {3, 'a'}, {5, 'b'}, {8, 'a'}, {5, 'c'}, {6, 'a'}, {10, 'b'}},
- .expected = {{5, 'a'}, {1, 'a'}, {3, 'a'}, {8, 'a'}, {6, 'a'}, {10, 'A'}},
- .expected_multi = {
- {5, 'a'}, {1, 'a'}, {1, 'b'}, {3, 'a'}, {5, 'b'}, {8, 'a'}, {5, 'c'}, {6, 'a'}, {10, 'A'}, {10, 'b'}
- }
-};
+TestCaseMapSet<T> constexpr OneElementContainer_RangeWithDuplicates{
+ .initial = {10},
+ .input = {5, 1, 1, 3, 5, 8, 5, 6, 10},
+ .expected = {5, 1, 3, 8, 6, 10},
+ .expected_multi = {5, 1, 1, 3, 5, 8, 5, 6, 10, 10}};
+template <class K, class V>
+TestCaseMapSet<std::pair<K, V>> constexpr OneElementContainer_RangeWithDuplicates<std::pair<K, V>>{
+ .initial = {{10, 'A'}},
+ .input = {{5, 'a'}, {1, 'a'}, {1, 'b'}, {3, 'a'}, {5, 'b'}, {8, 'a'}, {5, 'c'}, {6, 'a'}, {10, 'b'}},
+ .expected = {{5, 'a'}, {1, 'a'}, {3, 'a'}, {8, 'a'}, {6, 'a'}, {10, 'A'}},
+ .expected_multi = {
+ {5, 'a'}, {1, 'a'}, {1, 'b'}, {3, 'a'}, {5, 'b'}, {8, 'a'}, {5, 'c'}, {6, 'a'}, {10, 'A'}, {10, 'b'}}};
// N-elements container.
template <class T>
-TestCaseMapSet<T> constexpr NElementsContainer_EmptyRange {
- .initial = {10, 15, 19, 16}, .input = {}, .expected = {10, 15, 19, 16}
-};
-template <class K, class V> TestCaseMapSet<std::pair<K, V>>
-constexpr NElementsContainer_EmptyRange<std::pair<K, V>> {
- .initial = {{10, 'A'}, {15, 'B'}, {19, 'C'}, {16, 'D'}}, .input = {},
- .expected = {{10, 'A'}, {15, 'B'}, {19, 'C'}, {16, 'D'}}
-};
+TestCaseMapSet<T> constexpr NElementsContainer_EmptyRange{
+ .initial = {10, 15, 19, 16}, .input = {}, .expected = {10, 15, 19, 16}};
+template <class K, class V>
+TestCaseMapSet<std::pair<K, V>> constexpr NElementsContainer_EmptyRange<std::pair<K, V>>{
+ .initial = {{10, 'A'}, {15, 'B'}, {19, 'C'}, {16, 'D'}},
+ .input = {},
+ .expected = {{10, 'A'}, {15, 'B'}, {19, 'C'}, {16, 'D'}}};
template <class T>
-TestCaseMapSet<T> constexpr NElementsContainer_OneElementRange {
- .initial = {10, 15, 19, 16}, .input = {1}, .expected = {1, 10, 15, 19, 16}
-};
-template <class K, class V> TestCaseMapSet<std::pair<K, V>>
-constexpr NElementsContainer_OneElementRange<std::pair<K, V>> {
- .initial = {{10, 'A'}, {15, 'B'}, {19, 'C'}, {16, 'D'}}, .input = {{1, 'a'}},
- .expected = {{1, 'a'}, {10, 'A'}, {15, 'B'}, {19, 'C'}, {16, 'D'}}
-};
+TestCaseMapSet<T> constexpr NElementsContainer_OneElementRange{
+ .initial = {10, 15, 19, 16}, .input = {1}, .expected = {1, 10, 15, 19, 16}};
+template <class K, class V>
+TestCaseMapSet<std::pair<K, V>> constexpr NElementsContainer_OneElementRange<std::pair<K, V>>{
+ .initial = {{10, 'A'}, {15, 'B'}, {19, 'C'}, {16, 'D'}},
+ .input = {{1, 'a'}},
+ .expected = {{1, 'a'}, {10, 'A'}, {15, 'B'}, {19, 'C'}, {16, 'D'}}};
template <class T>
-TestCaseMapSet<T> constexpr NElementsContainer_RangeNoDuplicates {
- .initial = {10, 15, 19, 16}, .input = {5, 1, 3, 8, 6}, .expected = {5, 1, 3, 8, 6, 10, 15, 19, 16}
-};
-template <class K, class V> TestCaseMapSet<std::pair<K, V>>
-constexpr NElementsContainer_RangeNoDuplicates<std::pair<K, V>> {
- .initial = {{10, 'A'}, {15, 'B'}, {19, 'C'}, {16, 'D'}},
- .input = {{5, 'a'}, {1, 'e'}, {3, 'i'}, {8, 'o'}, {6, 'u'}},
- .expected = {{5, 'a'}, {1, 'e'}, {3, 'i'}, {8, 'o'}, {6, 'u'}, {10, 'A'}, {15, 'B'}, {19, 'C'}, {16, 'D'}}
-};
+TestCaseMapSet<T> constexpr NElementsContainer_RangeNoDuplicates{
+ .initial = {10, 15, 19, 16}, .input = {5, 1, 3, 8, 6}, .expected = {5, 1, 3, 8, 6, 10, 15, 19, 16}};
+template <class K, class V>
+TestCaseMapSet<std::pair<K, V>> constexpr NElementsContainer_RangeNoDuplicates<std::pair<K, V>>{
+ .initial = {{10, 'A'}, {15, 'B'}, {19, 'C'}, {16, 'D'}},
+ .input = {{5, 'a'}, {1, 'e'}, {3, 'i'}, {8, 'o'}, {6, 'u'}},
+ .expected = {{5, 'a'}, {1, 'e'}, {3, 'i'}, {8, 'o'}, {6, 'u'}, {10, 'A'}, {15, 'B'}, {19, 'C'}, {16, 'D'}}};
template <class T>
-TestCaseMapSet<T> constexpr NElementsContainer_RangeWithDuplicates {
- .initial = {10, 15, 19, 16},
- .input = {5, 1, 1, 3, 5, 8, 5, 6, 10},
- .expected = {5, 1, 3, 8, 6, 10, 15, 19, 16},
- .expected_multi = {5, 1, 1, 3, 5, 8, 5, 6, 10, 10, 15, 19, 16}
-};
-template <class K, class V> TestCaseMapSet<std::pair<K, V>>
-constexpr NElementsContainer_RangeWithDuplicates<std::pair<K, V>> {
- .initial = {{10, 'A'}, {15, 'B'}, {19, 'C'}, {16, 'D'}},
- .input = {{5, 'a'}, {1, 'a'}, {1, 'b'}, {3, 'a'}, {5, 'b'}, {8, 'a'}, {5, 'c'}, {6, 'a'}, {10, 'b'}},
- .expected = {{5, 'a'}, {1, 'a'}, {3, 'a'}, {8, 'a'}, {6, 'a'}, {10, 'A'}, {15, 'B'}, {19, 'C'}, {16, 'D'}},
- .expected_multi = {
- {5, 'a'}, {1, 'a'}, {1, 'b'}, {3, 'a'}, {5, 'b'}, {8, 'a'}, {5, 'c'}, {6, 'a'}, {10, 'b'},
- {10, 'A'}, {15, 'B'}, {19, 'C'}, {16, 'D'}
- }
-};
+TestCaseMapSet<T> constexpr NElementsContainer_RangeWithDuplicates{
+ .initial = {10, 15, 19, 16},
+ .input = {5, 1, 1, 3, 5, 8, 5, 6, 10},
+ .expected = {5, 1, 3, 8, 6, 10, 15, 19, 16},
+ .expected_multi = {5, 1, 1, 3, 5, 8, 5, 6, 10, 10, 15, 19, 16}};
+template <class K, class V>
+TestCaseMapSet<std::pair<K, V>> constexpr NElementsContainer_RangeWithDuplicates<std::pair<K, V>>{
+ .initial = {{10, 'A'}, {15, 'B'}, {19, 'C'}, {16, 'D'}},
+ .input = {{5, 'a'}, {1, 'a'}, {1, 'b'}, {3, 'a'}, {5, 'b'}, {8, 'a'}, {5, 'c'}, {6, 'a'}, {10, 'b'}},
+ .expected = {{5, 'a'}, {1, 'a'}, {3, 'a'}, {8, 'a'}, {6, 'a'}, {10, 'A'}, {15, 'B'}, {19, 'C'}, {16, 'D'}},
+ .expected_multi = {
+ {5, 'a'},
+ {1, 'a'},
+ {1, 'b'},
+ {3, 'a'},
+ {5, 'b'},
+ {8, 'a'},
+ {5, 'c'},
+ {6, 'a'},
+ {10, 'b'},
+ {10, 'A'},
+ {15, 'B'},
+ {19, 'C'},
+ {16, 'D'}}};
template <class Container, class T, class Iter, class Sent>
void test_map_set_insert_range(bool allow_duplicates = false) {
@@ -265,7 +249,7 @@ void test_map_set_insert_range(bool allow_duplicates = false) {
// Move-only types.
-template <template <class ...> class Container>
+template <template <class...> class Container>
void test_set_insert_range_move_only() {
MoveOnly input[5];
std::ranges::subrange in(std::move_iterator{input}, std::move_iterator{input + 5});
@@ -274,7 +258,7 @@ void test_set_insert_range_move_only() {
c.insert_range(in);
}
-template <template <class ...> class Container>
+template <template <class...> class Container>
void test_map_insert_range_move_only() {
using Value = std::pair<const int, MoveOnly>;
Value input[5];
@@ -286,7 +270,7 @@ void test_map_insert_range_move_only() {
// Exception safety.
-template <template <class ...> class Container>
+template <template <class...> class Container>
void test_set_insert_range_exception_safety_throwing_copy() {
#if !defined(TEST_HAS_NO_EXCEPTIONS)
using T = ThrowingCopy<3>;
@@ -305,17 +289,15 @@ void test_set_insert_range_exception_safety_throwing_copy() {
#endif
}
-template <template <class ...> class Container>
+template <template <class...> class Container>
void test_map_insert_range_exception_safety_throwing_copy() {
#if !defined(TEST_HAS_NO_EXCEPTIONS)
using K = int;
using V = ThrowingCopy<3>;
- V::throwing_enabled = false;
- std::pair<const K, V> in[5] = {
- {1, {}}, {2, {}}, {3, {}}, {4, {}}, {5, {}}
- };
- V::throwing_enabled = true;
+ V::throwing_enabled = false;
+ std::pair<const K, V> in[5] = {{1, {}}, {2, {}}, {3, {}}, {4, {}}, {5, {}}};
+ V::throwing_enabled = true;
V::reset();
try {
@@ -330,7 +312,7 @@ void test_map_insert_range_exception_safety_throwing_copy() {
#endif
}
-template <template <class ...> class Container, class T>
+template <template <class...> class Container, class T>
void test_assoc_set_insert_range_exception_safety_throwing_allocator() {
#if !defined(TEST_HAS_NO_EXCEPTIONS)
T in[] = {1, 2};
@@ -349,7 +331,7 @@ void test_assoc_set_insert_range_exception_safety_throwing_allocator() {
#endif
}
-template <template <class ...> class Container, class T>
+template <template <class...> class Container, class T>
void test_unord_set_insert_range_exception_safety_throwing_allocator() {
#if !defined(TEST_HAS_NO_EXCEPTIONS)
T in[] = {1, 2};
@@ -368,13 +350,11 @@ void test_unord_set_insert_range_exception_safety_throwing_allocator() {
#endif
}
-template <template <class ...> class Container, class K, class V>
+template <template <class...> class Container, class K, class V>
void test_assoc_map_insert_range_exception_safety_throwing_allocator() {
#if !defined(TEST_HAS_NO_EXCEPTIONS)
using ValueType = std::pair<const K, V>;
- ValueType in[] = {
- ValueType{K{1}, V{1}}
- };
+ ValueType in[] = {ValueType{K{1}, V{1}}};
try {
ThrowingAllocator<ValueType> alloc;
@@ -390,13 +370,11 @@ void test_assoc_map_insert_range_exception_safety_throwing_allocator() {
#endif
}
-template <template <class ...> class Container, class K, class V>
+template <template <class...> class Container, class K, class V>
void test_unord_map_insert_range_exception_safety_throwing_allocator() {
#if !defined(TEST_HAS_NO_EXCEPTIONS)
using ValueType = std::pair<const K, V>;
- ValueType in[] = {
- ValueType{K{1}, V{1}}
- };
+ ValueType in[] = {ValueType{K{1}, V{1}}};
try {
ThrowingAllocator<ValueType> alloc;
diff --git a/libcxx/test/std/containers/iterator.rel_ops.compile.pass.cpp b/libcxx/test/std/containers/iterator.rel_ops.compile.pass.cpp
index 9db2449f2f16656..2a8f99e321a78ad 100644
--- a/libcxx/test/std/containers/iterator.rel_ops.compile.pass.cpp
+++ b/libcxx/test/std/containers/iterator.rel_ops.compile.pass.cpp
@@ -29,73 +29,73 @@
#include "test_macros.h"
#if TEST_STD_VER >= 17
-#include <string_view>
+# include <string_view>
#endif
#if TEST_STD_VER >= 20
-#include <span>
+# include <span>
#endif
using namespace std::rel_ops;
-template<class It, class ConstIt>
+template <class It, class ConstIt>
void test_eq(It it, ConstIt cit) {
- (void)(it == it);
- (void)(it != it);
- (void)(it == cit);
- (void)(it != cit);
- (void)(cit == it);
- (void)(cit != it);
- (void)(cit == cit);
- (void)(cit != cit);
+ (void)(it == it);
+ (void)(it != it);
+ (void)(it == cit);
+ (void)(it != cit);
+ (void)(cit == it);
+ (void)(cit != it);
+ (void)(cit == cit);
+ (void)(cit != cit);
}
-template<class It, class ConstIt>
+template <class It, class ConstIt>
void test_lt(It it, ConstIt cit) {
- (void)(it < it);
- (void)(it <= it);
- (void)(it > it);
- (void)(it >= it);
- (void)(it < cit);
- (void)(it <= cit);
- (void)(it > cit);
- (void)(it >= cit);
- (void)(cit < it);
- (void)(cit <= it);
- (void)(cit > it);
- (void)(cit >= it);
- (void)(cit < cit);
- (void)(cit <= cit);
- (void)(cit > cit);
- (void)(cit >= cit);
-
- // Test subtraction too, even though std::rel_ops shouldn't affect it.
-
- (void)(it - it);
- (void)(it - cit);
- (void)(cit - it);
- (void)(cit - cit);
+ (void)(it < it);
+ (void)(it <= it);
+ (void)(it > it);
+ (void)(it >= it);
+ (void)(it < cit);
+ (void)(it <= cit);
+ (void)(it > cit);
+ (void)(it >= cit);
+ (void)(cit < it);
+ (void)(cit <= it);
+ (void)(cit > it);
+ (void)(cit >= it);
+ (void)(cit < cit);
+ (void)(cit <= cit);
+ (void)(cit > cit);
+ (void)(cit >= cit);
+
+ // Test subtraction too, even though std::rel_ops shouldn't affect it.
+
+ (void)(it - it);
+ (void)(it - cit);
+ (void)(cit - it);
+ (void)(cit - cit);
}
-template<class Container>
+template <class Container>
void test_forward() {
- // There is no need to distinguish "forward" from "bidirectional."
- // libc++ already can't handle `c.rbegin() >= c.rbegin()` in the
- // presence of std::rel_ops, and neither can Microsoft nor libstdc++.
-
- Container c;
- typename Container::iterator it = c.begin();
- typename Container::const_iterator cit = c.begin();
- test_eq(it, cit);
+ // There is no need to distinguish "forward" from "bidirectional."
+ // libc++ already can't handle `c.rbegin() >= c.rbegin()` in the
+ // presence of std::rel_ops, and neither can Microsoft nor libstdc++.
+
+ Container c;
+ typename Container::iterator it = c.begin();
+ typename Container::const_iterator cit = c.begin();
+ test_eq(it, cit);
}
-template<class Container>
+template <class Container>
void test_random_access() {
- Container c;
- typename Container::iterator it = c.begin();
- typename Container::const_iterator cit = c.begin();
- test_eq(it, cit);
- test_lt(it, cit);
+ Container c;
+ typename Container::iterator it = c.begin();
+ typename Container::const_iterator cit = c.begin();
+ test_eq(it, cit);
+ test_lt(it, cit);
}
template void test_random_access<std::array<int, 10> >();
@@ -115,13 +115,13 @@ template void test_random_access<std::vector<int> >();
#if TEST_STD_VER >= 17
void test_directory_iterators() {
-#ifndef TEST_HAS_NO_FILESYSTEM
- std::filesystem::directory_iterator it;
- test_eq(it, it);
+# ifndef TEST_HAS_NO_FILESYSTEM
+ std::filesystem::directory_iterator it;
+ test_eq(it, it);
- std::filesystem::recursive_directory_iterator rdit;
- test_eq(rdit, rdit);
-#endif
+ std::filesystem::recursive_directory_iterator rdit;
+ test_eq(rdit, rdit);
+# endif
}
template void test_forward<std::filesystem::path>();
@@ -133,9 +133,9 @@ template void test_random_access<std::string_view>();
#if TEST_STD_VER >= 20
void test_span() {
- std::span<int> c;
- std::span<int>::iterator it = c.begin(); // span has no const_iterator
- test_eq(it, it);
- test_lt(it, it);
+ std::span<int> c;
+ std::span<int>::iterator it = c.begin(); // span has no const_iterator
+ test_eq(it, it);
+ test_lt(it, it);
}
#endif
diff --git a/libcxx/test/std/containers/map_allocator_requirement_test_templates.h b/libcxx/test/std/containers/map_allocator_requirement_test_templates.h
index 9a6f4be0b003ada..74dc8b15928a97a 100644
--- a/libcxx/test/std/containers/map_allocator_requirement_test_templates.h
+++ b/libcxx/test/std/containers/map_allocator_requirement_test_templates.h
@@ -28,10 +28,8 @@
#include "count_new.h"
#include "container_test_types.h"
-
template <class Container>
-void testMapInsert()
-{
+void testMapInsert() {
typedef typename Container::value_type ValueTp;
ConstructController* cc = getConstructController();
cc->reset();
@@ -102,7 +100,7 @@ void testMapInsert()
{
// Testing C::insert(std::initializer_list<ValueTp>)
Container c;
- std::initializer_list<ValueTp> il = { ValueTp(1, 1), ValueTp(2, 1) };
+ std::initializer_list<ValueTp> il = {ValueTp(1, 1), ValueTp(2, 1)};
cc->expect<ValueTp const&>(2);
c.insert(il);
assert(!cc->unchecked());
@@ -114,7 +112,7 @@ void testMapInsert()
{
// Testing C::insert(Iter, Iter) for *Iter = value_type const&
Container c;
- const ValueTp ValueList[] = { ValueTp(1, 1), ValueTp(2, 1), ValueTp(3, 1) };
+ const ValueTp ValueList[] = {ValueTp(1, 1), ValueTp(2, 1), ValueTp(3, 1)};
cc->expect<ValueTp const&>(3);
c.insert(std::begin(ValueList), std::end(ValueList));
assert(!cc->unchecked());
@@ -126,14 +124,13 @@ void testMapInsert()
{
// Testing C::insert(Iter, Iter) for *Iter = value_type&&
Container c;
- ValueTp ValueList[] = { ValueTp(1, 1), ValueTp(2, 1) , ValueTp(3, 1) };
+ ValueTp ValueList[] = {ValueTp(1, 1), ValueTp(2, 1), ValueTp(3, 1)};
cc->expect<ValueTp&&>(3);
- c.insert(std::move_iterator<ValueTp*>(std::begin(ValueList)),
- std::move_iterator<ValueTp*>(std::end(ValueList)));
+ c.insert(std::move_iterator<ValueTp*>(std::begin(ValueList)), std::move_iterator<ValueTp*>(std::end(ValueList)));
assert(!cc->unchecked());
{
DisableAllocationGuard g;
- ValueTp ValueList2[] = { ValueTp(1, 1), ValueTp(2, 1) , ValueTp(3, 1) };
+ ValueTp ValueList2[] = {ValueTp(1, 1), ValueTp(2, 1), ValueTp(3, 1)};
c.insert(std::move_iterator<ValueTp*>(std::begin(ValueList2)),
std::move_iterator<ValueTp*>(std::end(ValueList2)));
}
@@ -141,7 +138,7 @@ void testMapInsert()
{
// Testing C::insert(Iter, Iter) for *Iter = value_type&
Container c;
- ValueTp ValueList[] = { ValueTp(1, 1), ValueTp(2, 1) , ValueTp(3, 1) };
+ ValueTp ValueList[] = {ValueTp(1, 1), ValueTp(2, 1), ValueTp(3, 1)};
cc->expect<ValueTp const&>(3);
c.insert(std::begin(ValueList), std::end(ValueList));
assert(!cc->unchecked());
@@ -152,10 +149,8 @@ void testMapInsert()
}
}
-
template <class Container>
-void testMapInsertHint()
-{
+void testMapInsertHint() {
typedef typename Container::value_type ValueTp;
typedef typename Container::key_type Key;
typedef typename Container::mapped_type Mapped;
@@ -281,14 +276,10 @@ void testMapInsertHint()
assert(c.size() == 1);
}
}
-
-
}
-
template <class Container>
-void testMapEmplace()
-{
+void testMapEmplace() {
typedef typename Container::value_type ValueTp;
typedef typename Container::key_type Key;
typedef typename Container::mapped_type Mapped;
@@ -431,10 +422,8 @@ void testMapEmplace()
}
}
-
template <class Container>
-void testMapEmplaceHint()
-{
+void testMapEmplaceHint() {
typedef typename Container::value_type ValueTp;
typedef typename Container::key_type Key;
typedef typename Container::mapped_type Mapped;
@@ -616,13 +605,10 @@ void testMapEmplaceHint()
assert(!cc->unchecked());
}
}
-
}
-
template <class Container>
-void testMultimapInsert()
-{
+void testMultimapInsert() {
typedef typename Container::value_type ValueTp;
ConstructController* cc = getConstructController();
cc->reset();
@@ -660,7 +646,7 @@ void testMultimapInsert()
{
// Testing C::insert(std::initializer_list<ValueTp>)
Container c;
- std::initializer_list<ValueTp> il = { ValueTp(1, 1), ValueTp(2, 1) };
+ std::initializer_list<ValueTp> il = {ValueTp(1, 1), ValueTp(2, 1)};
cc->expect<ValueTp const&>(2);
c.insert(il);
assert(!cc->unchecked());
@@ -668,7 +654,7 @@ void testMultimapInsert()
{
// Testing C::insert(Iter, Iter) for *Iter = value_type const&
Container c;
- const ValueTp ValueList[] = { ValueTp(1, 1), ValueTp(2, 1), ValueTp(3, 1) };
+ const ValueTp ValueList[] = {ValueTp(1, 1), ValueTp(2, 1), ValueTp(3, 1)};
cc->expect<ValueTp const&>(3);
c.insert(std::begin(ValueList), std::end(ValueList));
assert(!cc->unchecked());
@@ -676,26 +662,23 @@ void testMultimapInsert()
{
// Testing C::insert(Iter, Iter) for *Iter = value_type&&
Container c;
- ValueTp ValueList[] = { ValueTp(1, 1), ValueTp(2, 1) , ValueTp(3, 1) };
+ ValueTp ValueList[] = {ValueTp(1, 1), ValueTp(2, 1), ValueTp(3, 1)};
cc->expect<ValueTp&&>(3);
- c.insert(std::move_iterator<ValueTp*>(std::begin(ValueList)),
- std::move_iterator<ValueTp*>(std::end(ValueList)));
+ c.insert(std::move_iterator<ValueTp*>(std::begin(ValueList)), std::move_iterator<ValueTp*>(std::end(ValueList)));
assert(!cc->unchecked());
}
{
// Testing C::insert(Iter, Iter) for *Iter = value_type&
Container c;
- ValueTp ValueList[] = { ValueTp(1, 1), ValueTp(2, 1) , ValueTp(3, 1) };
+ ValueTp ValueList[] = {ValueTp(1, 1), ValueTp(2, 1), ValueTp(3, 1)};
cc->expect<ValueTp&>(3);
c.insert(std::begin(ValueList), std::end(ValueList));
assert(!cc->unchecked());
}
}
-
template <class Container>
-void testMultimapInsertHint()
-{
+void testMultimapInsertHint() {
typedef typename Container::value_type ValueTp;
ConstructController* cc = getConstructController();
cc->reset();
diff --git a/libcxx/test/std/containers/sequences/array/aggregate.pass.cpp b/libcxx/test/std/containers/sequences/array/aggregate.pass.cpp
index 9db25a9231bca19..582c9a5485c4a6b 100644
--- a/libcxx/test/std/containers/sequences/array/aggregate.pass.cpp
+++ b/libcxx/test/std/containers/sequences/array/aggregate.pass.cpp
@@ -15,33 +15,35 @@
#include <type_traits>
template <typename T>
-void check_aggregate()
-{
- static_assert(std::is_aggregate<std::array<T, 0> >::value, "");
- static_assert(std::is_aggregate<std::array<T, 1> >::value, "");
- static_assert(std::is_aggregate<std::array<T, 2> >::value, "");
- static_assert(std::is_aggregate<std::array<T, 3> >::value, "");
- static_assert(std::is_aggregate<std::array<T, 4> >::value, "");
+void check_aggregate() {
+ static_assert(std::is_aggregate<std::array<T, 0> >::value, "");
+ static_assert(std::is_aggregate<std::array<T, 1> >::value, "");
+ static_assert(std::is_aggregate<std::array<T, 2> >::value, "");
+ static_assert(std::is_aggregate<std::array<T, 3> >::value, "");
+ static_assert(std::is_aggregate<std::array<T, 4> >::value, "");
}
-struct Empty { };
-struct Trivial { int i; int j; };
+struct Empty {};
+struct Trivial {
+ int i;
+ int j;
+};
struct NonTrivial {
- int i; int j;
- NonTrivial(NonTrivial const&) { }
+ int i;
+ int j;
+ NonTrivial(NonTrivial const&) {}
};
-int main(int, char**)
-{
- check_aggregate<char>();
- check_aggregate<int>();
- check_aggregate<long>();
- check_aggregate<float>();
- check_aggregate<double>();
- check_aggregate<long double>();
- check_aggregate<Empty>();
- check_aggregate<Trivial>();
- check_aggregate<NonTrivial>();
+int main(int, char**) {
+ check_aggregate<char>();
+ check_aggregate<int>();
+ check_aggregate<long>();
+ check_aggregate<float>();
+ check_aggregate<double>();
+ check_aggregate<long double>();
+ check_aggregate<Empty>();
+ check_aggregate<Trivial>();
+ check_aggregate<NonTrivial>();
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/array/array.cons/deduct.pass.cpp b/libcxx/test/std/containers/sequences/array/array.cons/deduct.pass.cpp
index 30dd48e414b67be..55ef17c86bca302 100644
--- a/libcxx/test/std/containers/sequences/array/array.cons/deduct.pass.cpp
+++ b/libcxx/test/std/containers/sequences/array/array.cons/deduct.pass.cpp
@@ -20,44 +20,42 @@
#include "test_macros.h"
-constexpr bool tests()
-{
- // Test the explicit deduction guides
- {
- std::array arr{1,2,3}; // array(T, U...)
- static_assert(std::is_same_v<decltype(arr), std::array<int, 3>>, "");
- assert(arr[0] == 1);
- assert(arr[1] == 2);
- assert(arr[2] == 3);
- }
-
- {
- const long l1 = 42;
- std::array arr{1L, 4L, 9L, l1}; // array(T, U...)
- static_assert(std::is_same_v<decltype(arr)::value_type, long>, "");
- static_assert(arr.size() == 4, "");
- assert(arr[0] == 1);
- assert(arr[1] == 4);
- assert(arr[2] == 9);
- assert(arr[3] == l1);
- }
-
- // Test the implicit deduction guides
- {
- std::array<double, 2> source = {4.0, 5.0};
- std::array arr(source); // array(array)
- static_assert(std::is_same_v<decltype(arr), decltype(source)>, "");
- static_assert(std::is_same_v<decltype(arr), std::array<double, 2>>, "");
- assert(arr[0] == 4.0);
- assert(arr[1] == 5.0);
- }
-
- return true;
+constexpr bool tests() {
+ // Test the explicit deduction guides
+ {
+ std::array arr{1, 2, 3}; // array(T, U...)
+ static_assert(std::is_same_v<decltype(arr), std::array<int, 3>>, "");
+ assert(arr[0] == 1);
+ assert(arr[1] == 2);
+ assert(arr[2] == 3);
+ }
+
+ {
+ const long l1 = 42;
+ std::array arr{1L, 4L, 9L, l1}; // array(T, U...)
+ static_assert(std::is_same_v<decltype(arr)::value_type, long>, "");
+ static_assert(arr.size() == 4, "");
+ assert(arr[0] == 1);
+ assert(arr[1] == 4);
+ assert(arr[2] == 9);
+ assert(arr[3] == l1);
+ }
+
+ // Test the implicit deduction guides
+ {
+ std::array<double, 2> source = {4.0, 5.0};
+ std::array arr(source); // array(array)
+ static_assert(std::is_same_v<decltype(arr), decltype(source)>, "");
+ static_assert(std::is_same_v<decltype(arr), std::array<double, 2>>, "");
+ assert(arr[0] == 4.0);
+ assert(arr[1] == 5.0);
+ }
+
+ return true;
}
-int main(int, char**)
-{
- tests();
- static_assert(tests(), "");
- return 0;
+int main(int, char**) {
+ tests();
+ static_assert(tests(), "");
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/array/array.cons/deduct.verify.cpp b/libcxx/test/std/containers/sequences/array/array.cons/deduct.verify.cpp
index f59b761fad9c9de..92dac11501185d7 100644
--- a/libcxx/test/std/containers/sequences/array/array.cons/deduct.verify.cpp
+++ b/libcxx/test/std/containers/sequences/array/array.cons/deduct.verify.cpp
@@ -14,18 +14,17 @@
//
// Requires: (is_same_v<T, U> && ...) is true. Otherwise the program is ill-formed.
-
#include <array>
#include <cassert>
#include <cstddef>
#include "test_macros.h"
-int main(int, char**)
-{
- {
- std::array arr{1,2,3L}; // expected-error-re {{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}array'}}
- }
+int main(int, char**) {
+ {
+ std::array arr{1, 2, 3L};
+ // expected-error-re at -1 {{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}array'}}
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/array/array.cons/implicit_copy.pass.cpp b/libcxx/test/std/containers/sequences/array/array.cons/implicit_copy.pass.cpp
index 0e1e77fc5f18122..11f71052eea5953 100644
--- a/libcxx/test/std/containers/sequences/array/array.cons/implicit_copy.pass.cpp
+++ b/libcxx/test/std/containers/sequences/array/array.cons/implicit_copy.pass.cpp
@@ -19,101 +19,102 @@
// generated operator would be ill-formed; like in the case of a struct with a
// const member.
#if TEST_STD_VER < 11
-# define TEST_NOT_COPY_ASSIGNABLE(T) ((void)0)
+# define TEST_NOT_COPY_ASSIGNABLE(T) ((void)0)
#else
-# define TEST_NOT_COPY_ASSIGNABLE(T) static_assert(!std::is_copy_assignable<T>::value, "")
+# define TEST_NOT_COPY_ASSIGNABLE(T) static_assert(!std::is_copy_assignable<T>::value, "")
#endif
struct NoDefault {
- TEST_CONSTEXPR NoDefault(int) { }
+ TEST_CONSTEXPR NoDefault(int) {}
};
struct NonTrivialCopy {
- TEST_CONSTEXPR NonTrivialCopy() { }
- TEST_CONSTEXPR NonTrivialCopy(NonTrivialCopy const&) { }
- TEST_CONSTEXPR_CXX14 NonTrivialCopy& operator=(NonTrivialCopy const&) { return *this; }
+ TEST_CONSTEXPR NonTrivialCopy() {}
+ TEST_CONSTEXPR NonTrivialCopy(NonTrivialCopy const&) {}
+ TEST_CONSTEXPR_CXX14 NonTrivialCopy& operator=(NonTrivialCopy const&) { return *this; }
};
-TEST_CONSTEXPR_CXX14 bool tests()
-{
- {
- typedef std::array<double, 3> Array;
- Array array = {1.1, 2.2, 3.3};
- Array copy = array;
- copy = array;
- static_assert(std::is_copy_constructible<Array>::value, "");
- static_assert(std::is_copy_assignable<Array>::value, "");
- }
- {
- typedef std::array<double const, 3> Array;
- Array array = {1.1, 2.2, 3.3};
- Array copy = array; (void)copy;
- static_assert(std::is_copy_constructible<Array>::value, "");
- TEST_NOT_COPY_ASSIGNABLE(Array);
- }
- {
- typedef std::array<double, 0> Array;
- Array array = {};
- Array copy = array;
- copy = array;
- static_assert(std::is_copy_constructible<Array>::value, "");
- static_assert(std::is_copy_assignable<Array>::value, "");
- }
- {
- // const arrays of size 0 should disable the implicit copy assignment operator.
- typedef std::array<double const, 0> Array;
- Array array = {};
- Array copy = array; (void)copy;
- static_assert(std::is_copy_constructible<Array>::value, "");
- TEST_NOT_COPY_ASSIGNABLE(Array);
- }
- {
- typedef std::array<NoDefault, 0> Array;
- Array array = {};
- Array copy = array;
- copy = array;
- static_assert(std::is_copy_constructible<Array>::value, "");
- static_assert(std::is_copy_assignable<Array>::value, "");
- }
- {
- typedef std::array<NoDefault const, 0> Array;
- Array array = {};
- Array copy = array; (void)copy;
- static_assert(std::is_copy_constructible<Array>::value, "");
- TEST_NOT_COPY_ASSIGNABLE(Array);
- }
+TEST_CONSTEXPR_CXX14 bool tests() {
+ {
+ typedef std::array<double, 3> Array;
+ Array array = {1.1, 2.2, 3.3};
+ Array copy = array;
+ copy = array;
+ static_assert(std::is_copy_constructible<Array>::value, "");
+ static_assert(std::is_copy_assignable<Array>::value, "");
+ }
+ {
+ typedef std::array<double const, 3> Array;
+ Array array = {1.1, 2.2, 3.3};
+ Array copy = array;
+ (void)copy;
+ static_assert(std::is_copy_constructible<Array>::value, "");
+ TEST_NOT_COPY_ASSIGNABLE(Array);
+ }
+ {
+ typedef std::array<double, 0> Array;
+ Array array = {};
+ Array copy = array;
+ copy = array;
+ static_assert(std::is_copy_constructible<Array>::value, "");
+ static_assert(std::is_copy_assignable<Array>::value, "");
+ }
+ {
+ // const arrays of size 0 should disable the implicit copy assignment operator.
+ typedef std::array<double const, 0> Array;
+ Array array = {};
+ Array copy = array;
+ (void)copy;
+ static_assert(std::is_copy_constructible<Array>::value, "");
+ TEST_NOT_COPY_ASSIGNABLE(Array);
+ }
+ {
+ typedef std::array<NoDefault, 0> Array;
+ Array array = {};
+ Array copy = array;
+ copy = array;
+ static_assert(std::is_copy_constructible<Array>::value, "");
+ static_assert(std::is_copy_assignable<Array>::value, "");
+ }
+ {
+ typedef std::array<NoDefault const, 0> Array;
+ Array array = {};
+ Array copy = array;
+ (void)copy;
+ static_assert(std::is_copy_constructible<Array>::value, "");
+ TEST_NOT_COPY_ASSIGNABLE(Array);
+ }
- // Make sure we can implicitly copy a std::array of a non-trivially copyable type
- {
- typedef std::array<NonTrivialCopy, 0> Array;
- Array array = {};
- Array copy = array;
- copy = array;
- static_assert(std::is_copy_constructible<Array>::value, "");
- }
- {
- typedef std::array<NonTrivialCopy, 1> Array;
- Array array = {};
- Array copy = array;
- copy = array;
- static_assert(std::is_copy_constructible<Array>::value, "");
- }
- {
- typedef std::array<NonTrivialCopy, 2> Array;
- Array array = {};
- Array copy = array;
- copy = array;
- static_assert(std::is_copy_constructible<Array>::value, "");
- }
+ // Make sure we can implicitly copy a std::array of a non-trivially copyable type
+ {
+ typedef std::array<NonTrivialCopy, 0> Array;
+ Array array = {};
+ Array copy = array;
+ copy = array;
+ static_assert(std::is_copy_constructible<Array>::value, "");
+ }
+ {
+ typedef std::array<NonTrivialCopy, 1> Array;
+ Array array = {};
+ Array copy = array;
+ copy = array;
+ static_assert(std::is_copy_constructible<Array>::value, "");
+ }
+ {
+ typedef std::array<NonTrivialCopy, 2> Array;
+ Array array = {};
+ Array copy = array;
+ copy = array;
+ static_assert(std::is_copy_constructible<Array>::value, "");
+ }
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER >= 14
- static_assert(tests(), "");
+ static_assert(tests(), "");
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/array/array.cons/initialization.pass.cpp b/libcxx/test/std/containers/sequences/array/array.cons/initialization.pass.cpp
index a23211f5464d6fd..0bca4299c85162c 100644
--- a/libcxx/test/std/containers/sequences/array/array.cons/initialization.pass.cpp
+++ b/libcxx/test/std/containers/sequences/array/array.cons/initialization.pass.cpp
@@ -13,178 +13,215 @@
#include <type_traits>
#include "test_macros.h"
-
struct NoDefault {
- TEST_CONSTEXPR NoDefault(int) { }
+ TEST_CONSTEXPR NoDefault(int) {}
};
struct test_initialization {
- template <typename T>
- TEST_CONSTEXPR_CXX14 void operator()() const
+ template <typename T>
+ TEST_CONSTEXPR_CXX14 void operator()() const {
+ // Check default initalization
{
- // Check default initalization
- {
- std::array<T, 0> a0; (void)a0;
- // Before C++20, default initialization doesn't work inside constexpr for
- // trivially default constructible types. This only apply to non-empty arrays,
- // since empty arrays don't hold an element of type T.
+ std::array<T, 0> a0;
+ (void)a0;
+ // Before C++20, default initialization doesn't work inside constexpr for
+ // trivially default constructible types. This only apply to non-empty arrays,
+ // since empty arrays don't hold an element of type T.
#if TEST_STD_VER < 20
- if (!(TEST_IS_CONSTANT_EVALUATED && std::is_trivially_default_constructible<T>::value))
+ if (!(TEST_IS_CONSTANT_EVALUATED && std::is_trivially_default_constructible<T>::value))
#endif
- {
- std::array<T, 1> a1;
- (void)a1;
- std::array<T, 2> a2;
- (void)a2;
- std::array<T, 3> a3;
- (void)a3;
- }
-
- std::array<NoDefault, 0> nodefault; (void)nodefault;
- }
-
- // A const empty array can also be default-initialized regardless of the type
- // it contains. For non-empty arrays, this doesn't work whenever T doesn't
- // have a user-provided default constructor.
- {
- const std::array<T, 0> a0; (void)a0;
- const std::array<NoDefault, 0> nodefault; (void)nodefault;
- }
-
- // Check direct-list-initialization syntax (introduced in C++11)
- #if TEST_STD_VER >= 11
- {
- {
- std::array<T, 0> a0_0{}; (void)a0_0;
- }
- {
- std::array<T, 1> a1_0{}; (void)a1_0;
- std::array<T, 1> a1_1{T()}; (void)a1_1;
- }
- {
- std::array<T, 2> a2_0{}; (void)a2_0;
- std::array<T, 2> a2_1{T()}; (void)a2_1;
- std::array<T, 2> a2_2{T(), T()}; (void)a2_2;
- }
- {
- std::array<T, 3> a3_0{}; (void)a3_0;
- std::array<T, 3> a3_1{T()}; (void)a3_1;
- std::array<T, 3> a3_2{T(), T()}; (void)a3_2;
- std::array<T, 3> a3_3{T(), T(), T()}; (void)a3_3;
- }
-
- std::array<NoDefault, 0> nodefault{}; (void)nodefault;
- }
- #endif
-
- // Check copy-list-initialization syntax
- {
- {
- std::array<T, 0> a0_0 = {}; (void)a0_0;
- }
- {
- std::array<T, 1> a1_0 = {}; (void)a1_0;
- std::array<T, 1> a1_1 = {T()}; (void)a1_1;
- }
- {
- std::array<T, 2> a2_0 = {}; (void)a2_0;
- std::array<T, 2> a2_1 = {T()}; (void)a2_1;
- std::array<T, 2> a2_2 = {T(), T()}; (void)a2_2;
- }
- {
- std::array<T, 3> a3_0 = {}; (void)a3_0;
- std::array<T, 3> a3_1 = {T()}; (void)a3_1;
- std::array<T, 3> a3_2 = {T(), T()}; (void)a3_2;
- std::array<T, 3> a3_3 = {T(), T(), T()}; (void)a3_3;
- }
-
- std::array<NoDefault, 0> nodefault = {}; (void)nodefault;
- }
-
- // Test aggregate initialization
- {
- {
- std::array<T, 0> a0_0 = {{}}; (void)a0_0;
- }
- {
- std::array<T, 1> a1_0 = {{}}; (void)a1_0;
- std::array<T, 1> a1_1 = {{T()}}; (void)a1_1;
- }
- {
- std::array<T, 2> a2_0 = {{}}; (void)a2_0;
- std::array<T, 2> a2_1 = {{T()}}; (void)a2_1;
- std::array<T, 2> a2_2 = {{T(), T()}}; (void)a2_2;
- }
- {
- std::array<T, 3> a3_0 = {{}}; (void)a3_0;
- std::array<T, 3> a3_1 = {{T()}}; (void)a3_1;
- std::array<T, 3> a3_2 = {{T(), T()}}; (void)a3_2;
- std::array<T, 3> a3_3 = {{T(), T(), T()}}; (void)a3_3;
- }
-
- // See http://wg21.link/LWG2157
- std::array<NoDefault, 0> nodefault = {{}}; (void)nodefault;
- }
+ {
+ std::array<T, 1> a1;
+ (void)a1;
+ std::array<T, 2> a2;
+ (void)a2;
+ std::array<T, 3> a3;
+ (void)a3;
+ }
+
+ std::array<NoDefault, 0> nodefault;
+ (void)nodefault;
}
-};
-// Test construction from an initializer-list
-TEST_CONSTEXPR_CXX14 bool test_initializer_list()
-{
+ // A const empty array can also be default-initialized regardless of the type
+ // it contains. For non-empty arrays, this doesn't work whenever T doesn't
+ // have a user-provided default constructor.
{
- std::array<double, 3> const a3_0 = {};
- assert(a3_0[0] == double());
- assert(a3_0[1] == double());
- assert(a3_0[2] == double());
+ const std::array<T, 0> a0;
+ (void)a0;
+ const std::array<NoDefault, 0> nodefault;
+ (void)nodefault;
}
+
+ // Check direct-list-initialization syntax (introduced in C++11)
+#if TEST_STD_VER >= 11
{
- std::array<double, 3> const a3_1 = {1};
- assert(a3_1[0] == double(1));
- assert(a3_1[1] == double());
- assert(a3_1[2] == double());
+ {
+ std::array<T, 0> a0_0{};
+ (void)a0_0;
+ }
+ {
+ std::array<T, 1> a1_0{};
+ (void)a1_0;
+ std::array<T, 1> a1_1{T()};
+ (void)a1_1;
+ }
+ {
+ std::array<T, 2> a2_0{};
+ (void)a2_0;
+ std::array<T, 2> a2_1{T()};
+ (void)a2_1;
+ std::array<T, 2> a2_2{T(), T()};
+ (void)a2_2;
+ }
+ {
+ std::array<T, 3> a3_0{};
+ (void)a3_0;
+ std::array<T, 3> a3_1{T()};
+ (void)a3_1;
+ std::array<T, 3> a3_2{T(), T()};
+ (void)a3_2;
+ std::array<T, 3> a3_3{T(), T(), T()};
+ (void)a3_3;
+ }
+
+ std::array<NoDefault, 0> nodefault{};
+ (void)nodefault;
}
+#endif
+
+ // Check copy-list-initialization syntax
{
- std::array<double, 3> const a3_2 = {1, 2.2};
- assert(a3_2[0] == double(1));
- assert(a3_2[1] == 2.2);
- assert(a3_2[2] == double());
+ {
+ std::array<T, 0> a0_0 = {};
+ (void)a0_0;
+ }
+ {
+ std::array<T, 1> a1_0 = {};
+ (void)a1_0;
+ std::array<T, 1> a1_1 = {T()};
+ (void)a1_1;
+ }
+ {
+ std::array<T, 2> a2_0 = {};
+ (void)a2_0;
+ std::array<T, 2> a2_1 = {T()};
+ (void)a2_1;
+ std::array<T, 2> a2_2 = {T(), T()};
+ (void)a2_2;
+ }
+ {
+ std::array<T, 3> a3_0 = {};
+ (void)a3_0;
+ std::array<T, 3> a3_1 = {T()};
+ (void)a3_1;
+ std::array<T, 3> a3_2 = {T(), T()};
+ (void)a3_2;
+ std::array<T, 3> a3_3 = {T(), T(), T()};
+ (void)a3_3;
+ }
+
+ std::array<NoDefault, 0> nodefault = {};
+ (void)nodefault;
}
+
+ // Test aggregate initialization
{
- std::array<double, 3> const a3_3 = {1, 2, 3.5};
- assert(a3_3[0] == double(1));
- assert(a3_3[1] == double(2));
- assert(a3_3[2] == 3.5);
+ {
+ std::array<T, 0> a0_0 = {{}};
+ (void)a0_0;
+ }
+ {
+ std::array<T, 1> a1_0 = {{}};
+ (void)a1_0;
+ std::array<T, 1> a1_1 = {{T()}};
+ (void)a1_1;
+ }
+ {
+ std::array<T, 2> a2_0 = {{}};
+ (void)a2_0;
+ std::array<T, 2> a2_1 = {{T()}};
+ (void)a2_1;
+ std::array<T, 2> a2_2 = {{T(), T()}};
+ (void)a2_2;
+ }
+ {
+ std::array<T, 3> a3_0 = {{}};
+ (void)a3_0;
+ std::array<T, 3> a3_1 = {{T()}};
+ (void)a3_1;
+ std::array<T, 3> a3_2 = {{T(), T()}};
+ (void)a3_2;
+ std::array<T, 3> a3_3 = {{T(), T(), T()}};
+ (void)a3_3;
+ }
+
+ // See http://wg21.link/LWG2157
+ std::array<NoDefault, 0> nodefault = {{}};
+ (void)nodefault;
}
+ }
+};
- return true;
+// Test construction from an initializer-list
+TEST_CONSTEXPR_CXX14 bool test_initializer_list() {
+ {
+ std::array<double, 3> const a3_0 = {};
+ assert(a3_0[0] == double());
+ assert(a3_0[1] == double());
+ assert(a3_0[2] == double());
+ }
+ {
+ std::array<double, 3> const a3_1 = {1};
+ assert(a3_1[0] == double(1));
+ assert(a3_1[1] == double());
+ assert(a3_1[2] == double());
+ }
+ {
+ std::array<double, 3> const a3_2 = {1, 2.2};
+ assert(a3_2[0] == double(1));
+ assert(a3_2[1] == 2.2);
+ assert(a3_2[2] == double());
+ }
+ {
+ std::array<double, 3> const a3_3 = {1, 2, 3.5};
+ assert(a3_3[0] == double(1));
+ assert(a3_3[1] == double(2));
+ assert(a3_3[2] == 3.5);
+ }
+
+ return true;
}
-struct Empty { };
-struct Trivial { int i; int j; };
+struct Empty {};
+struct Trivial {
+ int i;
+ int j;
+};
struct NonTrivial {
- TEST_CONSTEXPR NonTrivial() { }
- TEST_CONSTEXPR NonTrivial(NonTrivial const&) { }
+ TEST_CONSTEXPR NonTrivial() {}
+ TEST_CONSTEXPR NonTrivial(NonTrivial const&) {}
};
struct NonEmptyNonTrivial {
- int i; int j;
- TEST_CONSTEXPR NonEmptyNonTrivial() : i(22), j(33) { }
- TEST_CONSTEXPR NonEmptyNonTrivial(NonEmptyNonTrivial const&) : i(22), j(33) { }
+ int i;
+ int j;
+ TEST_CONSTEXPR NonEmptyNonTrivial() : i(22), j(33) {}
+ TEST_CONSTEXPR NonEmptyNonTrivial(NonEmptyNonTrivial const&) : i(22), j(33) {}
};
template <typename F>
-TEST_CONSTEXPR_CXX14 bool with_all_types()
-{
- F().template operator()<char>();
- F().template operator()<int>();
- F().template operator()<long>();
- F().template operator()<float>();
- F().template operator()<double>();
- F().template operator()<long double>();
- F().template operator()<Empty>();
- F().template operator()<Trivial>();
- F().template operator()<NonTrivial>();
- F().template operator()<NonEmptyNonTrivial>();
- return true;
+TEST_CONSTEXPR_CXX14 bool with_all_types() {
+ F().template operator()<char>();
+ F().template operator()<int>();
+ F().template operator()<long>();
+ F().template operator()<float>();
+ F().template operator()<double>();
+ F().template operator()<long double>();
+ F().template operator()<Empty>();
+ F().template operator()<Trivial>();
+ F().template operator()<NonTrivial>();
+ F().template operator()<NonEmptyNonTrivial>();
+ return true;
}
// This is a regression test -- previously, libc++ would implement empty arrays by
@@ -193,22 +230,21 @@ TEST_CONSTEXPR_CXX14 bool with_all_types()
#if TEST_STD_VER >= 20
template <class T>
concept is_list_initializable_int = requires {
- { T{123} };
+ { T{123} };
};
-struct Foo { };
+struct Foo {};
static_assert(!is_list_initializable_int<std::array<Foo, 0>>);
static_assert(!is_list_initializable_int<std::array<Foo, 1>>);
#endif
-int main(int, char**)
-{
- with_all_types<test_initialization>();
- test_initializer_list();
+int main(int, char**) {
+ with_all_types<test_initialization>();
+ test_initializer_list();
#if TEST_STD_VER >= 14
- static_assert(with_all_types<test_initialization>(), "");
- static_assert(test_initializer_list(), "");
+ static_assert(with_all_types<test_initialization>(), "");
+ static_assert(test_initializer_list(), "");
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/array/array.creation/to_array.pass.cpp b/libcxx/test/std/containers/sequences/array/array.creation/to_array.pass.cpp
index 778fae1ced38383..c4a2123115a2480 100644
--- a/libcxx/test/std/containers/sequences/array/array.creation/to_array.pass.cpp
+++ b/libcxx/test/std/containers/sequences/array/array.creation/to_array.pass.cpp
@@ -23,8 +23,7 @@
#include "test_macros.h"
#include "MoveOnly.h"
-constexpr bool tests()
-{
+constexpr bool tests() {
// Test deduced type.
{
auto arr = std::to_array({1, 2, 3});
@@ -36,7 +35,7 @@ constexpr bool tests()
{
const long l1 = 42;
- auto arr = std::to_array({1L, 4L, 9L, l1});
+ auto arr = std::to_array({1L, 4L, 9L, l1});
ASSERT_SAME_TYPE(decltype(arr)::value_type, long);
static_assert(arr.size() == 4, "");
assert(arr[0] == 1);
@@ -57,7 +56,7 @@ constexpr bool tests()
{
double source[3] = {4.0, 5.0, 6.0};
- auto arr = std::to_array(source);
+ auto arr = std::to_array(source);
ASSERT_SAME_TYPE(decltype(arr), std::array<double, 3>);
assert(arr[0] == 4.0);
assert(arr[1] == 5.0);
@@ -66,7 +65,7 @@ constexpr bool tests()
{
double source[3] = {4.0, 5.0, 6.0};
- auto arr = std::to_array(std::move(source));
+ auto arr = std::to_array(std::move(source));
ASSERT_SAME_TYPE(decltype(arr), std::array<double, 3>);
assert(arr[0] == 4.0);
assert(arr[1] == 5.0);
@@ -116,8 +115,7 @@ constexpr bool tests()
return true;
}
-int main(int, char**)
-{
+int main(int, char**) {
tests();
static_assert(tests(), "");
return 0;
diff --git a/libcxx/test/std/containers/sequences/array/array.data/data.pass.cpp b/libcxx/test/std/containers/sequences/array/array.data/data.pass.cpp
index b0f9c3a7815e093..34c1e0e8ab39813 100644
--- a/libcxx/test/std/containers/sequences/array/array.data/data.pass.cpp
+++ b/libcxx/test/std/containers/sequences/array/array.data/data.pass.cpp
@@ -12,89 +12,87 @@
#include <array>
#include <cassert>
-#include <cstddef> // for std::max_align_t
+#include <cstddef> // for std::max_align_t
#include <cstdint>
#include "test_macros.h"
struct NoDefault {
- TEST_CONSTEXPR NoDefault(int) { }
+ TEST_CONSTEXPR NoDefault(int) {}
};
#if TEST_STD_VER < 11
struct natural_alignment {
- long t1;
- long long t2;
- double t3;
- long double t4;
+ long t1;
+ long long t2;
+ double t3;
+ long double t4;
};
#endif
-TEST_CONSTEXPR_CXX17 bool tests()
-{
- {
- typedef double T;
- typedef std::array<T, 3> C;
- C c = {1, 2, 3.5};
- ASSERT_NOEXCEPT(c.data());
- T* p = c.data();
- assert(p[0] == 1);
- assert(p[1] == 2);
- assert(p[2] == 3.5);
- }
- {
- typedef double T;
- typedef std::array<T, 0> C;
- C c = {};
- ASSERT_NOEXCEPT(c.data());
- T* p = c.data();
- (void)p;
- }
- {
- typedef double T;
- typedef std::array<const T, 0> C;
- C c = {{}};
- ASSERT_NOEXCEPT(c.data());
- const T* p = c.data();
- (void)p;
- static_assert((std::is_same<decltype(c.data()), const T*>::value), "");
- }
- {
- typedef NoDefault T;
- typedef std::array<T, 0> C;
- C c = {};
- ASSERT_NOEXCEPT(c.data());
- T* p = c.data();
- (void)p;
- }
- {
- std::array<int, 5> c = {0, 1, 2, 3, 4};
- assert(c.data() == &c[0]);
- assert(*c.data() == c[0]);
- }
+TEST_CONSTEXPR_CXX17 bool tests() {
+ {
+ typedef double T;
+ typedef std::array<T, 3> C;
+ C c = {1, 2, 3.5};
+ ASSERT_NOEXCEPT(c.data());
+ T* p = c.data();
+ assert(p[0] == 1);
+ assert(p[1] == 2);
+ assert(p[2] == 3.5);
+ }
+ {
+ typedef double T;
+ typedef std::array<T, 0> C;
+ C c = {};
+ ASSERT_NOEXCEPT(c.data());
+ T* p = c.data();
+ (void)p;
+ }
+ {
+ typedef double T;
+ typedef std::array<const T, 0> C;
+ C c = {{}};
+ ASSERT_NOEXCEPT(c.data());
+ const T* p = c.data();
+ (void)p;
+ static_assert((std::is_same<decltype(c.data()), const T*>::value), "");
+ }
+ {
+ typedef NoDefault T;
+ typedef std::array<T, 0> C;
+ C c = {};
+ ASSERT_NOEXCEPT(c.data());
+ T* p = c.data();
+ (void)p;
+ }
+ {
+ std::array<int, 5> c = {0, 1, 2, 3, 4};
+ assert(c.data() == &c[0]);
+ assert(*c.data() == c[0]);
+ }
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER >= 17
- static_assert(tests(), "");
+ static_assert(tests(), "");
#endif
- // Test the alignment of data()
- {
+ // Test the alignment of data()
+ {
#if TEST_STD_VER < 11
- typedef natural_alignment T;
+ typedef natural_alignment T;
#else
- typedef std::max_align_t T;
+ typedef std::max_align_t T;
#endif
- typedef std::array<T, 0> C;
- const C c = {};
- const T* p = c.data();
- std::uintptr_t pint = reinterpret_cast<std::uintptr_t>(p);
- assert(pint % TEST_ALIGNOF(T) == 0);
- }
- return 0;
+ typedef std::array<T, 0> C;
+ const C c = {};
+ const T* p = c.data();
+ std::uintptr_t pint = reinterpret_cast<std::uintptr_t>(p);
+ assert(pint % TEST_ALIGNOF(T) == 0);
+ }
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/array/array.data/data_const.pass.cpp b/libcxx/test/std/containers/sequences/array/array.data/data_const.pass.cpp
index f6c2e594cc991ac..41de212e68bf827 100644
--- a/libcxx/test/std/containers/sequences/array/array.data/data_const.pass.cpp
+++ b/libcxx/test/std/containers/sequences/array/array.data/data_const.pass.cpp
@@ -12,81 +12,79 @@
#include <array>
#include <cassert>
-#include <cstddef> // for std::max_align_t
+#include <cstddef> // for std::max_align_t
#include <cstdint>
#include "test_macros.h"
struct NoDefault {
- TEST_CONSTEXPR NoDefault(int) { }
+ TEST_CONSTEXPR NoDefault(int) {}
};
#if TEST_STD_VER < 11
struct natural_alignment {
- long t1;
- long long t2;
- double t3;
- long double t4;
+ long t1;
+ long long t2;
+ double t3;
+ long double t4;
};
#endif
-TEST_CONSTEXPR_CXX17 bool tests()
-{
- {
- typedef double T;
- typedef std::array<T, 3> C;
- const C c = {1, 2, 3.5};
- ASSERT_NOEXCEPT(c.data());
- const T* p = c.data();
- assert(p[0] == 1);
- assert(p[1] == 2);
- assert(p[2] == 3.5);
- }
- {
- typedef double T;
- typedef std::array<T, 0> C;
- const C c = {};
- ASSERT_NOEXCEPT(c.data());
- const T* p = c.data();
- (void)p;
- }
- {
- typedef NoDefault T;
- typedef std::array<T, 0> C;
- const C c = {};
- ASSERT_NOEXCEPT(c.data());
- const T* p = c.data();
- (void)p;
- }
- {
- std::array<int, 5> const c = {0, 1, 2, 3, 4};
- assert(c.data() == &c[0]);
- assert(*c.data() == c[0]);
- }
+TEST_CONSTEXPR_CXX17 bool tests() {
+ {
+ typedef double T;
+ typedef std::array<T, 3> C;
+ const C c = {1, 2, 3.5};
+ ASSERT_NOEXCEPT(c.data());
+ const T* p = c.data();
+ assert(p[0] == 1);
+ assert(p[1] == 2);
+ assert(p[2] == 3.5);
+ }
+ {
+ typedef double T;
+ typedef std::array<T, 0> C;
+ const C c = {};
+ ASSERT_NOEXCEPT(c.data());
+ const T* p = c.data();
+ (void)p;
+ }
+ {
+ typedef NoDefault T;
+ typedef std::array<T, 0> C;
+ const C c = {};
+ ASSERT_NOEXCEPT(c.data());
+ const T* p = c.data();
+ (void)p;
+ }
+ {
+ std::array<int, 5> const c = {0, 1, 2, 3, 4};
+ assert(c.data() == &c[0]);
+ assert(*c.data() == c[0]);
+ }
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER >= 17
- static_assert(tests(), "");
+ static_assert(tests(), "");
#endif
- // Test the alignment of data()
- {
+ // Test the alignment of data()
+ {
#if TEST_STD_VER < 11
- typedef natural_alignment T;
+ typedef natural_alignment T;
#else
- typedef std::max_align_t T;
+ typedef std::max_align_t T;
#endif
- typedef std::array<T, 0> C;
- const C c = {};
- const T* p = c.data();
- std::uintptr_t pint = reinterpret_cast<std::uintptr_t>(p);
- assert(pint % TEST_ALIGNOF(T) == 0);
- }
+ typedef std::array<T, 0> C;
+ const C c = {};
+ const T* p = c.data();
+ std::uintptr_t pint = reinterpret_cast<std::uintptr_t>(p);
+ assert(pint % TEST_ALIGNOF(T) == 0);
+ }
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/array/array.fill/fill.pass.cpp b/libcxx/test/std/containers/sequences/array/array.fill/fill.pass.cpp
index b2d7c4a192409d5..2bdb01f74bbae32 100644
--- a/libcxx/test/std/containers/sequences/array/array.fill/fill.pass.cpp
+++ b/libcxx/test/std/containers/sequences/array/array.fill/fill.pass.cpp
@@ -15,34 +15,32 @@
#include "test_macros.h"
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- {
- typedef double T;
- typedef std::array<T, 3> C;
- C c = {1, 2, 3.5};
- c.fill(5.5);
- assert(c.size() == 3);
- assert(c[0] == 5.5);
- assert(c[1] == 5.5);
- assert(c[2] == 5.5);
- }
+TEST_CONSTEXPR_CXX20 bool tests() {
+ {
+ typedef double T;
+ typedef std::array<T, 3> C;
+ C c = {1, 2, 3.5};
+ c.fill(5.5);
+ assert(c.size() == 3);
+ assert(c[0] == 5.5);
+ assert(c[1] == 5.5);
+ assert(c[2] == 5.5);
+ }
- {
- typedef double T;
- typedef std::array<T, 0> C;
- C c = {};
- c.fill(5.5);
- assert(c.size() == 0);
- }
- return true;
+ {
+ typedef double T;
+ typedef std::array<T, 0> C;
+ C c = {};
+ c.fill(5.5);
+ assert(c.size() == 0);
+ }
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER >= 20
- static_assert(tests(), "");
+ static_assert(tests(), "");
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/array/array.size/size.pass.cpp b/libcxx/test/std/containers/sequences/array/array.size/size.pass.cpp
index d39edd120641361..ba0120021de8da7 100644
--- a/libcxx/test/std/containers/sequences/array/array.size/size.pass.cpp
+++ b/libcxx/test/std/containers/sequences/array/array.size/size.pass.cpp
@@ -15,42 +15,41 @@
#include "test_macros.h"
-int main(int, char**)
-{
- {
- typedef double T;
- typedef std::array<T, 3> C;
- C c = {1, 2, 3.5};
- assert(c.size() == 3);
- assert(c.max_size() == 3);
- assert(!c.empty());
- }
- {
- typedef double T;
- typedef std::array<T, 0> C;
- C c = {};
- assert(c.size() == 0);
- assert(c.max_size() == 0);
- assert(c.empty());
- }
+int main(int, char**) {
+ {
+ typedef double T;
+ typedef std::array<T, 3> C;
+ C c = {1, 2, 3.5};
+ assert(c.size() == 3);
+ assert(c.max_size() == 3);
+ assert(!c.empty());
+ }
+ {
+ typedef double T;
+ typedef std::array<T, 0> C;
+ C c = {};
+ assert(c.size() == 0);
+ assert(c.max_size() == 0);
+ assert(c.empty());
+ }
#if TEST_STD_VER >= 11
- {
- typedef double T;
- typedef std::array<T, 3> C;
- constexpr C c = {1, 2, 3.5};
- static_assert(c.size() == 3, "");
- static_assert(c.max_size() == 3, "");
- static_assert(!c.empty(), "");
- }
- {
- typedef double T;
- typedef std::array<T, 0> C;
- constexpr C c = {};
- static_assert(c.size() == 0, "");
- static_assert(c.max_size() == 0, "");
- static_assert(c.empty(), "");
- }
+ {
+ typedef double T;
+ typedef std::array<T, 3> C;
+ constexpr C c = {1, 2, 3.5};
+ static_assert(c.size() == 3, "");
+ static_assert(c.max_size() == 3, "");
+ static_assert(!c.empty(), "");
+ }
+ {
+ typedef double T;
+ typedef std::array<T, 0> C;
+ constexpr C c = {};
+ static_assert(c.size() == 0, "");
+ static_assert(c.max_size() == 0, "");
+ static_assert(c.empty(), "");
+ }
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/array/array.special/swap.pass.cpp b/libcxx/test/std/containers/sequences/array/array.special/swap.pass.cpp
index 94974295dfc1081..594723da6d52afb 100644
--- a/libcxx/test/std/containers/sequences/array/array.special/swap.pass.cpp
+++ b/libcxx/test/std/containers/sequences/array/array.special/swap.pass.cpp
@@ -17,77 +17,75 @@
#include "test_macros.h"
struct NonSwappable {
- TEST_CONSTEXPR NonSwappable() { }
+ TEST_CONSTEXPR NonSwappable() {}
+
private:
- NonSwappable(NonSwappable const&);
- NonSwappable& operator=(NonSwappable const&);
+ NonSwappable(NonSwappable const&);
+ NonSwappable& operator=(NonSwappable const&);
};
template <class Tp>
-decltype(swap(std::declval<Tp>(), std::declval<Tp>()))
-can_swap_imp(int);
+decltype(swap(std::declval<Tp>(), std::declval<Tp>())) can_swap_imp(int);
template <class Tp>
std::false_type can_swap_imp(...);
template <class Tp>
-struct can_swap : std::is_same<decltype(can_swap_imp<Tp>(0)), void> { };
+struct can_swap : std::is_same<decltype(can_swap_imp<Tp>(0)), void> {};
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- {
- typedef double T;
- typedef std::array<T, 3> C;
- C c1 = {1, 2, 3.5};
- C c2 = {4, 5, 6.5};
- swap(c1, c2);
- assert(c1.size() == 3);
- assert(c1[0] == 4);
- assert(c1[1] == 5);
- assert(c1[2] == 6.5);
- assert(c2.size() == 3);
- assert(c2[0] == 1);
- assert(c2[1] == 2);
- assert(c2[2] == 3.5);
- }
- {
- typedef double T;
- typedef std::array<T, 0> C;
- C c1 = {};
- C c2 = {};
- swap(c1, c2);
- assert(c1.size() == 0);
- assert(c2.size() == 0);
- }
- {
- typedef NonSwappable T;
- typedef std::array<T, 0> C0;
- static_assert(can_swap<C0&>::value, "");
- C0 l = {};
- C0 r = {};
- swap(l, r);
+TEST_CONSTEXPR_CXX20 bool tests() {
+ {
+ typedef double T;
+ typedef std::array<T, 3> C;
+ C c1 = {1, 2, 3.5};
+ C c2 = {4, 5, 6.5};
+ swap(c1, c2);
+ assert(c1.size() == 3);
+ assert(c1[0] == 4);
+ assert(c1[1] == 5);
+ assert(c1[2] == 6.5);
+ assert(c2.size() == 3);
+ assert(c2[0] == 1);
+ assert(c2[1] == 2);
+ assert(c2[2] == 3.5);
+ }
+ {
+ typedef double T;
+ typedef std::array<T, 0> C;
+ C c1 = {};
+ C c2 = {};
+ swap(c1, c2);
+ assert(c1.size() == 0);
+ assert(c2.size() == 0);
+ }
+ {
+ typedef NonSwappable T;
+ typedef std::array<T, 0> C0;
+ static_assert(can_swap<C0&>::value, "");
+ C0 l = {};
+ C0 r = {};
+ swap(l, r);
#if TEST_STD_VER >= 11
- static_assert(noexcept(swap(l, r)), "");
+ static_assert(noexcept(swap(l, r)), "");
#endif
- }
+ }
#if TEST_STD_VER >= 11
- {
- // NonSwappable is still considered swappable in C++03 because there
- // is no access control SFINAE.
- typedef NonSwappable T;
- typedef std::array<T, 42> C1;
- static_assert(!can_swap<C1&>::value, "");
- }
+ {
+ // NonSwappable is still considered swappable in C++03 because there
+ // is no access control SFINAE.
+ typedef NonSwappable T;
+ typedef std::array<T, 42> C1;
+ static_assert(!can_swap<C1&>::value, "");
+ }
#endif
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER >= 20
- static_assert(tests(), "");
+ static_assert(tests(), "");
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/array/array.swap/swap.pass.cpp b/libcxx/test/std/containers/sequences/array/array.swap/swap.pass.cpp
index e0133ba8a2951ef..b67da087a454957 100644
--- a/libcxx/test/std/containers/sequences/array/array.swap/swap.pass.cpp
+++ b/libcxx/test/std/containers/sequences/array/array.swap/swap.pass.cpp
@@ -17,82 +17,81 @@
#include "test_macros.h"
struct NonSwappable {
- TEST_CONSTEXPR NonSwappable() { }
+ TEST_CONSTEXPR NonSwappable() {}
+
private:
- NonSwappable(NonSwappable const&);
- NonSwappable& operator=(NonSwappable const&);
+ NonSwappable(NonSwappable const&);
+ NonSwappable& operator=(NonSwappable const&);
};
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- {
- typedef double T;
- typedef std::array<T, 3> C;
- C c1 = {1, 2, 3.5};
- C c2 = {4, 5, 6.5};
- c1.swap(c2);
- assert(c1.size() == 3);
- assert(c1[0] == 4);
- assert(c1[1] == 5);
- assert(c1[2] == 6.5);
- assert(c2.size() == 3);
- assert(c2[0] == 1);
- assert(c2[1] == 2);
- assert(c2[2] == 3.5);
- }
- {
- typedef double T;
- typedef std::array<T, 3> C;
- C c1 = {1, 2, 3.5};
- C c2 = {4, 5, 6.5};
- std::swap(c1, c2);
- assert(c1.size() == 3);
- assert(c1[0] == 4);
- assert(c1[1] == 5);
- assert(c1[2] == 6.5);
- assert(c2.size() == 3);
- assert(c2[0] == 1);
- assert(c2[1] == 2);
- assert(c2[2] == 3.5);
- }
+TEST_CONSTEXPR_CXX20 bool tests() {
+ {
+ typedef double T;
+ typedef std::array<T, 3> C;
+ C c1 = {1, 2, 3.5};
+ C c2 = {4, 5, 6.5};
+ c1.swap(c2);
+ assert(c1.size() == 3);
+ assert(c1[0] == 4);
+ assert(c1[1] == 5);
+ assert(c1[2] == 6.5);
+ assert(c2.size() == 3);
+ assert(c2[0] == 1);
+ assert(c2[1] == 2);
+ assert(c2[2] == 3.5);
+ }
+ {
+ typedef double T;
+ typedef std::array<T, 3> C;
+ C c1 = {1, 2, 3.5};
+ C c2 = {4, 5, 6.5};
+ std::swap(c1, c2);
+ assert(c1.size() == 3);
+ assert(c1[0] == 4);
+ assert(c1[1] == 5);
+ assert(c1[2] == 6.5);
+ assert(c2.size() == 3);
+ assert(c2[0] == 1);
+ assert(c2[1] == 2);
+ assert(c2[2] == 3.5);
+ }
- {
- typedef double T;
- typedef std::array<T, 0> C;
- C c1 = {};
- C c2 = {};
- c1.swap(c2);
- assert(c1.size() == 0);
- assert(c2.size() == 0);
- }
- {
- typedef double T;
- typedef std::array<T, 0> C;
- C c1 = {};
- C c2 = {};
- std::swap(c1, c2);
- assert(c1.size() == 0);
- assert(c2.size() == 0);
- }
- {
- typedef NonSwappable T;
- typedef std::array<T, 0> C0;
- C0 l = {};
- C0 r = {};
- l.swap(r);
+ {
+ typedef double T;
+ typedef std::array<T, 0> C;
+ C c1 = {};
+ C c2 = {};
+ c1.swap(c2);
+ assert(c1.size() == 0);
+ assert(c2.size() == 0);
+ }
+ {
+ typedef double T;
+ typedef std::array<T, 0> C;
+ C c1 = {};
+ C c2 = {};
+ std::swap(c1, c2);
+ assert(c1.size() == 0);
+ assert(c2.size() == 0);
+ }
+ {
+ typedef NonSwappable T;
+ typedef std::array<T, 0> C0;
+ C0 l = {};
+ C0 r = {};
+ l.swap(r);
#if TEST_STD_VER >= 11
- static_assert(noexcept(l.swap(r)), "");
+ static_assert(noexcept(l.swap(r)), "");
#endif
- }
+ }
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER >= 20
- static_assert(tests(), "");
+ static_assert(tests(), "");
#endif
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/array/array.swap/swap.verify.cpp b/libcxx/test/std/containers/sequences/array/array.swap/swap.verify.cpp
index 7816b26578246fe..4d0ee390726caa7 100644
--- a/libcxx/test/std/containers/sequences/array/array.swap/swap.verify.cpp
+++ b/libcxx/test/std/containers/sequences/array/array.swap/swap.verify.cpp
@@ -19,7 +19,7 @@ int main(int, char**) {
{
typedef double T;
typedef std::array<const T, 0> C;
- C c = {};
+ C c = {};
C c2 = {};
// expected-error-re at array:* {{static assertion failed{{.*}}cannot swap zero-sized array of type 'const T'}}
c.swap(c2); // expected-note {{requested here}}
diff --git a/libcxx/test/std/containers/sequences/array/array.tuple/get.pass.cpp b/libcxx/test/std/containers/sequences/array/array.tuple/get.pass.cpp
index 04bb1313996df33..58bba33250734a1 100644
--- a/libcxx/test/std/containers/sequences/array/array.tuple/get.pass.cpp
+++ b/libcxx/test/std/containers/sequences/array/array.tuple/get.pass.cpp
@@ -15,57 +15,54 @@
#include "test_macros.h"
-template <typename ...T>
-TEST_CONSTEXPR std::array<int, sizeof...(T)> tempArray(T ...args)
-{
- return {args...};
+template <typename... T>
+TEST_CONSTEXPR std::array<int, sizeof...(T)> tempArray(T... args) {
+ return {args...};
}
-TEST_CONSTEXPR_CXX14 bool tests()
-{
- {
- std::array<double, 1> array = {3.3};
- assert(std::get<0>(array) == 3.3);
- std::get<0>(array) = 99.1;
- assert(std::get<0>(array) == 99.1);
- }
- {
- std::array<double, 2> array = {3.3, 4.4};
- assert(std::get<0>(array) == 3.3);
- assert(std::get<1>(array) == 4.4);
- std::get<0>(array) = 99.1;
- std::get<1>(array) = 99.2;
- assert(std::get<0>(array) == 99.1);
- assert(std::get<1>(array) == 99.2);
- }
- {
- std::array<double, 3> array = {3.3, 4.4, 5.5};
- assert(std::get<0>(array) == 3.3);
- assert(std::get<1>(array) == 4.4);
- assert(std::get<2>(array) == 5.5);
- std::get<1>(array) = 99.2;
- assert(std::get<0>(array) == 3.3);
- assert(std::get<1>(array) == 99.2);
- assert(std::get<2>(array) == 5.5);
- }
- {
- std::array<double, 1> array = {3.3};
- static_assert(std::is_same<double&, decltype(std::get<0>(array))>::value, "");
- }
- {
- assert(std::get<0>(tempArray(1, 2, 3)) == 1);
- assert(std::get<1>(tempArray(1, 2, 3)) == 2);
- assert(std::get<2>(tempArray(1, 2, 3)) == 3);
- }
+TEST_CONSTEXPR_CXX14 bool tests() {
+ {
+ std::array<double, 1> array = {3.3};
+ assert(std::get<0>(array) == 3.3);
+ std::get<0>(array) = 99.1;
+ assert(std::get<0>(array) == 99.1);
+ }
+ {
+ std::array<double, 2> array = {3.3, 4.4};
+ assert(std::get<0>(array) == 3.3);
+ assert(std::get<1>(array) == 4.4);
+ std::get<0>(array) = 99.1;
+ std::get<1>(array) = 99.2;
+ assert(std::get<0>(array) == 99.1);
+ assert(std::get<1>(array) == 99.2);
+ }
+ {
+ std::array<double, 3> array = {3.3, 4.4, 5.5};
+ assert(std::get<0>(array) == 3.3);
+ assert(std::get<1>(array) == 4.4);
+ assert(std::get<2>(array) == 5.5);
+ std::get<1>(array) = 99.2;
+ assert(std::get<0>(array) == 3.3);
+ assert(std::get<1>(array) == 99.2);
+ assert(std::get<2>(array) == 5.5);
+ }
+ {
+ std::array<double, 1> array = {3.3};
+ static_assert(std::is_same<double&, decltype(std::get<0>(array))>::value, "");
+ }
+ {
+ assert(std::get<0>(tempArray(1, 2, 3)) == 1);
+ assert(std::get<1>(tempArray(1, 2, 3)) == 2);
+ assert(std::get<2>(tempArray(1, 2, 3)) == 3);
+ }
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER >= 14
- static_assert(tests(), "");
+ static_assert(tests(), "");
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/array/array.tuple/get.verify.cpp b/libcxx/test/std/containers/sequences/array/array.tuple/get.verify.cpp
index f3a425e6537cb44..169f06f44e19ca0 100644
--- a/libcxx/test/std/containers/sequences/array/array.tuple/get.verify.cpp
+++ b/libcxx/test/std/containers/sequences/array/array.tuple/get.verify.cpp
@@ -21,7 +21,7 @@
void f() {
typedef double T;
typedef std::array<T, 3> C;
- C c = {1, 2, 3.5};
+ C c = {1, 2, 3.5};
std::get<3>(c) = 5.5; // expected-note {{requested here}}
// expected-error-re at array:* {{static assertion failed{{( due to requirement '3U[L]{0,2} < 3U[L]{0,2}')?}}{{.*}}Index out of bounds in std::get<> (std::array)}}
}
diff --git a/libcxx/test/std/containers/sequences/array/array.tuple/get_const.pass.cpp b/libcxx/test/std/containers/sequences/array/array.tuple/get_const.pass.cpp
index 5fc080b8efc8639..88c09897aa104ce 100644
--- a/libcxx/test/std/containers/sequences/array/array.tuple/get_const.pass.cpp
+++ b/libcxx/test/std/containers/sequences/array/array.tuple/get_const.pass.cpp
@@ -15,36 +15,34 @@
#include "test_macros.h"
-TEST_CONSTEXPR_CXX14 bool tests()
-{
- {
- std::array<double, 1> const array = {3.3};
- assert(std::get<0>(array) == 3.3);
- }
- {
- std::array<double, 2> const array = {3.3, 4.4};
- assert(std::get<0>(array) == 3.3);
- assert(std::get<1>(array) == 4.4);
- }
- {
- std::array<double, 3> const array = {3.3, 4.4, 5.5};
- assert(std::get<0>(array) == 3.3);
- assert(std::get<1>(array) == 4.4);
- assert(std::get<2>(array) == 5.5);
- }
- {
- std::array<double, 1> const array = {3.3};
- static_assert(std::is_same<double const&, decltype(std::get<0>(array))>::value, "");
- }
+TEST_CONSTEXPR_CXX14 bool tests() {
+ {
+ std::array<double, 1> const array = {3.3};
+ assert(std::get<0>(array) == 3.3);
+ }
+ {
+ std::array<double, 2> const array = {3.3, 4.4};
+ assert(std::get<0>(array) == 3.3);
+ assert(std::get<1>(array) == 4.4);
+ }
+ {
+ std::array<double, 3> const array = {3.3, 4.4, 5.5};
+ assert(std::get<0>(array) == 3.3);
+ assert(std::get<1>(array) == 4.4);
+ assert(std::get<2>(array) == 5.5);
+ }
+ {
+ std::array<double, 1> const array = {3.3};
+ static_assert(std::is_same<double const&, decltype(std::get<0>(array))>::value, "");
+ }
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER >= 14
- static_assert(tests(), "");
+ static_assert(tests(), "");
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/array/array.tuple/get_const_rv.pass.cpp b/libcxx/test/std/containers/sequences/array/array.tuple/get_const_rv.pass.cpp
index a5121000c18e099..4dd95c65088bd06 100644
--- a/libcxx/test/std/containers/sequences/array/array.tuple/get_const_rv.pass.cpp
+++ b/libcxx/test/std/containers/sequences/array/array.tuple/get_const_rv.pass.cpp
@@ -20,29 +20,27 @@
#include "test_macros.h"
-int main(int, char**)
-{
-
- {
- typedef std::unique_ptr<double> T;
- typedef std::array<T, 1> C;
- const C c = {std::unique_ptr<double>(new double(3.5))};
- static_assert(std::is_same<const T&&, decltype(std::get<0>(std::move(c)))>::value, "");
- static_assert(noexcept(std::get<0>(std::move(c))), "");
- const T&& t = std::get<0>(std::move(c));
- assert(*t == 3.5);
- }
+int main(int, char**) {
+ {
+ typedef std::unique_ptr<double> T;
+ typedef std::array<T, 1> C;
+ const C c = {std::unique_ptr<double>(new double(3.5))};
+ static_assert(std::is_same<const T&&, decltype(std::get<0>(std::move(c)))>::value, "");
+ static_assert(noexcept(std::get<0>(std::move(c))), "");
+ const T&& t = std::get<0>(std::move(c));
+ assert(*t == 3.5);
+ }
#if TEST_STD_VER >= 14
- {
- typedef double T;
- typedef std::array<T, 3> C;
- constexpr const C c = {1, 2, 3.5};
- static_assert(std::get<0>(std::move(c)) == 1, "");
- static_assert(std::get<1>(std::move(c)) == 2, "");
- static_assert(std::get<2>(std::move(c)) == 3.5, "");
- }
+ {
+ typedef double T;
+ typedef std::array<T, 3> C;
+ constexpr const C c = {1, 2, 3.5};
+ static_assert(std::get<0>(std::move(c)) == 1, "");
+ static_assert(std::get<1>(std::move(c)) == 2, "");
+ static_assert(std::get<2>(std::move(c)) == 3.5, "");
+ }
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/array/array.tuple/get_rv.pass.cpp b/libcxx/test/std/containers/sequences/array/array.tuple/get_rv.pass.cpp
index 2ab8acbcfdc2aaf..460219b1e4fce3d 100644
--- a/libcxx/test/std/containers/sequences/array/array.tuple/get_rv.pass.cpp
+++ b/libcxx/test/std/containers/sequences/array/array.tuple/get_rv.pass.cpp
@@ -19,15 +19,14 @@
#include "test_macros.h"
-int main(int, char**)
-{
- {
- typedef std::unique_ptr<double> T;
- typedef std::array<T, 1> C;
- C c = {std::unique_ptr<double>(new double(3.5))};
- T t = std::get<0>(std::move(c));
- assert(*t == 3.5);
- }
+int main(int, char**) {
+ {
+ typedef std::unique_ptr<double> T;
+ typedef std::array<T, 1> C;
+ C c = {std::unique_ptr<double>(new double(3.5))};
+ T t = std::get<0>(std::move(c));
+ assert(*t == 3.5);
+ }
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/array/array.tuple/tuple_element.pass.cpp b/libcxx/test/std/containers/sequences/array/array.tuple/tuple_element.pass.cpp
index fb7aa7cf02ca5f7..79451abc933c585 100644
--- a/libcxx/test/std/containers/sequences/array/array.tuple/tuple_element.pass.cpp
+++ b/libcxx/test/std/containers/sequences/array/array.tuple/tuple_element.pass.cpp
@@ -16,42 +16,40 @@
#include "test_macros.h"
template <class T>
-void test()
-{
- {
+void test() {
+ {
typedef T Exp;
typedef std::array<T, 3> C;
static_assert((std::is_same<typename std::tuple_element<0, C>::type, Exp>::value), "");
static_assert((std::is_same<typename std::tuple_element<1, C>::type, Exp>::value), "");
static_assert((std::is_same<typename std::tuple_element<2, C>::type, Exp>::value), "");
- }
- {
+ }
+ {
typedef T const Exp;
typedef std::array<T, 3> const C;
static_assert((std::is_same<typename std::tuple_element<0, C>::type, Exp>::value), "");
static_assert((std::is_same<typename std::tuple_element<1, C>::type, Exp>::value), "");
static_assert((std::is_same<typename std::tuple_element<2, C>::type, Exp>::value), "");
- }
- {
+ }
+ {
typedef T volatile Exp;
typedef std::array<T, 3> volatile C;
static_assert((std::is_same<typename std::tuple_element<0, C>::type, Exp>::value), "");
static_assert((std::is_same<typename std::tuple_element<1, C>::type, Exp>::value), "");
static_assert((std::is_same<typename std::tuple_element<2, C>::type, Exp>::value), "");
- }
- {
+ }
+ {
typedef T const volatile Exp;
typedef std::array<T, 3> const volatile C;
static_assert((std::is_same<typename std::tuple_element<0, C>::type, Exp>::value), "");
static_assert((std::is_same<typename std::tuple_element<1, C>::type, Exp>::value), "");
static_assert((std::is_same<typename std::tuple_element<2, C>::type, Exp>::value), "");
- }
+ }
}
-int main(int, char**)
-{
- test<double>();
- test<int>();
+int main(int, char**) {
+ test<double>();
+ test<int>();
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/array/array.tuple/tuple_size.pass.cpp b/libcxx/test/std/containers/sequences/array/array.tuple/tuple_size.pass.cpp
index e31407ac5a7d7ab..ebfcffc699d0695 100644
--- a/libcxx/test/std/containers/sequences/array/array.tuple/tuple_size.pass.cpp
+++ b/libcxx/test/std/containers/sequences/array/array.tuple/tuple_size.pass.cpp
@@ -15,31 +15,29 @@
#include "test_macros.h"
template <class T, std::size_t N>
-void test()
-{
- {
+void test() {
+ {
typedef std::array<T, N> C;
static_assert((std::tuple_size<C>::value == N), "");
- }
- {
+ }
+ {
typedef std::array<T const, N> C;
static_assert((std::tuple_size<C>::value == N), "");
- }
- {
+ }
+ {
typedef std::array<T volatile, N> C;
static_assert((std::tuple_size<C>::value == N), "");
- }
- {
+ }
+ {
typedef std::array<T const volatile, N> C;
static_assert((std::tuple_size<C>::value == N), "");
- }
+ }
}
-int main(int, char**)
-{
- test<double, 0>();
- test<double, 3>();
- test<double, 5>();
+int main(int, char**) {
+ test<double, 0>();
+ test<double, 3>();
+ test<double, 5>();
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/array/array.zero/tested_elsewhere.pass.cpp b/libcxx/test/std/containers/sequences/array/array.zero/tested_elsewhere.pass.cpp
index af4ab87048eb49e..d4c62f0d0493f3c 100644
--- a/libcxx/test/std/containers/sequences/array/array.zero/tested_elsewhere.pass.cpp
+++ b/libcxx/test/std/containers/sequences/array/array.zero/tested_elsewhere.pass.cpp
@@ -14,8 +14,4 @@
#include "test_macros.h"
-int main(int, char**)
-{
-
- return 0;
-}
+int main(int, char**) { return 0; }
diff --git a/libcxx/test/std/containers/sequences/array/at.pass.cpp b/libcxx/test/std/containers/sequences/array/at.pass.cpp
index 90b5684b1e567d1..48a3aef2f59539c 100644
--- a/libcxx/test/std/containers/sequences/array/at.pass.cpp
+++ b/libcxx/test/std/containers/sequences/array/at.pass.cpp
@@ -14,96 +14,93 @@
#include <cassert>
#ifndef TEST_HAS_NO_EXCEPTIONS
-#include <stdexcept>
+# include <stdexcept>
#endif
#include "test_macros.h"
-TEST_CONSTEXPR_CXX17 bool tests()
-{
- {
- typedef double T;
- typedef std::array<T, 3> C;
- C c = {1, 2, 3.5};
- typename C::reference r1 = c.at(0);
- assert(r1 == 1);
- r1 = 5.5;
- assert(c[0] == 5.5);
-
- typename C::reference r2 = c.at(2);
- assert(r2 == 3.5);
- r2 = 7.5;
- assert(c[2] == 7.5);
- }
- return true;
+TEST_CONSTEXPR_CXX17 bool tests() {
+ {
+ typedef double T;
+ typedef std::array<T, 3> C;
+ C c = {1, 2, 3.5};
+ typename C::reference r1 = c.at(0);
+ assert(r1 == 1);
+ r1 = 5.5;
+ assert(c[0] == 5.5);
+
+ typename C::reference r2 = c.at(2);
+ assert(r2 == 3.5);
+ r2 = 7.5;
+ assert(c[2] == 7.5);
+ }
+ return true;
}
-void test_exceptions()
-{
+void test_exceptions() {
#ifndef TEST_HAS_NO_EXCEPTIONS
- {
- std::array<int, 4> array = {1, 2, 3, 4};
-
- try {
- TEST_IGNORE_NODISCARD array.at(4);
- assert(false);
- } catch (std::out_of_range const&) {
- // pass
- } catch (...) {
- assert(false);
- }
-
- try {
- TEST_IGNORE_NODISCARD array.at(5);
- assert(false);
- } catch (std::out_of_range const&) {
- // pass
- } catch (...) {
- assert(false);
- }
-
- try {
- TEST_IGNORE_NODISCARD array.at(6);
- assert(false);
- } catch (std::out_of_range const&) {
- // pass
- } catch (...) {
- assert(false);
- }
-
- try {
- using size_type = decltype(array)::size_type;
- TEST_IGNORE_NODISCARD array.at(static_cast<size_type>(-1));
- assert(false);
- } catch (std::out_of_range const&) {
- // pass
- } catch (...) {
- assert(false);
- }
+ {
+ std::array<int, 4> array = {1, 2, 3, 4};
+
+ try {
+ TEST_IGNORE_NODISCARD array.at(4);
+ assert(false);
+ } catch (std::out_of_range const&) {
+ // pass
+ } catch (...) {
+ assert(false);
+ }
+
+ try {
+ TEST_IGNORE_NODISCARD array.at(5);
+ assert(false);
+ } catch (std::out_of_range const&) {
+ // pass
+ } catch (...) {
+ assert(false);
}
- {
- std::array<int, 0> array = {};
-
- try {
- TEST_IGNORE_NODISCARD array.at(0);
- assert(false);
- } catch (std::out_of_range const&) {
- // pass
- } catch (...) {
- assert(false);
- }
+ try {
+ TEST_IGNORE_NODISCARD array.at(6);
+ assert(false);
+ } catch (std::out_of_range const&) {
+ // pass
+ } catch (...) {
+ assert(false);
+ }
+
+ try {
+ using size_type = decltype(array)::size_type;
+ TEST_IGNORE_NODISCARD array.at(static_cast<size_type>(-1));
+ assert(false);
+ } catch (std::out_of_range const&) {
+ // pass
+ } catch (...) {
+ assert(false);
+ }
+ }
+
+ {
+ std::array<int, 0> array = {};
+
+ try {
+ TEST_IGNORE_NODISCARD array.at(0);
+ assert(false);
+ } catch (std::out_of_range const&) {
+ // pass
+ } catch (...) {
+ assert(false);
}
+ }
#endif
}
-int main(int, char**)
-{
- tests();
- test_exceptions();
+int main(int, char**) {
+ tests();
+ test_exceptions();
#if TEST_STD_VER >= 17
- static_assert(tests(), "");
+ static_assert(tests(), "");
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/array/at_const.pass.cpp b/libcxx/test/std/containers/sequences/array/at_const.pass.cpp
index 2ddd5a03a6c6726..fd12d34512a1219 100644
--- a/libcxx/test/std/containers/sequences/array/at_const.pass.cpp
+++ b/libcxx/test/std/containers/sequences/array/at_const.pass.cpp
@@ -14,92 +14,89 @@
#include <cassert>
#ifndef TEST_HAS_NO_EXCEPTIONS
-#include <stdexcept>
+# include <stdexcept>
#endif
#include "test_macros.h"
-TEST_CONSTEXPR_CXX14 bool tests()
-{
- {
- typedef double T;
- typedef std::array<T, 3> C;
- C const c = {1, 2, 3.5};
- typename C::const_reference r1 = c.at(0);
- assert(r1 == 1);
-
- typename C::const_reference r2 = c.at(2);
- assert(r2 == 3.5);
- }
- return true;
+TEST_CONSTEXPR_CXX14 bool tests() {
+ {
+ typedef double T;
+ typedef std::array<T, 3> C;
+ C const c = {1, 2, 3.5};
+ typename C::const_reference r1 = c.at(0);
+ assert(r1 == 1);
+
+ typename C::const_reference r2 = c.at(2);
+ assert(r2 == 3.5);
+ }
+ return true;
}
-void test_exceptions()
-{
+void test_exceptions() {
#ifndef TEST_HAS_NO_EXCEPTIONS
- {
- std::array<int, 4> const array = {1, 2, 3, 4};
-
- try {
- TEST_IGNORE_NODISCARD array.at(4);
- assert(false);
- } catch (std::out_of_range const&) {
- // pass
- } catch (...) {
- assert(false);
- }
-
- try {
- TEST_IGNORE_NODISCARD array.at(5);
- assert(false);
- } catch (std::out_of_range const&) {
- // pass
- } catch (...) {
- assert(false);
- }
-
- try {
- TEST_IGNORE_NODISCARD array.at(6);
- assert(false);
- } catch (std::out_of_range const&) {
- // pass
- } catch (...) {
- assert(false);
- }
-
- try {
- using size_type = decltype(array)::size_type;
- TEST_IGNORE_NODISCARD array.at(static_cast<size_type>(-1));
- assert(false);
- } catch (std::out_of_range const&) {
- // pass
- } catch (...) {
- assert(false);
- }
+ {
+ std::array<int, 4> const array = {1, 2, 3, 4};
+
+ try {
+ TEST_IGNORE_NODISCARD array.at(4);
+ assert(false);
+ } catch (std::out_of_range const&) {
+ // pass
+ } catch (...) {
+ assert(false);
+ }
+
+ try {
+ TEST_IGNORE_NODISCARD array.at(5);
+ assert(false);
+ } catch (std::out_of_range const&) {
+ // pass
+ } catch (...) {
+ assert(false);
}
- {
- std::array<int, 0> array = {};
-
- try {
- TEST_IGNORE_NODISCARD array.at(0);
- assert(false);
- } catch (std::out_of_range const&) {
- // pass
- } catch (...) {
- assert(false);
- }
+ try {
+ TEST_IGNORE_NODISCARD array.at(6);
+ assert(false);
+ } catch (std::out_of_range const&) {
+ // pass
+ } catch (...) {
+ assert(false);
+ }
+
+ try {
+ using size_type = decltype(array)::size_type;
+ TEST_IGNORE_NODISCARD array.at(static_cast<size_type>(-1));
+ assert(false);
+ } catch (std::out_of_range const&) {
+ // pass
+ } catch (...) {
+ assert(false);
+ }
+ }
+
+ {
+ std::array<int, 0> array = {};
+
+ try {
+ TEST_IGNORE_NODISCARD array.at(0);
+ assert(false);
+ } catch (std::out_of_range const&) {
+ // pass
+ } catch (...) {
+ assert(false);
}
+ }
#endif
}
-int main(int, char**)
-{
- tests();
- test_exceptions();
+int main(int, char**) {
+ tests();
+ test_exceptions();
#if TEST_STD_VER >= 14
- static_assert(tests(), "");
+ static_assert(tests(), "");
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/array/contiguous.pass.cpp b/libcxx/test/std/containers/sequences/array/contiguous.pass.cpp
index 85e6ed7ae9aeec5..fda0f9ef138ec78 100644
--- a/libcxx/test/std/containers/sequences/array/contiguous.pass.cpp
+++ b/libcxx/test/std/containers/sequences/array/contiguous.pass.cpp
@@ -17,32 +17,29 @@
#include "test_macros.h"
template <class Container>
-TEST_CONSTEXPR_CXX14 void assert_contiguous(Container const& c)
-{
- for (std::size_t i = 0; i < c.size(); ++i)
- assert(*(c.begin() + i) == *(std::addressof(*c.begin()) + i));
+TEST_CONSTEXPR_CXX14 void assert_contiguous(Container const& c) {
+ for (std::size_t i = 0; i < c.size(); ++i)
+ assert(*(c.begin() + i) == *(std::addressof(*c.begin()) + i));
}
-TEST_CONSTEXPR_CXX17 bool tests()
-{
- assert_contiguous(std::array<double, 0>());
- assert_contiguous(std::array<double, 1>());
- assert_contiguous(std::array<double, 2>());
- assert_contiguous(std::array<double, 3>());
+TEST_CONSTEXPR_CXX17 bool tests() {
+ assert_contiguous(std::array<double, 0>());
+ assert_contiguous(std::array<double, 1>());
+ assert_contiguous(std::array<double, 2>());
+ assert_contiguous(std::array<double, 3>());
- assert_contiguous(std::array<char, 0>());
- assert_contiguous(std::array<char, 1>());
- assert_contiguous(std::array<char, 2>());
- assert_contiguous(std::array<char, 3>());
+ assert_contiguous(std::array<char, 0>());
+ assert_contiguous(std::array<char, 1>());
+ assert_contiguous(std::array<char, 2>());
+ assert_contiguous(std::array<char, 3>());
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER >= 17 // begin() & friends are constexpr in >= C++17 only
- static_assert(tests(), "");
+ static_assert(tests(), "");
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/array/empty.pass.cpp b/libcxx/test/std/containers/sequences/array/empty.pass.cpp
index 8b61575c2e731a5..a2289760b2e9678 100644
--- a/libcxx/test/std/containers/sequences/array/empty.pass.cpp
+++ b/libcxx/test/std/containers/sequences/array/empty.pass.cpp
@@ -17,38 +17,36 @@
#include "test_macros.h"
-TEST_CONSTEXPR_CXX14 bool tests()
-{
- {
- typedef std::array<int, 2> C;
- C c = {};
- ASSERT_NOEXCEPT(c.empty());
- assert(!c.empty());
- }
- {
- typedef std::array<int, 0> C;
- C c = {};
- ASSERT_NOEXCEPT(c.empty());
- assert(c.empty());
- }
-
- return true;
+TEST_CONSTEXPR_CXX14 bool tests() {
+ {
+ typedef std::array<int, 2> C;
+ C c = {};
+ ASSERT_NOEXCEPT(c.empty());
+ assert(!c.empty());
+ }
+ {
+ typedef std::array<int, 0> C;
+ C c = {};
+ ASSERT_NOEXCEPT(c.empty());
+ assert(c.empty());
+ }
+
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER >= 14
- static_assert(tests(), "");
+ static_assert(tests(), "");
#endif
#if TEST_STD_VER >= 11
- // Sanity check for constexpr in C++11
- {
- constexpr std::array<int, 3> array = {};
- static_assert(!array.empty(), "");
- }
+ // Sanity check for constexpr in C++11
+ {
+ constexpr std::array<int, 3> array = {};
+ static_assert(!array.empty(), "");
+ }
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/array/empty.verify.cpp b/libcxx/test/std/containers/sequences/array/empty.verify.cpp
index 9cf8f1156990f9c..2fc821e08a10635 100644
--- a/libcxx/test/std/containers/sequences/array/empty.verify.cpp
+++ b/libcxx/test/std/containers/sequences/array/empty.verify.cpp
@@ -17,8 +17,8 @@
#include <array>
void f() {
- std::array<int, 1> c;
- c.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::array<int, 0> c0;
- c0.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::array<int, 1> c;
+ c.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::array<int, 0> c0;
+ c0.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}
diff --git a/libcxx/test/std/containers/sequences/array/front_back.pass.cpp b/libcxx/test/std/containers/sequences/array/front_back.pass.cpp
index c37acd0b786381c..4d8cffbcd77a426 100644
--- a/libcxx/test/std/containers/sequences/array/front_back.pass.cpp
+++ b/libcxx/test/std/containers/sequences/array/front_back.pass.cpp
@@ -16,58 +16,56 @@
#include "test_macros.h"
-TEST_CONSTEXPR_CXX17 bool tests()
-{
- {
- typedef double T;
- typedef std::array<T, 3> C;
- C c = {1, 2, 3.5};
+TEST_CONSTEXPR_CXX17 bool tests() {
+ {
+ typedef double T;
+ typedef std::array<T, 3> C;
+ C c = {1, 2, 3.5};
- C::reference r1 = c.front();
- assert(r1 == 1);
- r1 = 5.5;
- assert(c[0] == 5.5);
+ C::reference r1 = c.front();
+ assert(r1 == 1);
+ r1 = 5.5;
+ assert(c[0] == 5.5);
- C::reference r2 = c.back();
- assert(r2 == 3.5);
- r2 = 7.5;
- assert(c[2] == 7.5);
+ C::reference r2 = c.back();
+ assert(r2 == 3.5);
+ r2 = 7.5;
+ assert(c[2] == 7.5);
+ }
+ {
+ typedef double T;
+ typedef std::array<T, 0> C;
+ C c = {};
+ ASSERT_SAME_TYPE(decltype(c.back()), C::reference);
+ LIBCPP_ASSERT_NOEXCEPT(c.back());
+ ASSERT_SAME_TYPE(decltype(c.front()), C::reference);
+ LIBCPP_ASSERT_NOEXCEPT(c.front());
+ if (c.size() > (0)) { // always false
+ TEST_IGNORE_NODISCARD c.front();
+ TEST_IGNORE_NODISCARD c.back();
}
- {
- typedef double T;
- typedef std::array<T, 0> C;
- C c = {};
- ASSERT_SAME_TYPE(decltype(c.back()), C::reference);
- LIBCPP_ASSERT_NOEXCEPT(c.back());
- ASSERT_SAME_TYPE(decltype(c.front()), C::reference);
- LIBCPP_ASSERT_NOEXCEPT(c.front());
- if (c.size() > (0)) { // always false
- TEST_IGNORE_NODISCARD c.front();
- TEST_IGNORE_NODISCARD c.back();
- }
- }
- {
- typedef double T;
- typedef std::array<const T, 0> C;
- C c = {};
- ASSERT_SAME_TYPE(decltype( c.back()), C::reference);
- LIBCPP_ASSERT_NOEXCEPT( c.back());
- ASSERT_SAME_TYPE(decltype( c.front()), C::reference);
- LIBCPP_ASSERT_NOEXCEPT( c.front());
- if (c.size() > (0)) {
- TEST_IGNORE_NODISCARD c.front();
- TEST_IGNORE_NODISCARD c.back();
- }
+ }
+ {
+ typedef double T;
+ typedef std::array<const T, 0> C;
+ C c = {};
+ ASSERT_SAME_TYPE(decltype(c.back()), C::reference);
+ LIBCPP_ASSERT_NOEXCEPT(c.back());
+ ASSERT_SAME_TYPE(decltype(c.front()), C::reference);
+ LIBCPP_ASSERT_NOEXCEPT(c.front());
+ if (c.size() > (0)) {
+ TEST_IGNORE_NODISCARD c.front();
+ TEST_IGNORE_NODISCARD c.back();
}
+ }
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER >= 17
- static_assert(tests(), "");
+ static_assert(tests(), "");
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/array/front_back_const.pass.cpp b/libcxx/test/std/containers/sequences/array/front_back_const.pass.cpp
index 9204663f0da3cbf..d795223df40d7c7 100644
--- a/libcxx/test/std/containers/sequences/array/front_back_const.pass.cpp
+++ b/libcxx/test/std/containers/sequences/array/front_back_const.pass.cpp
@@ -16,53 +16,51 @@
#include "test_macros.h"
-TEST_CONSTEXPR_CXX14 bool tests()
-{
- {
- typedef double T;
- typedef std::array<T, 3> C;
- C const c = {1, 2, 3.5};
- C::const_reference r1 = c.front();
- assert(r1 == 1);
+TEST_CONSTEXPR_CXX14 bool tests() {
+ {
+ typedef double T;
+ typedef std::array<T, 3> C;
+ C const c = {1, 2, 3.5};
+ C::const_reference r1 = c.front();
+ assert(r1 == 1);
- C::const_reference r2 = c.back();
- assert(r2 == 3.5);
+ C::const_reference r2 = c.back();
+ assert(r2 == 3.5);
+ }
+ {
+ typedef double T;
+ typedef std::array<T, 0> C;
+ C const c = {};
+ ASSERT_SAME_TYPE(decltype(c.back()), C::const_reference);
+ LIBCPP_ASSERT_NOEXCEPT(c.back());
+ ASSERT_SAME_TYPE(decltype(c.front()), C::const_reference);
+ LIBCPP_ASSERT_NOEXCEPT(c.front());
+ if (c.size() > (0)) { // always false
+ TEST_IGNORE_NODISCARD c.front();
+ TEST_IGNORE_NODISCARD c.back();
}
- {
- typedef double T;
- typedef std::array<T, 0> C;
- C const c = {};
- ASSERT_SAME_TYPE(decltype(c.back()), C::const_reference);
- LIBCPP_ASSERT_NOEXCEPT(c.back());
- ASSERT_SAME_TYPE(decltype(c.front()), C::const_reference);
- LIBCPP_ASSERT_NOEXCEPT(c.front());
- if (c.size() > (0)) { // always false
- TEST_IGNORE_NODISCARD c.front();
- TEST_IGNORE_NODISCARD c.back();
- }
- }
- {
- typedef double T;
- typedef std::array<const T, 0> C;
- C const c = {};
- ASSERT_SAME_TYPE(decltype(c.back()), C::const_reference);
- LIBCPP_ASSERT_NOEXCEPT(c.back());
- ASSERT_SAME_TYPE(decltype(c.front()), C::const_reference);
- LIBCPP_ASSERT_NOEXCEPT(c.front());
- if (c.size() > (0)) {
- TEST_IGNORE_NODISCARD c.front();
- TEST_IGNORE_NODISCARD c.back();
- }
+ }
+ {
+ typedef double T;
+ typedef std::array<const T, 0> C;
+ C const c = {};
+ ASSERT_SAME_TYPE(decltype(c.back()), C::const_reference);
+ LIBCPP_ASSERT_NOEXCEPT(c.back());
+ ASSERT_SAME_TYPE(decltype(c.front()), C::const_reference);
+ LIBCPP_ASSERT_NOEXCEPT(c.front());
+ if (c.size() > (0)) {
+ TEST_IGNORE_NODISCARD c.front();
+ TEST_IGNORE_NODISCARD c.back();
}
+ }
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER >= 14
- static_assert(tests(), "");
+ static_assert(tests(), "");
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/array/indexing.pass.cpp b/libcxx/test/std/containers/sequences/array/indexing.pass.cpp
index 48a2be0bdcbd7ff..9caa90f2567f5c3 100644
--- a/libcxx/test/std/containers/sequences/array/indexing.pass.cpp
+++ b/libcxx/test/std/containers/sequences/array/indexing.pass.cpp
@@ -16,59 +16,57 @@
#include "test_macros.h"
-TEST_CONSTEXPR_CXX17 bool tests()
-{
- {
- typedef double T;
- typedef std::array<T, 3> C;
- C c = {1, 2, 3.5};
- LIBCPP_ASSERT_NOEXCEPT(c[0]);
- ASSERT_SAME_TYPE(C::reference, decltype(c[0]));
- C::reference r1 = c[0];
- assert(r1 == 1);
- r1 = 5.5;
- assert(c.front() == 5.5);
+TEST_CONSTEXPR_CXX17 bool tests() {
+ {
+ typedef double T;
+ typedef std::array<T, 3> C;
+ C c = {1, 2, 3.5};
+ LIBCPP_ASSERT_NOEXCEPT(c[0]);
+ ASSERT_SAME_TYPE(C::reference, decltype(c[0]));
+ C::reference r1 = c[0];
+ assert(r1 == 1);
+ r1 = 5.5;
+ assert(c.front() == 5.5);
- C::reference r2 = c[2];
- assert(r2 == 3.5);
- r2 = 7.5;
- assert(c.back() == 7.5);
- }
+ C::reference r2 = c[2];
+ assert(r2 == 3.5);
+ r2 = 7.5;
+ assert(c.back() == 7.5);
+ }
- // Test operator[] "works" on zero sized arrays
+ // Test operator[] "works" on zero sized arrays
+ {
+ {
+ typedef double T;
+ typedef std::array<T, 0> C;
+ C c = {};
+ LIBCPP_ASSERT_NOEXCEPT(c[0]);
+ ASSERT_SAME_TYPE(C::reference, decltype(c[0]));
+ if (c.size() > (0)) { // always false
+ C::reference r = c[0];
+ (void)r;
+ }
+ }
{
- {
- typedef double T;
- typedef std::array<T, 0> C;
- C c = {};
- LIBCPP_ASSERT_NOEXCEPT(c[0]);
- ASSERT_SAME_TYPE(C::reference, decltype(c[0]));
- if (c.size() > (0)) { // always false
- C::reference r = c[0];
- (void)r;
- }
- }
- {
- typedef double T;
- typedef std::array<const T, 0> C;
- C c = {};
- LIBCPP_ASSERT_NOEXCEPT(c[0]);
- ASSERT_SAME_TYPE(C::reference, decltype(c[0]));
- if (c.size() > (0)) { // always false
- C::reference r = c[0];
- (void)r;
- }
- }
+ typedef double T;
+ typedef std::array<const T, 0> C;
+ C c = {};
+ LIBCPP_ASSERT_NOEXCEPT(c[0]);
+ ASSERT_SAME_TYPE(C::reference, decltype(c[0]));
+ if (c.size() > (0)) { // always false
+ C::reference r = c[0];
+ (void)r;
+ }
}
+ }
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER >= 17
- static_assert(tests(), "");
+ static_assert(tests(), "");
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/array/indexing_const.pass.cpp b/libcxx/test/std/containers/sequences/array/indexing_const.pass.cpp
index ce6f8bb59aac83c..78844c60060d8a2 100644
--- a/libcxx/test/std/containers/sequences/array/indexing_const.pass.cpp
+++ b/libcxx/test/std/containers/sequences/array/indexing_const.pass.cpp
@@ -16,53 +16,51 @@
#include "test_macros.h"
-TEST_CONSTEXPR_CXX14 bool tests()
-{
+TEST_CONSTEXPR_CXX14 bool tests() {
+ {
+ typedef double T;
+ typedef std::array<T, 3> C;
+ C const c = {1, 2, 3.5};
+ LIBCPP_ASSERT_NOEXCEPT(c[0]);
+ ASSERT_SAME_TYPE(C::const_reference, decltype(c[0]));
+ C::const_reference r1 = c[0];
+ assert(r1 == 1);
+ C::const_reference r2 = c[2];
+ assert(r2 == 3.5);
+ }
+ // Test operator[] "works" on zero sized arrays
+ {
{
- typedef double T;
- typedef std::array<T, 3> C;
- C const c = {1, 2, 3.5};
- LIBCPP_ASSERT_NOEXCEPT(c[0]);
- ASSERT_SAME_TYPE(C::const_reference, decltype(c[0]));
- C::const_reference r1 = c[0];
- assert(r1 == 1);
- C::const_reference r2 = c[2];
- assert(r2 == 3.5);
+ typedef double T;
+ typedef std::array<T, 0> C;
+ C const c = {};
+ LIBCPP_ASSERT_NOEXCEPT(c[0]);
+ ASSERT_SAME_TYPE(C::const_reference, decltype(c[0]));
+ if (c.size() > (0)) { // always false
+ C::const_reference r = c[0];
+ (void)r;
+ }
}
- // Test operator[] "works" on zero sized arrays
{
- {
- typedef double T;
- typedef std::array<T, 0> C;
- C const c = {};
- LIBCPP_ASSERT_NOEXCEPT(c[0]);
- ASSERT_SAME_TYPE(C::const_reference, decltype(c[0]));
- if (c.size() > (0)) { // always false
- C::const_reference r = c[0];
- (void)r;
- }
- }
- {
- typedef double T;
- typedef std::array<T const, 0> C;
- C const c = {};
- LIBCPP_ASSERT_NOEXCEPT(c[0]);
- ASSERT_SAME_TYPE(C::const_reference, decltype(c[0]));
- if (c.size() > (0)) { // always false
- C::const_reference r = c[0];
- (void)r;
- }
- }
+ typedef double T;
+ typedef std::array<T const, 0> C;
+ C const c = {};
+ LIBCPP_ASSERT_NOEXCEPT(c[0]);
+ ASSERT_SAME_TYPE(C::const_reference, decltype(c[0]));
+ if (c.size() > (0)) { // always false
+ C::const_reference r = c[0];
+ (void)r;
+ }
}
+ }
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER >= 14
- static_assert(tests(), "");
+ static_assert(tests(), "");
#endif
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/array/iterator_concept_conformance.compile.pass.cpp b/libcxx/test/std/containers/sequences/array/iterator_concept_conformance.compile.pass.cpp
index 5ab30616fb5b553..6e048aefc004bac 100644
--- a/libcxx/test/std/containers/sequences/array/iterator_concept_conformance.compile.pass.cpp
+++ b/libcxx/test/std/containers/sequences/array/iterator_concept_conformance.compile.pass.cpp
@@ -14,9 +14,9 @@
#include <iterator>
-using iterator = std::array<int, 10>::iterator;
-using const_iterator = std::array<int, 10>::const_iterator;
-using reverse_iterator = std::array<int, 10>::reverse_iterator;
+using iterator = std::array<int, 10>::iterator;
+using const_iterator = std::array<int, 10>::const_iterator;
+using reverse_iterator = std::array<int, 10>::reverse_iterator;
using const_reverse_iterator = std::array<int, 10>::const_reverse_iterator;
static_assert(std::contiguous_iterator<iterator>);
@@ -29,23 +29,23 @@ static_assert(std::sized_sentinel_for<iterator, iterator>);
static_assert(std::sized_sentinel_for<iterator, const_iterator>);
static_assert(!std::sized_sentinel_for<iterator, reverse_iterator>);
static_assert(!std::sized_sentinel_for<iterator, const_reverse_iterator>);
-static_assert( std::indirectly_movable<iterator, iterator>);
-static_assert( std::indirectly_movable_storable<iterator, iterator>);
+static_assert(std::indirectly_movable<iterator, iterator>);
+static_assert(std::indirectly_movable_storable<iterator, iterator>);
static_assert(!std::indirectly_movable<iterator, const_iterator>);
static_assert(!std::indirectly_movable_storable<iterator, const_iterator>);
-static_assert( std::indirectly_movable<iterator, reverse_iterator>);
-static_assert( std::indirectly_movable_storable<iterator, reverse_iterator>);
+static_assert(std::indirectly_movable<iterator, reverse_iterator>);
+static_assert(std::indirectly_movable_storable<iterator, reverse_iterator>);
static_assert(!std::indirectly_movable<iterator, const_reverse_iterator>);
static_assert(!std::indirectly_movable_storable<iterator, const_reverse_iterator>);
-static_assert( std::indirectly_copyable<iterator, iterator>);
-static_assert( std::indirectly_copyable_storable<iterator, iterator>);
+static_assert(std::indirectly_copyable<iterator, iterator>);
+static_assert(std::indirectly_copyable_storable<iterator, iterator>);
static_assert(!std::indirectly_copyable<iterator, const_iterator>);
static_assert(!std::indirectly_copyable_storable<iterator, const_iterator>);
-static_assert( std::indirectly_copyable<iterator, reverse_iterator>);
-static_assert( std::indirectly_copyable_storable<iterator, reverse_iterator>);
+static_assert(std::indirectly_copyable<iterator, reverse_iterator>);
+static_assert(std::indirectly_copyable_storable<iterator, reverse_iterator>);
static_assert(!std::indirectly_copyable<iterator, const_reverse_iterator>);
static_assert(!std::indirectly_copyable_storable<iterator, const_reverse_iterator>);
-static_assert( std::indirectly_swappable<iterator, iterator>);
+static_assert(std::indirectly_swappable<iterator, iterator>);
static_assert(std::contiguous_iterator<const_iterator>);
static_assert(!std::indirectly_writable<const_iterator, int>);
@@ -57,20 +57,20 @@ static_assert(std::sized_sentinel_for<const_iterator, iterator>);
static_assert(std::sized_sentinel_for<const_iterator, const_iterator>);
static_assert(!std::sized_sentinel_for<const_iterator, reverse_iterator>);
static_assert(!std::sized_sentinel_for<const_iterator, const_reverse_iterator>);
-static_assert( std::indirectly_movable<const_iterator, iterator>);
-static_assert( std::indirectly_movable_storable<const_iterator, iterator>);
+static_assert(std::indirectly_movable<const_iterator, iterator>);
+static_assert(std::indirectly_movable_storable<const_iterator, iterator>);
static_assert(!std::indirectly_movable<const_iterator, const_iterator>);
static_assert(!std::indirectly_movable_storable<const_iterator, const_iterator>);
-static_assert( std::indirectly_movable<const_iterator, reverse_iterator>);
-static_assert( std::indirectly_movable_storable<const_iterator, reverse_iterator>);
+static_assert(std::indirectly_movable<const_iterator, reverse_iterator>);
+static_assert(std::indirectly_movable_storable<const_iterator, reverse_iterator>);
static_assert(!std::indirectly_movable<const_iterator, const_reverse_iterator>);
static_assert(!std::indirectly_movable_storable<const_iterator, const_reverse_iterator>);
-static_assert( std::indirectly_copyable<const_iterator, iterator>);
-static_assert( std::indirectly_copyable_storable<const_iterator, iterator>);
+static_assert(std::indirectly_copyable<const_iterator, iterator>);
+static_assert(std::indirectly_copyable_storable<const_iterator, iterator>);
static_assert(!std::indirectly_copyable<const_iterator, const_iterator>);
static_assert(!std::indirectly_copyable_storable<const_iterator, const_iterator>);
-static_assert( std::indirectly_copyable<const_iterator, reverse_iterator>);
-static_assert( std::indirectly_copyable_storable<const_iterator, reverse_iterator>);
+static_assert(std::indirectly_copyable<const_iterator, reverse_iterator>);
+static_assert(std::indirectly_copyable_storable<const_iterator, reverse_iterator>);
static_assert(!std::indirectly_copyable<const_iterator, const_reverse_iterator>);
static_assert(!std::indirectly_copyable_storable<const_iterator, const_reverse_iterator>);
static_assert(!std::indirectly_swappable<const_iterator, const_iterator>);
diff --git a/libcxx/test/std/containers/sequences/array/iterators.pass.cpp b/libcxx/test/std/containers/sequences/array/iterators.pass.cpp
index 710994c68295ef3..f3857848358f04d 100644
--- a/libcxx/test/std/containers/sequences/array/iterators.pass.cpp
+++ b/libcxx/test/std/containers/sequences/array/iterators.pass.cpp
@@ -30,194 +30,193 @@
#include "test_macros.h"
struct NoDefault {
- TEST_CONSTEXPR NoDefault(int) { }
+ TEST_CONSTEXPR NoDefault(int) {}
};
template <class T>
TEST_CONSTEXPR_CXX17 void check_noexcept(T& c) {
- ASSERT_NOEXCEPT(c.begin());
- ASSERT_NOEXCEPT(c.end());
- ASSERT_NOEXCEPT(c.cbegin());
- ASSERT_NOEXCEPT(c.cend());
- ASSERT_NOEXCEPT(c.rbegin());
- ASSERT_NOEXCEPT(c.rend());
- ASSERT_NOEXCEPT(c.crbegin());
- ASSERT_NOEXCEPT(c.crend());
-
- const T& cc = c; (void)cc;
- ASSERT_NOEXCEPT(cc.begin());
- ASSERT_NOEXCEPT(cc.end());
- ASSERT_NOEXCEPT(cc.rbegin());
- ASSERT_NOEXCEPT(cc.rend());
+ ASSERT_NOEXCEPT(c.begin());
+ ASSERT_NOEXCEPT(c.end());
+ ASSERT_NOEXCEPT(c.cbegin());
+ ASSERT_NOEXCEPT(c.cend());
+ ASSERT_NOEXCEPT(c.rbegin());
+ ASSERT_NOEXCEPT(c.rend());
+ ASSERT_NOEXCEPT(c.crbegin());
+ ASSERT_NOEXCEPT(c.crend());
+
+ const T& cc = c;
+ (void)cc;
+ ASSERT_NOEXCEPT(cc.begin());
+ ASSERT_NOEXCEPT(cc.end());
+ ASSERT_NOEXCEPT(cc.rbegin());
+ ASSERT_NOEXCEPT(cc.rend());
}
-TEST_CONSTEXPR_CXX17 bool tests()
-{
- {
- typedef std::array<int, 5> C;
- C array = {};
- check_noexcept(array);
- typename C::iterator i = array.begin();
- typename C::const_iterator j = array.cbegin();
- assert(i == j);
- }
- {
- typedef std::array<int, 0> C;
- C array = {};
- check_noexcept(array);
- typename C::iterator i = array.begin();
- typename C::const_iterator j = array.cbegin();
- assert(i == j);
- }
-
- {
- typedef std::array<int, 0> C;
- C array = {};
- check_noexcept(array);
- typename C::iterator i = array.begin();
- typename C::const_iterator j = array.cbegin();
- assert(i == array.end());
- assert(j == array.cend());
- }
- {
- typedef std::array<int, 1> C;
- C array = {1};
- check_noexcept(array);
- typename C::iterator i = array.begin();
- assert(*i == 1);
- assert(&*i == array.data());
- *i = 99;
- assert(array[0] == 99);
- }
- {
- typedef std::array<int, 2> C;
- C array = {1, 2};
- check_noexcept(array);
- typename C::iterator i = array.begin();
- assert(*i == 1);
- assert(&*i == array.data());
- *i = 99;
- assert(array[0] == 99);
- assert(array[1] == 2);
- }
- {
- typedef std::array<double, 3> C;
- C array = {1, 2, 3.5};
- check_noexcept(array);
- typename C::iterator i = array.begin();
- assert(*i == 1);
- assert(&*i == array.data());
- *i = 5.5;
- assert(array[0] == 5.5);
- assert(array[1] == 2.0);
- }
- {
- typedef std::array<NoDefault, 0> C;
- C array = {};
- typename C::iterator ib = array.begin();
- typename C::iterator ie = array.end();
- assert(ib == ie);
- }
+TEST_CONSTEXPR_CXX17 bool tests() {
+ {
+ typedef std::array<int, 5> C;
+ C array = {};
+ check_noexcept(array);
+ typename C::iterator i = array.begin();
+ typename C::const_iterator j = array.cbegin();
+ assert(i == j);
+ }
+ {
+ typedef std::array<int, 0> C;
+ C array = {};
+ check_noexcept(array);
+ typename C::iterator i = array.begin();
+ typename C::const_iterator j = array.cbegin();
+ assert(i == j);
+ }
+
+ {
+ typedef std::array<int, 0> C;
+ C array = {};
+ check_noexcept(array);
+ typename C::iterator i = array.begin();
+ typename C::const_iterator j = array.cbegin();
+ assert(i == array.end());
+ assert(j == array.cend());
+ }
+ {
+ typedef std::array<int, 1> C;
+ C array = {1};
+ check_noexcept(array);
+ typename C::iterator i = array.begin();
+ assert(*i == 1);
+ assert(&*i == array.data());
+ *i = 99;
+ assert(array[0] == 99);
+ }
+ {
+ typedef std::array<int, 2> C;
+ C array = {1, 2};
+ check_noexcept(array);
+ typename C::iterator i = array.begin();
+ assert(*i == 1);
+ assert(&*i == array.data());
+ *i = 99;
+ assert(array[0] == 99);
+ assert(array[1] == 2);
+ }
+ {
+ typedef std::array<double, 3> C;
+ C array = {1, 2, 3.5};
+ check_noexcept(array);
+ typename C::iterator i = array.begin();
+ assert(*i == 1);
+ assert(&*i == array.data());
+ *i = 5.5;
+ assert(array[0] == 5.5);
+ assert(array[1] == 2.0);
+ }
+ {
+ typedef std::array<NoDefault, 0> C;
+ C array = {};
+ typename C::iterator ib = array.begin();
+ typename C::iterator ie = array.end();
+ assert(ib == ie);
+ }
#if TEST_STD_VER >= 14
- { // N3644 testing
- {
- typedef std::array<int, 5> C;
- C::iterator ii1{}, ii2{};
- C::iterator ii4 = ii1;
- C::const_iterator cii{};
- assert(ii1 == ii2);
- assert(ii1 == ii4);
- assert(ii1 == cii);
-
- assert(!(ii1 != ii2));
- assert(!(ii1 != cii));
-
- C c = {};
- check_noexcept(c);
- assert(c.begin() == std::begin(c));
- assert(c.cbegin() == std::cbegin(c));
- assert(c.rbegin() == std::rbegin(c));
- assert(c.crbegin() == std::crbegin(c));
- assert(c.end() == std::end(c));
- assert(c.cend() == std::cend(c));
- assert(c.rend() == std::rend(c));
- assert(c.crend() == std::crend(c));
-
- assert(std::begin(c) != std::end(c));
- assert(std::rbegin(c) != std::rend(c));
- assert(std::cbegin(c) != std::cend(c));
- assert(std::crbegin(c) != std::crend(c));
+ { // N3644 testing
+ {
+ typedef std::array<int, 5> C;
+ C::iterator ii1{}, ii2{};
+ C::iterator ii4 = ii1;
+ C::const_iterator cii{};
+ assert(ii1 == ii2);
+ assert(ii1 == ii4);
+ assert(ii1 == cii);
+
+ assert(!(ii1 != ii2));
+ assert(!(ii1 != cii));
+
+ C c = {};
+ check_noexcept(c);
+ assert(c.begin() == std::begin(c));
+ assert(c.cbegin() == std::cbegin(c));
+ assert(c.rbegin() == std::rbegin(c));
+ assert(c.crbegin() == std::crbegin(c));
+ assert(c.end() == std::end(c));
+ assert(c.cend() == std::cend(c));
+ assert(c.rend() == std::rend(c));
+ assert(c.crend() == std::crend(c));
+
+ assert(std::begin(c) != std::end(c));
+ assert(std::rbegin(c) != std::rend(c));
+ assert(std::cbegin(c) != std::cend(c));
+ assert(std::crbegin(c) != std::crend(c));
# if TEST_STD_VER >= 20
- // P1614 + LWG3352
- std::same_as<std::strong_ordering> decltype(auto) r1 = ii1 <=> ii2;
- assert(r1 == std::strong_ordering::equal);
+ // P1614 + LWG3352
+ std::same_as<std::strong_ordering> decltype(auto) r1 = ii1 <=> ii2;
+ assert(r1 == std::strong_ordering::equal);
- std::same_as<std::strong_ordering> decltype(auto) r2 = cii <=> ii2;
- assert(r2 == std::strong_ordering::equal);
+ std::same_as<std::strong_ordering> decltype(auto) r2 = cii <=> ii2;
+ assert(r2 == std::strong_ordering::equal);
# endif
- }
- {
- typedef std::array<int, 0> C;
- C::iterator ii1{}, ii2{};
- C::iterator ii4 = ii1;
- C::const_iterator cii{};
- assert(ii1 == ii2);
- assert(ii1 == ii4);
-
- assert(!(ii1 != ii2));
-
- assert( (ii1 == cii));
- assert( (cii == ii1));
- assert(!(ii1 != cii));
- assert(!(cii != ii1));
- assert(!(ii1 < cii));
- assert(!(cii < ii1));
- assert( (ii1 <= cii));
- assert( (cii <= ii1));
- assert(!(ii1 > cii));
- assert(!(cii > ii1));
- assert( (ii1 >= cii));
- assert( (cii >= ii1));
- assert(cii - ii1 == 0);
- assert(ii1 - cii == 0);
-
- C c = {};
- check_noexcept(c);
- assert(c.begin() == std::begin(c));
- assert(c.cbegin() == std::cbegin(c));
- assert(c.rbegin() == std::rbegin(c));
- assert(c.crbegin() == std::crbegin(c));
- assert(c.end() == std::end(c));
- assert(c.cend() == std::cend(c));
- assert(c.rend() == std::rend(c));
- assert(c.crend() == std::crend(c));
-
- assert(std::begin(c) == std::end(c));
- assert(std::rbegin(c) == std::rend(c));
- assert(std::cbegin(c) == std::cend(c));
- assert(std::crbegin(c) == std::crend(c));
+ }
+ {
+ typedef std::array<int, 0> C;
+ C::iterator ii1{}, ii2{};
+ C::iterator ii4 = ii1;
+ C::const_iterator cii{};
+ assert(ii1 == ii2);
+ assert(ii1 == ii4);
+
+ assert(!(ii1 != ii2));
+
+ assert((ii1 == cii));
+ assert((cii == ii1));
+ assert(!(ii1 != cii));
+ assert(!(cii != ii1));
+ assert(!(ii1 < cii));
+ assert(!(cii < ii1));
+ assert((ii1 <= cii));
+ assert((cii <= ii1));
+ assert(!(ii1 > cii));
+ assert(!(cii > ii1));
+ assert((ii1 >= cii));
+ assert((cii >= ii1));
+ assert(cii - ii1 == 0);
+ assert(ii1 - cii == 0);
+
+ C c = {};
+ check_noexcept(c);
+ assert(c.begin() == std::begin(c));
+ assert(c.cbegin() == std::cbegin(c));
+ assert(c.rbegin() == std::rbegin(c));
+ assert(c.crbegin() == std::crbegin(c));
+ assert(c.end() == std::end(c));
+ assert(c.cend() == std::cend(c));
+ assert(c.rend() == std::rend(c));
+ assert(c.crend() == std::crend(c));
+
+ assert(std::begin(c) == std::end(c));
+ assert(std::rbegin(c) == std::rend(c));
+ assert(std::cbegin(c) == std::cend(c));
+ assert(std::crbegin(c) == std::crend(c));
# if TEST_STD_VER >= 20
- // P1614 + LWG3352
- std::same_as<std::strong_ordering> decltype(auto) r1 = ii1 <=> ii2;
- assert(r1 == std::strong_ordering::equal);
+ // P1614 + LWG3352
+ std::same_as<std::strong_ordering> decltype(auto) r1 = ii1 <=> ii2;
+ assert(r1 == std::strong_ordering::equal);
- std::same_as<std::strong_ordering> decltype(auto) r2 = cii <=> ii2;
- assert(r2 == std::strong_ordering::equal);
+ std::same_as<std::strong_ordering> decltype(auto) r2 = cii <=> ii2;
+ assert(r2 == std::strong_ordering::equal);
# endif
- }
}
+ }
#endif
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER >= 17
- static_assert(tests(), "");
+ static_assert(tests(), "");
#endif
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/array/max_size.pass.cpp b/libcxx/test/std/containers/sequences/array/max_size.pass.cpp
index 8ca8cd44725e2dd..af6f25559b8ddca 100644
--- a/libcxx/test/std/containers/sequences/array/max_size.pass.cpp
+++ b/libcxx/test/std/containers/sequences/array/max_size.pass.cpp
@@ -17,38 +17,36 @@
#include "test_macros.h"
-TEST_CONSTEXPR_CXX14 bool tests()
-{
- {
- typedef std::array<int, 2> C;
- C c = {};
- ASSERT_NOEXCEPT(c.max_size());
- assert(c.max_size() == 2);
- }
- {
- typedef std::array<int, 0> C;
- C c = {};
- ASSERT_NOEXCEPT(c.max_size());
- assert(c.max_size() == 0);
- }
-
- return true;
+TEST_CONSTEXPR_CXX14 bool tests() {
+ {
+ typedef std::array<int, 2> C;
+ C c = {};
+ ASSERT_NOEXCEPT(c.max_size());
+ assert(c.max_size() == 2);
+ }
+ {
+ typedef std::array<int, 0> C;
+ C c = {};
+ ASSERT_NOEXCEPT(c.max_size());
+ assert(c.max_size() == 0);
+ }
+
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER >= 14
- static_assert(tests(), "");
+ static_assert(tests(), "");
#endif
#if TEST_STD_VER >= 11
- // Sanity check for constexpr in C++11
- {
- constexpr std::array<int, 3> array = {};
- static_assert(array.max_size() == 3, "");
- }
+ // Sanity check for constexpr in C++11
+ {
+ constexpr std::array<int, 3> array = {};
+ static_assert(array.max_size() == 3, "");
+ }
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/array/range_concept_conformance.compile.pass.cpp b/libcxx/test/std/containers/sequences/array/range_concept_conformance.compile.pass.cpp
index 6e3f2a2801a2b4f..a398968d213b3c8 100644
--- a/libcxx/test/std/containers/sequences/array/range_concept_conformance.compile.pass.cpp
+++ b/libcxx/test/std/containers/sequences/array/range_concept_conformance.compile.pass.cpp
@@ -17,7 +17,6 @@
using range = std::array<int, 10>;
-
static_assert(!std::ranges::view<range>);
static_assert(std::same_as<std::ranges::iterator_t<range>, range::iterator>);
static_assert(std::ranges::common_range<range>);
diff --git a/libcxx/test/std/containers/sequences/array/types.pass.cpp b/libcxx/test/std/containers/sequences/array/types.pass.cpp
index c50981050796275..f216d3ed1584926 100644
--- a/libcxx/test/std/containers/sequences/array/types.pass.cpp
+++ b/libcxx/test/std/containers/sequences/array/types.pass.cpp
@@ -32,63 +32,66 @@
template <class C>
void test_iterators() {
- typedef std::iterator_traits<typename C::iterator> ItT;
- typedef std::iterator_traits<typename C::const_iterator> CItT;
- static_assert((std::is_same<typename ItT::iterator_category, std::random_access_iterator_tag>::value), "");
- static_assert((std::is_same<typename ItT::value_type, typename C::value_type>::value), "");
- static_assert((std::is_same<typename ItT::reference, typename C::reference>::value), "");
- static_assert((std::is_same<typename ItT::pointer, typename C::pointer>::value), "");
- static_assert((std::is_same<typename ItT::
diff erence_type, typename C::
diff erence_type>::value), "");
+ typedef std::iterator_traits<typename C::iterator> ItT;
+ typedef std::iterator_traits<typename C::const_iterator> CItT;
+ static_assert((std::is_same<typename ItT::iterator_category, std::random_access_iterator_tag>::value), "");
+ static_assert((std::is_same<typename ItT::value_type, typename C::value_type>::value), "");
+ static_assert((std::is_same<typename ItT::reference, typename C::reference>::value), "");
+ static_assert((std::is_same<typename ItT::pointer, typename C::pointer>::value), "");
+ static_assert((std::is_same<typename ItT::
diff erence_type, typename C::
diff erence_type>::value), "");
- static_assert((std::is_same<typename CItT::iterator_category, std::random_access_iterator_tag>::value), "");
- static_assert((std::is_same<typename CItT::value_type, typename C::value_type>::value), "");
- static_assert((std::is_same<typename CItT::reference, typename C::const_reference>::value), "");
- static_assert((std::is_same<typename CItT::pointer, typename C::const_pointer>::value), "");
- static_assert((std::is_same<typename CItT::
diff erence_type, typename C::
diff erence_type>::value), "");
+ static_assert((std::is_same<typename CItT::iterator_category, std::random_access_iterator_tag>::value), "");
+ static_assert((std::is_same<typename CItT::value_type, typename C::value_type>::value), "");
+ static_assert((std::is_same<typename CItT::reference, typename C::const_reference>::value), "");
+ static_assert((std::is_same<typename CItT::pointer, typename C::const_pointer>::value), "");
+ static_assert((std::is_same<typename CItT::
diff erence_type, typename C::
diff erence_type>::value), "");
}
-int main(int, char**)
-{
- {
- typedef double T;
- typedef std::array<T, 10> C;
- static_assert((std::is_same<C::reference, T&>::value), "");
- static_assert((std::is_same<C::const_reference, const T&>::value), "");
- test_iterators<C>();
- static_assert((std::is_same<C::pointer, T*>::value), "");
- static_assert((std::is_same<C::const_pointer, const T*>::value), "");
- static_assert((std::is_same<C::size_type, std::size_t>::value), "");
- static_assert((std::is_same<C::
diff erence_type, std::ptr
diff _t>::value), "");
- static_assert((std::is_same<C::reverse_iterator, std::reverse_iterator<C::iterator> >::value), "");
- static_assert((std::is_same<C::const_reverse_iterator, std::reverse_iterator<C::const_iterator> >::value), "");
+int main(int, char**) {
+ {
+ typedef double T;
+ typedef std::array<T, 10> C;
+ static_assert((std::is_same<C::reference, T&>::value), "");
+ static_assert((std::is_same<C::const_reference, const T&>::value), "");
+ test_iterators<C>();
+ static_assert((std::is_same<C::pointer, T*>::value), "");
+ static_assert((std::is_same<C::const_pointer, const T*>::value), "");
+ static_assert((std::is_same<C::size_type, std::size_t>::value), "");
+ static_assert((std::is_same<C::
diff erence_type, std::ptr
diff _t>::value), "");
+ static_assert((std::is_same<C::reverse_iterator, std::reverse_iterator<C::iterator> >::value), "");
+ static_assert((std::is_same<C::const_reverse_iterator, std::reverse_iterator<C::const_iterator> >::value), "");
- static_assert((std::is_signed<typename C::
diff erence_type>::value), "");
- static_assert((std::is_unsigned<typename C::size_type>::value), "");
- static_assert((std::is_same<typename C::
diff erence_type,
- typename std::iterator_traits<typename C::iterator>::
diff erence_type>::value), "");
- static_assert((std::is_same<typename C::
diff erence_type,
- typename std::iterator_traits<typename C::const_iterator>::
diff erence_type>::value), "");
- }
- {
- typedef int* T;
- typedef std::array<T, 0> C;
- static_assert((std::is_same<C::reference, T&>::value), "");
- static_assert((std::is_same<C::const_reference, const T&>::value), "");
- test_iterators<C>();
- static_assert((std::is_same<C::pointer, T*>::value), "");
- static_assert((std::is_same<C::const_pointer, const T*>::value), "");
- static_assert((std::is_same<C::size_type, std::size_t>::value), "");
- static_assert((std::is_same<C::
diff erence_type, std::ptr
diff _t>::value), "");
- static_assert((std::is_same<C::reverse_iterator, std::reverse_iterator<C::iterator> >::value), "");
- static_assert((std::is_same<C::const_reverse_iterator, std::reverse_iterator<C::const_iterator> >::value), "");
+ static_assert((std::is_signed<typename C::
diff erence_type>::value), "");
+ static_assert((std::is_unsigned<typename C::size_type>::value), "");
+ static_assert((std::is_same<typename C::
diff erence_type,
+ typename std::iterator_traits<typename C::iterator>::
diff erence_type>::value),
+ "");
+ static_assert((std::is_same<typename C::
diff erence_type,
+ typename std::iterator_traits<typename C::const_iterator>::
diff erence_type>::value),
+ "");
+ }
+ {
+ typedef int* T;
+ typedef std::array<T, 0> C;
+ static_assert((std::is_same<C::reference, T&>::value), "");
+ static_assert((std::is_same<C::const_reference, const T&>::value), "");
+ test_iterators<C>();
+ static_assert((std::is_same<C::pointer, T*>::value), "");
+ static_assert((std::is_same<C::const_pointer, const T*>::value), "");
+ static_assert((std::is_same<C::size_type, std::size_t>::value), "");
+ static_assert((std::is_same<C::
diff erence_type, std::ptr
diff _t>::value), "");
+ static_assert((std::is_same<C::reverse_iterator, std::reverse_iterator<C::iterator> >::value), "");
+ static_assert((std::is_same<C::const_reverse_iterator, std::reverse_iterator<C::const_iterator> >::value), "");
- static_assert((std::is_signed<typename C::
diff erence_type>::value), "");
- static_assert((std::is_unsigned<typename C::size_type>::value), "");
- static_assert((std::is_same<typename C::
diff erence_type,
- typename std::iterator_traits<typename C::iterator>::
diff erence_type>::value), "");
- static_assert((std::is_same<typename C::
diff erence_type,
- typename std::iterator_traits<typename C::const_iterator>::
diff erence_type>::value), "");
- }
+ static_assert((std::is_signed<typename C::
diff erence_type>::value), "");
+ static_assert((std::is_unsigned<typename C::size_type>::value), "");
+ static_assert((std::is_same<typename C::
diff erence_type,
+ typename std::iterator_traits<typename C::iterator>::
diff erence_type>::value),
+ "");
+ static_assert((std::is_same<typename C::
diff erence_type,
+ typename std::iterator_traits<typename C::const_iterator>::
diff erence_type>::value),
+ "");
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/deque/allocator_mismatch.verify.cpp b/libcxx/test/std/containers/sequences/deque/allocator_mismatch.verify.cpp
index 1096e1dc7136926..81648cb1624c130 100644
--- a/libcxx/test/std/containers/sequences/deque/allocator_mismatch.verify.cpp
+++ b/libcxx/test/std/containers/sequences/deque/allocator_mismatch.verify.cpp
@@ -12,4 +12,4 @@
#include <deque>
std::deque<int, std::allocator<long> > d;
- // expected-error-re@*:* {{static assertion failed{{.*}}Allocator::value_type must be same type as value_type}}
+// expected-error-re@*:* {{static assertion failed{{.*}}Allocator::value_type must be same type as value_type}}
diff --git a/libcxx/test/std/containers/sequences/deque/compare.pass.cpp b/libcxx/test/std/containers/sequences/deque/compare.pass.cpp
index fc7c07e2d0d48d7..526e3d38e7dff41 100644
--- a/libcxx/test/std/containers/sequences/deque/compare.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/compare.pass.cpp
@@ -37,83 +37,82 @@
#include "test_comparisons.h"
-int main(int, char**)
-{
- {
- const std::deque<int> d1, d2;
- assert(testComparisons(d1, d2, true, false));
- }
- {
- const std::deque<int> d1(1, 1), d2(1, 1);
- assert(testComparisons(d1, d2, true, false));
- }
- {
- int items[3] = {1, 2, 3};
- const std::deque<int> d1(items, items + 3);
- const std::deque<int> d2(items, items + 3);
- assert(testComparisons(d1, d2, true, false));
- }
- {
- const std::deque<int> d1(1, 1), d2;
- assert(testComparisons(d1, d2, false, false));
- }
- {
- const std::deque<int> d1(1, 1), d2(1, 2);
- assert(testComparisons(d1, d2, false, true));
- }
- {
- int items1[2] = {1, 2};
- int items2[2] = {1, 3};
- const std::deque<int> d1(items1, items1 + 2);
- const std::deque<int> d2(items2, items2 + 2);
- assert(testComparisons(d1, d2, false, true));
- }
- {
- int items1[2] = {2, 2};
- int items2[2] = {1, 3};
- const std::deque<int> d1(items1, items1 + 2);
- const std::deque<int> d2(items2, items2 + 2);
- assert(testComparisons(d1, d2, false, false));
- }
- {
- const std::deque<LessAndEqComp> d1, d2;
- assert(testComparisons(d1, d2, true, false));
- }
- {
- const std::deque<LessAndEqComp> d1(1, LessAndEqComp(1));
- const std::deque<LessAndEqComp> d2(1, LessAndEqComp(1));
- assert(testComparisons(d1, d2, true, false));
- }
- {
- LessAndEqComp items[3] = {LessAndEqComp(1), LessAndEqComp(2), LessAndEqComp(3)};
- const std::deque<LessAndEqComp> d1(items, items + 3);
- const std::deque<LessAndEqComp> d2(items, items + 3);
- assert(testComparisons(d1, d2, true, false));
- }
- {
- const std::deque<LessAndEqComp> d1(1, LessAndEqComp(1));
- const std::deque<LessAndEqComp> d2;
- assert(testComparisons(d1, d2, false, false));
- }
- {
- const std::deque<LessAndEqComp> d1(1, LessAndEqComp(1));
- const std::deque<LessAndEqComp> d2(1, LessAndEqComp(2));
- assert(testComparisons(d1, d2, false, true));
- }
- {
- LessAndEqComp items1[2] = {LessAndEqComp(1), LessAndEqComp(2)};
- LessAndEqComp items2[2] = {LessAndEqComp(1), LessAndEqComp(3)};
- const std::deque<LessAndEqComp> d1(items1, items1 + 2);
- const std::deque<LessAndEqComp> d2(items2, items2 + 2);
- assert(testComparisons(d1, d2, false, true));
- }
- {
- LessAndEqComp items1[2] = {LessAndEqComp(2), LessAndEqComp(2)};
- LessAndEqComp items2[2] = {LessAndEqComp(1), LessAndEqComp(3)};
- const std::deque<LessAndEqComp> d1(items1, items1 + 2);
- const std::deque<LessAndEqComp> d2(items2, items2 + 2);
- assert(testComparisons(d1, d2, false, false));
- }
+int main(int, char**) {
+ {
+ const std::deque<int> d1, d2;
+ assert(testComparisons(d1, d2, true, false));
+ }
+ {
+ const std::deque<int> d1(1, 1), d2(1, 1);
+ assert(testComparisons(d1, d2, true, false));
+ }
+ {
+ int items[3] = {1, 2, 3};
+ const std::deque<int> d1(items, items + 3);
+ const std::deque<int> d2(items, items + 3);
+ assert(testComparisons(d1, d2, true, false));
+ }
+ {
+ const std::deque<int> d1(1, 1), d2;
+ assert(testComparisons(d1, d2, false, false));
+ }
+ {
+ const std::deque<int> d1(1, 1), d2(1, 2);
+ assert(testComparisons(d1, d2, false, true));
+ }
+ {
+ int items1[2] = {1, 2};
+ int items2[2] = {1, 3};
+ const std::deque<int> d1(items1, items1 + 2);
+ const std::deque<int> d2(items2, items2 + 2);
+ assert(testComparisons(d1, d2, false, true));
+ }
+ {
+ int items1[2] = {2, 2};
+ int items2[2] = {1, 3};
+ const std::deque<int> d1(items1, items1 + 2);
+ const std::deque<int> d2(items2, items2 + 2);
+ assert(testComparisons(d1, d2, false, false));
+ }
+ {
+ const std::deque<LessAndEqComp> d1, d2;
+ assert(testComparisons(d1, d2, true, false));
+ }
+ {
+ const std::deque<LessAndEqComp> d1(1, LessAndEqComp(1));
+ const std::deque<LessAndEqComp> d2(1, LessAndEqComp(1));
+ assert(testComparisons(d1, d2, true, false));
+ }
+ {
+ LessAndEqComp items[3] = {LessAndEqComp(1), LessAndEqComp(2), LessAndEqComp(3)};
+ const std::deque<LessAndEqComp> d1(items, items + 3);
+ const std::deque<LessAndEqComp> d2(items, items + 3);
+ assert(testComparisons(d1, d2, true, false));
+ }
+ {
+ const std::deque<LessAndEqComp> d1(1, LessAndEqComp(1));
+ const std::deque<LessAndEqComp> d2;
+ assert(testComparisons(d1, d2, false, false));
+ }
+ {
+ const std::deque<LessAndEqComp> d1(1, LessAndEqComp(1));
+ const std::deque<LessAndEqComp> d2(1, LessAndEqComp(2));
+ assert(testComparisons(d1, d2, false, true));
+ }
+ {
+ LessAndEqComp items1[2] = {LessAndEqComp(1), LessAndEqComp(2)};
+ LessAndEqComp items2[2] = {LessAndEqComp(1), LessAndEqComp(3)};
+ const std::deque<LessAndEqComp> d1(items1, items1 + 2);
+ const std::deque<LessAndEqComp> d2(items2, items2 + 2);
+ assert(testComparisons(d1, d2, false, true));
+ }
+ {
+ LessAndEqComp items1[2] = {LessAndEqComp(2), LessAndEqComp(2)};
+ LessAndEqComp items2[2] = {LessAndEqComp(1), LessAndEqComp(3)};
+ const std::deque<LessAndEqComp> d1(items1, items1 + 2);
+ const std::deque<LessAndEqComp> d2(items2, items2 + 2);
+ assert(testComparisons(d1, d2, false, false));
+ }
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/deque/deque.capacity/access.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.capacity/access.pass.cpp
index add0456cdbe4e18..294663c5bd356bc 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.capacity/access.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.capacity/access.pass.cpp
@@ -29,98 +29,94 @@
#include "test_macros.h"
template <class C>
-C
-make(int size, int start = 0 )
-{
- const int b = 4096 / sizeof(int);
- int init = 0;
- if (start > 0)
- {
- init = (start+1) / b + ((start+1) % b != 0);
- init *= b;
- --init;
- }
- C c(init, 0);
- for (int i = 0; i < init-start; ++i)
- c.pop_back();
- for (int i = 0; i < size; ++i)
- c.push_back(i);
- for (int i = 0; i < start; ++i)
- c.pop_front();
- return c;
+C make(int size, int start = 0) {
+ const int b = 4096 / sizeof(int);
+ int init = 0;
+ if (start > 0) {
+ init = (start + 1) / b + ((start + 1) % b != 0);
+ init *= b;
+ --init;
+ }
+ C c(init, 0);
+ for (int i = 0; i < init - start; ++i)
+ c.pop_back();
+ for (int i = 0; i < size; ++i)
+ c.push_back(i);
+ for (int i = 0; i < start; ++i)
+ c.pop_front();
+ return c;
}
-int main(int, char**)
-{
- {
- typedef std::deque<int> C;
- C c = make<std::deque<int> >(10);
- ASSERT_SAME_TYPE(decltype(c[0]), C::reference);
- LIBCPP_ASSERT_NOEXCEPT( c[0]);
- LIBCPP_ASSERT_NOEXCEPT( c.front());
- ASSERT_SAME_TYPE(decltype(c.front()), C::reference);
- LIBCPP_ASSERT_NOEXCEPT( c.back());
- ASSERT_SAME_TYPE(decltype(c.back()), C::reference);
- for (int i = 0; i < 10; ++i)
- assert(c[i] == i);
- for (int i = 0; i < 10; ++i)
- assert(c.at(i) == i);
- assert(c.front() == 0);
- assert(c.back() == 9);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
- }
- {
- typedef std::deque<int> C;
- const C c = make<std::deque<int> >(10);
- ASSERT_SAME_TYPE(decltype(c[0]), C::const_reference);
- LIBCPP_ASSERT_NOEXCEPT( c[0]);
- LIBCPP_ASSERT_NOEXCEPT( c.front());
- ASSERT_SAME_TYPE(decltype(c.front()), C::const_reference);
- LIBCPP_ASSERT_NOEXCEPT( c.back());
- ASSERT_SAME_TYPE(decltype(c.back()), C::const_reference);
- for (int i = 0; i < 10; ++i)
- assert(c[i] == i);
- for (int i = 0; i < 10; ++i)
- assert(c.at(i) == i);
- assert(c.front() == 0);
- assert(c.back() == 9);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
- }
+int main(int, char**) {
+ {
+ typedef std::deque<int> C;
+ C c = make<std::deque<int> >(10);
+ ASSERT_SAME_TYPE(decltype(c[0]), C::reference);
+ LIBCPP_ASSERT_NOEXCEPT(c[0]);
+ LIBCPP_ASSERT_NOEXCEPT(c.front());
+ ASSERT_SAME_TYPE(decltype(c.front()), C::reference);
+ LIBCPP_ASSERT_NOEXCEPT(c.back());
+ ASSERT_SAME_TYPE(decltype(c.back()), C::reference);
+ for (int i = 0; i < 10; ++i)
+ assert(c[i] == i);
+ for (int i = 0; i < 10; ++i)
+ assert(c.at(i) == i);
+ assert(c.front() == 0);
+ assert(c.back() == 9);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
+ }
+ {
+ typedef std::deque<int> C;
+ const C c = make<std::deque<int> >(10);
+ ASSERT_SAME_TYPE(decltype(c[0]), C::const_reference);
+ LIBCPP_ASSERT_NOEXCEPT(c[0]);
+ LIBCPP_ASSERT_NOEXCEPT(c.front());
+ ASSERT_SAME_TYPE(decltype(c.front()), C::const_reference);
+ LIBCPP_ASSERT_NOEXCEPT(c.back());
+ ASSERT_SAME_TYPE(decltype(c.back()), C::const_reference);
+ for (int i = 0; i < 10; ++i)
+ assert(c[i] == i);
+ for (int i = 0; i < 10; ++i)
+ assert(c.at(i) == i);
+ assert(c.front() == 0);
+ assert(c.back() == 9);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::deque<int, min_allocator<int>> C;
- C c = make<std::deque<int, min_allocator<int>> >(10);
- ASSERT_SAME_TYPE(decltype(c[0]), C::reference);
- LIBCPP_ASSERT_NOEXCEPT( c[0]);
- LIBCPP_ASSERT_NOEXCEPT( c.front());
- ASSERT_SAME_TYPE(decltype(c.front()), C::reference);
- LIBCPP_ASSERT_NOEXCEPT( c.back());
- ASSERT_SAME_TYPE(decltype(c.back()), C::reference);
- for (int i = 0; i < 10; ++i)
- assert(c[i] == i);
- for (int i = 0; i < 10; ++i)
- assert(c.at(i) == i);
- assert(c.front() == 0);
- assert(c.back() == 9);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
- }
- {
- typedef std::deque<int, min_allocator<int>> C;
- const C c = make<std::deque<int, min_allocator<int>> >(10);
- ASSERT_SAME_TYPE(decltype(c[0]), C::const_reference);
- LIBCPP_ASSERT_NOEXCEPT( c[0]);
- LIBCPP_ASSERT_NOEXCEPT( c.front());
- ASSERT_SAME_TYPE(decltype(c.front()), C::const_reference);
- LIBCPP_ASSERT_NOEXCEPT( c.back());
- ASSERT_SAME_TYPE(decltype(c.back()), C::const_reference);
- for (int i = 0; i < 10; ++i)
- assert(c[i] == i);
- for (int i = 0; i < 10; ++i)
- assert(c.at(i) == i);
- assert(c.front() == 0);
- assert(c.back() == 9);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
- }
+ {
+ typedef std::deque<int, min_allocator<int>> C;
+ C c = make<std::deque<int, min_allocator<int>> >(10);
+ ASSERT_SAME_TYPE(decltype(c[0]), C::reference);
+ LIBCPP_ASSERT_NOEXCEPT(c[0]);
+ LIBCPP_ASSERT_NOEXCEPT(c.front());
+ ASSERT_SAME_TYPE(decltype(c.front()), C::reference);
+ LIBCPP_ASSERT_NOEXCEPT(c.back());
+ ASSERT_SAME_TYPE(decltype(c.back()), C::reference);
+ for (int i = 0; i < 10; ++i)
+ assert(c[i] == i);
+ for (int i = 0; i < 10; ++i)
+ assert(c.at(i) == i);
+ assert(c.front() == 0);
+ assert(c.back() == 9);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
+ }
+ {
+ typedef std::deque<int, min_allocator<int>> C;
+ const C c = make<std::deque<int, min_allocator<int>> >(10);
+ ASSERT_SAME_TYPE(decltype(c[0]), C::const_reference);
+ LIBCPP_ASSERT_NOEXCEPT(c[0]);
+ LIBCPP_ASSERT_NOEXCEPT(c.front());
+ ASSERT_SAME_TYPE(decltype(c.front()), C::const_reference);
+ LIBCPP_ASSERT_NOEXCEPT(c.back());
+ ASSERT_SAME_TYPE(decltype(c.back()), C::const_reference);
+ for (int i = 0; i < 10; ++i)
+ assert(c[i] == i);
+ for (int i = 0; i < 10; ++i)
+ assert(c.at(i) == i);
+ assert(c.front() == 0);
+ assert(c.back() == 9);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/deque/deque.capacity/empty.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.capacity/empty.pass.cpp
index 57393061c4bac8c..5e3a6ec1cea8260 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.capacity/empty.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.capacity/empty.pass.cpp
@@ -19,9 +19,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::deque<int> C;
C c;
ASSERT_NOEXCEPT(c.empty());
@@ -32,9 +31,9 @@ int main(int, char**)
c.clear();
assert(c.empty());
LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::deque<int, min_allocator<int>> C;
C c;
ASSERT_NOEXCEPT(c.empty());
@@ -45,7 +44,7 @@ int main(int, char**)
c.clear();
assert(c.empty());
LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/deque/deque.capacity/empty.verify.cpp b/libcxx/test/std/containers/sequences/deque/deque.capacity/empty.verify.cpp
index a2295088c0a9b7f..9bf3180eb4d8a71 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.capacity/empty.verify.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.capacity/empty.verify.cpp
@@ -17,6 +17,6 @@
#include <deque>
void f() {
- std::deque<int> c;
- c.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::deque<int> c;
+ c.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}
diff --git a/libcxx/test/std/containers/sequences/deque/deque.capacity/max_size.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.capacity/max_size.pass.cpp
index 6f1d0f049126460..39feabe3889b3ee 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.capacity/max_size.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.capacity/max_size.pass.cpp
@@ -31,8 +31,7 @@ int main(int, char**) {
{
typedef limited_allocator<int, (std::size_t)-1> A;
typedef std::deque<int, A> C;
- const C::size_type max_dist =
- static_cast<C::size_type>(std::numeric_limits<C::
diff erence_type>::max());
+ const C::size_type max_dist = static_cast<C::size_type>(std::numeric_limits<C::
diff erence_type>::max());
C c;
assert(c.max_size() <= max_dist);
LIBCPP_ASSERT(c.max_size() == max_dist);
@@ -40,8 +39,7 @@ int main(int, char**) {
}
{
typedef std::deque<char> C;
- const C::size_type max_dist =
- static_cast<C::size_type>(std::numeric_limits<C::
diff erence_type>::max());
+ const C::size_type max_dist = static_cast<C::size_type>(std::numeric_limits<C::
diff erence_type>::max());
C c;
assert(c.max_size() <= max_dist);
assert(c.max_size() <= alloc_max_size(c.get_allocator()));
diff --git a/libcxx/test/std/containers/sequences/deque/deque.capacity/resize_size.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.capacity/resize_size.pass.cpp
index a38dd60bd18611e..767fe7ae8864eed 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.capacity/resize_size.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.capacity/resize_size.pass.cpp
@@ -21,82 +21,74 @@
#include "min_allocator.h"
template <class C>
-C
-make(int size, int start = 0 )
-{
- const int b = 4096 / sizeof(int);
- int init = 0;
- if (start > 0)
- {
- init = (start+1) / b + ((start+1) % b != 0);
- init *= b;
- --init;
- }
- C c(init, 0);
- for (int i = 0; i < init-start; ++i)
- c.pop_back();
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
- for (int i = 0; i < size; ++i)
- c.push_back(i);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
- for (int i = 0; i < start; ++i)
- c.pop_front();
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
- return c;
+C make(int size, int start = 0) {
+ const int b = 4096 / sizeof(int);
+ int init = 0;
+ if (start > 0) {
+ init = (start + 1) / b + ((start + 1) % b != 0);
+ init *= b;
+ --init;
+ }
+ C c(init, 0);
+ for (int i = 0; i < init - start; ++i)
+ c.pop_back();
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
+ for (int i = 0; i < size; ++i)
+ c.push_back(i);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
+ for (int i = 0; i < start; ++i)
+ c.pop_front();
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
+ return c;
}
template <class C>
-void
-test(C& c1, int size)
-{
- typedef typename C::const_iterator CI;
- typename C::size_type c1_osize = c1.size();
- c1.resize(size);
- assert(c1.size() == static_cast<std::size_t>(size));
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- CI i = c1.begin();
- for (int j = 0; static_cast<std::size_t>(j) < std::min(c1_osize, c1.size()); ++j, ++i)
- assert(*i == j);
- for (std::size_t j = c1_osize; j < c1.size(); ++j, ++i)
- assert(*i == 0);
+void test(C& c1, int size) {
+ typedef typename C::const_iterator CI;
+ typename C::size_type c1_osize = c1.size();
+ c1.resize(size);
+ assert(c1.size() == static_cast<std::size_t>(size));
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ CI i = c1.begin();
+ for (int j = 0; static_cast<std::size_t>(j) < std::min(c1_osize, c1.size()); ++j, ++i)
+ assert(*i == j);
+ for (std::size_t j = c1_osize; j < c1.size(); ++j, ++i)
+ assert(*i == 0);
}
template <class C>
-void
-testN(int start, int N, int M)
-{
- C c1 = make<C>(N, start);
- test(c1, M);
+void testN(int start, int N, int M) {
+ C c1 = make<C>(N, start);
+ test(c1, M);
}
-int main(int, char**)
-{
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+int main(int, char**) {
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- for (int k = 0; k < N; ++k)
- testN<std::deque<int> >(rng[i], rng[j], rng[k]);
- }
+ for (int j = 0; j < N; ++j)
+ for (int k = 0; k < N; ++k)
+ testN<std::deque<int> >(rng[i], rng[j], rng[k]);
+ }
#if TEST_STD_VER >= 11
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- for (int k = 0; k < N; ++k)
- testN<std::deque<int, min_allocator<int>>>(rng[i], rng[j], rng[k]);
- }
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+ for (int j = 0; j < N; ++j)
+ for (int k = 0; k < N; ++k)
+ testN<std::deque<int, min_allocator<int>>>(rng[i], rng[j], rng[k]);
+ }
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- for (int k = 0; k < N; ++k)
- testN<std::deque<int, safe_allocator<int>>>(rng[i], rng[j], rng[k]);
- }
+ for (int j = 0; j < N; ++j)
+ for (int k = 0; k < N; ++k)
+ testN<std::deque<int, safe_allocator<int>>>(rng[i], rng[j], rng[k]);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp
index e640825ee76a760..0abd94759a50ffb 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp
@@ -21,82 +21,74 @@
#include "min_allocator.h"
template <class C>
-C
-make(int size, int start = 0 )
-{
- const int b = 4096 / sizeof(int);
- int init = 0;
- if (start > 0)
- {
- init = (start+1) / b + ((start+1) % b != 0);
- init *= b;
- --init;
- }
- C c(init, 0);
- for (int i = 0; i < init-start; ++i)
- c.pop_back();
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
- for (int i = 0; i < size; ++i)
- c.push_back(i);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
- for (int i = 0; i < start; ++i)
- c.pop_front();
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
- return c;
+C make(int size, int start = 0) {
+ const int b = 4096 / sizeof(int);
+ int init = 0;
+ if (start > 0) {
+ init = (start + 1) / b + ((start + 1) % b != 0);
+ init *= b;
+ --init;
+ }
+ C c(init, 0);
+ for (int i = 0; i < init - start; ++i)
+ c.pop_back();
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
+ for (int i = 0; i < size; ++i)
+ c.push_back(i);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
+ for (int i = 0; i < start; ++i)
+ c.pop_front();
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
+ return c;
}
template <class C>
-void
-test(C& c1, int size, int x)
-{
- typedef typename C::const_iterator CI;
- typename C::size_type c1_osize = c1.size();
- c1.resize(size, x);
- assert(c1.size() == static_cast<std::size_t>(size));
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- CI i = c1.begin();
- for (int j = 0; static_cast<std::size_t>(j) < std::min(c1_osize, c1.size()); ++j, ++i)
- assert(*i == j);
- for (std::size_t j = c1_osize; j < c1.size(); ++j, ++i)
- assert(*i == x);
+void test(C& c1, int size, int x) {
+ typedef typename C::const_iterator CI;
+ typename C::size_type c1_osize = c1.size();
+ c1.resize(size, x);
+ assert(c1.size() == static_cast<std::size_t>(size));
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ CI i = c1.begin();
+ for (int j = 0; static_cast<std::size_t>(j) < std::min(c1_osize, c1.size()); ++j, ++i)
+ assert(*i == j);
+ for (std::size_t j = c1_osize; j < c1.size(); ++j, ++i)
+ assert(*i == x);
}
template <class C>
-void
-testN(int start, int N, int M)
-{
- C c1 = make<C>(N, start);
- test(c1, M, -10);
+void testN(int start, int N, int M) {
+ C c1 = make<C>(N, start);
+ test(c1, M, -10);
}
-int main(int, char**)
-{
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+int main(int, char**) {
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- for (int k = 0; k < N; ++k)
- testN<std::deque<int> >(rng[i], rng[j], rng[k]);
- }
+ for (int j = 0; j < N; ++j)
+ for (int k = 0; k < N; ++k)
+ testN<std::deque<int> >(rng[i], rng[j], rng[k]);
+ }
#if TEST_STD_VER >= 11
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- for (int k = 0; k < N; ++k)
- testN<std::deque<int, min_allocator<int>>>(rng[i], rng[j], rng[k]);
- }
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+ for (int j = 0; j < N; ++j)
+ for (int k = 0; k < N; ++k)
+ testN<std::deque<int, min_allocator<int>>>(rng[i], rng[j], rng[k]);
+ }
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- for (int k = 0; k < N; ++k)
- testN<std::deque<int, safe_allocator<int>>>(rng[i], rng[j], rng[k]);
- }
+ for (int j = 0; j < N; ++j)
+ for (int k = 0; k < N; ++k)
+ testN<std::deque<int, safe_allocator<int>>>(rng[i], rng[j], rng[k]);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/deque/deque.capacity/shrink_to_fit.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.capacity/shrink_to_fit.pass.cpp
index 88e8bd53c71d50a..34eedf8d050b742 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.capacity/shrink_to_fit.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.capacity/shrink_to_fit.pass.cpp
@@ -18,69 +18,61 @@
#include "min_allocator.h"
template <class C>
-C
-make(int size, int start = 0 )
-{
- const int b = 4096 / sizeof(int);
- int init = 0;
- if (start > 0)
- {
- init = (start+1) / b + ((start+1) % b != 0);
- init *= b;
- --init;
- }
- C c(init, 0);
- for (int i = 0; i < init-start; ++i)
- c.pop_back();
- for (int i = 0; i < size; ++i)
- c.push_back(i);
- for (int i = 0; i < start; ++i)
- c.pop_front();
- return c;
+C make(int size, int start = 0) {
+ const int b = 4096 / sizeof(int);
+ int init = 0;
+ if (start > 0) {
+ init = (start + 1) / b + ((start + 1) % b != 0);
+ init *= b;
+ --init;
+ }
+ C c(init, 0);
+ for (int i = 0; i < init - start; ++i)
+ c.pop_back();
+ for (int i = 0; i < size; ++i)
+ c.push_back(i);
+ for (int i = 0; i < start; ++i)
+ c.pop_front();
+ return c;
}
template <class C>
-void
-test(C& c1)
-{
- C s = c1;
- c1.shrink_to_fit();
- assert(c1 == s);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+void test(C& c1) {
+ C s = c1;
+ c1.shrink_to_fit();
+ assert(c1 == s);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
}
template <class C>
-void
-testN(int start, int N)
-{
- C c1 = make<C>(N, start);
- test(c1);
+void testN(int start, int N) {
+ C c1 = make<C>(N, start);
+ test(c1);
}
-int main(int, char**)
-{
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+int main(int, char**) {
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- testN<std::deque<int> >(rng[i], rng[j]);
- }
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<int> >(rng[i], rng[j]);
+ }
#if TEST_STD_VER >= 11
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j]);
- }
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j]);
+ }
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- testN<std::deque<int, safe_allocator<int>> >(rng[i], rng[j]);
- }
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<int, safe_allocator<int>> >(rng[i], rng[j]);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/deque/deque.capacity/size.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.capacity/size.pass.cpp
index 21d5ca03a10a20f..5c6a34867b39a24 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.capacity/size.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.capacity/size.pass.cpp
@@ -19,9 +19,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::deque<int> C;
C c;
ASSERT_NOEXCEPT(c.size());
@@ -45,9 +44,9 @@ int main(int, char**)
c.erase(c.begin());
assert(c.size() == 0);
LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::deque<int, min_allocator<int>> C;
C c;
ASSERT_NOEXCEPT(c.size());
@@ -71,7 +70,7 @@ int main(int, char**)
c.erase(c.begin());
assert(c.size() == 0);
LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/alloc.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/alloc.pass.cpp
index 8e3361e35999f0d..4b19ef3e22173be 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.cons/alloc.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.cons/alloc.pass.cpp
@@ -20,26 +20,23 @@
#include "min_allocator.h"
template <class T, class Allocator>
-void
-test(const Allocator& a)
-{
- std::deque<T, Allocator> d(a);
- assert(d.size() == 0);
- assert(d.get_allocator() == a);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(d));
+void test(const Allocator& a) {
+ std::deque<T, Allocator> d(a);
+ assert(d.size() == 0);
+ assert(d.get_allocator() == a);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(d));
}
-int main(int, char**)
-{
- test<int>(std::allocator<int>());
- test<NotConstructible>(test_allocator<NotConstructible>(3));
+int main(int, char**) {
+ test<int>(std::allocator<int>());
+ test<NotConstructible>(test_allocator<NotConstructible>(3));
#if TEST_STD_VER >= 11
- test<int>(min_allocator<int>());
- test<int>(safe_allocator<int>());
- test<NotConstructible>(min_allocator<NotConstructible>{});
- test<NotConstructible>(safe_allocator<NotConstructible>{});
- test<int>(explicit_allocator<int>());
- test<NotConstructible>(explicit_allocator<NotConstructible>{});
+ test<int>(min_allocator<int>());
+ test<int>(safe_allocator<int>());
+ test<NotConstructible>(min_allocator<NotConstructible>{});
+ test<NotConstructible>(safe_allocator<NotConstructible>{});
+ test<int>(explicit_allocator<int>());
+ test<NotConstructible>(explicit_allocator<NotConstructible>{});
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/assign_initializer_list.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/assign_initializer_list.pass.cpp
index 229034e8ca77f0e..bc57098463eaa75 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.cons/assign_initializer_list.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.cons/assign_initializer_list.pass.cpp
@@ -19,9 +19,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
std::deque<int> d;
d.assign({3, 4, 5, 6});
assert(d.size() == 4);
@@ -30,8 +29,8 @@ int main(int, char**)
assert(d[2] == 5);
assert(d[3] == 6);
LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(d));
- }
- {
+ }
+ {
std::deque<int, min_allocator<int>> d;
d.assign({3, 4, 5, 6});
assert(d.size() == 4);
@@ -40,7 +39,7 @@ int main(int, char**)
assert(d[2] == 5);
assert(d[3] == 6);
LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(d));
- }
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/assign_iter_iter.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/assign_iter_iter.pass.cpp
index c8ccfd6db7e47f1..c57eb9d08cabee0 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.cons/assign_iter_iter.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.cons/assign_iter_iter.pass.cpp
@@ -20,103 +20,91 @@
#include "test_iterators.h"
#include "min_allocator.h"
#if TEST_STD_VER >= 11
-#include "emplace_constructible.h"
+# include "emplace_constructible.h"
#endif
template <class C>
-C
-make(int size, int start = 0 )
-{
- const int b = 4096 / sizeof(int);
- int init = 0;
- if (start > 0)
- {
- init = (start+1) / b + ((start+1) % b != 0);
- init *= b;
- --init;
- }
- C c(init, 0);
- for (int i = 0; i < init-start; ++i)
- c.pop_back();
- for (int i = 0; i < size; ++i)
- c.push_back(i);
- for (int i = 0; i < start; ++i)
- c.pop_front();
- return c;
+C make(int size, int start = 0) {
+ const int b = 4096 / sizeof(int);
+ int init = 0;
+ if (start > 0) {
+ init = (start + 1) / b + ((start + 1) % b != 0);
+ init *= b;
+ --init;
+ }
+ C c(init, 0);
+ for (int i = 0; i < init - start; ++i)
+ c.pop_back();
+ for (int i = 0; i < size; ++i)
+ c.push_back(i);
+ for (int i = 0; i < start; ++i)
+ c.pop_front();
+ return c;
}
template <class C>
-void
-test(C& c1, const C& c2)
-{
- c1.assign(c2.begin(), c2.end());
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(c1 == c2);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
+void test(C& c1, const C& c2) {
+ c1.assign(c2.begin(), c2.end());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(c1 == c2);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
}
template <class C>
-void
-testN(int start, int N, int M)
-{
- C c1 = make<C>(N, start);
- C c2 = make<C>(M);
- test(c1, c2);
+void testN(int start, int N, int M) {
+ C c1 = make<C>(N, start);
+ C c2 = make<C>(M);
+ test(c1, c2);
}
template <class C>
-void
-testI(C& c1, const C& c2)
-{
- typedef typename C::const_iterator CI;
- typedef cpp17_input_iterator<CI> ICI;
- c1.assign(ICI(c2.begin()), ICI(c2.end()));
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(c1 == c2);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
+void testI(C& c1, const C& c2) {
+ typedef typename C::const_iterator CI;
+ typedef cpp17_input_iterator<CI> ICI;
+ c1.assign(ICI(c2.begin()), ICI(c2.end()));
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(c1 == c2);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
}
template <class C>
-void
-testNI(int start, int N, int M)
-{
- C c1 = make<C>(N, start);
- C c2 = make<C>(M);
- testI(c1, c2);
+void testNI(int start, int N, int M) {
+ C c1 = make<C>(N, start);
+ C c2 = make<C>(M);
+ testI(c1, c2);
}
-void basic_test()
-{
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+void basic_test() {
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- for (int k = 0; k < N; ++k)
- testN<std::deque<int> >(rng[i], rng[j], rng[k]);
+ for (int j = 0; j < N; ++j)
+ for (int k = 0; k < N; ++k)
+ testN<std::deque<int> >(rng[i], rng[j], rng[k]);
testNI<std::deque<int> >(1500, 2000, 1000);
- }
+ }
#if TEST_STD_VER >= 11
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- for (int k = 0; k < N; ++k)
- testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j], rng[k]);
+ for (int j = 0; j < N; ++j)
+ for (int k = 0; k < N; ++k)
+ testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j], rng[k]);
testNI<std::deque<int, min_allocator<int>> >(1500, 2000, 1000);
- }
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+ }
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- for (int k = 0; k < N; ++k)
- testN<std::deque<int, safe_allocator<int>> >(rng[i], rng[j], rng[k]);
+ for (int j = 0; j < N; ++j)
+ for (int k = 0; k < N; ++k)
+ testN<std::deque<int, safe_allocator<int>> >(rng[i], rng[j], rng[k]);
testNI<std::deque<int, safe_allocator<int>> >(1500, 2000, 1000);
- }
+ }
#endif
}
diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/assign_size_value.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/assign_size_value.pass.cpp
index a5272d010cdeaa0..30277125e46e18e 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.cons/assign_size_value.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.cons/assign_size_value.pass.cpp
@@ -20,67 +20,59 @@
#include "min_allocator.h"
template <class C>
-C
-make(int size, int start = 0 )
-{
- const int b = 4096 / sizeof(int);
- int init = 0;
- if (start > 0)
- {
- init = (start+1) / b + ((start+1) % b != 0);
- init *= b;
- --init;
- }
- C c(init, 0);
- for (int i = 0; i < init-start; ++i)
- c.pop_back();
- for (int i = 0; i < size; ++i)
- c.push_back(i);
- for (int i = 0; i < start; ++i)
- c.pop_front();
- return c;
+C make(int size, int start = 0) {
+ const int b = 4096 / sizeof(int);
+ int init = 0;
+ if (start > 0) {
+ init = (start + 1) / b + ((start + 1) % b != 0);
+ init *= b;
+ --init;
+ }
+ C c(init, 0);
+ for (int i = 0; i < init - start; ++i)
+ c.pop_back();
+ for (int i = 0; i < size; ++i)
+ c.push_back(i);
+ for (int i = 0; i < start; ++i)
+ c.pop_front();
+ return c;
}
template <class C>
-void
-test(C& c1, int size, int v)
-{
- typedef typename C::const_iterator CI;
- c1.assign(size, v);
- assert(c1.size() == static_cast<std::size_t>(size));
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- for (CI i = c1.begin(); i != c1.end(); ++i)
- assert(*i == v);
+void test(C& c1, int size, int v) {
+ typedef typename C::const_iterator CI;
+ c1.assign(size, v);
+ assert(c1.size() == static_cast<std::size_t>(size));
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ for (CI i = c1.begin(); i != c1.end(); ++i)
+ assert(*i == v);
}
template <class C>
-void
-testN(int start, int N, int M)
-{
- C c1 = make<C>(N, start);
- test(c1, M, -10);
+void testN(int start, int N, int M) {
+ C c1 = make<C>(N, start);
+ test(c1, M, -10);
}
-int main(int, char**)
-{
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+int main(int, char**) {
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- for (int k = 0; k < N; ++k)
- testN<std::deque<int> >(rng[i], rng[j], rng[k]);
- }
+ for (int j = 0; j < N; ++j)
+ for (int k = 0; k < N; ++k)
+ testN<std::deque<int> >(rng[i], rng[j], rng[k]);
+ }
#if TEST_STD_VER >= 11
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- for (int k = 0; k < N; ++k)
- testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j], rng[k]);
- }
+ for (int j = 0; j < N; ++j)
+ for (int k = 0; k < N; ++k)
+ testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j], rng[k]);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/copy.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/copy.pass.cpp
index 44245916c0a31a4..9f7a429d122a326 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.cons/copy.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.cons/copy.pass.cpp
@@ -19,52 +19,49 @@
#include "min_allocator.h"
template <class C>
-void
-test(const C& x)
-{
- C c(x);
- assert(c == x);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(x));
+void test(const C& x) {
+ C c(x);
+ assert(c == x);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(x));
}
-int main(int, char**)
-{
- {
- int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
- int* an = ab + sizeof(ab)/sizeof(ab[0]);
- test(std::deque<int>(ab, an));
- }
- {
- std::deque<int, test_allocator<int> > v(3, 2, test_allocator<int>(5));
- std::deque<int, test_allocator<int> > v2 = v;
- assert(v2 == v);
- assert(v2.get_allocator() == v.get_allocator());
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(v));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(v2));
- }
+int main(int, char**) {
+ {
+ int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
+ int* an = ab + sizeof(ab) / sizeof(ab[0]);
+ test(std::deque<int>(ab, an));
+ }
+ {
+ std::deque<int, test_allocator<int> > v(3, 2, test_allocator<int>(5));
+ std::deque<int, test_allocator<int> > v2 = v;
+ assert(v2 == v);
+ assert(v2.get_allocator() == v.get_allocator());
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(v));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(v2));
+ }
#if TEST_STD_VER >= 11
- {
- std::deque<int, other_allocator<int> > v(3, 2, other_allocator<int>(5));
- std::deque<int, other_allocator<int> > v2 = v;
- assert(v2 == v);
- assert(v2.get_allocator() == other_allocator<int>(-2));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(v));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(v2));
- }
- {
- int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
- int* an = ab + sizeof(ab)/sizeof(ab[0]);
- test(std::deque<int, min_allocator<int>>(ab, an));
- }
- {
- std::deque<int, min_allocator<int> > v(3, 2, min_allocator<int>());
- std::deque<int, min_allocator<int> > v2 = v;
- assert(v2 == v);
- assert(v2.get_allocator() == v.get_allocator());
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(v));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(v2));
- }
+ {
+ std::deque<int, other_allocator<int> > v(3, 2, other_allocator<int>(5));
+ std::deque<int, other_allocator<int> > v2 = v;
+ assert(v2 == v);
+ assert(v2.get_allocator() == other_allocator<int>(-2));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(v));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(v2));
+ }
+ {
+ int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
+ int* an = ab + sizeof(ab) / sizeof(ab[0]);
+ test(std::deque<int, min_allocator<int>>(ab, an));
+ }
+ {
+ std::deque<int, min_allocator<int> > v(3, 2, min_allocator<int>());
+ std::deque<int, min_allocator<int> > v2 = v;
+ assert(v2 == v);
+ assert(v2.get_allocator() == v.get_allocator());
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(v));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(v2));
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/copy_alloc.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/copy_alloc.pass.cpp
index 3fdfcc3405f0e30..fb3ad3c25a8f13e 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.cons/copy_alloc.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.cons/copy_alloc.pass.cpp
@@ -19,42 +19,35 @@
#include "min_allocator.h"
template <class C>
-void
-test(const C& x, const typename C::allocator_type& a)
-{
- C c(x, a);
- assert(c == x);
- assert(c.get_allocator() == a);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
+void test(const C& x, const typename C::allocator_type& a) {
+ C c(x, a);
+ assert(c == x);
+ assert(c.get_allocator() == a);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
}
-int main(int, char**)
-{
- {
- int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
- int* an = ab + sizeof(ab)/sizeof(ab[0]);
- test(std::deque<int, test_allocator<int> >(ab, an, test_allocator<int>(3)),
- test_allocator<int>(4));
- }
- {
- int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
- int* an = ab + sizeof(ab)/sizeof(ab[0]);
- test(std::deque<int, other_allocator<int> >(ab, an, other_allocator<int>(3)),
- other_allocator<int>(4));
- }
+int main(int, char**) {
+ {
+ int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
+ int* an = ab + sizeof(ab) / sizeof(ab[0]);
+ test(std::deque<int, test_allocator<int> >(ab, an, test_allocator<int>(3)), test_allocator<int>(4));
+ }
+ {
+ int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
+ int* an = ab + sizeof(ab) / sizeof(ab[0]);
+ test(std::deque<int, other_allocator<int> >(ab, an, other_allocator<int>(3)), other_allocator<int>(4));
+ }
#if TEST_STD_VER >= 11
- {
- int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
- int* an = ab + sizeof(ab)/sizeof(ab[0]);
- test(std::deque<int, min_allocator<int> >(ab, an, min_allocator<int>()),
- min_allocator<int>());
- }
- {
- int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
- int* an = ab + sizeof(ab)/sizeof(ab[0]);
- test(std::deque<int, safe_allocator<int> >(ab, an, safe_allocator<int>()),
- safe_allocator<int>());
- }
+ {
+ int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
+ int* an = ab + sizeof(ab) / sizeof(ab[0]);
+ test(std::deque<int, min_allocator<int> >(ab, an, min_allocator<int>()), min_allocator<int>());
+ }
+ {
+ int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
+ int* an = ab + sizeof(ab) / sizeof(ab[0]);
+ test(std::deque<int, safe_allocator<int> >(ab, an, safe_allocator<int>()), safe_allocator<int>());
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/deduct.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/deduct.pass.cpp
index 096db12590d42f3..c481ac59ab411f0 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.cons/deduct.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.cons/deduct.pass.cpp
@@ -32,21 +32,19 @@
struct A {};
-int main(int, char**)
-{
-
-// Test the explicit deduction guides
- {
- const int arr[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
+int main(int, char**) {
+ // Test the explicit deduction guides
+ {
+ const int arr[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
std::deque deq(std::begin(arr), std::end(arr));
static_assert(std::is_same_v<decltype(deq), std::deque<int>>, "");
assert(std::equal(deq.begin(), deq.end(), std::begin(arr), std::end(arr)));
LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(deq));
- }
+ }
- {
- const long arr[] = {INT_MAX, 1L, 2L, 3L };
+ {
+ const long arr[] = {INT_MAX, 1L, 2L, 3L};
std::deque deq(std::begin(arr), std::end(arr), std::allocator<long>());
static_assert(std::is_same_v<decltype(deq)::value_type, long>, "");
assert(deq.size() == 4);
@@ -54,110 +52,110 @@ int main(int, char**)
assert(deq[1] == 1L);
assert(deq[2] == 2L);
LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(deq));
- }
+ }
-// Test the implicit deduction guides
+ // Test the implicit deduction guides
- {
-// We don't expect this one to work.
-// std::deque deq(std::allocator<int>()); // deque (allocator &)
- }
+ {
+ // We don't expect this one to work.
+ // std::deque deq(std::allocator<int>()); // deque (allocator &)
+ }
- {
+ {
std::deque deq(1, A{}); // deque (size_type, T)
static_assert(std::is_same_v<decltype(deq)::value_type, A>, "");
static_assert(std::is_same_v<decltype(deq)::allocator_type, std::allocator<A>>, "");
assert(deq.size() == 1);
LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(deq));
- }
+ }
- {
+ {
std::deque deq(1, A{}, test_allocator<A>()); // deque (size_type, T, allocator)
static_assert(std::is_same_v<decltype(deq)::value_type, A>, "");
static_assert(std::is_same_v<decltype(deq)::allocator_type, test_allocator<A>>, "");
assert(deq.size() == 1);
LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(deq));
- }
+ }
- {
+ {
std::deque deq{1U, 2U, 3U, 4U, 5U}; // deque(initializer-list)
static_assert(std::is_same_v<decltype(deq)::value_type, unsigned>, "");
assert(deq.size() == 5);
assert(deq[2] == 3U);
LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(deq));
- }
+ }
- {
+ {
std::deque deq({1.0, 2.0, 3.0, 4.0}, test_allocator<double>()); // deque(initializer-list, allocator)
static_assert(std::is_same_v<decltype(deq)::value_type, double>, "");
static_assert(std::is_same_v<decltype(deq)::allocator_type, test_allocator<double>>, "");
assert(deq.size() == 4);
assert(deq[3] == 4.0);
LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(deq));
- }
+ }
- {
+ {
std::deque<long double> source;
std::deque deq(source); // deque(deque &)
static_assert(std::is_same_v<decltype(deq)::value_type, long double>, "");
static_assert(std::is_same_v<decltype(deq)::allocator_type, std::allocator<long double>>, "");
assert(deq.size() == 0);
LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(deq));
+ }
+
+ {
+ typedef test_allocator<short> Alloc;
+ typedef test_allocator<int> ConvertibleToAlloc;
+
+ {
+ std::deque<short, Alloc> source;
+ std::deque deq(source, Alloc(2));
+ static_assert(std::is_same_v<decltype(deq), decltype(source)>);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(deq));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(source));
+ }
+
+ {
+ std::deque<short, Alloc> source;
+ std::deque deq(source, ConvertibleToAlloc(2));
+ static_assert(std::is_same_v<decltype(deq), decltype(source)>);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(deq));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(source));
+ }
+
+ {
+ std::deque<short, Alloc> source;
+ std::deque deq(std::move(source), Alloc(2));
+ static_assert(std::is_same_v<decltype(deq), decltype(source)>);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(deq));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(source));
}
{
- typedef test_allocator<short> Alloc;
- typedef test_allocator<int> ConvertibleToAlloc;
-
- {
- std::deque<short, Alloc> source;
- std::deque deq(source, Alloc(2));
- static_assert(std::is_same_v<decltype(deq), decltype(source)>);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(deq));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(source));
- }
-
- {
- std::deque<short, Alloc> source;
- std::deque deq(source, ConvertibleToAlloc(2));
- static_assert(std::is_same_v<decltype(deq), decltype(source)>);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(deq));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(source));
- }
-
- {
- std::deque<short, Alloc> source;
- std::deque deq(std::move(source), Alloc(2));
- static_assert(std::is_same_v<decltype(deq), decltype(source)>);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(deq));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(source));
- }
-
- {
- std::deque<short, Alloc> source;
- std::deque deq(std::move(source), ConvertibleToAlloc(2));
- static_assert(std::is_same_v<decltype(deq), decltype(source)>);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(deq));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(source));
- }
+ std::deque<short, Alloc> source;
+ std::deque deq(std::move(source), ConvertibleToAlloc(2));
+ static_assert(std::is_same_v<decltype(deq), decltype(source)>);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(deq));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(source));
}
+ }
#if TEST_STD_VER >= 23
+ {
+ {
+ std::deque c(std::from_range, std::array<int, 0>());
+ static_assert(std::is_same_v<decltype(c), std::deque<int>>);
+ }
+
{
- {
- std::deque c(std::from_range, std::array<int, 0>());
- static_assert(std::is_same_v<decltype(c), std::deque<int>>);
- }
-
- {
- using Alloc = test_allocator<int>;
- std::deque c(std::from_range, std::array<int, 0>(), Alloc());
- static_assert(std::is_same_v<decltype(c), std::deque<int, Alloc>>);
- }
+ using Alloc = test_allocator<int>;
+ std::deque c(std::from_range, std::array<int, 0>(), Alloc());
+ static_assert(std::is_same_v<decltype(c), std::deque<int, Alloc>>);
}
+ }
#endif
- SequenceContainerDeductionGuidesSfinaeAway<std::deque, std::deque<int>>();
+ SequenceContainerDeductionGuidesSfinaeAway<std::deque, std::deque<int>>();
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/deduct.verify.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/deduct.verify.cpp
index f65e230112d90d2..61e58b08ca263dc 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.cons/deduct.verify.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.cons/deduct.verify.cpp
@@ -22,19 +22,18 @@
struct A {};
-int main(int, char**)
-{
-// Test the explicit deduction guides
-
-// Test the implicit deduction guides
- {
-// deque (allocator &)
- std::deque deq((std::allocator<int>())); // expected-error-re {{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}deque'}}
-// Note: The extra parens are necessary, since otherwise clang decides it is a function declaration.
-// Also, we can't use {} instead of parens, because that constructs a
-// deque<allocator<int>, allocator<allocator<int>>>
- }
-
+int main(int, char**) {
+ // Test the explicit deduction guides
+
+ // Test the implicit deduction guides
+ {
+ // deque (allocator &)
+ std::deque deq((std::allocator< int>()));
+ // expected-error-re at -1 {{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}deque'}}
+ // Note: The extra parens are necessary, since otherwise clang decides it is a function declaration.
+ // Also, we can't use {} instead of parens, because that constructs a
+ // deque<allocator<int>, allocator<allocator<int>>>
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/default.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/default.pass.cpp
index 493274e93258687..6bfd4857f9b0ab0 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.cons/default.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.cons/default.pass.cpp
@@ -20,26 +20,23 @@
#include "min_allocator.h"
template <class T, class Allocator>
-void
-test()
-{
- std::deque<T, Allocator> d;
- assert(d.size() == 0);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(d));
+void test() {
+ std::deque<T, Allocator> d;
+ assert(d.size() == 0);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(d));
#if TEST_STD_VER >= 11
- std::deque<T, Allocator> d1 = {};
- assert(d1.size() == 0);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(d1));
+ std::deque<T, Allocator> d1 = {};
+ assert(d1.size() == 0);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(d1));
#endif
}
-int main(int, char**)
-{
- test<int, std::allocator<int> >();
- test<NotConstructible, limited_allocator<NotConstructible, 1> >();
+int main(int, char**) {
+ test<int, std::allocator<int> >();
+ test<NotConstructible, limited_allocator<NotConstructible, 1> >();
#if TEST_STD_VER >= 11
- test<int, min_allocator<int> >();
- test<NotConstructible, min_allocator<NotConstructible> >();
+ test<int, min_allocator<int> >();
+ test<NotConstructible, min_allocator<NotConstructible> >();
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/default_noexcept.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/default_noexcept.pass.cpp
index 88672fa044fe21e..244fef829f521e1 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.cons/default_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.cons/default_noexcept.pass.cpp
@@ -23,33 +23,31 @@
#include "test_allocator.h"
template <class T>
-struct some_alloc
-{
- typedef T value_type;
- some_alloc(const some_alloc&);
- void allocate(std::size_t);
+struct some_alloc {
+ typedef T value_type;
+ some_alloc(const some_alloc&);
+ void allocate(std::size_t);
};
-int main(int, char**)
-{
+int main(int, char**) {
#if defined(_LIBCPP_VERSION)
- {
- typedef std::deque<MoveOnly> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
- }
- {
- typedef std::deque<MoveOnly, test_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
- }
+ {
+ typedef std::deque<MoveOnly> C;
+ static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ }
+ {
+ typedef std::deque<MoveOnly, test_allocator<MoveOnly>> C;
+ static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ }
#endif // _LIBCPP_VERSION
- {
- typedef std::deque<MoveOnly, other_allocator<MoveOnly>> C;
- static_assert(!std::is_nothrow_default_constructible<C>::value, "");
- }
- {
- typedef std::deque<MoveOnly, some_alloc<MoveOnly>> C;
- static_assert(!std::is_nothrow_default_constructible<C>::value, "");
- }
+ {
+ typedef std::deque<MoveOnly, other_allocator<MoveOnly>> C;
+ static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+ }
+ {
+ typedef std::deque<MoveOnly, some_alloc<MoveOnly>> C;
+ static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/dtor_noexcept.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/dtor_noexcept.pass.cpp
index 88fce25a1f7e3aa..f0a839484f9dce5 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.cons/dtor_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.cons/dtor_noexcept.pass.cpp
@@ -20,33 +20,31 @@
#include "test_allocator.h"
template <class T>
-struct some_alloc
-{
- typedef T value_type;
- some_alloc(const some_alloc&);
- ~some_alloc() noexcept(false);
- void allocate(std::size_t);
+struct some_alloc {
+ typedef T value_type;
+ some_alloc(const some_alloc&);
+ ~some_alloc() noexcept(false);
+ void allocate(std::size_t);
};
-int main(int, char**)
-{
- {
- typedef std::deque<MoveOnly> C;
- static_assert(std::is_nothrow_destructible<C>::value, "");
- }
- {
- typedef std::deque<MoveOnly, test_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_destructible<C>::value, "");
- }
- {
- typedef std::deque<MoveOnly, other_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_destructible<C>::value, "");
- }
+int main(int, char**) {
+ {
+ typedef std::deque<MoveOnly> C;
+ static_assert(std::is_nothrow_destructible<C>::value, "");
+ }
+ {
+ typedef std::deque<MoveOnly, test_allocator<MoveOnly>> C;
+ static_assert(std::is_nothrow_destructible<C>::value, "");
+ }
+ {
+ typedef std::deque<MoveOnly, other_allocator<MoveOnly>> C;
+ static_assert(std::is_nothrow_destructible<C>::value, "");
+ }
#if defined(_LIBCPP_VERSION)
- {
- typedef std::deque<MoveOnly, some_alloc<MoveOnly>> C;
- static_assert(!std::is_nothrow_destructible<C>::value, "");
- }
+ {
+ typedef std::deque<MoveOnly, some_alloc<MoveOnly>> C;
+ static_assert(!std::is_nothrow_destructible<C>::value, "");
+ }
#endif // _LIBCPP_VERSION
return 0;
diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/initializer_list.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/initializer_list.pass.cpp
index bf7bc4bd90acc9c..d7df936f9413d17 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.cons/initializer_list.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.cons/initializer_list.pass.cpp
@@ -19,9 +19,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
std::deque<int> d = {3, 4, 5, 6};
assert(d.size() == 4);
assert(d[0] == 3);
@@ -29,8 +28,8 @@ int main(int, char**)
assert(d[2] == 5);
assert(d[3] == 6);
LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(d));
- }
- {
+ }
+ {
std::deque<int, min_allocator<int>> d = {3, 4, 5, 6};
assert(d.size() == 4);
assert(d[0] == 3);
@@ -38,7 +37,7 @@ int main(int, char**)
assert(d[2] == 5);
assert(d[3] == 6);
LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(d));
- }
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/initializer_list_alloc.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/initializer_list_alloc.pass.cpp
index 99e6195151703c4..f5f1a232430021a 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.cons/initializer_list_alloc.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.cons/initializer_list_alloc.pass.cpp
@@ -20,9 +20,8 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
std::deque<int, test_allocator<int>> d({3, 4, 5, 6}, test_allocator<int>(3));
assert(d.get_allocator() == test_allocator<int>(3));
assert(d.size() == 4);
@@ -31,8 +30,8 @@ int main(int, char**)
assert(d[2] == 5);
assert(d[3] == 6);
LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(d));
- }
- {
+ }
+ {
std::deque<int, min_allocator<int>> d({3, 4, 5, 6}, min_allocator<int>());
assert(d.get_allocator() == min_allocator<int>());
assert(d.size() == 4);
@@ -41,7 +40,7 @@ int main(int, char**)
assert(d[2] == 5);
assert(d[3] == 6);
LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(d));
- }
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/iter_iter.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/iter_iter.pass.cpp
index c0df278f001402c..1f8a044d0b602a5 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.cons/iter_iter.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.cons/iter_iter.pass.cpp
@@ -20,61 +20,55 @@
#include "test_iterators.h"
#include "min_allocator.h"
#if TEST_STD_VER >= 11
-#include "emplace_constructible.h"
+# include "emplace_constructible.h"
#endif
template <class InputIterator>
-void
-test(InputIterator f, InputIterator l)
-{
- typedef typename std::iterator_traits<InputIterator>::value_type T;
- typedef std::allocator<T> Allocator;
- typedef std::deque<T, Allocator> C;
- typedef typename C::const_iterator const_iterator;
- C d(f, l);
- assert(d.size() == static_cast<std::size_t>(std::distance(f, l)));
- assert(static_cast<std::size_t>(std::distance(d.begin(), d.end())) == d.size());
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(d));
- for (const_iterator i = d.begin(), e = d.end(); i != e; ++i, ++f)
- assert(*i == *f);
+void test(InputIterator f, InputIterator l) {
+ typedef typename std::iterator_traits<InputIterator>::value_type T;
+ typedef std::allocator<T> Allocator;
+ typedef std::deque<T, Allocator> C;
+ typedef typename C::const_iterator const_iterator;
+ C d(f, l);
+ assert(d.size() == static_cast<std::size_t>(std::distance(f, l)));
+ assert(static_cast<std::size_t>(std::distance(d.begin(), d.end())) == d.size());
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(d));
+ for (const_iterator i = d.begin(), e = d.end(); i != e; ++i, ++f)
+ assert(*i == *f);
}
template <class Allocator, class InputIterator>
-void
-test(InputIterator f, InputIterator l)
-{
- typedef typename std::iterator_traits<InputIterator>::value_type T;
- typedef std::deque<T, Allocator> C;
- typedef typename C::const_iterator const_iterator;
- C d(f, l);
- assert(d.size() == static_cast<std::size_t>(std::distance(f, l)));
- assert(static_cast<std::size_t>(std::distance(d.begin(), d.end())) == d.size());
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(d));
- for (const_iterator i = d.begin(), e = d.end(); i != e; ++i, ++f)
- assert(*i == *f);
+void test(InputIterator f, InputIterator l) {
+ typedef typename std::iterator_traits<InputIterator>::value_type T;
+ typedef std::deque<T, Allocator> C;
+ typedef typename C::const_iterator const_iterator;
+ C d(f, l);
+ assert(d.size() == static_cast<std::size_t>(std::distance(f, l)));
+ assert(static_cast<std::size_t>(std::distance(d.begin(), d.end())) == d.size());
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(d));
+ for (const_iterator i = d.begin(), e = d.end(); i != e; ++i, ++f)
+ assert(*i == *f);
}
-void basic_test()
-{
- int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
- int* an = ab + sizeof(ab)/sizeof(ab[0]);
- test(cpp17_input_iterator<const int*>(ab), cpp17_input_iterator<const int*>(an));
- test(forward_iterator<const int*>(ab), forward_iterator<const int*>(an));
- test(bidirectional_iterator<const int*>(ab), bidirectional_iterator<const int*>(an));
- test(random_access_iterator<const int*>(ab), random_access_iterator<const int*>(an));
- test<limited_allocator<int, 4096> >(ab, an);
+void basic_test() {
+ int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
+ int* an = ab + sizeof(ab) / sizeof(ab[0]);
+ test(cpp17_input_iterator<const int*>(ab), cpp17_input_iterator<const int*>(an));
+ test(forward_iterator<const int*>(ab), forward_iterator<const int*>(an));
+ test(bidirectional_iterator<const int*>(ab), bidirectional_iterator<const int*>(an));
+ test(random_access_iterator<const int*>(ab), random_access_iterator<const int*>(an));
+ test<limited_allocator<int, 4096> >(ab, an);
#if TEST_STD_VER >= 11
- test<min_allocator<int> >(ab, an);
+ test<min_allocator<int> >(ab, an);
#endif
}
-
void test_emplacable_concept() {
#if TEST_STD_VER >= 11
int arr1[] = {42};
int arr2[] = {1, 101, 42};
{
- using T = EmplaceConstructibleAndMoveable<int>;
+ using T = EmplaceConstructibleAndMoveable<int>;
using It = random_access_iterator<int*>;
{
std::deque<T> v(It(arr1), It(std::end(arr1)));
@@ -88,7 +82,7 @@ void test_emplacable_concept() {
}
}
{
- using T = EmplaceConstructibleAndMoveable<int>;
+ using T = EmplaceConstructibleAndMoveable<int>;
using It = cpp17_input_iterator<int*>;
{
std::deque<T> v(It(arr1), It(std::end(arr1)));
diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/iter_iter_alloc.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/iter_iter_alloc.pass.cpp
index 40cf5cabc735c62..61318c3d0f2d3d0 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.cons/iter_iter_alloc.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.cons/iter_iter_alloc.pass.cpp
@@ -21,48 +21,44 @@
#include "test_allocator.h"
#include "min_allocator.h"
#if TEST_STD_VER >= 11
-#include "emplace_constructible.h"
+# include "emplace_constructible.h"
#endif
template <class InputIterator, class Allocator>
-void
-test(InputIterator f, InputIterator l, const Allocator& a)
-{
- typedef typename std::iterator_traits<InputIterator>::value_type T;
- typedef std::deque<T, Allocator> C;
- typedef typename C::const_iterator const_iterator;
- C d(f, l, a);
- assert(d.get_allocator() == a);
- assert(d.size() == static_cast<std::size_t>(std::distance(f, l)));
- assert(static_cast<std::size_t>(std::distance(d.begin(), d.end())) == d.size());
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(d));
- for (const_iterator i = d.begin(), e = d.end(); i != e; ++i, ++f)
- assert(*i == *f);
+void test(InputIterator f, InputIterator l, const Allocator& a) {
+ typedef typename std::iterator_traits<InputIterator>::value_type T;
+ typedef std::deque<T, Allocator> C;
+ typedef typename C::const_iterator const_iterator;
+ C d(f, l, a);
+ assert(d.get_allocator() == a);
+ assert(d.size() == static_cast<std::size_t>(std::distance(f, l)));
+ assert(static_cast<std::size_t>(std::distance(d.begin(), d.end())) == d.size());
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(d));
+ for (const_iterator i = d.begin(), e = d.end(); i != e; ++i, ++f)
+ assert(*i == *f);
}
-void basic_test()
-{
- int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
- int* an = ab + sizeof(ab)/sizeof(ab[0]);
- test(cpp17_input_iterator<const int*>(ab), cpp17_input_iterator<const int*>(an), test_allocator<int>(3));
- test(forward_iterator<const int*>(ab), forward_iterator<const int*>(an), test_allocator<int>(4));
- test(bidirectional_iterator<const int*>(ab), bidirectional_iterator<const int*>(an), test_allocator<int>(5));
- test(random_access_iterator<const int*>(ab), random_access_iterator<const int*>(an), test_allocator<int>(6));
+void basic_test() {
+ int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
+ int* an = ab + sizeof(ab) / sizeof(ab[0]);
+ test(cpp17_input_iterator<const int*>(ab), cpp17_input_iterator<const int*>(an), test_allocator<int>(3));
+ test(forward_iterator<const int*>(ab), forward_iterator<const int*>(an), test_allocator<int>(4));
+ test(bidirectional_iterator<const int*>(ab), bidirectional_iterator<const int*>(an), test_allocator<int>(5));
+ test(random_access_iterator<const int*>(ab), random_access_iterator<const int*>(an), test_allocator<int>(6));
#if TEST_STD_VER >= 11
- test(cpp17_input_iterator<const int*>(ab), cpp17_input_iterator<const int*>(an), min_allocator<int>());
- test(forward_iterator<const int*>(ab), forward_iterator<const int*>(an), min_allocator<int>());
- test(bidirectional_iterator<const int*>(ab), bidirectional_iterator<const int*>(an), min_allocator<int>());
- test(random_access_iterator<const int*>(ab), random_access_iterator<const int*>(an), min_allocator<int>());
+ test(cpp17_input_iterator<const int*>(ab), cpp17_input_iterator<const int*>(an), min_allocator<int>());
+ test(forward_iterator<const int*>(ab), forward_iterator<const int*>(an), min_allocator<int>());
+ test(bidirectional_iterator<const int*>(ab), bidirectional_iterator<const int*>(an), min_allocator<int>());
+ test(random_access_iterator<const int*>(ab), random_access_iterator<const int*>(an), min_allocator<int>());
#endif
}
-
void test_emplacable_concept() {
#if TEST_STD_VER >= 11
int arr1[] = {42};
int arr2[] = {1, 101, 42};
{
- using T = EmplaceConstructibleAndMoveable<int>;
+ using T = EmplaceConstructibleAndMoveable<int>;
using It = random_access_iterator<int*>;
std::allocator<T> a;
{
@@ -79,7 +75,7 @@ void test_emplacable_concept() {
}
}
{
- using T = EmplaceConstructibleAndMoveable<int>;
+ using T = EmplaceConstructibleAndMoveable<int>;
using It = cpp17_input_iterator<int*>;
std::allocator<T> a;
{
diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/move.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/move.pass.cpp
index b3f08da81ff5be1..66ff168cc83b71b 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.cons/move.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.cons/move.pass.cpp
@@ -21,65 +21,64 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
- int* an = ab + sizeof(ab)/sizeof(ab[0]);
- typedef test_allocator<MoveOnly> A;
- std::deque<MoveOnly, A> c1(A(1));
- for (int* p = ab; p < an; ++p)
- c1.push_back(MoveOnly(*p));
- std::deque<MoveOnly, A> c2(A(2));
- for (int* p = ab; p < an; ++p)
- c2.push_back(MoveOnly(*p));
- A old_a = c1.get_allocator();
- std::deque<MoveOnly, A> c3 = std::move(c1);
- assert(c2 == c3);
- assert(c1.size() == 0);
- assert(c3.get_allocator() == old_a);
- assert(c1.get_allocator() == A(1));
- assert(c1.get_allocator().get_id() == test_alloc_base::moved_value);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c3));
- }
- {
- int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
- int* an = ab + sizeof(ab)/sizeof(ab[0]);
- typedef other_allocator<MoveOnly> A;
- std::deque<MoveOnly, A> c1(A(1));
- for (int* p = ab; p < an; ++p)
- c1.push_back(MoveOnly(*p));
- std::deque<MoveOnly, A> c2(A(2));
- for (int* p = ab; p < an; ++p)
- c2.push_back(MoveOnly(*p));
- std::deque<MoveOnly, A> c3 = std::move(c1);
- assert(c2 == c3);
- assert(c1.size() == 0);
- assert(c3.get_allocator() == c1.get_allocator());
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c3));
- }
- {
- int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
- int* an = ab + sizeof(ab)/sizeof(ab[0]);
- typedef min_allocator<MoveOnly> A;
- std::deque<MoveOnly, A> c1(A{});
- for (int* p = ab; p < an; ++p)
- c1.push_back(MoveOnly(*p));
- std::deque<MoveOnly, A> c2(A{});
- for (int* p = ab; p < an; ++p)
- c2.push_back(MoveOnly(*p));
- std::deque<MoveOnly, A> c3 = std::move(c1);
- assert(c2 == c3);
- assert(c1.size() == 0);
- assert(c3.get_allocator() == c1.get_allocator());
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c3));
- }
+int main(int, char**) {
+ {
+ int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
+ int* an = ab + sizeof(ab) / sizeof(ab[0]);
+ typedef test_allocator<MoveOnly> A;
+ std::deque<MoveOnly, A> c1(A(1));
+ for (int* p = ab; p < an; ++p)
+ c1.push_back(MoveOnly(*p));
+ std::deque<MoveOnly, A> c2(A(2));
+ for (int* p = ab; p < an; ++p)
+ c2.push_back(MoveOnly(*p));
+ A old_a = c1.get_allocator();
+ std::deque<MoveOnly, A> c3 = std::move(c1);
+ assert(c2 == c3);
+ assert(c1.size() == 0);
+ assert(c3.get_allocator() == old_a);
+ assert(c1.get_allocator() == A(1));
+ assert(c1.get_allocator().get_id() == test_alloc_base::moved_value);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c3));
+ }
+ {
+ int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
+ int* an = ab + sizeof(ab) / sizeof(ab[0]);
+ typedef other_allocator<MoveOnly> A;
+ std::deque<MoveOnly, A> c1(A(1));
+ for (int* p = ab; p < an; ++p)
+ c1.push_back(MoveOnly(*p));
+ std::deque<MoveOnly, A> c2(A(2));
+ for (int* p = ab; p < an; ++p)
+ c2.push_back(MoveOnly(*p));
+ std::deque<MoveOnly, A> c3 = std::move(c1);
+ assert(c2 == c3);
+ assert(c1.size() == 0);
+ assert(c3.get_allocator() == c1.get_allocator());
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c3));
+ }
+ {
+ int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
+ int* an = ab + sizeof(ab) / sizeof(ab[0]);
+ typedef min_allocator<MoveOnly> A;
+ std::deque<MoveOnly, A> c1(A{});
+ for (int* p = ab; p < an; ++p)
+ c1.push_back(MoveOnly(*p));
+ std::deque<MoveOnly, A> c2(A{});
+ for (int* p = ab; p < an; ++p)
+ c2.push_back(MoveOnly(*p));
+ std::deque<MoveOnly, A> c3 = std::move(c1);
+ assert(c2 == c3);
+ assert(c1.size() == 0);
+ assert(c3.get_allocator() == c1.get_allocator());
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c3));
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/move_alloc.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/move_alloc.pass.cpp
index 25a838f55e4419d..985d8ad9db67fea 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.cons/move_alloc.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.cons/move_alloc.pass.cpp
@@ -21,80 +21,79 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
- const int* an = ab + sizeof(ab)/sizeof(ab[0]);
- typedef test_allocator<MoveOnly> A;
- std::deque<MoveOnly, A> c1(A(1));
- for (int* p = ab; p < an; ++p)
- c1.push_back(MoveOnly(*p));
- std::deque<MoveOnly, A> c2(A(1));
- for (int* p = ab; p < an; ++p)
- c2.push_back(MoveOnly(*p));
- std::deque<MoveOnly, A> c3(std::move(c1), A(3)); // unequal allocator
- assert(c2 == c3);
- assert(c3.get_allocator() == A(3));
- LIBCPP_ASSERT(c1.size() != 0);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c3));
- }
- {
- int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
- const int* an = ab + sizeof(ab)/sizeof(ab[0]);
- typedef test_allocator<MoveOnly> A;
- std::deque<MoveOnly, A> c1(A(1));
- for (int* p = ab; p < an; ++p)
- c1.push_back(MoveOnly(*p));
- std::deque<MoveOnly, A> c2(A(1));
- for (int* p = ab; p < an; ++p)
- c2.push_back(MoveOnly(*p));
- std::deque<MoveOnly, A> c3(std::move(c1), A(1)); // equal allocator
- assert(c2 == c3);
- assert(c3.get_allocator() == A(1));
- LIBCPP_ASSERT(c1.size() == 0);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c3));
- }
- {
- int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
- const int* an = ab + sizeof(ab)/sizeof(ab[0]);
- typedef other_allocator<MoveOnly> A;
- std::deque<MoveOnly, A> c1(A(1));
- for (int* p = ab; p < an; ++p)
- c1.push_back(MoveOnly(*p));
- std::deque<MoveOnly, A> c2(A(1));
- for (int* p = ab; p < an; ++p)
- c2.push_back(MoveOnly(*p));
- std::deque<MoveOnly, A> c3(std::move(c1), A(3)); // unequal allocator
- assert(c2 == c3);
- assert(c3.get_allocator() == A(3));
- LIBCPP_ASSERT(c1.size() != 0);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c3));
- }
- {
- int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
- const int* an = ab + sizeof(ab)/sizeof(ab[0]);
- typedef min_allocator<MoveOnly> A;
- std::deque<MoveOnly, A> c1(A{});
- for (int* p = ab; p < an; ++p)
- c1.push_back(MoveOnly(*p));
- std::deque<MoveOnly, A> c2(A{});
- for (int* p = ab; p < an; ++p)
- c2.push_back(MoveOnly(*p));
- std::deque<MoveOnly, A> c3(std::move(c1), A()); // equal allocator
- assert(c2 == c3);
- assert(c3.get_allocator() == A());
- LIBCPP_ASSERT(c1.size() == 0);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c3));
- }
+int main(int, char**) {
+ {
+ int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
+ const int* an = ab + sizeof(ab) / sizeof(ab[0]);
+ typedef test_allocator<MoveOnly> A;
+ std::deque<MoveOnly, A> c1(A(1));
+ for (int* p = ab; p < an; ++p)
+ c1.push_back(MoveOnly(*p));
+ std::deque<MoveOnly, A> c2(A(1));
+ for (int* p = ab; p < an; ++p)
+ c2.push_back(MoveOnly(*p));
+ std::deque<MoveOnly, A> c3(std::move(c1), A(3)); // unequal allocator
+ assert(c2 == c3);
+ assert(c3.get_allocator() == A(3));
+ LIBCPP_ASSERT(c1.size() != 0);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c3));
+ }
+ {
+ int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
+ const int* an = ab + sizeof(ab) / sizeof(ab[0]);
+ typedef test_allocator<MoveOnly> A;
+ std::deque<MoveOnly, A> c1(A(1));
+ for (int* p = ab; p < an; ++p)
+ c1.push_back(MoveOnly(*p));
+ std::deque<MoveOnly, A> c2(A(1));
+ for (int* p = ab; p < an; ++p)
+ c2.push_back(MoveOnly(*p));
+ std::deque<MoveOnly, A> c3(std::move(c1), A(1)); // equal allocator
+ assert(c2 == c3);
+ assert(c3.get_allocator() == A(1));
+ LIBCPP_ASSERT(c1.size() == 0);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c3));
+ }
+ {
+ int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
+ const int* an = ab + sizeof(ab) / sizeof(ab[0]);
+ typedef other_allocator<MoveOnly> A;
+ std::deque<MoveOnly, A> c1(A(1));
+ for (int* p = ab; p < an; ++p)
+ c1.push_back(MoveOnly(*p));
+ std::deque<MoveOnly, A> c2(A(1));
+ for (int* p = ab; p < an; ++p)
+ c2.push_back(MoveOnly(*p));
+ std::deque<MoveOnly, A> c3(std::move(c1), A(3)); // unequal allocator
+ assert(c2 == c3);
+ assert(c3.get_allocator() == A(3));
+ LIBCPP_ASSERT(c1.size() != 0);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c3));
+ }
+ {
+ int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
+ const int* an = ab + sizeof(ab) / sizeof(ab[0]);
+ typedef min_allocator<MoveOnly> A;
+ std::deque<MoveOnly, A> c1(A{});
+ for (int* p = ab; p < an; ++p)
+ c1.push_back(MoveOnly(*p));
+ std::deque<MoveOnly, A> c2(A{});
+ for (int* p = ab; p < an; ++p)
+ c2.push_back(MoveOnly(*p));
+ std::deque<MoveOnly, A> c3(std::move(c1), A()); // equal allocator
+ assert(c2 == c3);
+ assert(c3.get_allocator() == A());
+ LIBCPP_ASSERT(c1.size() == 0);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c3));
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/move_assign.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/move_assign.pass.cpp
index 7cf0b63e06b1eaa..426dea034710156 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.cons/move_assign.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.cons/move_assign.pass.cpp
@@ -21,84 +21,83 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
- int* an = ab + sizeof(ab)/sizeof(ab[0]);
- typedef test_allocator<MoveOnly> A;
- std::deque<MoveOnly, A> c1(A(5));
- for (int* p = ab; p < an; ++p)
- c1.push_back(MoveOnly(*p));
- std::deque<MoveOnly, A> c2(A(5));
- for (int* p = ab; p < an; ++p)
- c2.push_back(MoveOnly(*p));
- std::deque<MoveOnly, A> c3(A(5));
- c3 = std::move(c1);
- assert(c2 == c3);
- assert(c1.size() == 0);
- assert(c3.get_allocator() == A(5));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c3));
- }
- {
- int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
- int* an = ab + sizeof(ab)/sizeof(ab[0]);
- typedef test_allocator<MoveOnly> A;
- std::deque<MoveOnly, A> c1(A(5));
- for (int* p = ab; p < an; ++p)
- c1.push_back(MoveOnly(*p));
- std::deque<MoveOnly, A> c2(A(5));
- for (int* p = ab; p < an; ++p)
- c2.push_back(MoveOnly(*p));
- std::deque<MoveOnly, A> c3(A(6));
- c3 = std::move(c1);
- assert(c2 == c3);
- assert(c1.size() != 0);
- assert(c3.get_allocator() == A(6));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c3));
- }
- {
- int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
- int* an = ab + sizeof(ab)/sizeof(ab[0]);
- typedef other_allocator<MoveOnly> A;
- std::deque<MoveOnly, A> c1(A(5));
- for (int* p = ab; p < an; ++p)
- c1.push_back(MoveOnly(*p));
- std::deque<MoveOnly, A> c2(A(5));
- for (int* p = ab; p < an; ++p)
- c2.push_back(MoveOnly(*p));
- std::deque<MoveOnly, A> c3(A(6));
- c3 = std::move(c1);
- assert(c2 == c3);
- assert(c1.size() == 0);
- assert(c3.get_allocator() == A(5));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c3));
- }
- {
- int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
- int* an = ab + sizeof(ab)/sizeof(ab[0]);
- typedef min_allocator<MoveOnly> A;
- std::deque<MoveOnly, A> c1(A{});
- for (int* p = ab; p < an; ++p)
- c1.push_back(MoveOnly(*p));
- std::deque<MoveOnly, A> c2(A{});
- for (int* p = ab; p < an; ++p)
- c2.push_back(MoveOnly(*p));
- std::deque<MoveOnly, A> c3(A{});
- c3 = std::move(c1);
- assert(c2 == c3);
- assert(c1.size() == 0);
- assert(c3.get_allocator() == A());
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c3));
- }
+int main(int, char**) {
+ {
+ int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
+ int* an = ab + sizeof(ab) / sizeof(ab[0]);
+ typedef test_allocator<MoveOnly> A;
+ std::deque<MoveOnly, A> c1(A(5));
+ for (int* p = ab; p < an; ++p)
+ c1.push_back(MoveOnly(*p));
+ std::deque<MoveOnly, A> c2(A(5));
+ for (int* p = ab; p < an; ++p)
+ c2.push_back(MoveOnly(*p));
+ std::deque<MoveOnly, A> c3(A(5));
+ c3 = std::move(c1);
+ assert(c2 == c3);
+ assert(c1.size() == 0);
+ assert(c3.get_allocator() == A(5));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c3));
+ }
+ {
+ int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
+ int* an = ab + sizeof(ab) / sizeof(ab[0]);
+ typedef test_allocator<MoveOnly> A;
+ std::deque<MoveOnly, A> c1(A(5));
+ for (int* p = ab; p < an; ++p)
+ c1.push_back(MoveOnly(*p));
+ std::deque<MoveOnly, A> c2(A(5));
+ for (int* p = ab; p < an; ++p)
+ c2.push_back(MoveOnly(*p));
+ std::deque<MoveOnly, A> c3(A(6));
+ c3 = std::move(c1);
+ assert(c2 == c3);
+ assert(c1.size() != 0);
+ assert(c3.get_allocator() == A(6));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c3));
+ }
+ {
+ int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
+ int* an = ab + sizeof(ab) / sizeof(ab[0]);
+ typedef other_allocator<MoveOnly> A;
+ std::deque<MoveOnly, A> c1(A(5));
+ for (int* p = ab; p < an; ++p)
+ c1.push_back(MoveOnly(*p));
+ std::deque<MoveOnly, A> c2(A(5));
+ for (int* p = ab; p < an; ++p)
+ c2.push_back(MoveOnly(*p));
+ std::deque<MoveOnly, A> c3(A(6));
+ c3 = std::move(c1);
+ assert(c2 == c3);
+ assert(c1.size() == 0);
+ assert(c3.get_allocator() == A(5));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c3));
+ }
+ {
+ int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
+ int* an = ab + sizeof(ab) / sizeof(ab[0]);
+ typedef min_allocator<MoveOnly> A;
+ std::deque<MoveOnly, A> c1(A{});
+ for (int* p = ab; p < an; ++p)
+ c1.push_back(MoveOnly(*p));
+ std::deque<MoveOnly, A> c2(A{});
+ for (int* p = ab; p < an; ++p)
+ c2.push_back(MoveOnly(*p));
+ std::deque<MoveOnly, A> c3(A{});
+ c3 = std::move(c1);
+ assert(c2 == c3);
+ assert(c1.size() == 0);
+ assert(c3.get_allocator() == A());
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c3));
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/move_noexcept.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/move_noexcept.pass.cpp
index add19ec61c8cc3e..37e8a801e9d7199 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.cons/move_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.cons/move_noexcept.pass.cpp
@@ -23,32 +23,30 @@
#include "test_allocator.h"
template <class T>
-struct some_alloc
-{
- typedef T value_type;
- some_alloc(const some_alloc&);
- void allocate(std::size_t);
+struct some_alloc {
+ typedef T value_type;
+ some_alloc(const some_alloc&);
+ void allocate(std::size_t);
};
-int main(int, char**)
-{
+int main(int, char**) {
#if defined(_LIBCPP_VERSION)
- {
- typedef std::deque<MoveOnly> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
- }
- {
- typedef std::deque<MoveOnly, test_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
- }
- {
- typedef std::deque<MoveOnly, other_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
- }
- {
- typedef std::deque<MoveOnly, some_alloc<MoveOnly>> C;
- static_assert(!std::is_nothrow_move_constructible<C>::value, "");
- }
+ {
+ typedef std::deque<MoveOnly> C;
+ static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ }
+ {
+ typedef std::deque<MoveOnly, test_allocator<MoveOnly>> C;
+ static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ }
+ {
+ typedef std::deque<MoveOnly, other_allocator<MoveOnly>> C;
+ static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ }
+ {
+ typedef std::deque<MoveOnly, some_alloc<MoveOnly>> C;
+ static_assert(!std::is_nothrow_move_constructible<C>::value, "");
+ }
#endif // _LIBCPP_VERSION
return 0;
diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/op_equal.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/op_equal.pass.cpp
index 538d3fc4aa44553..05d172268e0bd1d 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.cons/op_equal.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.cons/op_equal.pass.cpp
@@ -18,56 +18,53 @@
#include "min_allocator.h"
template <class C>
-void
-test(const C& x)
-{
- C c;
- c = x;
- assert(c == x);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(x));
+void test(const C& x) {
+ C c;
+ c = x;
+ assert(c == x);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(x));
}
-int main(int, char**)
-{
- {
- int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
- int* an = ab + sizeof(ab)/sizeof(ab[0]);
- test(std::deque<int>(ab, an));
- }
- {
- std::deque<int, test_allocator<int> > l(3, 2, test_allocator<int>(5));
- std::deque<int, test_allocator<int> > l2(l, test_allocator<int>(3));
- l2 = l;
- assert(l2 == l);
- assert(l2.get_allocator() == test_allocator<int>(3));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(l));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(l2));
- }
- {
- std::deque<int, other_allocator<int> > l(3, 2, other_allocator<int>(5));
- std::deque<int, other_allocator<int> > l2(l, other_allocator<int>(3));
- l2 = l;
- assert(l2 == l);
- assert(l2.get_allocator() == other_allocator<int>(5));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(l));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(l2));
- }
+int main(int, char**) {
+ {
+ int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
+ int* an = ab + sizeof(ab) / sizeof(ab[0]);
+ test(std::deque<int>(ab, an));
+ }
+ {
+ std::deque<int, test_allocator<int> > l(3, 2, test_allocator<int>(5));
+ std::deque<int, test_allocator<int> > l2(l, test_allocator<int>(3));
+ l2 = l;
+ assert(l2 == l);
+ assert(l2.get_allocator() == test_allocator<int>(3));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(l));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(l2));
+ }
+ {
+ std::deque<int, other_allocator<int> > l(3, 2, other_allocator<int>(5));
+ std::deque<int, other_allocator<int> > l2(l, other_allocator<int>(3));
+ l2 = l;
+ assert(l2 == l);
+ assert(l2.get_allocator() == other_allocator<int>(5));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(l));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(l2));
+ }
#if TEST_STD_VER >= 11
- {
- int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
- int* an = ab + sizeof(ab)/sizeof(ab[0]);
- test(std::deque<int, min_allocator<int>>(ab, an));
- }
- {
- std::deque<int, min_allocator<int> > l(3, 2, min_allocator<int>());
- std::deque<int, min_allocator<int> > l2(l, min_allocator<int>());
- l2 = l;
- assert(l2 == l);
- assert(l2.get_allocator() == min_allocator<int>());
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(l));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(l2));
- }
+ {
+ int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
+ int* an = ab + sizeof(ab) / sizeof(ab[0]);
+ test(std::deque<int, min_allocator<int>>(ab, an));
+ }
+ {
+ std::deque<int, min_allocator<int> > l(3, 2, min_allocator<int>());
+ std::deque<int, min_allocator<int> > l2(l, min_allocator<int>());
+ l2 = l;
+ assert(l2 == l);
+ assert(l2.get_allocator() == min_allocator<int>());
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(l));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(l2));
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/op_equal_initializer_list.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/op_equal_initializer_list.pass.cpp
index 2331d3017dcd849..b2760b4a3ff4965 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.cons/op_equal_initializer_list.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.cons/op_equal_initializer_list.pass.cpp
@@ -19,9 +19,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
std::deque<int> d;
d = {3, 4, 5, 6};
assert(d.size() == 4);
@@ -30,8 +29,8 @@ int main(int, char**)
assert(d[2] == 5);
assert(d[3] == 6);
LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(d));
- }
- {
+ }
+ {
std::deque<int, min_allocator<int>> d;
d = {3, 4, 5, 6};
assert(d.size() == 4);
@@ -40,7 +39,7 @@ int main(int, char**)
assert(d[2] == 5);
assert(d[3] == 6);
LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(d));
- }
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/size.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/size.pass.cpp
index de1a9843a478ec3..f8f42bd668f831a 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.cons/size.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.cons/size.pass.cpp
@@ -21,36 +21,32 @@
#include "min_allocator.h"
template <class T, class Allocator>
-void
-test2(unsigned n)
-{
+void test2(unsigned n) {
#if TEST_STD_VER > 11
- typedef std::deque<T, Allocator> C;
- typedef typename C::const_iterator const_iterator;
- assert(DefaultOnly::count == 0);
- {
+ typedef std::deque<T, Allocator> C;
+ typedef typename C::const_iterator const_iterator;
+ assert(DefaultOnly::count == 0);
+ {
C d(n, Allocator());
assert(static_cast<unsigned>(DefaultOnly::count) == n);
assert(d.size() == n);
assert(static_cast<std::size_t>(std::distance(d.begin(), d.end())) == d.size());
LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(d));
for (const_iterator i = d.begin(), e = d.end(); i != e; ++i)
- assert(*i == T());
- }
- assert(DefaultOnly::count == 0);
+ assert(*i == T());
+ }
+ assert(DefaultOnly::count == 0);
#else
- ((void)n);
+ ((void)n);
#endif
}
template <class T, class Allocator>
-void
-test1(unsigned n)
-{
- typedef std::deque<T, Allocator> C;
- typedef typename C::const_iterator const_iterator;
- assert(DefaultOnly::count == 0);
- {
+void test1(unsigned n) {
+ typedef std::deque<T, Allocator> C;
+ typedef typename C::const_iterator const_iterator;
+ assert(DefaultOnly::count == 0);
+ {
C d(n);
assert(static_cast<unsigned>(DefaultOnly::count) == n);
assert(d.size() == n);
@@ -58,65 +54,59 @@ test1(unsigned n)
LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(d));
#if TEST_STD_VER >= 11
for (const_iterator i = d.begin(), e = d.end(); i != e; ++i)
- assert(*i == T());
+ assert(*i == T());
#endif
- }
- assert(DefaultOnly::count == 0);
+ }
+ assert(DefaultOnly::count == 0);
}
template <class T, class Allocator>
-void
-test3(unsigned n, Allocator const &alloc = Allocator())
-{
+void test3(unsigned n, Allocator const& alloc = Allocator()) {
#if TEST_STD_VER > 11
- typedef std::deque<T, Allocator> C;
- {
+ typedef std::deque<T, Allocator> C;
+ {
C d(n, alloc);
assert(d.size() == n);
assert(d.get_allocator() == alloc);
LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(d));
- }
+ }
#else
- ((void)n);
- ((void)alloc);
+ ((void)n);
+ ((void)alloc);
#endif
}
template <class T, class Allocator>
-void
-test(unsigned n)
-{
- test1<T, Allocator> ( n );
- test2<T, Allocator> ( n );
+void test(unsigned n) {
+ test1<T, Allocator>(n);
+ test2<T, Allocator>(n);
}
-int main(int, char**)
-{
- test<DefaultOnly, std::allocator<DefaultOnly> >(0);
- test<DefaultOnly, std::allocator<DefaultOnly> >(1);
- test<DefaultOnly, std::allocator<DefaultOnly> >(10);
- test<DefaultOnly, std::allocator<DefaultOnly> >(1023);
- test<DefaultOnly, std::allocator<DefaultOnly> >(1024);
- test<DefaultOnly, std::allocator<DefaultOnly> >(1025);
- test<DefaultOnly, std::allocator<DefaultOnly> >(2047);
- test<DefaultOnly, std::allocator<DefaultOnly> >(2048);
- test<DefaultOnly, std::allocator<DefaultOnly> >(2049);
- test<DefaultOnly, std::allocator<DefaultOnly> >(4095);
- test<DefaultOnly, std::allocator<DefaultOnly> >(4096);
- test<DefaultOnly, std::allocator<DefaultOnly> >(4097);
+int main(int, char**) {
+ test<DefaultOnly, std::allocator<DefaultOnly> >(0);
+ test<DefaultOnly, std::allocator<DefaultOnly> >(1);
+ test<DefaultOnly, std::allocator<DefaultOnly> >(10);
+ test<DefaultOnly, std::allocator<DefaultOnly> >(1023);
+ test<DefaultOnly, std::allocator<DefaultOnly> >(1024);
+ test<DefaultOnly, std::allocator<DefaultOnly> >(1025);
+ test<DefaultOnly, std::allocator<DefaultOnly> >(2047);
+ test<DefaultOnly, std::allocator<DefaultOnly> >(2048);
+ test<DefaultOnly, std::allocator<DefaultOnly> >(2049);
+ test<DefaultOnly, std::allocator<DefaultOnly> >(4095);
+ test<DefaultOnly, std::allocator<DefaultOnly> >(4096);
+ test<DefaultOnly, std::allocator<DefaultOnly> >(4097);
- LIBCPP_ONLY(test1<DefaultOnly, limited_allocator<DefaultOnly, 4096> >(4095));
+ LIBCPP_ONLY(test1<DefaultOnly, limited_allocator<DefaultOnly, 4096> >(4095));
#if TEST_STD_VER >= 11
- test<DefaultOnly, min_allocator<DefaultOnly> >(4095);
+ test<DefaultOnly, min_allocator<DefaultOnly> >(4095);
#endif
#if TEST_STD_VER > 11
- test3<DefaultOnly, std::allocator<DefaultOnly>> (1023);
- test3<int, std::allocator<int>>(1);
- test3<int, min_allocator<int>> (3);
+ test3<DefaultOnly, std::allocator<DefaultOnly>>(1023);
+ test3<int, std::allocator<int>>(1);
+ test3<int, min_allocator<int>>(3);
#endif
-
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/size_value.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/size_value.pass.cpp
index 767c544e9556166..231aa9c44c6631d 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.cons/size_value.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.cons/size_value.pass.cpp
@@ -20,36 +20,33 @@
#include "min_allocator.h"
template <class T, class Allocator>
-void
-test(unsigned n, const T& x)
-{
- typedef std::deque<T, Allocator> C;
- typedef typename C::const_iterator const_iterator;
- C d(n, x);
- assert(d.size() == n);
- assert(static_cast<std::size_t>(std::distance(d.begin(), d.end())) == d.size());
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(d));
- for (const_iterator i = d.begin(), e = d.end(); i != e; ++i)
- assert(*i == x);
+void test(unsigned n, const T& x) {
+ typedef std::deque<T, Allocator> C;
+ typedef typename C::const_iterator const_iterator;
+ C d(n, x);
+ assert(d.size() == n);
+ assert(static_cast<std::size_t>(std::distance(d.begin(), d.end())) == d.size());
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(d));
+ for (const_iterator i = d.begin(), e = d.end(); i != e; ++i)
+ assert(*i == x);
}
-int main(int, char**)
-{
- test<int, std::allocator<int> >(0, 5);
- test<int, std::allocator<int> >(1, 10);
- test<int, std::allocator<int> >(10, 11);
- test<int, std::allocator<int> >(1023, -11);
- test<int, std::allocator<int> >(1024, 25);
- test<int, std::allocator<int> >(1025, 0);
- test<int, std::allocator<int> >(2047, 110);
- test<int, std::allocator<int> >(2048, -500);
- test<int, std::allocator<int> >(2049, 654);
- test<int, std::allocator<int> >(4095, 78);
- test<int, std::allocator<int> >(4096, 1165);
- test<int, std::allocator<int> >(4097, 157);
- LIBCPP_ONLY(test<int, limited_allocator<int, 4096> >(4095, 90));
+int main(int, char**) {
+ test<int, std::allocator<int> >(0, 5);
+ test<int, std::allocator<int> >(1, 10);
+ test<int, std::allocator<int> >(10, 11);
+ test<int, std::allocator<int> >(1023, -11);
+ test<int, std::allocator<int> >(1024, 25);
+ test<int, std::allocator<int> >(1025, 0);
+ test<int, std::allocator<int> >(2047, 110);
+ test<int, std::allocator<int> >(2048, -500);
+ test<int, std::allocator<int> >(2049, 654);
+ test<int, std::allocator<int> >(4095, 78);
+ test<int, std::allocator<int> >(4096, 1165);
+ test<int, std::allocator<int> >(4097, 157);
+ LIBCPP_ONLY(test<int, limited_allocator<int, 4096> >(4095, 90));
#if TEST_STD_VER >= 11
- test<int, min_allocator<int> >(4095, 90);
+ test<int, min_allocator<int> >(4095, 90);
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/size_value_alloc.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/size_value_alloc.pass.cpp
index 746d5a221663f8e..f8ea37e64d9ebb3 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.cons/size_value_alloc.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.cons/size_value_alloc.pass.cpp
@@ -19,23 +19,20 @@
#include "min_allocator.h"
template <class T, class Allocator>
-void
-test(unsigned n, const T& x, const Allocator& a)
-{
- typedef std::deque<T, Allocator> C;
- typedef typename C::const_iterator const_iterator;
- C d(n, x, a);
- assert(d.get_allocator() == a);
- assert(d.size() == n);
- assert(static_cast<std::size_t>(std::distance(d.begin(), d.end())) == d.size());
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(d));
- for (const_iterator i = d.begin(), e = d.end(); i != e; ++i)
- assert(*i == x);
+void test(unsigned n, const T& x, const Allocator& a) {
+ typedef std::deque<T, Allocator> C;
+ typedef typename C::const_iterator const_iterator;
+ C d(n, x, a);
+ assert(d.get_allocator() == a);
+ assert(d.size() == n);
+ assert(static_cast<std::size_t>(std::distance(d.begin(), d.end())) == d.size());
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(d));
+ for (const_iterator i = d.begin(), e = d.end(); i != e; ++i)
+ assert(*i == x);
}
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
std::allocator<int> a;
test(0, 5, a);
test(1, 10, a);
@@ -49,9 +46,9 @@ int main(int, char**)
test(4095, 78, a);
test(4096, 1165, a);
test(4097, 157, a);
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
min_allocator<int> a;
test(0, 5, a);
test(1, 10, a);
@@ -65,7 +62,7 @@ int main(int, char**)
test(4095, 78, a);
test(4096, 1165, a);
test(4097, 157, a);
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/deque/deque.erasure/erase.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.erasure/erase.pass.cpp
index edb52a79618ecee..947e06bd64375a6 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.erasure/erase.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.erasure/erase.pass.cpp
@@ -32,8 +32,7 @@ void test0(S s, U val, S expected, std::size_t expected_erased_count) {
}
template <class S>
-void test()
-{
+void test() {
test0(S(), 1, S(), 0);
test0(S({1}), 1, S(), 1);
@@ -67,15 +66,14 @@ void test()
test0(S({1, 2, 1}), opt(3), S({1, 2, 1}), 0);
}
-int main(int, char**)
-{
- test<std::deque<int>>();
- test<std::deque<int, min_allocator<int>>> ();
- test<std::deque<int, safe_allocator<int>>> ();
- test<std::deque<int, test_allocator<int>>> ();
+int main(int, char**) {
+ test<std::deque<int>>();
+ test<std::deque<int, min_allocator<int>>>();
+ test<std::deque<int, safe_allocator<int>>>();
+ test<std::deque<int, test_allocator<int>>>();
- test<std::deque<long>>();
- test<std::deque<double>>();
+ test<std::deque<long>>();
+ test<std::deque<double>>();
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/deque/deque.erasure/erase_if.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.erasure/erase_if.pass.cpp
index 49709bcc033e263..ed5220422dab22d 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.erasure/erase_if.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.erasure/erase_if.pass.cpp
@@ -31,53 +31,51 @@ void test0(S s, Pred p, S expected, std::size_t expected_erased_count) {
}
template <typename S>
-void test()
-{
- auto is1 = [](auto v) { return v == 1;};
- auto is2 = [](auto v) { return v == 2;};
- auto is3 = [](auto v) { return v == 3;};
- auto is4 = [](auto v) { return v == 4;};
- auto True = [](auto) { return true; };
- auto False = [](auto) { return false; };
-
- test0(S(), is1, S(), 0);
-
- test0(S({1}), is1, S(), 1);
- test0(S({1}), is2, S({1}), 0);
-
- test0(S({1, 2}), is1, S({2}), 1);
- test0(S({1, 2}), is2, S({1}), 1);
- test0(S({1, 2}), is3, S({1, 2}), 0);
- test0(S({1, 1}), is1, S(), 2);
- test0(S({1, 1}), is3, S({1, 1}), 0);
-
- test0(S({1, 2, 3}), is1, S({2, 3}), 1);
- test0(S({1, 2, 3}), is2, S({1, 3}), 1);
- test0(S({1, 2, 3}), is3, S({1, 2}), 1);
- test0(S({1, 2, 3}), is4, S({1, 2, 3}), 0);
-
- test0(S({1, 1, 1}), is1, S(), 3);
- test0(S({1, 1, 1}), is2, S({1, 1, 1}), 0);
- test0(S({1, 1, 2}), is1, S({2}), 2);
- test0(S({1, 1, 2}), is2, S({1, 1}), 1);
- test0(S({1, 1, 2}), is3, S({1, 1, 2}), 0);
- test0(S({1, 2, 2}), is1, S({2, 2}), 1);
- test0(S({1, 2, 2}), is2, S({1}), 2);
- test0(S({1, 2, 2}), is3, S({1, 2, 2}), 0);
-
- test0(S({1, 2, 3}), True, S(), 3);
- test0(S({1, 2, 3}), False, S({1, 2, 3}), 0);
+void test() {
+ auto is1 = [](auto v) { return v == 1; };
+ auto is2 = [](auto v) { return v == 2; };
+ auto is3 = [](auto v) { return v == 3; };
+ auto is4 = [](auto v) { return v == 4; };
+ auto True = [](auto) { return true; };
+ auto False = [](auto) { return false; };
+
+ test0(S(), is1, S(), 0);
+
+ test0(S({1}), is1, S(), 1);
+ test0(S({1}), is2, S({1}), 0);
+
+ test0(S({1, 2}), is1, S({2}), 1);
+ test0(S({1, 2}), is2, S({1}), 1);
+ test0(S({1, 2}), is3, S({1, 2}), 0);
+ test0(S({1, 1}), is1, S(), 2);
+ test0(S({1, 1}), is3, S({1, 1}), 0);
+
+ test0(S({1, 2, 3}), is1, S({2, 3}), 1);
+ test0(S({1, 2, 3}), is2, S({1, 3}), 1);
+ test0(S({1, 2, 3}), is3, S({1, 2}), 1);
+ test0(S({1, 2, 3}), is4, S({1, 2, 3}), 0);
+
+ test0(S({1, 1, 1}), is1, S(), 3);
+ test0(S({1, 1, 1}), is2, S({1, 1, 1}), 0);
+ test0(S({1, 1, 2}), is1, S({2}), 2);
+ test0(S({1, 1, 2}), is2, S({1, 1}), 1);
+ test0(S({1, 1, 2}), is3, S({1, 1, 2}), 0);
+ test0(S({1, 2, 2}), is1, S({2, 2}), 1);
+ test0(S({1, 2, 2}), is2, S({1}), 2);
+ test0(S({1, 2, 2}), is3, S({1, 2, 2}), 0);
+
+ test0(S({1, 2, 3}), True, S(), 3);
+ test0(S({1, 2, 3}), False, S({1, 2, 3}), 0);
}
-int main(int, char**)
-{
- test<std::deque<int>>();
- test<std::deque<int, min_allocator<int>>> ();
- test<std::deque<int, safe_allocator<int>>> ();
- test<std::deque<int, test_allocator<int>>> ();
+int main(int, char**) {
+ test<std::deque<int>>();
+ test<std::deque<int, min_allocator<int>>>();
+ test<std::deque<int, safe_allocator<int>>>();
+ test<std::deque<int, test_allocator<int>>>();
- test<std::deque<long>>();
- test<std::deque<double>>();
+ test<std::deque<long>>();
+ test<std::deque<double>>();
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/clear.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/clear.pass.cpp
index 1e0b04dd24f2511..bb2fa6e52af4322 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/clear.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/clear.pass.cpp
@@ -18,57 +18,56 @@
#include "../../../NotConstructible.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef NotConstructible T;
- typedef std::deque<T> C;
- C c;
- ASSERT_NOEXCEPT(c.clear());
- c.clear();
- assert(std::distance(c.begin(), c.end()) == 0);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
- }
- {
- typedef int T;
- typedef std::deque<T> C;
- const T t[] = {0, 1, 2, 3, 4};
- C c(std::begin(t), std::end(t));
+int main(int, char**) {
+ {
+ typedef NotConstructible T;
+ typedef std::deque<T> C;
+ C c;
+ ASSERT_NOEXCEPT(c.clear());
+ c.clear();
+ assert(std::distance(c.begin(), c.end()) == 0);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
+ }
+ {
+ typedef int T;
+ typedef std::deque<T> C;
+ const T t[] = {0, 1, 2, 3, 4};
+ C c(std::begin(t), std::end(t));
- ASSERT_NOEXCEPT(c.clear());
- c.clear();
- assert(std::distance(c.begin(), c.end()) == 0);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
+ ASSERT_NOEXCEPT(c.clear());
+ c.clear();
+ assert(std::distance(c.begin(), c.end()) == 0);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
- c.clear();
- assert(std::distance(c.begin(), c.end()) == 0);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
- }
+ c.clear();
+ assert(std::distance(c.begin(), c.end()) == 0);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
+ }
#if TEST_STD_VER >= 11
- {
- typedef NotConstructible T;
- typedef std::deque<T, min_allocator<T>> C;
- C c;
- ASSERT_NOEXCEPT(c.clear());
- c.clear();
- assert(std::distance(c.begin(), c.end()) == 0);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
- }
- {
- typedef int T;
- typedef std::deque<T, min_allocator<T>> C;
- const T t[] = {0, 1, 2, 3, 4};
- C c(std::begin(t), std::end(t));
+ {
+ typedef NotConstructible T;
+ typedef std::deque<T, min_allocator<T>> C;
+ C c;
+ ASSERT_NOEXCEPT(c.clear());
+ c.clear();
+ assert(std::distance(c.begin(), c.end()) == 0);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
+ }
+ {
+ typedef int T;
+ typedef std::deque<T, min_allocator<T>> C;
+ const T t[] = {0, 1, 2, 3, 4};
+ C c(std::begin(t), std::end(t));
- ASSERT_NOEXCEPT(c.clear());
- c.clear();
- assert(std::distance(c.begin(), c.end()) == 0);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
+ ASSERT_NOEXCEPT(c.clear());
+ c.clear();
+ assert(std::distance(c.begin(), c.end()) == 0);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
- c.clear();
- assert(std::distance(c.begin(), c.end()) == 0);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
- }
+ c.clear();
+ assert(std::distance(c.begin(), c.end()) == 0);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/emplace.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/emplace.pass.cpp
index b992610506538a4..7c90216a9ce5688 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/emplace.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/emplace.pass.cpp
@@ -21,97 +21,81 @@
#include "../../../Emplaceable.h"
#include "min_allocator.h"
-
template <class C>
-C
-make(int size, int start = 0 )
-{
- const int b = 4096 / sizeof(int);
- int init = 0;
- if (start > 0)
- {
- init = (start+1) / b + ((start+1) % b != 0);
- init *= b;
- --init;
- }
- C c(init);
- for (int i = 0; i < init-start; ++i)
- c.pop_back();
- for (int i = 0; i < size; ++i)
- c.push_back(Emplaceable());
- for (int i = 0; i < start; ++i)
- c.pop_front();
- return c;
+C make(int size, int start = 0) {
+ const int b = 4096 / sizeof(int);
+ int init = 0;
+ if (start > 0) {
+ init = (start + 1) / b + ((start + 1) % b != 0);
+ init *= b;
+ --init;
+ }
+ C c(init);
+ for (int i = 0; i < init - start; ++i)
+ c.pop_back();
+ for (int i = 0; i < size; ++i)
+ c.push_back(Emplaceable());
+ for (int i = 0; i < start; ++i)
+ c.pop_front();
+ return c;
}
template <class C>
-void
-test(int P, C& c1)
-{
- typedef typename C::const_iterator CI;
- std::size_t c1_osize = c1.size();
- CI i = c1.emplace(c1.begin() + P, Emplaceable(1, 2.5));
- assert(i == c1.begin() + P);
- assert(c1.size() == c1_osize + 1);
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(*i == Emplaceable(1, 2.5));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+void test(int P, C& c1) {
+ typedef typename C::const_iterator CI;
+ std::size_t c1_osize = c1.size();
+ CI i = c1.emplace(c1.begin() + P, Emplaceable(1, 2.5));
+ assert(i == c1.begin() + P);
+ assert(c1.size() == c1_osize + 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(*i == Emplaceable(1, 2.5));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
}
template <class C>
-void
-testN(int start, int N)
-{
- for (int i = 0; i <= 3; ++i)
- {
- if (0 <= i && i <= N)
- {
- C c1 = make<C>(N, start);
- test(i, c1);
- }
+void testN(int start, int N) {
+ for (int i = 0; i <= 3; ++i) {
+ if (0 <= i && i <= N) {
+ C c1 = make<C>(N, start);
+ test(i, c1);
}
- for (int i = N/2-1; i <= N/2+1; ++i)
- {
- if (0 <= i && i <= N)
- {
- C c1 = make<C>(N, start);
- test(i, c1);
- }
+ }
+ for (int i = N / 2 - 1; i <= N / 2 + 1; ++i) {
+ if (0 <= i && i <= N) {
+ C c1 = make<C>(N, start);
+ test(i, c1);
}
- for (int i = N - 3; i <= N; ++i)
- {
- if (0 <= i && i <= N)
- {
- C c1 = make<C>(N, start);
- test(i, c1);
- }
+ }
+ for (int i = N - 3; i <= N; ++i) {
+ if (0 <= i && i <= N) {
+ C c1 = make<C>(N, start);
+ test(i, c1);
}
+ }
}
-
-int main(int, char**)
-{
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+int main(int, char**) {
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- testN<std::deque<Emplaceable> >(rng[i], rng[j]);
- }
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<Emplaceable> >(rng[i], rng[j]);
+ }
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- testN<std::deque<Emplaceable, min_allocator<Emplaceable>> >(rng[i], rng[j]);
- }
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<Emplaceable, min_allocator<Emplaceable>> >(rng[i], rng[j]);
+ }
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- testN<std::deque<Emplaceable, safe_allocator<Emplaceable>> >(rng[i], rng[j]);
- }
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<Emplaceable, safe_allocator<Emplaceable>> >(rng[i], rng[j]);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/emplace_back.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/emplace_back.pass.cpp
index 1ea3423bd43c68b..590ab432dd51933 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/emplace_back.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/emplace_back.pass.cpp
@@ -24,89 +24,80 @@
#include "test_allocator.h"
template <class C>
-C
-make(int size, int start = 0 )
-{
- const int b = 4096 / sizeof(int);
- int init = 0;
- if (start > 0)
- {
- init = (start+1) / b + ((start+1) % b != 0);
- init *= b;
- --init;
- }
- C c(init);
- for (int i = 0; i < init-start; ++i)
- c.pop_back();
- for (int i = 0; i < size; ++i)
- c.push_back(Emplaceable());
- for (int i = 0; i < start; ++i)
- c.pop_front();
- return c;
+C make(int size, int start = 0) {
+ const int b = 4096 / sizeof(int);
+ int init = 0;
+ if (start > 0) {
+ init = (start + 1) / b + ((start + 1) % b != 0);
+ init *= b;
+ --init;
+ }
+ C c(init);
+ for (int i = 0; i < init - start; ++i)
+ c.pop_back();
+ for (int i = 0; i < size; ++i)
+ c.push_back(Emplaceable());
+ for (int i = 0; i < start; ++i)
+ c.pop_front();
+ return c;
}
template <class C>
-void
-test(C& c1)
-{
- typedef typename C::iterator I;
- std::size_t c1_osize = c1.size();
+void test(C& c1) {
+ typedef typename C::iterator I;
+ std::size_t c1_osize = c1.size();
#if TEST_STD_VER > 14
- typedef typename C::reference Ref;
- Ref ref = c1.emplace_back(Emplaceable(1, 2.5));
+ typedef typename C::reference Ref;
+ Ref ref = c1.emplace_back(Emplaceable(1, 2.5));
#else
- c1.emplace_back(Emplaceable(1, 2.5));
+ c1.emplace_back(Emplaceable(1, 2.5));
#endif
- assert(c1.size() == c1_osize + 1);
- assert(std::distance(c1.begin(), c1.end())
- == static_cast<std::ptr
diff _t>(c1.size()));
- I i = c1.end();
- assert(*--i == Emplaceable(1, 2.5));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ assert(c1.size() == c1_osize + 1);
+ assert(std::distance(c1.begin(), c1.end()) == static_cast<std::ptr
diff _t>(c1.size()));
+ I i = c1.end();
+ assert(*--i == Emplaceable(1, 2.5));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
#if TEST_STD_VER > 14
- assert(&(*i) == &ref);
+ assert(&(*i) == &ref);
#endif
}
template <class C>
-void
-testN(int start, int N)
-{
- C c1 = make<C>(N, start);
- test(c1);
+void testN(int start, int N) {
+ C c1 = make<C>(N, start);
+ test(c1);
}
-int main(int, char**)
-{
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+int main(int, char**) {
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- testN<std::deque<Emplaceable> >(rng[i], rng[j]);
- }
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<Emplaceable> >(rng[i], rng[j]);
+ }
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- testN<std::deque<Emplaceable, min_allocator<Emplaceable>> >(rng[i], rng[j]);
- }
- {
- std::deque<Tag_X, TaggingAllocator<Tag_X>> c;
- c.emplace_back();
- assert(c.size() == 1);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
- c.emplace_back(1, 2, 3);
- assert(c.size() == 2);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
- c.emplace_front();
- assert(c.size() == 3);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
- c.emplace_front(1, 2, 3);
- assert(c.size() == 4);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
- }
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<Emplaceable, min_allocator<Emplaceable>> >(rng[i], rng[j]);
+ }
+ {
+ std::deque<Tag_X, TaggingAllocator<Tag_X>> c;
+ c.emplace_back();
+ assert(c.size() == 1);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
+ c.emplace_back(1, 2, 3);
+ assert(c.size() == 2);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
+ c.emplace_front();
+ assert(c.size() == 3);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
+ c.emplace_front(1, 2, 3);
+ assert(c.size() == 4);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/emplace_front.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/emplace_front.pass.cpp
index 26926e411c96a99..3fbaee1fc158757 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/emplace_front.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/emplace_front.pass.cpp
@@ -24,90 +24,80 @@
#include "test_allocator.h"
template <class C>
-C
-make(int size, int start = 0 )
-{
- const int b = 4096 / sizeof(int);
- int init = 0;
- if (start > 0)
- {
- init = (start+1) / b + ((start+1) % b != 0);
- init *= b;
- --init;
- }
- C c(init);
- for (int i = 0; i < init-start; ++i)
- c.pop_back();
- for (int i = 0; i < size; ++i)
- c.push_back(Emplaceable());
- for (int i = 0; i < start; ++i)
- c.pop_front();
- return c;
+C make(int size, int start = 0) {
+ const int b = 4096 / sizeof(int);
+ int init = 0;
+ if (start > 0) {
+ init = (start + 1) / b + ((start + 1) % b != 0);
+ init *= b;
+ --init;
+ }
+ C c(init);
+ for (int i = 0; i < init - start; ++i)
+ c.pop_back();
+ for (int i = 0; i < size; ++i)
+ c.push_back(Emplaceable());
+ for (int i = 0; i < start; ++i)
+ c.pop_front();
+ return c;
}
template <class C>
-void
-test(C& c1)
-{
- typedef typename C::iterator I;
- std::size_t c1_osize = c1.size();
+void test(C& c1) {
+ typedef typename C::iterator I;
+ std::size_t c1_osize = c1.size();
#if TEST_STD_VER > 14
- typedef typename C::reference Ref;
- Ref res_ref = c1.emplace_front(Emplaceable(1, 2.5));
+ typedef typename C::reference Ref;
+ Ref res_ref = c1.emplace_front(Emplaceable(1, 2.5));
#else
- c1.emplace_front(Emplaceable(1, 2.5));
+ c1.emplace_front(Emplaceable(1, 2.5));
#endif
- assert(c1.size() == c1_osize + 1);
- assert(std::distance(c1.begin(), c1.end())
- == static_cast<std::ptr
diff _t>(c1.size()));
- I i = c1.begin();
- assert(*i == Emplaceable(1, 2.5));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ assert(c1.size() == c1_osize + 1);
+ assert(std::distance(c1.begin(), c1.end()) == static_cast<std::ptr
diff _t>(c1.size()));
+ I i = c1.begin();
+ assert(*i == Emplaceable(1, 2.5));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
#if TEST_STD_VER > 14
- assert(&res_ref == &(*i));
+ assert(&res_ref == &(*i));
#endif
}
template <class C>
-void
-testN(int start, int N)
-{
- C c1 = make<C>(N, start);
- test(c1);
+void testN(int start, int N) {
+ C c1 = make<C>(N, start);
+ test(c1);
}
-
-int main(int, char**)
-{
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+int main(int, char**) {
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- testN<std::deque<Emplaceable> >(rng[i], rng[j]);
- }
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<Emplaceable> >(rng[i], rng[j]);
+ }
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- testN<std::deque<Emplaceable, min_allocator<Emplaceable>> >(rng[i], rng[j]);
- }
- {
- std::deque<Tag_X, TaggingAllocator<Tag_X>> c;
- c.emplace_front();
- assert(c.size() == 1);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
- c.emplace_front(1, 2, 3);
- assert(c.size() == 2);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
- c.emplace_front();
- assert(c.size() == 3);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
- c.emplace_front(1, 2, 3);
- assert(c.size() == 4);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
- }
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<Emplaceable, min_allocator<Emplaceable>> >(rng[i], rng[j]);
+ }
+ {
+ std::deque<Tag_X, TaggingAllocator<Tag_X>> c;
+ c.emplace_front();
+ assert(c.size() == 1);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
+ c.emplace_front(1, 2, 3);
+ assert(c.size() == 2);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
+ c.emplace_front();
+ assert(c.size() == 3);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
+ c.emplace_front(1, 2, 3);
+ assert(c.size() == 4);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/erase_iter.invalidation.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/erase_iter.invalidation.pass.cpp
index 22f67b2f9287331..b538b0f037ab1dd 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/erase_iter.invalidation.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/erase_iter.invalidation.pass.cpp
@@ -20,56 +20,52 @@
#include "test_macros.h"
template <typename C>
-void del_at_start(C c)
-{
- typename C::iterator first = c.begin();
- typename C::iterator it1 = first + 1;
- typename C::iterator it2 = c.end() - 1;
+void del_at_start(C c) {
+ typename C::iterator first = c.begin();
+ typename C::iterator it1 = first + 1;
+ typename C::iterator it2 = c.end() - 1;
- c.erase (first);
+ c.erase(first);
- typename C::iterator it3 = c.begin();
- typename C::iterator it4 = c.end() - 1;
- assert( it1 == it3);
- assert( *it1 == *it3);
- assert(&*it1 == &*it3);
- assert( it2 == it4);
- assert( *it2 == *it4);
- assert(&*it2 == &*it4);
+ typename C::iterator it3 = c.begin();
+ typename C::iterator it4 = c.end() - 1;
+ assert(it1 == it3);
+ assert(*it1 == *it3);
+ assert(&*it1 == &*it3);
+ assert(it2 == it4);
+ assert(*it2 == *it4);
+ assert(&*it2 == &*it4);
}
template <typename C>
-void del_at_end(C c)
-{
- typename C::iterator first = c.end() - 1;
- typename C::iterator it1 = c.begin();
- typename C::iterator it2 = first - 1;
+void del_at_end(C c) {
+ typename C::iterator first = c.end() - 1;
+ typename C::iterator it1 = c.begin();
+ typename C::iterator it2 = first - 1;
- c.erase (first);
+ c.erase(first);
- typename C::iterator it3 = c.begin();
- typename C::iterator it4 = c.end() - 1;
- assert( it1 == it3);
- assert( *it1 == *it3);
- assert(&*it1 == &*it3);
- assert( it2 == it4);
- assert( *it2 == *it4);
- assert(&*it2 == &*it4);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
+ typename C::iterator it3 = c.begin();
+ typename C::iterator it4 = c.end() - 1;
+ assert(it1 == it3);
+ assert(*it1 == *it3);
+ assert(&*it1 == &*it3);
+ assert(it2 == it4);
+ assert(*it2 == *it4);
+ assert(&*it2 == &*it4);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
}
-int main(int, char**)
-{
- std::deque<int> queue;
- for (int i = 0; i < 20; ++i)
- queue.push_back(i);
+int main(int, char**) {
+ std::deque<int> queue;
+ for (int i = 0; i < 20; ++i)
+ queue.push_back(i);
- while (queue.size() > 1)
- {
- del_at_start(queue);
- del_at_end(queue);
- queue.pop_back();
- }
+ while (queue.size() > 1) {
+ del_at_start(queue);
+ del_at_end(queue);
+ queue.pop_back();
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp
index 6b19d5b8bc69ba2..2d40f0c449f4d93 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp
@@ -22,106 +22,109 @@
#ifndef TEST_HAS_NO_EXCEPTIONS
struct Throws {
- Throws() : v_(0) {}
- Throws(int v) : v_(v) {}
- Throws(const Throws &rhs) : v_(rhs.v_) { if (sThrows) throw 1; }
- Throws( Throws &&rhs) : v_(rhs.v_) { if (sThrows) throw 1; }
- Throws& operator=(const Throws &rhs) { v_ = rhs.v_; return *this; }
- Throws& operator=( Throws &&rhs) { v_ = rhs.v_; return *this; }
- int v_;
+ Throws() : v_(0) {}
+ Throws(int v) : v_(v) {}
+ Throws(const Throws& rhs) : v_(rhs.v_) {
+ if (sThrows)
+ throw 1;
+ }
+ Throws(Throws&& rhs) : v_(rhs.v_) {
+ if (sThrows)
+ throw 1;
+ }
+ Throws& operator=(const Throws& rhs) {
+ v_ = rhs.v_;
+ return *this;
+ }
+ Throws& operator=(Throws&& rhs) {
+ v_ = rhs.v_;
+ return *this;
+ }
+ int v_;
- static bool sThrows;
- };
+ static bool sThrows;
+};
bool Throws::sThrows = false;
#endif
template <class C>
-C
-make(int size, int start = 0 )
-{
- const int b = 4096 / sizeof(int);
- int init = 0;
- if (start > 0)
- {
- init = (start+1) / b + ((start+1) % b != 0);
- init *= b;
- --init;
- }
- C c(init, 0);
- for (int i = 0; i < init-start; ++i)
- c.pop_back();
- for (int i = 0; i < size; ++i)
- c.push_back(i);
- for (int i = 0; i < start; ++i)
- c.pop_front();
- return c;
+C make(int size, int start = 0) {
+ const int b = 4096 / sizeof(int);
+ int init = 0;
+ if (start > 0) {
+ init = (start + 1) / b + ((start + 1) % b != 0);
+ init *= b;
+ --init;
+ }
+ C c(init, 0);
+ for (int i = 0; i < init - start; ++i)
+ c.pop_back();
+ for (int i = 0; i < size; ++i)
+ c.push_back(i);
+ for (int i = 0; i < start; ++i)
+ c.pop_front();
+ return c;
}
template <class C>
-void
-test(int P, C& c1)
-{
- typedef typename C::iterator I;
- assert(static_cast<std::size_t>(P) < c1.size());
- std::size_t c1_osize = c1.size();
- I i = c1.erase(c1.cbegin() + P);
- assert(i == c1.begin() + P);
- assert(c1.size() == c1_osize - 1);
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- i = c1.begin();
- int j = 0;
- for (; j < P; ++j, ++i)
- assert(*i == j);
- for (++j; static_cast<std::size_t>(j) < c1_osize; ++j, ++i)
- assert(*i == j);
+void test(int P, C& c1) {
+ typedef typename C::iterator I;
+ assert(static_cast<std::size_t>(P) < c1.size());
+ std::size_t c1_osize = c1.size();
+ I i = c1.erase(c1.cbegin() + P);
+ assert(i == c1.begin() + P);
+ assert(c1.size() == c1_osize - 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ i = c1.begin();
+ int j = 0;
+ for (; j < P; ++j, ++i)
+ assert(*i == j);
+ for (++j; static_cast<std::size_t>(j) < c1_osize; ++j, ++i)
+ assert(*i == j);
}
template <class C>
-void
-testN(int start, int N)
-{
- int pstep = std::max(N / std::max(std::min(N, 10), 1), 1);
- for (int p = 0; p < N; p += pstep)
- {
- C c1 = make<C>(N, start);
- test(p, c1);
- }
+void testN(int start, int N) {
+ int pstep = std::max(N / std::max(std::min(N, 10), 1), 1);
+ for (int p = 0; p < N; p += pstep) {
+ C c1 = make<C>(N, start);
+ test(p, c1);
+ }
}
-int main(int, char**)
-{
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+int main(int, char**) {
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- testN<std::deque<int> >(rng[i], rng[j]);
- }
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<int> >(rng[i], rng[j]);
+ }
#if TEST_STD_VER >= 11
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j]);
- }
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j]);
+ }
#endif
#ifndef TEST_HAS_NO_EXCEPTIONS
-// Test for LWG2953:
-// Throws: Nothing unless an exception is thrown by the assignment operator of T.
-// (which includes move assignment)
- {
+ // Test for LWG2953:
+ // Throws: Nothing unless an exception is thrown by the assignment operator of T.
+ // (which includes move assignment)
+ {
Throws arr[] = {1, 2, 3};
- std::deque<Throws> v(arr, arr+3);
+ std::deque<Throws> v(arr, arr + 3);
Throws::sThrows = true;
v.erase(v.begin());
v.erase(--v.end());
v.erase(v.begin());
assert(v.size() == 0);
LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(v));
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.invalidation.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.invalidation.pass.cpp
index 2920b7d83a1a643..320d4771a2fc768 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.invalidation.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.invalidation.pass.cpp
@@ -13,7 +13,6 @@
// Erasing items from the beginning or the end of a deque shall not invalidate iterators
// to items that were not erased.
-
#include "asan_testing.h"
#include <deque>
#include <cstdint>
@@ -22,63 +21,57 @@
#include "test_macros.h"
template <typename C>
-void del_at_start(C c, std::size_t num)
-{
- typename C::iterator first = c.begin();
- typename C::iterator last = first + num;
- typename C::iterator it1 = last;
- typename C::iterator it2 = c.end() - 1;
-
- c.erase (first, last);
-
- typename C::iterator it3 = c.begin();
- typename C::iterator it4 = c.end() - 1;
- assert( it1 == it3);
- assert( *it1 == *it3);
- assert(&*it1 == &*it3);
- assert( it2 == it4);
- assert( *it2 == *it4);
- assert(&*it2 == &*it4);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
+void del_at_start(C c, std::size_t num) {
+ typename C::iterator first = c.begin();
+ typename C::iterator last = first + num;
+ typename C::iterator it1 = last;
+ typename C::iterator it2 = c.end() - 1;
+
+ c.erase(first, last);
+
+ typename C::iterator it3 = c.begin();
+ typename C::iterator it4 = c.end() - 1;
+ assert(it1 == it3);
+ assert(*it1 == *it3);
+ assert(&*it1 == &*it3);
+ assert(it2 == it4);
+ assert(*it2 == *it4);
+ assert(&*it2 == &*it4);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
}
template <typename C>
-void del_at_end(C c, std::size_t num)
-{
- typename C::iterator last = c.end();
- typename C::iterator first = last - num;
- typename C::iterator it1 = c.begin();
- typename C::iterator it2 = first - 1;
-
- c.erase (first, last);
-
- typename C::iterator it3 = c.begin();
- typename C::iterator it4 = c.end() - 1;
- assert( it1 == it3);
- assert( *it1 == *it3);
- assert(&*it1 == &*it3);
- assert( it2 == it4);
- assert( *it2 == *it4);
- assert(&*it2 == &*it4);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
+void del_at_end(C c, std::size_t num) {
+ typename C::iterator last = c.end();
+ typename C::iterator first = last - num;
+ typename C::iterator it1 = c.begin();
+ typename C::iterator it2 = first - 1;
+
+ c.erase(first, last);
+
+ typename C::iterator it3 = c.begin();
+ typename C::iterator it4 = c.end() - 1;
+ assert(it1 == it3);
+ assert(*it1 == *it3);
+ assert(&*it1 == &*it3);
+ assert(it2 == it4);
+ assert(*it2 == *it4);
+ assert(&*it2 == &*it4);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
}
+int main(int, char**) {
+ std::deque<int> queue;
+ for (int i = 0; i < 20; ++i)
+ queue.push_back(i);
-int main(int, char**)
-{
- std::deque<int> queue;
- for (int i = 0; i < 20; ++i)
- queue.push_back(i);
-
- while (queue.size() > 1)
- {
- for (std::size_t i = 1; i < queue.size(); ++i)
- {
- del_at_start(queue, i);
- del_at_end (queue, i);
- }
- queue.pop_back();
+ while (queue.size() > 1) {
+ for (std::size_t i = 1; i < queue.size(); ++i) {
+ del_at_start(queue, i);
+ del_at_end(queue, i);
}
+ queue.pop_back();
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp
index 51e774cb5919480..1eaa7a6c72a57db 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp
@@ -24,104 +24,105 @@
#ifndef TEST_HAS_NO_EXCEPTIONS
struct Throws {
- Throws() : v_(0) {}
- Throws(int v) : v_(v) {}
- Throws(const Throws &rhs) : v_(rhs.v_) { if (sThrows) throw 1; }
- Throws( Throws &&rhs) : v_(rhs.v_) { if (sThrows) throw 1; }
- Throws& operator=(const Throws &rhs) { v_ = rhs.v_; return *this; }
- Throws& operator=( Throws &&rhs) { v_ = rhs.v_; return *this; }
- int v_;
+ Throws() : v_(0) {}
+ Throws(int v) : v_(v) {}
+ Throws(const Throws& rhs) : v_(rhs.v_) {
+ if (sThrows)
+ throw 1;
+ }
+ Throws(Throws&& rhs) : v_(rhs.v_) {
+ if (sThrows)
+ throw 1;
+ }
+ Throws& operator=(const Throws& rhs) {
+ v_ = rhs.v_;
+ return *this;
+ }
+ Throws& operator=(Throws&& rhs) {
+ v_ = rhs.v_;
+ return *this;
+ }
+ int v_;
- static bool sThrows;
- };
+ static bool sThrows;
+};
bool Throws::sThrows = false;
#endif
-
template <class C>
-C
-make(int size, int start = 0 )
-{
- const int b = 4096 / sizeof(int);
- int init = 0;
- if (start > 0)
- {
- init = (start+1) / b + ((start+1) % b != 0);
- init *= b;
- --init;
- }
- C c(init, 0);
- for (int i = 0; i < init-start; ++i)
- c.pop_back();
- for (int i = 0; i < size; ++i)
- c.push_back(i);
- for (int i = 0; i < start; ++i)
- c.pop_front();
- return c;
+C make(int size, int start = 0) {
+ const int b = 4096 / sizeof(int);
+ int init = 0;
+ if (start > 0) {
+ init = (start + 1) / b + ((start + 1) % b != 0);
+ init *= b;
+ --init;
+ }
+ C c(init, 0);
+ for (int i = 0; i < init - start; ++i)
+ c.pop_back();
+ for (int i = 0; i < size; ++i)
+ c.push_back(i);
+ for (int i = 0; i < start; ++i)
+ c.pop_front();
+ return c;
}
template <class C>
-void
-test(int P, C& c1, int size)
-{
- typedef typename C::iterator I;
- assert(static_cast<std::size_t>(P + size) <= c1.size());
- std::size_t c1_osize = c1.size();
- I i = c1.erase(c1.cbegin() + P, c1.cbegin() + (P + size));
- assert(i == c1.begin() + P);
- assert(c1.size() == c1_osize - size);
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- i = c1.begin();
- int j = 0;
- for (; j < P; ++j, ++i)
- assert(*i == j);
- for (j += size; static_cast<std::size_t>(j) < c1_osize; ++j, ++i)
- assert(*i == j);
+void test(int P, C& c1, int size) {
+ typedef typename C::iterator I;
+ assert(static_cast<std::size_t>(P + size) <= c1.size());
+ std::size_t c1_osize = c1.size();
+ I i = c1.erase(c1.cbegin() + P, c1.cbegin() + (P + size));
+ assert(i == c1.begin() + P);
+ assert(c1.size() == c1_osize - size);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ i = c1.begin();
+ int j = 0;
+ for (; j < P; ++j, ++i)
+ assert(*i == j);
+ for (j += size; static_cast<std::size_t>(j) < c1_osize; ++j, ++i)
+ assert(*i == j);
}
template <class C>
-void
-testN(int start, int N)
-{
- int pstep = std::max(N / std::max(std::min(N, 10), 1), 1);
- for (int p = 0; p <= N; p += pstep)
- {
- int sstep = std::max((N - p) / std::max(std::min(N - p, 10), 1), 1);
- for (int s = 0; s <= N - p; s += sstep)
- {
- C c1 = make<C>(N, start);
- test(p, c1, s);
- }
+void testN(int start, int N) {
+ int pstep = std::max(N / std::max(std::min(N, 10), 1), 1);
+ for (int p = 0; p <= N; p += pstep) {
+ int sstep = std::max((N - p) / std::max(std::min(N - p, 10), 1), 1);
+ for (int s = 0; s <= N - p; s += sstep) {
+ C c1 = make<C>(N, start);
+ test(p, c1, s);
}
+ }
}
-int main(int, char**)
-{
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+int main(int, char**) {
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- testN<std::deque<int> >(rng[i], rng[j]);
- }
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<int> >(rng[i], rng[j]);
+ }
#if TEST_STD_VER >= 11
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j]);
- }
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j]);
+ }
#endif
#ifndef TEST_HAS_NO_EXCEPTIONS
-// Test for LWG2953:
-// Throws: Nothing unless an exception is thrown by the assignment operator of T.
-// (which includes move assignment)
- {
+ // Test for LWG2953:
+ // Throws: Nothing unless an exception is thrown by the assignment operator of T.
+ // (which includes move assignment)
+ {
Throws arr[] = {1, 2, 3};
- std::deque<Throws> v(arr, arr+3);
+ std::deque<Throws> v(arr, arr + 3);
Throws::sThrows = true;
v.erase(v.begin(), --v.end());
assert(v.size() == 1);
@@ -129,7 +130,7 @@ int main(int, char**)
v.erase(v.begin(), v.end());
assert(v.size() == 0);
LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(v));
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_iter_initializer_list.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_iter_initializer_list.pass.cpp
index 080a60cec1a3cb7..117ce63b93d7e30 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_iter_initializer_list.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_iter_initializer_list.pass.cpp
@@ -19,9 +19,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
std::deque<int> d(10, 1);
std::deque<int>::iterator i = d.insert(d.cbegin() + 2, {3, 4, 5, 6});
assert(d.size() == 14);
@@ -41,8 +40,8 @@ int main(int, char**)
assert(d[12] == 1);
assert(d[13] == 1);
LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(d));
- }
- {
+ }
+ {
std::deque<int, min_allocator<int>> d(10, 1);
std::deque<int, min_allocator<int>>::iterator i = d.insert(d.cbegin() + 2, {3, 4, 5, 6});
assert(d.size() == 14);
@@ -62,7 +61,7 @@ int main(int, char**)
assert(d[12] == 1);
assert(d[13] == 1);
LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(d));
- }
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp
index b99c2b87cc5fe91..3941c1e8bc6c5bd 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp
@@ -31,37 +31,32 @@
#include "min_allocator.h"
template <class C>
-C
-make(int size, int start = 0 )
-{
- const int b = 4096 / sizeof(int);
- int init = 0;
- if (start > 0)
- {
- init = (start+1) / b + ((start+1) % b != 0);
- init *= b;
- --init;
- }
- C c(init, 0);
- for (int i = 0; i < init-start; ++i)
- c.pop_back();
- for (int i = 0; i < size; ++i)
- c.push_back(i);
- for (int i = 0; i < start; ++i)
- c.pop_front();
- return c;
+C make(int size, int start = 0) {
+ const int b = 4096 / sizeof(int);
+ int init = 0;
+ if (start > 0) {
+ init = (start + 1) / b + ((start + 1) % b != 0);
+ init *= b;
+ --init;
+ }
+ C c(init, 0);
+ for (int i = 0; i < init - start; ++i)
+ c.pop_back();
+ for (int i = 0; i < size; ++i)
+ c.push_back(i);
+ for (int i = 0; i < start; ++i)
+ c.pop_front();
+ return c;
}
template <class C>
-void
-test(int P, const C& c0, const C& c2)
-{
- {
+void test(int P, const C& c0, const C& c2) {
+ {
typedef typename C::const_iterator CI;
typedef cpp17_input_iterator<CI> BCI;
- C c1 = c0;
+ C c1 = c0;
std::size_t c1_osize = c1.size();
- CI i = c1.insert(c1.begin() + P, BCI(c2.begin()), BCI(c2.end()));
+ CI i = c1.insert(c1.begin() + P, BCI(c2.begin()), BCI(c2.end()));
assert(i == c1.begin() + P);
assert(c1.size() == c1_osize + c2.size());
assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
@@ -69,242 +64,211 @@ test(int P, const C& c0, const C& c2)
LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
i = c1.begin();
for (int j = 0; j < P; ++j, ++i)
- assert(*i == j);
+ assert(*i == j);
for (int j = 0; static_cast<std::size_t>(j) < c2.size(); ++j, ++i)
- assert(*i == j);
+ assert(*i == j);
for (int j = P; static_cast<std::size_t>(j) < c1_osize; ++j, ++i)
- assert(*i == j);
- }
- {
+ assert(*i == j);
+ }
+ {
typedef typename C::const_iterator CI;
typedef forward_iterator<CI> BCI;
- C c1 = c0;
+ C c1 = c0;
std::size_t c1_osize = c1.size();
- CI i = c1.insert(c1.begin() + P, BCI(c2.begin()), BCI(c2.end()));
+ CI i = c1.insert(c1.begin() + P, BCI(c2.begin()), BCI(c2.end()));
assert(i == c1.begin() + P);
assert(c1.size() == c1_osize + c2.size());
assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
i = c1.begin();
for (int j = 0; j < P; ++j, ++i)
- assert(*i == j);
+ assert(*i == j);
for (int j = 0; static_cast<std::size_t>(j) < c2.size(); ++j, ++i)
- assert(*i == j);
+ assert(*i == j);
for (int j = P; static_cast<std::size_t>(j) < c1_osize; ++j, ++i)
- assert(*i == j);
- }
- {
+ assert(*i == j);
+ }
+ {
typedef typename C::const_iterator CI;
typedef bidirectional_iterator<CI> BCI;
- C c1 = c0;
+ C c1 = c0;
std::size_t c1_osize = c1.size();
- CI i = c1.insert(c1.begin() + P, BCI(c2.begin()), BCI(c2.end()));
+ CI i = c1.insert(c1.begin() + P, BCI(c2.begin()), BCI(c2.end()));
assert(i == c1.begin() + P);
assert(c1.size() == c1_osize + c2.size());
assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
i = c1.begin();
for (int j = 0; j < P; ++j, ++i)
- assert(*i == j);
+ assert(*i == j);
for (int j = 0; static_cast<std::size_t>(j) < c2.size(); ++j, ++i)
- assert(*i == j);
+ assert(*i == j);
for (int j = P; static_cast<std::size_t>(j) < c1_osize; ++j, ++i)
- assert(*i == j);
- }
+ assert(*i == j);
+ }
}
template <class C>
-void
-testN(int start, int N, int M)
-{
- for (int i = 0; i <= 3; ++i)
- {
- if (0 <= i && i <= N)
- {
- C c1 = make<C>(N, start);
- C c2 = make<C>(M);
- test(i, c1, c2);
- }
+void testN(int start, int N, int M) {
+ for (int i = 0; i <= 3; ++i) {
+ if (0 <= i && i <= N) {
+ C c1 = make<C>(N, start);
+ C c2 = make<C>(M);
+ test(i, c1, c2);
}
- for (int i = M-1; i <= M+1; ++i)
- {
- if (0 <= i && i <= N)
- {
- C c1 = make<C>(N, start);
- C c2 = make<C>(M);
- test(i, c1, c2);
- }
+ }
+ for (int i = M - 1; i <= M + 1; ++i) {
+ if (0 <= i && i <= N) {
+ C c1 = make<C>(N, start);
+ C c2 = make<C>(M);
+ test(i, c1, c2);
}
- for (int i = N/2-1; i <= N/2+1; ++i)
- {
- if (0 <= i && i <= N)
- {
- C c1 = make<C>(N, start);
- C c2 = make<C>(M);
- test(i, c1, c2);
- }
+ }
+ for (int i = N / 2 - 1; i <= N / 2 + 1; ++i) {
+ if (0 <= i && i <= N) {
+ C c1 = make<C>(N, start);
+ C c2 = make<C>(M);
+ test(i, c1, c2);
}
- for (int i = N - M - 1; i <= N - M + 1; ++i)
- {
- if (0 <= i && i <= N)
- {
- C c1 = make<C>(N, start);
- C c2 = make<C>(M);
- test(i, c1, c2);
- }
+ }
+ for (int i = N - M - 1; i <= N - M + 1; ++i) {
+ if (0 <= i && i <= N) {
+ C c1 = make<C>(N, start);
+ C c2 = make<C>(M);
+ test(i, c1, c2);
}
- for (int i = N - M - 1; i <= N - M + 1; ++i)
- {
- if (0 <= i && i <= N)
- {
- C c1 = make<C>(N, start);
- C c2 = make<C>(M);
- test(i, c1, c2);
- }
+ }
+ for (int i = N - M - 1; i <= N - M + 1; ++i) {
+ if (0 <= i && i <= N) {
+ C c1 = make<C>(N, start);
+ C c2 = make<C>(M);
+ test(i, c1, c2);
}
- for (int i = N - 3; i <= N; ++i)
- {
- if (0 <= i && i <= N)
- {
- C c1 = make<C>(N, start);
- C c2 = make<C>(M);
- test(i, c1, c2);
- }
+ }
+ for (int i = N - 3; i <= N; ++i) {
+ if (0 <= i && i <= N) {
+ C c1 = make<C>(N, start);
+ C c2 = make<C>(M);
+ test(i, c1, c2);
}
+ }
}
template <class C>
-void
-testI(int P, C& c1, const C& c2)
-{
- typedef typename C::const_iterator CI;
- typedef cpp17_input_iterator<CI> ICI;
- std::size_t c1_osize = c1.size();
- CI i = c1.insert(c1.begin() + P, ICI(c2.begin()), ICI(c2.end()));
- assert(i == c1.begin() + P);
- assert(c1.size() == c1_osize + c2.size());
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
- i = c1.begin();
- for (int j = 0; j < P; ++j, ++i)
- assert(*i == j);
- for (int j = 0; static_cast<std::size_t>(j) < c2.size(); ++j, ++i)
- assert(*i == j);
- for (int j = P; static_cast<std::size_t>(j) < c1_osize; ++j, ++i)
- assert(*i == j);
+void testI(int P, C& c1, const C& c2) {
+ typedef typename C::const_iterator CI;
+ typedef cpp17_input_iterator<CI> ICI;
+ std::size_t c1_osize = c1.size();
+ CI i = c1.insert(c1.begin() + P, ICI(c2.begin()), ICI(c2.end()));
+ assert(i == c1.begin() + P);
+ assert(c1.size() == c1_osize + c2.size());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
+ i = c1.begin();
+ for (int j = 0; j < P; ++j, ++i)
+ assert(*i == j);
+ for (int j = 0; static_cast<std::size_t>(j) < c2.size(); ++j, ++i)
+ assert(*i == j);
+ for (int j = P; static_cast<std::size_t>(j) < c1_osize; ++j, ++i)
+ assert(*i == j);
}
template <class C>
-void
-testNI(int start, int N, int M)
-{
- for (int i = 0; i <= 3; ++i)
- {
- if (0 <= i && i <= N)
- {
- C c1 = make<C>(N, start);
- C c2 = make<C>(M);
- testI(i, c1, c2);
- }
+void testNI(int start, int N, int M) {
+ for (int i = 0; i <= 3; ++i) {
+ if (0 <= i && i <= N) {
+ C c1 = make<C>(N, start);
+ C c2 = make<C>(M);
+ testI(i, c1, c2);
}
- for (int i = M-1; i <= M+1; ++i)
- {
- if (0 <= i && i <= N)
- {
- C c1 = make<C>(N, start);
- C c2 = make<C>(M);
- testI(i, c1, c2);
- }
+ }
+ for (int i = M - 1; i <= M + 1; ++i) {
+ if (0 <= i && i <= N) {
+ C c1 = make<C>(N, start);
+ C c2 = make<C>(M);
+ testI(i, c1, c2);
}
- for (int i = N/2-1; i <= N/2+1; ++i)
- {
- if (0 <= i && i <= N)
- {
- C c1 = make<C>(N, start);
- C c2 = make<C>(M);
- testI(i, c1, c2);
- }
+ }
+ for (int i = N / 2 - 1; i <= N / 2 + 1; ++i) {
+ if (0 <= i && i <= N) {
+ C c1 = make<C>(N, start);
+ C c2 = make<C>(M);
+ testI(i, c1, c2);
}
- for (int i = N - M - 1; i <= N - M + 1; ++i)
- {
- if (0 <= i && i <= N)
- {
- C c1 = make<C>(N, start);
- C c2 = make<C>(M);
- testI(i, c1, c2);
- }
+ }
+ for (int i = N - M - 1; i <= N - M + 1; ++i) {
+ if (0 <= i && i <= N) {
+ C c1 = make<C>(N, start);
+ C c2 = make<C>(M);
+ testI(i, c1, c2);
}
- for (int i = N - 3; i <= N; ++i)
- {
- if (0 <= i && i <= N)
- {
- C c1 = make<C>(N, start);
- C c2 = make<C>(M);
- testI(i, c1, c2);
- }
+ }
+ for (int i = N - 3; i <= N; ++i) {
+ if (0 <= i && i <= N) {
+ C c1 = make<C>(N, start);
+ C c2 = make<C>(M);
+ testI(i, c1, c2);
}
+ }
}
template <class C>
-void
-test_move()
-{
+void test_move() {
#if TEST_STD_VER >= 11
- C c;
- typedef typename C::const_iterator CI;
- {
- MoveOnly mo(0);
- typedef MoveOnly* I;
- c.insert(c.end(), std::move_iterator<I>(&mo), std::move_iterator<I>(&mo+1));
- }
- int j = 0;
- for (CI i = c.begin(); i != c.end(); ++i, (void) ++j)
- assert(*i == MoveOnly(j));
- {
- MoveOnly mo(1);
- typedef cpp17_input_iterator<MoveOnly*> I;
- c.insert(c.end(), std::move_iterator<I>(I(&mo)), std::move_iterator<I>(I(&mo+1)));
- }
- j = 0;
- for (CI i = c.begin(); i != c.end(); ++i, (void) ++j)
- assert(*i == MoveOnly(j));
+ C c;
+ typedef typename C::const_iterator CI;
+ {
+ MoveOnly mo(0);
+ typedef MoveOnly* I;
+ c.insert(c.end(), std::move_iterator<I>(&mo), std::move_iterator<I>(&mo + 1));
+ }
+ int j = 0;
+ for (CI i = c.begin(); i != c.end(); ++i, (void)++j)
+ assert(*i == MoveOnly(j));
+ {
+ MoveOnly mo(1);
+ typedef cpp17_input_iterator<MoveOnly*> I;
+ c.insert(c.end(), std::move_iterator<I>(I(&mo)), std::move_iterator<I>(I(&mo + 1)));
+ }
+ j = 0;
+ for (CI i = c.begin(); i != c.end(); ++i, (void)++j)
+ assert(*i == MoveOnly(j));
#endif
}
-int main(int, char**)
-{
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+int main(int, char**) {
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- for (int k = 0; k < N; ++k)
- testN<std::deque<int> >(rng[i], rng[j], rng[k]);
+ for (int j = 0; j < N; ++j)
+ for (int k = 0; k < N; ++k)
+ testN<std::deque<int> >(rng[i], rng[j], rng[k]);
testNI<std::deque<int> >(1500, 2000, 1000);
#if TEST_STD_VER >= 11
test_move<std::deque<MoveOnly, limited_allocator<MoveOnly, 2000> > >();
#endif
- }
+ }
#if TEST_STD_VER >= 11
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- for (int k = 0; k < N; ++k)
- testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j], rng[k]);
+ for (int j = 0; j < N; ++j)
+ for (int k = 0; k < N; ++k)
+ testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j], rng[k]);
testNI<std::deque<int> >(1500, 2000, 1000);
test_move<std::deque<MoveOnly, min_allocator<MoveOnly> > >();
- }
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+ }
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- for (int k = 0; k < N; ++k)
- testN<std::deque<int, safe_allocator<int>> >(rng[i], rng[j], rng[k]);
+ for (int j = 0; j < N; ++j)
+ for (int k = 0; k < N; ++k)
+ testN<std::deque<int, safe_allocator<int>> >(rng[i], rng[j], rng[k]);
testNI<std::deque<int> >(1500, 2000, 1000);
test_move<std::deque<MoveOnly, safe_allocator<MoveOnly> > >();
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_rvalue.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_rvalue.pass.cpp
index 24092029a745323..ff4654cf0ccb36d 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_rvalue.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_rvalue.pass.cpp
@@ -21,102 +21,87 @@
#include "MoveOnly.h"
#include "min_allocator.h"
-
template <class C>
-C
-make(int size, int start = 0 )
-{
- const int b = 4096 / sizeof(int);
- int init = 0;
- if (start > 0)
- {
- init = (start+1) / b + ((start+1) % b != 0);
- init *= b;
- --init;
- }
- C c(init);
- for (int i = 0; i < init-start; ++i)
- c.pop_back();
- for (int i = 0; i < size; ++i)
- c.push_back(MoveOnly(i));
- for (int i = 0; i < start; ++i)
- c.pop_front();
- return c;
+C make(int size, int start = 0) {
+ const int b = 4096 / sizeof(int);
+ int init = 0;
+ if (start > 0) {
+ init = (start + 1) / b + ((start + 1) % b != 0);
+ init *= b;
+ --init;
+ }
+ C c(init);
+ for (int i = 0; i < init - start; ++i)
+ c.pop_back();
+ for (int i = 0; i < size; ++i)
+ c.push_back(MoveOnly(i));
+ for (int i = 0; i < start; ++i)
+ c.pop_front();
+ return c;
}
template <class C>
-void
-test(int P, C& c1, int x)
-{
- typedef typename C::const_iterator CI;
- std::size_t c1_osize = c1.size();
- CI i = c1.insert(c1.begin() + P, MoveOnly(x));
- assert(i == c1.begin() + P);
- assert(c1.size() == c1_osize + 1);
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- i = c1.begin();
- for (int j = 0; j < P; ++j, (void) ++i)
- assert(*i == MoveOnly(j));
- assert(*i == MoveOnly(x));
- ++i;
- for (int j = P; static_cast<std::size_t>(j) < c1_osize; ++j, (void) ++i)
- assert(*i == MoveOnly(j));
+void test(int P, C& c1, int x) {
+ typedef typename C::const_iterator CI;
+ std::size_t c1_osize = c1.size();
+ CI i = c1.insert(c1.begin() + P, MoveOnly(x));
+ assert(i == c1.begin() + P);
+ assert(c1.size() == c1_osize + 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ i = c1.begin();
+ for (int j = 0; j < P; ++j, (void)++i)
+ assert(*i == MoveOnly(j));
+ assert(*i == MoveOnly(x));
+ ++i;
+ for (int j = P; static_cast<std::size_t>(j) < c1_osize; ++j, (void)++i)
+ assert(*i == MoveOnly(j));
}
template <class C>
-void
-testN(int start, int N)
-{
- for (int i = 0; i <= 3; ++i)
- {
- if (0 <= i && i <= N)
- {
- C c1 = make<C>(N, start);
- test(i, c1, -10);
- }
+void testN(int start, int N) {
+ for (int i = 0; i <= 3; ++i) {
+ if (0 <= i && i <= N) {
+ C c1 = make<C>(N, start);
+ test(i, c1, -10);
}
- for (int i = N/2-1; i <= N/2+1; ++i)
- {
- if (0 <= i && i <= N)
- {
- C c1 = make<C>(N, start);
- test(i, c1, -10);
- }
+ }
+ for (int i = N / 2 - 1; i <= N / 2 + 1; ++i) {
+ if (0 <= i && i <= N) {
+ C c1 = make<C>(N, start);
+ test(i, c1, -10);
}
- for (int i = N - 3; i <= N; ++i)
- {
- if (0 <= i && i <= N)
- {
- C c1 = make<C>(N, start);
- test(i, c1, -10);
- }
+ }
+ for (int i = N - 3; i <= N; ++i) {
+ if (0 <= i && i <= N) {
+ C c1 = make<C>(N, start);
+ test(i, c1, -10);
}
+ }
}
-int main(int, char**)
-{
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+int main(int, char**) {
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- testN<std::deque<MoveOnly> >(rng[i], rng[j]);
- }
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<MoveOnly> >(rng[i], rng[j]);
+ }
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- testN<std::deque<MoveOnly, min_allocator<MoveOnly>> >(rng[i], rng[j]);
- }
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<MoveOnly, min_allocator<MoveOnly>> >(rng[i], rng[j]);
+ }
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- testN<std::deque<MoveOnly, safe_allocator<MoveOnly>> >(rng[i], rng[j]);
- }
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<MoveOnly, safe_allocator<MoveOnly>> >(rng[i], rng[j]);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_size_value.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_size_value.pass.cpp
index 555cb902d91da7c..05a16a9e76387ec 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_size_value.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_size_value.pass.cpp
@@ -21,149 +21,127 @@
#include "min_allocator.h"
template <class C>
-C
-make(int size, int start = 0 )
-{
- const int b = 4096 / sizeof(int);
- int init = 0;
- if (start > 0)
- {
- init = (start+1) / b + ((start+1) % b != 0);
- init *= b;
- --init;
- }
- C c(init, 0);
- for (int i = 0; i < init-start; ++i)
- c.pop_back();
- for (int i = 0; i < size; ++i)
- c.push_back(i);
- for (int i = 0; i < start; ++i)
- c.pop_front();
- return c;
+C make(int size, int start = 0) {
+ const int b = 4096 / sizeof(int);
+ int init = 0;
+ if (start > 0) {
+ init = (start + 1) / b + ((start + 1) % b != 0);
+ init *= b;
+ --init;
+ }
+ C c(init, 0);
+ for (int i = 0; i < init - start; ++i)
+ c.pop_back();
+ for (int i = 0; i < size; ++i)
+ c.push_back(i);
+ for (int i = 0; i < start; ++i)
+ c.pop_front();
+ return c;
}
template <class C>
-void
-test(int P, C& c1, int size, int x)
-{
- typedef typename C::const_iterator CI;
- std::size_t c1_osize = c1.size();
- CI i = c1.insert(c1.begin() + P, size, x);
- assert(i == c1.begin() + P);
- assert(c1.size() == c1_osize + size);
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- i = c1.begin();
- for (int j = 0; j < P; ++j, ++i)
- assert(*i == j);
- for (int j = 0; j < size; ++j, ++i)
- assert(*i == x);
- for (int j = P; static_cast<std::size_t>(j) < c1_osize; ++j, ++i)
- assert(*i == j);
+void test(int P, C& c1, int size, int x) {
+ typedef typename C::const_iterator CI;
+ std::size_t c1_osize = c1.size();
+ CI i = c1.insert(c1.begin() + P, size, x);
+ assert(i == c1.begin() + P);
+ assert(c1.size() == c1_osize + size);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ i = c1.begin();
+ for (int j = 0; j < P; ++j, ++i)
+ assert(*i == j);
+ for (int j = 0; j < size; ++j, ++i)
+ assert(*i == x);
+ for (int j = P; static_cast<std::size_t>(j) < c1_osize; ++j, ++i)
+ assert(*i == j);
}
template <class C>
-void
-testN(int start, int N, int M)
-{
- for (int i = 0; i <= 3; ++i)
- {
- if (0 <= i && i <= N)
- {
- C c1 = make<C>(N, start);
- test(i, c1, M, -10);
- }
+void testN(int start, int N, int M) {
+ for (int i = 0; i <= 3; ++i) {
+ if (0 <= i && i <= N) {
+ C c1 = make<C>(N, start);
+ test(i, c1, M, -10);
}
- for (int i = M-1; i <= M+1; ++i)
- {
- if (0 <= i && i <= N)
- {
- C c1 = make<C>(N, start);
- test(i, c1, M, -10);
- }
+ }
+ for (int i = M - 1; i <= M + 1; ++i) {
+ if (0 <= i && i <= N) {
+ C c1 = make<C>(N, start);
+ test(i, c1, M, -10);
}
- for (int i = N/2-1; i <= N/2+1; ++i)
- {
- if (0 <= i && i <= N)
- {
- C c1 = make<C>(N, start);
- test(i, c1, M, -10);
- }
+ }
+ for (int i = N / 2 - 1; i <= N / 2 + 1; ++i) {
+ if (0 <= i && i <= N) {
+ C c1 = make<C>(N, start);
+ test(i, c1, M, -10);
}
- for (int i = N - M - 1; i <= N - M + 1; ++i)
- {
- if (0 <= i && i <= N)
- {
- C c1 = make<C>(N, start);
- test(i, c1, M, -10);
- }
+ }
+ for (int i = N - M - 1; i <= N - M + 1; ++i) {
+ if (0 <= i && i <= N) {
+ C c1 = make<C>(N, start);
+ test(i, c1, M, -10);
}
- for (int i = N - 3; i <= N; ++i)
- {
- if (0 <= i && i <= N)
- {
- C c1 = make<C>(N, start);
- test(i, c1, M, -10);
- }
+ }
+ for (int i = N - 3; i <= N; ++i) {
+ if (0 <= i && i <= N) {
+ C c1 = make<C>(N, start);
+ test(i, c1, M, -10);
}
+ }
}
template <class C>
-void
-self_reference_test()
-{
- typedef typename C::const_iterator CI;
- for (int i = 0; i < 20; ++i)
- {
- for (int j = 0; j < 20; ++j)
- {
- C c = make<C>(20);
- CI it = c.cbegin() + i;
- CI jt = c.cbegin() + j;
- c.insert(it, 5, *jt);
- assert(c.size() == 25);
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- it = c.cbegin();
- for (int k = 0; k < i; ++k, ++it)
- assert(*it == k);
- for (int k = 0; k < 5; ++k, ++it)
- assert(*it == j);
- for (int k = i; k < 20; ++k, ++it)
- assert(*it == k);
- }
+void self_reference_test() {
+ typedef typename C::const_iterator CI;
+ for (int i = 0; i < 20; ++i) {
+ for (int j = 0; j < 20; ++j) {
+ C c = make<C>(20);
+ CI it = c.cbegin() + i;
+ CI jt = c.cbegin() + j;
+ c.insert(it, 5, *jt);
+ assert(c.size() == 25);
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ it = c.cbegin();
+ for (int k = 0; k < i; ++k, ++it)
+ assert(*it == k);
+ for (int k = 0; k < 5; ++k, ++it)
+ assert(*it == j);
+ for (int k = i; k < 20; ++k, ++it)
+ assert(*it == k);
}
+ }
}
-int main(int, char**)
-{
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+int main(int, char**) {
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- for (int k = 0; k < N; ++k)
- testN<std::deque<int> >(rng[i], rng[j], rng[k]);
+ for (int j = 0; j < N; ++j)
+ for (int k = 0; k < N; ++k)
+ testN<std::deque<int> >(rng[i], rng[j], rng[k]);
self_reference_test<std::deque<int> >();
- }
+ }
#if TEST_STD_VER >= 11
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- for (int k = 0; k < N; ++k)
- testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j], rng[k]);
+ for (int j = 0; j < N; ++j)
+ for (int k = 0; k < N; ++k)
+ testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j], rng[k]);
self_reference_test<std::deque<int, min_allocator<int>> >();
- }
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+ }
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- for (int k = 0; k < N; ++k)
- testN<std::deque<int, safe_allocator<int>> >(rng[i], rng[j], rng[k]);
+ for (int j = 0; j < N; ++j)
+ for (int k = 0; k < N; ++k)
+ testN<std::deque<int, safe_allocator<int>> >(rng[i], rng[j], rng[k]);
self_reference_test<std::deque<int, safe_allocator<int>> >();
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_value.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_value.pass.cpp
index 250e19418e45b07..b9440acb4986a7e 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_value.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_value.pass.cpp
@@ -19,130 +19,112 @@
#include "min_allocator.h"
template <class C>
-C
-make(int size, int start = 0 )
-{
- const int b = 4096 / sizeof(int);
- int init = 0;
- if (start > 0)
- {
- init = (start+1) / b + ((start+1) % b != 0);
- init *= b;
- --init;
- }
- C c(init, 0);
- for (int i = 0; i < init-start; ++i)
- c.pop_back();
- for (int i = 0; i < size; ++i)
- c.push_back(i);
- for (int i = 0; i < start; ++i)
- c.pop_front();
- return c;
+C make(int size, int start = 0) {
+ const int b = 4096 / sizeof(int);
+ int init = 0;
+ if (start > 0) {
+ init = (start + 1) / b + ((start + 1) % b != 0);
+ init *= b;
+ --init;
+ }
+ C c(init, 0);
+ for (int i = 0; i < init - start; ++i)
+ c.pop_back();
+ for (int i = 0; i < size; ++i)
+ c.push_back(i);
+ for (int i = 0; i < start; ++i)
+ c.pop_front();
+ return c;
}
template <class C>
-void
-test(int P, C& c1, int x)
-{
- typedef typename C::const_iterator CI;
- std::size_t c1_osize = c1.size();
- CI i = c1.insert(c1.begin() + P, x);
- assert(i == c1.begin() + P);
- assert(c1.size() == c1_osize + 1);
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- i = c1.begin();
- for (int j = 0; j < P; ++j, ++i)
- assert(*i == j);
- assert(*i == x);
- ++i;
- for (int j = P; static_cast<std::size_t>(j) < c1_osize; ++j, ++i)
- assert(*i == j);
+void test(int P, C& c1, int x) {
+ typedef typename C::const_iterator CI;
+ std::size_t c1_osize = c1.size();
+ CI i = c1.insert(c1.begin() + P, x);
+ assert(i == c1.begin() + P);
+ assert(c1.size() == c1_osize + 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ i = c1.begin();
+ for (int j = 0; j < P; ++j, ++i)
+ assert(*i == j);
+ assert(*i == x);
+ ++i;
+ for (int j = P; static_cast<std::size_t>(j) < c1_osize; ++j, ++i)
+ assert(*i == j);
}
template <class C>
-void
-testN(int start, int N)
-{
- for (int i = 0; i <= 3; ++i)
- {
- if (0 <= i && i <= N)
- {
- C c1 = make<C>(N, start);
- test(i, c1, -10);
- }
+void testN(int start, int N) {
+ for (int i = 0; i <= 3; ++i) {
+ if (0 <= i && i <= N) {
+ C c1 = make<C>(N, start);
+ test(i, c1, -10);
}
- for (int i = N/2-1; i <= N/2+1; ++i)
- {
- if (0 <= i && i <= N)
- {
- C c1 = make<C>(N, start);
- test(i, c1, -10);
- }
+ }
+ for (int i = N / 2 - 1; i <= N / 2 + 1; ++i) {
+ if (0 <= i && i <= N) {
+ C c1 = make<C>(N, start);
+ test(i, c1, -10);
}
- for (int i = N - 3; i <= N; ++i)
- {
- if (0 <= i && i <= N)
- {
- C c1 = make<C>(N, start);
- test(i, c1, -10);
- }
+ }
+ for (int i = N - 3; i <= N; ++i) {
+ if (0 <= i && i <= N) {
+ C c1 = make<C>(N, start);
+ test(i, c1, -10);
}
+ }
}
template <class C>
-void
-self_reference_test()
-{
- typedef typename C::const_iterator CI;
- for (int i = 0; i < 20; ++i)
- {
- for (int j = 0; j < 20; ++j)
- {
- C c = make<C>(20);
- CI it = c.cbegin() + i;
- CI jt = c.cbegin() + j;
- c.insert(it, *jt);
- assert(c.size() == 21);
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- it = c.cbegin();
- for (int k = 0; k < i; ++k, ++it)
- assert(*it == k);
- assert(*it == j);
- ++it;
- for (int k = i; k < 20; ++k, ++it)
- assert(*it == k);
- }
+void self_reference_test() {
+ typedef typename C::const_iterator CI;
+ for (int i = 0; i < 20; ++i) {
+ for (int j = 0; j < 20; ++j) {
+ C c = make<C>(20);
+ CI it = c.cbegin() + i;
+ CI jt = c.cbegin() + j;
+ c.insert(it, *jt);
+ assert(c.size() == 21);
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ it = c.cbegin();
+ for (int k = 0; k < i; ++k, ++it)
+ assert(*it == k);
+ assert(*it == j);
+ ++it;
+ for (int k = i; k < 20; ++k, ++it)
+ assert(*it == k);
}
+ }
}
-int main(int, char**)
-{
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+int main(int, char**) {
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- testN<std::deque<int> >(rng[i], rng[j]);
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<int> >(rng[i], rng[j]);
self_reference_test<std::deque<int> >();
- }
+ }
#if TEST_STD_VER >= 11
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j]);
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j]);
self_reference_test<std::deque<int, min_allocator<int>> >();
- }
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+ }
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- testN<std::deque<int, safe_allocator<int>> >(rng[i], rng[j]);
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<int, safe_allocator<int>> >(rng[i], rng[j]);
self_reference_test<std::deque<int, safe_allocator<int>> >();
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_back.invalidation.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_back.invalidation.pass.cpp
index 3071d00a9dbffb2..3d0133e362b6ac7 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_back.invalidation.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_back.invalidation.pass.cpp
@@ -20,36 +20,33 @@
#include "test_macros.h"
template <typename C>
-void test(C c)
-{
- typename C::iterator it1 = c.begin();
- typename C::iterator it2 = c.end() - 2;
-
- c.pop_back();
-
- typename C::iterator it3 = c.begin();
- typename C::iterator it4 = c.end() - 1;
- assert( it1 == it3);
- assert( *it1 == *it3);
- assert(&*it1 == &*it3);
- assert( it2 == it4);
- assert( *it2 == *it4);
- assert(&*it2 == &*it4);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
+void test(C c) {
+ typename C::iterator it1 = c.begin();
+ typename C::iterator it2 = c.end() - 2;
+
+ c.pop_back();
+
+ typename C::iterator it3 = c.begin();
+ typename C::iterator it4 = c.end() - 1;
+ assert(it1 == it3);
+ assert(*it1 == *it3);
+ assert(&*it1 == &*it3);
+ assert(it2 == it4);
+ assert(*it2 == *it4);
+ assert(&*it2 == &*it4);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
}
-int main(int, char**)
-{
- std::deque<int> queue;
- for (int i = 0; i < 4098; ++i)
- queue.push_back(i);
-
- while (queue.size() > 1)
- {
- test(queue);
- queue.pop_back();
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(queue));
- }
+int main(int, char**) {
+ std::deque<int> queue;
+ for (int i = 0; i < 4098; ++i)
+ queue.push_back(i);
+
+ while (queue.size() > 1) {
+ test(queue);
+ queue.pop_back();
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(queue));
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_back.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_back.pass.cpp
index b027f40d8dd4620..301d8e3342bb699 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_back.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_back.pass.cpp
@@ -19,77 +19,68 @@
#include "min_allocator.h"
template <class C>
-C
-make(int size, int start = 0 )
-{
- const int b = 4096 / sizeof(int);
- int init = 0;
- if (start > 0)
- {
- init = (start+1) / b + ((start+1) % b != 0);
- init *= b;
- --init;
- }
- C c(init, 0);
- for (int i = 0; i < init-start; ++i)
- c.pop_back();
- for (int i = 0; i < size; ++i)
- c.push_back(i);
- for (int i = 0; i < start; ++i)
- c.pop_front();
- return c;
+C make(int size, int start = 0) {
+ const int b = 4096 / sizeof(int);
+ int init = 0;
+ if (start > 0) {
+ init = (start + 1) / b + ((start + 1) % b != 0);
+ init *= b;
+ --init;
+ }
+ C c(init, 0);
+ for (int i = 0; i < init - start; ++i)
+ c.pop_back();
+ for (int i = 0; i < size; ++i)
+ c.push_back(i);
+ for (int i = 0; i < start; ++i)
+ c.pop_front();
+ return c;
}
template <class C>
-void
-test(C& c1)
-{
- typedef typename C::iterator I;
- std::size_t c1_osize = c1.size();
- c1.pop_back();
- assert(c1.size() == c1_osize - 1);
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- I i = c1.begin();
- for (int j = 0; static_cast<std::size_t>(j) < c1.size(); ++j, ++i)
- assert(*i == j);
+void test(C& c1) {
+ typedef typename C::iterator I;
+ std::size_t c1_osize = c1.size();
+ c1.pop_back();
+ assert(c1.size() == c1_osize - 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ I i = c1.begin();
+ for (int j = 0; static_cast<std::size_t>(j) < c1.size(); ++j, ++i)
+ assert(*i == j);
}
template <class C>
-void
-testN(int start, int N)
-{
- if (N != 0)
- {
- C c1 = make<C>(N, start);
- test(c1);
- }
+void testN(int start, int N) {
+ if (N != 0) {
+ C c1 = make<C>(N, start);
+ test(c1);
+ }
}
-int main(int, char**)
-{
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+int main(int, char**) {
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- testN<std::deque<int> >(rng[i], rng[j]);
- }
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<int> >(rng[i], rng[j]);
+ }
#if TEST_STD_VER >= 11
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j]);
- }
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j]);
+ }
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- testN<std::deque<int, safe_allocator<int>> >(rng[i], rng[j]);
- }
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<int, safe_allocator<int>> >(rng[i], rng[j]);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_front.invalidation.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_front.invalidation.pass.cpp
index 4e77cdca430d2a0..c857c3038d49e1b 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_front.invalidation.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_front.invalidation.pass.cpp
@@ -20,35 +20,32 @@
#include "test_macros.h"
template <typename C>
-void test(C c)
-{
- typename C::iterator it1 = c.begin() + 1;
- typename C::iterator it2 = c.end() - 1;
-
- c.pop_front();
-
- typename C::iterator it3 = c.begin();
- typename C::iterator it4 = c.end() - 1;
- assert( it1 == it3);
- assert( *it1 == *it3);
- assert(&*it1 == &*it3);
- assert( it2 == it4);
- assert( *it2 == *it4);
- assert(&*it2 == &*it4);
+void test(C c) {
+ typename C::iterator it1 = c.begin() + 1;
+ typename C::iterator it2 = c.end() - 1;
+
+ c.pop_front();
+
+ typename C::iterator it3 = c.begin();
+ typename C::iterator it4 = c.end() - 1;
+ assert(it1 == it3);
+ assert(*it1 == *it3);
+ assert(&*it1 == &*it3);
+ assert(it2 == it4);
+ assert(*it2 == *it4);
+ assert(&*it2 == &*it4);
}
-int main(int, char**)
-{
- std::deque<int> queue;
- for (int i = 0; i < 4098; ++i)
- queue.push_back(i);
-
- while (queue.size() > 1)
- {
- test(queue);
- queue.pop_back();
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(queue));
- }
+int main(int, char**) {
+ std::deque<int> queue;
+ for (int i = 0; i < 4098; ++i)
+ queue.push_back(i);
+
+ while (queue.size() > 1) {
+ test(queue);
+ queue.pop_back();
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(queue));
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_front.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_front.pass.cpp
index e28242c8a4890f7..2bd390ac315e0c5 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_front.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_front.pass.cpp
@@ -19,70 +19,61 @@
#include "min_allocator.h"
template <class C>
-C
-make(int size, int start = 0 )
-{
- const int b = 4096 / sizeof(int);
- int init = 0;
- if (start > 0)
- {
- init = (start+1) / b + ((start+1) % b != 0);
- init *= b;
- --init;
- }
- C c(init, 0);
- for (int i = 0; i < init-start; ++i)
- c.pop_back();
- for (int i = 0; i < size; ++i)
- c.push_back(i);
- for (int i = 0; i < start; ++i)
- c.pop_front();
- return c;
+C make(int size, int start = 0) {
+ const int b = 4096 / sizeof(int);
+ int init = 0;
+ if (start > 0) {
+ init = (start + 1) / b + ((start + 1) % b != 0);
+ init *= b;
+ --init;
+ }
+ C c(init, 0);
+ for (int i = 0; i < init - start; ++i)
+ c.pop_back();
+ for (int i = 0; i < size; ++i)
+ c.push_back(i);
+ for (int i = 0; i < start; ++i)
+ c.pop_front();
+ return c;
}
template <class C>
-void
-test(C& c1)
-{
- typedef typename C::iterator I;
- std::size_t c1_osize = c1.size();
- c1.pop_front();
- assert(c1.size() == c1_osize - 1);
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- I i = c1.begin();
- for (int j = 1; static_cast<std::size_t>(j) < c1.size(); ++j, ++i)
- assert(*i == j);
+void test(C& c1) {
+ typedef typename C::iterator I;
+ std::size_t c1_osize = c1.size();
+ c1.pop_front();
+ assert(c1.size() == c1_osize - 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ I i = c1.begin();
+ for (int j = 1; static_cast<std::size_t>(j) < c1.size(); ++j, ++i)
+ assert(*i == j);
}
template <class C>
-void
-testN(int start, int N)
-{
- if (N != 0)
- {
- C c1 = make<C>(N, start);
- test(c1);
- }
+void testN(int start, int N) {
+ if (N != 0) {
+ C c1 = make<C>(N, start);
+ test(c1);
+ }
}
-int main(int, char**)
-{
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+int main(int, char**) {
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- testN<std::deque<int> >(rng[i], rng[j]);
- }
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<int> >(rng[i], rng[j]);
+ }
#if TEST_STD_VER >= 11
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j]);
- }
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j]);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_back.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_back.pass.cpp
index 70aa1baa1efcba9..fff3433ab4dd4c5 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_back.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_back.pass.cpp
@@ -20,57 +20,51 @@
#include "min_allocator.h"
template <class C>
-C
-make(int size, int start = 0 )
-{
- const int b = 4096 / sizeof(int);
- int init = 0;
- if (start > 0)
- {
- init = (start+1) / b + ((start+1) % b != 0);
- init *= b;
- --init;
- }
- C c(init, 0);
- for (int i = 0; i < init-start; ++i)
- c.pop_back();
- for (int i = 0; i < size; ++i)
- c.push_back(i);
- for (int i = 0; i < start; ++i)
- c.pop_front();
- return c;
+C make(int size, int start = 0) {
+ const int b = 4096 / sizeof(int);
+ int init = 0;
+ if (start > 0) {
+ init = (start + 1) / b + ((start + 1) % b != 0);
+ init *= b;
+ --init;
+ }
+ C c(init, 0);
+ for (int i = 0; i < init - start; ++i)
+ c.pop_back();
+ for (int i = 0; i < size; ++i)
+ c.push_back(i);
+ for (int i = 0; i < start; ++i)
+ c.pop_front();
+ return c;
}
template <class C>
-void test(int size)
-{
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2046, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
- for (int j = 0; j < N; ++j)
- {
- C c = make<C>(size, rng[j]);
- typename C::const_iterator it = c.begin();
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
- for (int i = 0; i < size; ++i, ++it)
- assert(*it == i);
- }
+void test(int size) {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2046, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
+ for (int j = 0; j < N; ++j) {
+ C c = make<C>(size, rng[j]);
+ typename C::const_iterator it = c.begin();
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
+ for (int i = 0; i < size; ++i, ++it)
+ assert(*it == i);
+ }
}
-int main(int, char**)
-{
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2046, 2047, 2048, 2049, 4094, 4095, 4096};
- const int N = sizeof(rng)/sizeof(rng[0]);
+int main(int, char**) {
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2046, 2047, 2048, 2049, 4094, 4095, 4096};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int j = 0; j < N; ++j)
- test<std::deque<int> >(rng[j]);
- }
+ test<std::deque<int> >(rng[j]);
+ }
#if TEST_STD_VER >= 11
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2046, 2047, 2048, 2049, 4094, 4095, 4096};
- const int N = sizeof(rng)/sizeof(rng[0]);
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2046, 2047, 2048, 2049, 4094, 4095, 4096};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int j = 0; j < N; ++j)
- test<std::deque<int, min_allocator<int>> >(rng[j]);
- }
+ test<std::deque<int, min_allocator<int>> >(rng[j]);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_back_exception_safety.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_back_exception_safety.pass.cpp
index 3e65f993f6506d2..10da5b02f96f185 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_back_exception_safety.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_back_exception_safety.pass.cpp
@@ -20,19 +20,26 @@
static bool gCopyConstructorShouldThrow = false;
class CMyClass {
- public: CMyClass(int tag);
- public: CMyClass(const CMyClass& iOther);
- public: ~CMyClass();
+public:
+ CMyClass(int tag);
- bool equal(const CMyClass &rhs) const
- { return fTag == rhs.fTag && fMagicValue == rhs.fMagicValue; }
+public:
+ CMyClass(const CMyClass& iOther);
- private:
- int fMagicValue;
- int fTag;
+public:
+ ~CMyClass();
- private: static int kStartedConstructionMagicValue;
- private: static int kFinishedConstructionMagicValue;
+ bool equal(const CMyClass& rhs) const { return fTag == rhs.fTag && fMagicValue == rhs.fMagicValue; }
+
+private:
+ int fMagicValue;
+ int fTag;
+
+private:
+ static int kStartedConstructionMagicValue;
+
+private:
+ static int kFinishedConstructionMagicValue;
};
// Value for fMagicValue when the constructor has started running, but not yet finished
@@ -40,35 +47,30 @@ int CMyClass::kStartedConstructionMagicValue = 0;
// Value for fMagicValue when the constructor has finished running
int CMyClass::kFinishedConstructionMagicValue = 12345;
-CMyClass::CMyClass(int tag) :
- fMagicValue(kStartedConstructionMagicValue), fTag(tag)
-{
- // Signal that the constructor has finished running
- fMagicValue = kFinishedConstructionMagicValue;
+CMyClass::CMyClass(int tag) : fMagicValue(kStartedConstructionMagicValue), fTag(tag) {
+ // Signal that the constructor has finished running
+ fMagicValue = kFinishedConstructionMagicValue;
}
-CMyClass::CMyClass(const CMyClass& iOther) :
- fMagicValue(kStartedConstructionMagicValue), fTag(iOther.fTag)
-{
- // If requested, throw an exception _before_ setting fMagicValue to kFinishedConstructionMagicValue
- if (gCopyConstructorShouldThrow) {
- throw std::exception();
- }
- // Signal that the constructor has finished running
- fMagicValue = kFinishedConstructionMagicValue;
+CMyClass::CMyClass(const CMyClass& iOther) : fMagicValue(kStartedConstructionMagicValue), fTag(iOther.fTag) {
+ // If requested, throw an exception _before_ setting fMagicValue to kFinishedConstructionMagicValue
+ if (gCopyConstructorShouldThrow) {
+ throw std::exception();
+ }
+ // Signal that the constructor has finished running
+ fMagicValue = kFinishedConstructionMagicValue;
}
CMyClass::~CMyClass() {
- // Only instances for which the constructor has finished running should be destructed
- assert(fMagicValue == kFinishedConstructionMagicValue);
+ // Only instances for which the constructor has finished running should be destructed
+ assert(fMagicValue == kFinishedConstructionMagicValue);
}
-bool operator==(const CMyClass &lhs, const CMyClass &rhs) { return lhs.equal(rhs); }
+bool operator==(const CMyClass& lhs, const CMyClass& rhs) { return lhs.equal(rhs); }
-int main(int, char**)
-{
- CMyClass instance(42);
- {
+int main(int, char**) {
+ CMyClass instance(42);
+ {
std::deque<CMyClass> vec;
vec.push_back(instance);
@@ -76,16 +78,15 @@ int main(int, char**)
gCopyConstructorShouldThrow = true;
try {
- vec.push_back(instance);
- assert(false);
- }
- catch (...) {
+ vec.push_back(instance);
+ assert(false);
+ } catch (...) {
gCopyConstructorShouldThrow = false;
assert(vec == vec2);
}
- }
+ }
- {
+ {
test_allocator_statistics alloc_stats;
typedef std::deque<CMyClass, test_allocator<CMyClass> > C;
C vec((test_allocator<CMyClass>(&alloc_stats)));
@@ -93,13 +94,12 @@ int main(int, char**)
alloc_stats.throw_after = 1;
try {
- vec.push_back(instance);
- assert(false);
- }
- catch (...) {
- assert(vec==vec2);
- }
+ vec.push_back(instance);
+ assert(false);
+ } catch (...) {
+ assert(vec == vec2);
}
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_back_rvalue.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_back_rvalue.pass.cpp
index 817379b62ae078c..c9e0ca7a6d7e0cc 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_back_rvalue.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_back_rvalue.pass.cpp
@@ -22,65 +22,57 @@
#include "MoveOnly.h"
#include "min_allocator.h"
-
template <class C>
-C
-make(int size, int start = 0 )
-{
- const int b = 4096 / sizeof(int);
- int init = 0;
- if (start > 0)
- {
- init = (start+1) / b + ((start+1) % b != 0);
- init *= b;
- --init;
- }
- C c(init);
- for (int i = 0; i < init-start; ++i)
- c.pop_back();
- for (int i = 0; i < size; ++i)
- c.push_back(MoveOnly(i));
- for (int i = 0; i < start; ++i)
- c.pop_front();
- return c;
+C make(int size, int start = 0) {
+ const int b = 4096 / sizeof(int);
+ int init = 0;
+ if (start > 0) {
+ init = (start + 1) / b + ((start + 1) % b != 0);
+ init *= b;
+ --init;
+ }
+ C c(init);
+ for (int i = 0; i < init - start; ++i)
+ c.pop_back();
+ for (int i = 0; i < size; ++i)
+ c.push_back(MoveOnly(i));
+ for (int i = 0; i < start; ++i)
+ c.pop_front();
+ return c;
}
template <class C>
-void test(int size)
-{
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2046, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
- for (int j = 0; j < N; ++j)
- {
- C c = make<C>(size, rng[j]);
- typename C::const_iterator it = c.begin();
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
- for (int i = 0; i < size; ++i, (void) ++it)
- assert(*it == MoveOnly(i));
- }
+void test(int size) {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2046, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
+ for (int j = 0; j < N; ++j) {
+ C c = make<C>(size, rng[j]);
+ typename C::const_iterator it = c.begin();
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
+ for (int i = 0; i < size; ++i, (void)++it)
+ assert(*it == MoveOnly(i));
+ }
}
-
-int main(int, char**)
-{
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2046, 2047, 2048, 2049, 4094, 4095, 4096};
- const int N = sizeof(rng)/sizeof(rng[0]);
+int main(int, char**) {
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2046, 2047, 2048, 2049, 4094, 4095, 4096};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int j = 0; j < N; ++j)
- test<std::deque<MoveOnly> >(rng[j]);
- }
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2046, 2047, 2048, 2049, 4094, 4095, 4096};
- const int N = sizeof(rng)/sizeof(rng[0]);
+ test<std::deque<MoveOnly> >(rng[j]);
+ }
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2046, 2047, 2048, 2049, 4094, 4095, 4096};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int j = 0; j < N; ++j)
- test<std::deque<MoveOnly, min_allocator<MoveOnly>> >(rng[j]);
- }
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2046, 2047, 2048, 2049, 4094, 4095, 4096};
- const int N = sizeof(rng)/sizeof(rng[0]);
+ test<std::deque<MoveOnly, min_allocator<MoveOnly>> >(rng[j]);
+ }
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2046, 2047, 2048, 2049, 4094, 4095, 4096};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int j = 0; j < N; ++j)
- test<std::deque<MoveOnly, safe_allocator<MoveOnly>> >(rng[j]);
- }
+ test<std::deque<MoveOnly, safe_allocator<MoveOnly>> >(rng[j]);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_front.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_front.pass.cpp
index 2d1246b1507e703..1fb8341895a3576 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_front.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_front.pass.cpp
@@ -19,76 +19,68 @@
#include "min_allocator.h"
template <class C>
-C
-make(int size, int start = 0 )
-{
- const int b = 4096 / sizeof(int);
- int init = 0;
- if (start > 0)
- {
- init = (start+1) / b + ((start+1) % b != 0);
- init *= b;
- --init;
- }
- C c(init, 0);
- for (int i = 0; i < init-start; ++i)
- c.pop_back();
- for (int i = 0; i < size; ++i)
- c.push_back(i);
- for (int i = 0; i < start; ++i)
- c.pop_front();
- return c;
+C make(int size, int start = 0) {
+ const int b = 4096 / sizeof(int);
+ int init = 0;
+ if (start > 0) {
+ init = (start + 1) / b + ((start + 1) % b != 0);
+ init *= b;
+ --init;
+ }
+ C c(init, 0);
+ for (int i = 0; i < init - start; ++i)
+ c.pop_back();
+ for (int i = 0; i < size; ++i)
+ c.push_back(i);
+ for (int i = 0; i < start; ++i)
+ c.pop_front();
+ return c;
}
template <class C>
-void
-test(C& c1, int x)
-{
- typedef typename C::iterator I;
- std::size_t c1_osize = c1.size();
- c1.push_front(x);
- assert(c1.size() == c1_osize + 1);
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- I i = c1.begin();
- assert(*i == x);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- ++i;
- for (int j = 0; static_cast<std::size_t>(j) < c1_osize; ++j, ++i)
- assert(*i == j);
+void test(C& c1, int x) {
+ typedef typename C::iterator I;
+ std::size_t c1_osize = c1.size();
+ c1.push_front(x);
+ assert(c1.size() == c1_osize + 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ I i = c1.begin();
+ assert(*i == x);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ ++i;
+ for (int j = 0; static_cast<std::size_t>(j) < c1_osize; ++j, ++i)
+ assert(*i == j);
}
template <class C>
-void
-testN(int start, int N)
-{
- C c1 = make<C>(N, start);
- test(c1, -10);
+void testN(int start, int N) {
+ C c1 = make<C>(N, start);
+ test(c1, -10);
}
-int main(int, char**)
-{
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+int main(int, char**) {
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- testN<std::deque<int> >(rng[i], rng[j]);
- }
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<int> >(rng[i], rng[j]);
+ }
#if TEST_STD_VER >= 11
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j]);
- }
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j]);
+ }
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- testN<std::deque<int, safe_allocator<int>> >(rng[i], rng[j]);
- }
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<int, safe_allocator<int>> >(rng[i], rng[j]);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_front_exception_safety.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_front_exception_safety.pass.cpp
index c1d7723bbbf25d2..f4b77bcf09f6219 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_front_exception_safety.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_front_exception_safety.pass.cpp
@@ -20,18 +20,26 @@
static bool gCopyConstructorShouldThrow = false;
class CMyClass {
- public: CMyClass(int tag);
- public: CMyClass(const CMyClass& iOther);
- public: ~CMyClass();
-
- bool equal(const CMyClass &rhs) const
- { return fTag == rhs.fTag && fMagicValue == rhs.fMagicValue; }
- private:
- int fMagicValue;
- int fTag;
-
- private: static int kStartedConstructionMagicValue;
- private: static int kFinishedConstructionMagicValue;
+public:
+ CMyClass(int tag);
+
+public:
+ CMyClass(const CMyClass& iOther);
+
+public:
+ ~CMyClass();
+
+ bool equal(const CMyClass& rhs) const { return fTag == rhs.fTag && fMagicValue == rhs.fMagicValue; }
+
+private:
+ int fMagicValue;
+ int fTag;
+
+private:
+ static int kStartedConstructionMagicValue;
+
+private:
+ static int kFinishedConstructionMagicValue;
};
// Value for fMagicValue when the constructor has started running, but not yet finished
@@ -39,35 +47,30 @@ int CMyClass::kStartedConstructionMagicValue = 0;
// Value for fMagicValue when the constructor has finished running
int CMyClass::kFinishedConstructionMagicValue = 12345;
-CMyClass::CMyClass(int tag) :
- fMagicValue(kStartedConstructionMagicValue), fTag(tag)
-{
- // Signal that the constructor has finished running
- fMagicValue = kFinishedConstructionMagicValue;
+CMyClass::CMyClass(int tag) : fMagicValue(kStartedConstructionMagicValue), fTag(tag) {
+ // Signal that the constructor has finished running
+ fMagicValue = kFinishedConstructionMagicValue;
}
-CMyClass::CMyClass(const CMyClass& iOther) :
- fMagicValue(kStartedConstructionMagicValue), fTag(iOther.fTag)
-{
- // If requested, throw an exception _before_ setting fMagicValue to kFinishedConstructionMagicValue
- if (gCopyConstructorShouldThrow) {
- throw std::exception();
- }
- // Signal that the constructor has finished running
- fMagicValue = kFinishedConstructionMagicValue;
+CMyClass::CMyClass(const CMyClass& iOther) : fMagicValue(kStartedConstructionMagicValue), fTag(iOther.fTag) {
+ // If requested, throw an exception _before_ setting fMagicValue to kFinishedConstructionMagicValue
+ if (gCopyConstructorShouldThrow) {
+ throw std::exception();
+ }
+ // Signal that the constructor has finished running
+ fMagicValue = kFinishedConstructionMagicValue;
}
CMyClass::~CMyClass() {
- // Only instances for which the constructor has finished running should be destructed
- assert(fMagicValue == kFinishedConstructionMagicValue);
+ // Only instances for which the constructor has finished running should be destructed
+ assert(fMagicValue == kFinishedConstructionMagicValue);
}
-bool operator==(const CMyClass &lhs, const CMyClass &rhs) { return lhs.equal(rhs); }
+bool operator==(const CMyClass& lhs, const CMyClass& rhs) { return lhs.equal(rhs); }
-int main(int, char**)
-{
- CMyClass instance(42);
- {
+int main(int, char**) {
+ CMyClass instance(42);
+ {
std::deque<CMyClass> vec;
vec.push_front(instance);
@@ -75,16 +78,15 @@ int main(int, char**)
gCopyConstructorShouldThrow = true;
try {
- vec.push_front(instance);
- assert(false);
- }
- catch (...) {
+ vec.push_front(instance);
+ assert(false);
+ } catch (...) {
gCopyConstructorShouldThrow = false;
assert(vec == vec2);
}
- }
+ }
- {
+ {
test_allocator_statistics alloc_stats;
typedef std::deque<CMyClass, test_allocator<CMyClass> > C;
C vec((test_allocator<CMyClass>(&alloc_stats)));
@@ -92,13 +94,12 @@ int main(int, char**)
alloc_stats.throw_after = 1;
try {
- vec.push_front(instance);
- assert(false);
- }
- catch (...) {
- assert(vec==vec2);
- }
+ vec.push_front(instance);
+ assert(false);
+ } catch (...) {
+ assert(vec == vec2);
}
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp
index 2755433e58cbfdc..418a0c976e66c18 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp
@@ -21,71 +21,61 @@
#include "MoveOnly.h"
#include "min_allocator.h"
-
template <class C>
-C
-make(int size, int start = 0 )
-{
- const int b = 4096 / sizeof(int);
- int init = 0;
- if (start > 0)
- {
- init = (start+1) / b + ((start+1) % b != 0);
- init *= b;
- --init;
- }
- C c(init);
- for (int i = 0; i < init-start; ++i)
- c.pop_back();
- for (int i = 0; i < size; ++i)
- c.push_back(MoveOnly(i));
- for (int i = 0; i < start; ++i)
- c.pop_front();
- return c;
+C make(int size, int start = 0) {
+ const int b = 4096 / sizeof(int);
+ int init = 0;
+ if (start > 0) {
+ init = (start + 1) / b + ((start + 1) % b != 0);
+ init *= b;
+ --init;
+ }
+ C c(init);
+ for (int i = 0; i < init - start; ++i)
+ c.pop_back();
+ for (int i = 0; i < size; ++i)
+ c.push_back(MoveOnly(i));
+ for (int i = 0; i < start; ++i)
+ c.pop_front();
+ return c;
}
template <class C>
-void
-test(C& c1, int x)
-{
- typedef typename C::iterator I;
- std::size_t c1_osize = c1.size();
- c1.push_front(MoveOnly(x));
- assert(c1.size() == c1_osize + 1);
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- I i = c1.begin();
- assert(*i == MoveOnly(x));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- ++i;
- for (int j = 0; static_cast<std::size_t>(j) < c1_osize; ++j, (void) ++i)
- assert(*i == MoveOnly(j));
+void test(C& c1, int x) {
+ typedef typename C::iterator I;
+ std::size_t c1_osize = c1.size();
+ c1.push_front(MoveOnly(x));
+ assert(c1.size() == c1_osize + 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ I i = c1.begin();
+ assert(*i == MoveOnly(x));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ ++i;
+ for (int j = 0; static_cast<std::size_t>(j) < c1_osize; ++j, (void)++i)
+ assert(*i == MoveOnly(j));
}
template <class C>
-void
-testN(int start, int N)
-{
- C c1 = make<C>(N, start);
- test(c1, -10);
+void testN(int start, int N) {
+ C c1 = make<C>(N, start);
+ test(c1, -10);
}
-
-int main(int, char**)
-{
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+int main(int, char**) {
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- testN<std::deque<MoveOnly> >(rng[i], rng[j]);
- }
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<MoveOnly> >(rng[i], rng[j]);
+ }
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- testN<std::deque<MoveOnly, safe_allocator<MoveOnly>> >(rng[i], rng[j]);
- }
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<MoveOnly, safe_allocator<MoveOnly>> >(rng[i], rng[j]);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/deque/deque.special/copy.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.special/copy.pass.cpp
index e472a1cb59d473a..382d6e530b24fb6 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.special/copy.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.special/copy.pass.cpp
@@ -23,80 +23,75 @@
#include "min_allocator.h"
template <class C>
-C
-make(int size, int start = 0 )
-{
- const int b = 4096 / sizeof(int);
- int init = 0;
- if (start > 0)
- {
- init = (start+1) / b + ((start+1) % b != 0);
- init *= b;
- --init;
- }
- C c(init, 0);
- for (int i = 0; i < init-start; ++i)
- c.pop_back();
- for (int i = 0; i < size; ++i)
- c.push_back(i);
- for (int i = 0; i < start; ++i)
- c.pop_front();
- return c;
+C make(int size, int start = 0) {
+ const int b = 4096 / sizeof(int);
+ int init = 0;
+ if (start > 0) {
+ init = (start + 1) / b + ((start + 1) % b != 0);
+ init *= b;
+ --init;
+ }
+ C c(init, 0);
+ for (int i = 0; i < init - start; ++i)
+ c.pop_back();
+ for (int i = 0; i < size; ++i)
+ c.push_back(i);
+ for (int i = 0; i < start; ++i)
+ c.pop_front();
+ return c;
}
template <class C>
-void testN(int start, int N)
-{
- typedef typename C::iterator I;
- typedef typename C::const_iterator CI;
- typedef random_access_iterator<I> RAI;
- typedef random_access_iterator<CI> RACI;
- typedef cpp17_input_iterator<CI> ICI;
- C c1 = make<C>(N, start);
- C c2 = make<C>(N);
- assert(std::copy(c1.cbegin(), c1.cend(), c2.begin()) == c2.end());
- assert(c1 == c2);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
- assert(std::copy(c2.cbegin(), c2.cend(), c1.begin()) == c1.end());
- assert(c1 == c2);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
- assert(std::copy(c1.cbegin(), c1.cend(), RAI(c2.begin())) == RAI(c2.end()));
- assert(c1 == c2);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
- assert(std::copy(c2.cbegin(), c2.cend(), RAI(c1.begin())) == RAI(c1.end()));
- assert(c1 == c2);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
- assert(std::copy(RACI(c1.cbegin()), RACI(c1.cend()), c2.begin()) == c2.end());
- assert(c1 == c2);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
- assert(std::copy(ICI(c2.cbegin()), ICI(c2.cend()), c1.begin()) == c1.end());
- assert(c1 == c2);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
+void testN(int start, int N) {
+ typedef typename C::iterator I;
+ typedef typename C::const_iterator CI;
+ typedef random_access_iterator<I> RAI;
+ typedef random_access_iterator<CI> RACI;
+ typedef cpp17_input_iterator<CI> ICI;
+ C c1 = make<C>(N, start);
+ C c2 = make<C>(N);
+ assert(std::copy(c1.cbegin(), c1.cend(), c2.begin()) == c2.end());
+ assert(c1 == c2);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
+ assert(std::copy(c2.cbegin(), c2.cend(), c1.begin()) == c1.end());
+ assert(c1 == c2);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
+ assert(std::copy(c1.cbegin(), c1.cend(), RAI(c2.begin())) == RAI(c2.end()));
+ assert(c1 == c2);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
+ assert(std::copy(c2.cbegin(), c2.cend(), RAI(c1.begin())) == RAI(c1.end()));
+ assert(c1 == c2);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
+ assert(std::copy(RACI(c1.cbegin()), RACI(c1.cend()), c2.begin()) == c2.end());
+ assert(c1 == c2);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
+ assert(std::copy(ICI(c2.cbegin()), ICI(c2.cend()), c1.begin()) == c1.end());
+ assert(c1 == c2);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
}
-int main(int, char**)
-{
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+int main(int, char**) {
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- testN<std::deque<int> >(rng[i], rng[j]);
- }
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<int> >(rng[i], rng[j]);
+ }
#if TEST_STD_VER >= 11
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j]);
- }
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j]);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/deque/deque.special/copy_backward.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.special/copy_backward.pass.cpp
index bba4d173745cbdb..1414f03a549c1d4 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.special/copy_backward.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.special/copy_backward.pass.cpp
@@ -23,79 +23,74 @@
#include "min_allocator.h"
template <class C>
-C
-make(int size, int start = 0 )
-{
- const int b = 4096 / sizeof(int);
- int init = 0;
- if (start > 0)
- {
- init = (start+1) / b + ((start+1) % b != 0);
- init *= b;
- --init;
- }
- C c(init, 0);
- for (int i = 0; i < init-start; ++i)
- c.pop_back();
- for (int i = 0; i < size; ++i)
- c.push_back(i);
- for (int i = 0; i < start; ++i)
- c.pop_front();
- return c;
+C make(int size, int start = 0) {
+ const int b = 4096 / sizeof(int);
+ int init = 0;
+ if (start > 0) {
+ init = (start + 1) / b + ((start + 1) % b != 0);
+ init *= b;
+ --init;
+ }
+ C c(init, 0);
+ for (int i = 0; i < init - start; ++i)
+ c.pop_back();
+ for (int i = 0; i < size; ++i)
+ c.push_back(i);
+ for (int i = 0; i < start; ++i)
+ c.pop_front();
+ return c;
}
template <class C>
-void testN(int start, int N)
-{
- typedef typename C::iterator I;
- typedef typename C::const_iterator CI;
- typedef random_access_iterator<I> RAI;
- typedef random_access_iterator<CI> RACI;
- C c1 = make<C>(N, start);
- C c2 = make<C>(N);
- assert(std::copy_backward(c1.cbegin(), c1.cend(), c2.end()) == c2.begin());
- assert(c1 == c2);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
- assert(std::copy_backward(c2.cbegin(), c2.cend(), c1.end()) == c1.begin());
- assert(c1 == c2);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
- assert(std::copy_backward(c1.cbegin(), c1.cend(), RAI(c2.end())) == RAI(c2.begin()));
- assert(c1 == c2);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
- assert(std::copy_backward(c2.cbegin(), c2.cend(), RAI(c1.end())) == RAI(c1.begin()));
- assert(c1 == c2);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
- assert(std::copy_backward(RACI(c1.cbegin()), RACI(c1.cend()), c2.end()) == c2.begin());
- assert(c1 == c2);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
- assert(std::copy_backward(RACI(c2.cbegin()), RACI(c2.cend()), c1.end()) == c1.begin());
- assert(c1 == c2);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
+void testN(int start, int N) {
+ typedef typename C::iterator I;
+ typedef typename C::const_iterator CI;
+ typedef random_access_iterator<I> RAI;
+ typedef random_access_iterator<CI> RACI;
+ C c1 = make<C>(N, start);
+ C c2 = make<C>(N);
+ assert(std::copy_backward(c1.cbegin(), c1.cend(), c2.end()) == c2.begin());
+ assert(c1 == c2);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
+ assert(std::copy_backward(c2.cbegin(), c2.cend(), c1.end()) == c1.begin());
+ assert(c1 == c2);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
+ assert(std::copy_backward(c1.cbegin(), c1.cend(), RAI(c2.end())) == RAI(c2.begin()));
+ assert(c1 == c2);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
+ assert(std::copy_backward(c2.cbegin(), c2.cend(), RAI(c1.end())) == RAI(c1.begin()));
+ assert(c1 == c2);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
+ assert(std::copy_backward(RACI(c1.cbegin()), RACI(c1.cend()), c2.end()) == c2.begin());
+ assert(c1 == c2);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
+ assert(std::copy_backward(RACI(c2.cbegin()), RACI(c2.cend()), c1.end()) == c1.begin());
+ assert(c1 == c2);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
}
-int main(int, char**)
-{
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+int main(int, char**) {
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- testN<std::deque<int> >(rng[i], rng[j]);
- }
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<int> >(rng[i], rng[j]);
+ }
#if TEST_STD_VER >= 11
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j]);
- }
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j]);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/deque/deque.special/move.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.special/move.pass.cpp
index 497fac1063b6f76..4b24141db3ceef0 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.special/move.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.special/move.pass.cpp
@@ -23,79 +23,74 @@
#include "min_allocator.h"
template <class C>
-C
-make(int size, int start = 0 )
-{
- const int b = 4096 / sizeof(int);
- int init = 0;
- if (start > 0)
- {
- init = (start+1) / b + ((start+1) % b != 0);
- init *= b;
- --init;
- }
- C c(init, 0);
- for (int i = 0; i < init-start; ++i)
- c.pop_back();
- for (int i = 0; i < size; ++i)
- c.push_back(i);
- for (int i = 0; i < start; ++i)
- c.pop_front();
- return c;
+C make(int size, int start = 0) {
+ const int b = 4096 / sizeof(int);
+ int init = 0;
+ if (start > 0) {
+ init = (start + 1) / b + ((start + 1) % b != 0);
+ init *= b;
+ --init;
+ }
+ C c(init, 0);
+ for (int i = 0; i < init - start; ++i)
+ c.pop_back();
+ for (int i = 0; i < size; ++i)
+ c.push_back(i);
+ for (int i = 0; i < start; ++i)
+ c.pop_front();
+ return c;
}
template <class C>
-void testN(int start, int N)
-{
- typedef typename C::iterator I;
- typedef typename C::const_iterator CI;
- typedef random_access_iterator<I> RAI;
- typedef random_access_iterator<CI> RACI;
- C c1 = make<C>(N, start);
- C c2 = make<C>(N);
- assert(std::move(c1.cbegin(), c1.cend(), c2.begin()) == c2.end());
- assert(c1 == c2);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
- assert(std::move(c2.cbegin(), c2.cend(), c1.begin()) == c1.end());
- assert(c1 == c2);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
- assert(std::move(c1.cbegin(), c1.cend(), RAI(c2.begin())) == RAI(c2.end()));
- assert(c1 == c2);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
- assert(std::move(c2.cbegin(), c2.cend(), RAI(c1.begin())) == RAI(c1.end()));
- assert(c1 == c2);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
- assert(std::move(RACI(c1.cbegin()), RACI(c1.cend()), c2.begin()) == c2.end());
- assert(c1 == c2);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
- assert(std::move(RACI(c2.cbegin()), RACI(c2.cend()), c1.begin()) == c1.end());
- assert(c1 == c2);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
+void testN(int start, int N) {
+ typedef typename C::iterator I;
+ typedef typename C::const_iterator CI;
+ typedef random_access_iterator<I> RAI;
+ typedef random_access_iterator<CI> RACI;
+ C c1 = make<C>(N, start);
+ C c2 = make<C>(N);
+ assert(std::move(c1.cbegin(), c1.cend(), c2.begin()) == c2.end());
+ assert(c1 == c2);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
+ assert(std::move(c2.cbegin(), c2.cend(), c1.begin()) == c1.end());
+ assert(c1 == c2);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
+ assert(std::move(c1.cbegin(), c1.cend(), RAI(c2.begin())) == RAI(c2.end()));
+ assert(c1 == c2);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
+ assert(std::move(c2.cbegin(), c2.cend(), RAI(c1.begin())) == RAI(c1.end()));
+ assert(c1 == c2);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
+ assert(std::move(RACI(c1.cbegin()), RACI(c1.cend()), c2.begin()) == c2.end());
+ assert(c1 == c2);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
+ assert(std::move(RACI(c2.cbegin()), RACI(c2.cend()), c1.begin()) == c1.end());
+ assert(c1 == c2);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
}
-int main(int, char**)
-{
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+int main(int, char**) {
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- testN<std::deque<int> >(rng[i], rng[j]);
- }
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<int> >(rng[i], rng[j]);
+ }
#if TEST_STD_VER >= 11
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j]);
- }
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j]);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/deque/deque.special/move_backward.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.special/move_backward.pass.cpp
index 5a261304ff6843f..726abe7617aef28 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.special/move_backward.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.special/move_backward.pass.cpp
@@ -23,79 +23,74 @@
#include "min_allocator.h"
template <class C>
-C
-make(int size, int start = 0 )
-{
- const int b = 4096 / sizeof(int);
- int init = 0;
- if (start > 0)
- {
- init = (start+1) / b + ((start+1) % b != 0);
- init *= b;
- --init;
- }
- C c(init, 0);
- for (int i = 0; i < init-start; ++i)
- c.pop_back();
- for (int i = 0; i < size; ++i)
- c.push_back(i);
- for (int i = 0; i < start; ++i)
- c.pop_front();
- return c;
+C make(int size, int start = 0) {
+ const int b = 4096 / sizeof(int);
+ int init = 0;
+ if (start > 0) {
+ init = (start + 1) / b + ((start + 1) % b != 0);
+ init *= b;
+ --init;
+ }
+ C c(init, 0);
+ for (int i = 0; i < init - start; ++i)
+ c.pop_back();
+ for (int i = 0; i < size; ++i)
+ c.push_back(i);
+ for (int i = 0; i < start; ++i)
+ c.pop_front();
+ return c;
}
template <class C>
-void testN(int start, int N)
-{
- typedef typename C::iterator I;
- typedef typename C::const_iterator CI;
- typedef random_access_iterator<I> RAI;
- typedef random_access_iterator<CI> RACI;
- C c1 = make<C>(N, start);
- C c2 = make<C>(N);
- assert(std::move_backward(c1.cbegin(), c1.cend(), c2.end()) == c2.begin());
- assert(c1 == c2);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
- assert(std::move_backward(c2.cbegin(), c2.cend(), c1.end()) == c1.begin());
- assert(c1 == c2);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
- assert(std::move_backward(c1.cbegin(), c1.cend(), RAI(c2.end())) == RAI(c2.begin()));
- assert(c1 == c2);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
- assert(std::move_backward(c2.cbegin(), c2.cend(), RAI(c1.end())) == RAI(c1.begin()));
- assert(c1 == c2);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
- assert(std::move_backward(RACI(c1.cbegin()), RACI(c1.cend()), c2.end()) == c2.begin());
- assert(c1 == c2);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
- assert(std::move_backward(RACI(c2.cbegin()), RACI(c2.cend()), c1.end()) == c1.begin());
- assert(c1 == c2);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
+void testN(int start, int N) {
+ typedef typename C::iterator I;
+ typedef typename C::const_iterator CI;
+ typedef random_access_iterator<I> RAI;
+ typedef random_access_iterator<CI> RACI;
+ C c1 = make<C>(N, start);
+ C c2 = make<C>(N);
+ assert(std::move_backward(c1.cbegin(), c1.cend(), c2.end()) == c2.begin());
+ assert(c1 == c2);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
+ assert(std::move_backward(c2.cbegin(), c2.cend(), c1.end()) == c1.begin());
+ assert(c1 == c2);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
+ assert(std::move_backward(c1.cbegin(), c1.cend(), RAI(c2.end())) == RAI(c2.begin()));
+ assert(c1 == c2);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
+ assert(std::move_backward(c2.cbegin(), c2.cend(), RAI(c1.end())) == RAI(c1.begin()));
+ assert(c1 == c2);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
+ assert(std::move_backward(RACI(c1.cbegin()), RACI(c1.cend()), c2.end()) == c2.begin());
+ assert(c1 == c2);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
+ assert(std::move_backward(RACI(c2.cbegin()), RACI(c2.cend()), c1.end()) == c1.begin());
+ assert(c1 == c2);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
}
-int main(int, char**)
-{
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+int main(int, char**) {
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- testN<std::deque<int> >(rng[i], rng[j]);
- }
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<int> >(rng[i], rng[j]);
+ }
#if TEST_STD_VER >= 11
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- testN<std::deque<int, min_allocator<int> > >(rng[i], rng[j]);
- }
+ for (int j = 0; j < N; ++j)
+ testN<std::deque<int, min_allocator<int> > >(rng[i], rng[j]);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/deque/deque.special/swap.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.special/swap.pass.cpp
index e5816326ffac666..07004315a0bfb4a 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.special/swap.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.special/swap.pass.cpp
@@ -19,104 +19,99 @@
#include "min_allocator.h"
template <class C>
-C
-make(int size, int start = 0 )
-{
- const int b = 4096 / sizeof(int);
- int init = 0;
- if (start > 0)
- {
- init = (start+1) / b + ((start+1) % b != 0);
- init *= b;
- --init;
- }
- C c(init, 0);
- for (int i = 0; i < init-start; ++i)
- c.pop_back();
- for (int i = 0; i < size; ++i)
- c.push_back(i);
- for (int i = 0; i < start; ++i)
- c.pop_front();
- return c;
+C make(int size, int start = 0) {
+ const int b = 4096 / sizeof(int);
+ int init = 0;
+ if (start > 0) {
+ init = (start + 1) / b + ((start + 1) % b != 0);
+ init *= b;
+ --init;
+ }
+ C c(init, 0);
+ for (int i = 0; i < init - start; ++i)
+ c.pop_back();
+ for (int i = 0; i < size; ++i)
+ c.push_back(i);
+ for (int i = 0; i < start; ++i)
+ c.pop_front();
+ return c;
}
template <class C>
-void testN(int start, int N, int M)
-{
- C c1 = make<C>(N, start);
- C c2 = make<C>(M);
- C c1_save = c1;
- C c2_save = c2;
+void testN(int start, int N, int M) {
+ C c1 = make<C>(N, start);
+ C c2 = make<C>(M);
+ C c1_save = c1;
+ C c2_save = c2;
+ swap(c1, c2);
+ assert(c1 == c2_save);
+ assert(c2 == c1_save);
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1_save));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2_save));
+}
+
+int main(int, char**) {
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
+ for (int i = 0; i < N; ++i)
+ for (int j = 0; j < N; ++j)
+ for (int k = 0; k < N; ++k)
+ testN<std::deque<int> >(rng[i], rng[j], rng[k]);
+ }
+ {
+ int a1[] = {1, 3, 7, 9, 10};
+ int a2[] = {0, 2, 4, 5, 6, 8, 11};
+ typedef test_allocator<int> A;
+ std::deque<int, A> c1(a1, a1 + sizeof(a1) / sizeof(a1[0]), A(1, 1));
+ std::deque<int, A> c2(a2, a2 + sizeof(a2) / sizeof(a2[0]), A(1, 2));
swap(c1, c2);
- assert(c1 == c2_save);
- assert(c2 == c1_save);
+ assert((c1 == std::deque<int, A>(a2, a2 + sizeof(a2) / sizeof(a2[0]))));
+ assert(c1.get_allocator().get_id() == 1);
+ assert((c2 == std::deque<int, A>(a1, a1 + sizeof(a1) / sizeof(a1[0]))));
+ assert(c2.get_allocator().get_id() == 2);
LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1_save));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2_save));
-}
-
-int main(int, char**)
-{
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
- for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- for (int k = 0; k < N; ++k)
- testN<std::deque<int> >(rng[i], rng[j], rng[k]);
- }
- {
- int a1[] = {1, 3, 7, 9, 10};
- int a2[] = {0, 2, 4, 5, 6, 8, 11};
- typedef test_allocator<int> A;
- std::deque<int, A> c1(a1, a1+sizeof(a1)/sizeof(a1[0]), A(1, 1));
- std::deque<int, A> c2(a2, a2+sizeof(a2)/sizeof(a2[0]), A(1, 2));
- swap(c1, c2);
- assert((c1 == std::deque<int, A>(a2, a2+sizeof(a2)/sizeof(a2[0]))));
- assert(c1.get_allocator().get_id() == 1);
- assert((c2 == std::deque<int, A>(a1, a1+sizeof(a1)/sizeof(a1[0]))));
- assert(c2.get_allocator().get_id() == 2);
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
- }
- {
- int a1[] = {1, 3, 7, 9, 10};
- int a2[] = {0, 2, 4, 5, 6, 8, 11};
- typedef other_allocator<int> A;
- std::deque<int, A> c1(a1, a1+sizeof(a1)/sizeof(a1[0]), A(1));
- std::deque<int, A> c2(a2, a2+sizeof(a2)/sizeof(a2[0]), A(2));
- swap(c1, c2);
- assert((c1 == std::deque<int, A>(a2, a2+sizeof(a2)/sizeof(a2[0]))));
- assert(c1.get_allocator() == A(2));
- assert((c2 == std::deque<int, A>(a1, a1+sizeof(a1)/sizeof(a1[0]))));
- assert(c2.get_allocator() == A(1));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
- }
+ }
+ {
+ int a1[] = {1, 3, 7, 9, 10};
+ int a2[] = {0, 2, 4, 5, 6, 8, 11};
+ typedef other_allocator<int> A;
+ std::deque<int, A> c1(a1, a1 + sizeof(a1) / sizeof(a1[0]), A(1));
+ std::deque<int, A> c2(a2, a2 + sizeof(a2) / sizeof(a2[0]), A(2));
+ swap(c1, c2);
+ assert((c1 == std::deque<int, A>(a2, a2 + sizeof(a2) / sizeof(a2[0]))));
+ assert(c1.get_allocator() == A(2));
+ assert((c2 == std::deque<int, A>(a1, a1 + sizeof(a1) / sizeof(a1[0]))));
+ assert(c2.get_allocator() == A(1));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
+ }
#if TEST_STD_VER >= 11
- {
- int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
- const int N = sizeof(rng)/sizeof(rng[0]);
- for (int i = 0; i < N; ++i)
- for (int j = 0; j < N; ++j)
- for (int k = 0; k < N; ++k)
- testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j], rng[k]);
- }
- {
- int a1[] = {1, 3, 7, 9, 10};
- int a2[] = {0, 2, 4, 5, 6, 8, 11};
- typedef min_allocator<int> A;
- std::deque<int, A> c1(a1, a1+sizeof(a1)/sizeof(a1[0]), A());
- std::deque<int, A> c2(a2, a2+sizeof(a2)/sizeof(a2[0]), A());
- swap(c1, c2);
- assert((c1 == std::deque<int, A>(a2, a2+sizeof(a2)/sizeof(a2[0]))));
- assert(c1.get_allocator() == A());
- assert((c2 == std::deque<int, A>(a1, a1+sizeof(a1)/sizeof(a1[0]))));
- assert(c2.get_allocator() == A());
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
- LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
- }
+ {
+ int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+ const int N = sizeof(rng) / sizeof(rng[0]);
+ for (int i = 0; i < N; ++i)
+ for (int j = 0; j < N; ++j)
+ for (int k = 0; k < N; ++k)
+ testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j], rng[k]);
+ }
+ {
+ int a1[] = {1, 3, 7, 9, 10};
+ int a2[] = {0, 2, 4, 5, 6, 8, 11};
+ typedef min_allocator<int> A;
+ std::deque<int, A> c1(a1, a1 + sizeof(a1) / sizeof(a1[0]), A());
+ std::deque<int, A> c2(a2, a2 + sizeof(a2) / sizeof(a2[0]), A());
+ swap(c1, c2);
+ assert((c1 == std::deque<int, A>(a2, a2 + sizeof(a2) / sizeof(a2[0]))));
+ assert(c1.get_allocator() == A());
+ assert((c2 == std::deque<int, A>(a1, a1 + sizeof(a1) / sizeof(a1[0]))));
+ assert(c2.get_allocator() == A());
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c1));
+ LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2));
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/deque/deque.special/swap_noexcept.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.special/swap_noexcept.pass.cpp
index d6257b13aaaec7a..6347496d67c15bb 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.special/swap_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.special/swap_noexcept.pass.cpp
@@ -28,65 +28,61 @@
#include "test_allocator.h"
template <class T>
-struct some_alloc
-{
- typedef T value_type;
+struct some_alloc {
+ typedef T value_type;
- some_alloc() {}
- some_alloc(const some_alloc&);
- void allocate(std::size_t);
- void deallocate(void*, unsigned) {}
+ some_alloc() {}
+ some_alloc(const some_alloc&);
+ void allocate(std::size_t);
+ void deallocate(void*, unsigned) {}
- typedef std::true_type propagate_on_container_swap;
+ typedef std::true_type propagate_on_container_swap;
};
template <class T>
-struct some_alloc2
-{
- typedef T value_type;
+struct some_alloc2 {
+ typedef T value_type;
- some_alloc2() {}
- some_alloc2(const some_alloc2&);
- void allocate(std::size_t);
- void deallocate(void*, unsigned) {}
+ some_alloc2() {}
+ some_alloc2(const some_alloc2&);
+ void allocate(std::size_t);
+ void deallocate(void*, unsigned) {}
- typedef std::false_type propagate_on_container_swap;
- typedef std::true_type is_always_equal;
+ typedef std::false_type propagate_on_container_swap;
+ typedef std::true_type is_always_equal;
};
-int main(int, char**)
-{
- {
- typedef std::deque<MoveOnly> C;
- static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
+int main(int, char**) {
+ {
+ typedef std::deque<MoveOnly> C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
#if defined(_LIBCPP_VERSION)
- {
- typedef std::deque<MoveOnly, test_allocator<MoveOnly>> C;
- static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- {
- typedef std::deque<MoveOnly, other_allocator<MoveOnly>> C;
- static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
+ {
+ typedef std::deque<MoveOnly, test_allocator<MoveOnly>> C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
+ {
+ typedef std::deque<MoveOnly, other_allocator<MoveOnly>> C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
#endif // _LIBCPP_VERSION
- {
- typedef std::deque<MoveOnly, some_alloc<MoveOnly>> C;
+ {
+ typedef std::deque<MoveOnly, some_alloc<MoveOnly>> C;
#if TEST_STD_VER >= 14
// In C++14, if POCS is set, swapping the allocator is required not to throw
- static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
#else
- static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
#endif
- }
+ }
#if TEST_STD_VER >= 14
- {
- typedef std::deque<MoveOnly, some_alloc2<MoveOnly>> C;
+ {
+ typedef std::deque<MoveOnly, some_alloc2<MoveOnly>> C;
// if the allocators are always equal, then the swap can be noexcept
- static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
#endif
-
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/deque/get_allocator.pass.cpp b/libcxx/test/std/containers/sequences/deque/get_allocator.pass.cpp
index e42dbb7d75153f5..6b8bc6c555bcd5e 100644
--- a/libcxx/test/std/containers/sequences/deque/get_allocator.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/get_allocator.pass.cpp
@@ -19,16 +19,16 @@
#include "test_macros.h"
int main(int, char**) {
- {
- std::allocator<int> alloc;
- const std::deque<int> d(alloc);
- assert(d.get_allocator() == alloc);
- }
- {
- other_allocator<int> alloc(1);
- const std::deque<int, other_allocator<int> > d(alloc);
- assert(d.get_allocator() == alloc);
- }
+ {
+ std::allocator<int> alloc;
+ const std::deque<int> d(alloc);
+ assert(d.get_allocator() == alloc);
+ }
+ {
+ other_allocator<int> alloc(1);
+ const std::deque<int, other_allocator<int> > d(alloc);
+ assert(d.get_allocator() == alloc);
+ }
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/deque/iterator_concept_conformance.compile.pass.cpp b/libcxx/test/std/containers/sequences/deque/iterator_concept_conformance.compile.pass.cpp
index 3b0aa36f02aac09..02c1ecf78b0af95 100644
--- a/libcxx/test/std/containers/sequences/deque/iterator_concept_conformance.compile.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/iterator_concept_conformance.compile.pass.cpp
@@ -14,11 +14,11 @@
#include <iterator>
-using iterator = std::deque<int>::iterator;
-using const_iterator = std::deque<int>::const_iterator;
-using reverse_iterator = std::deque<int>::reverse_iterator;
+using iterator = std::deque<int>::iterator;
+using const_iterator = std::deque<int>::const_iterator;
+using reverse_iterator = std::deque<int>::reverse_iterator;
using const_reverse_iterator = std::deque<int>::const_reverse_iterator;
-using value_type = int;
+using value_type = int;
static_assert(std::random_access_iterator<iterator>);
static_assert(!std::contiguous_iterator<iterator>);
@@ -31,20 +31,20 @@ static_assert(std::sized_sentinel_for<iterator, iterator>);
static_assert(std::sized_sentinel_for<iterator, const_iterator>);
static_assert(!std::sized_sentinel_for<iterator, reverse_iterator>);
static_assert(!std::sized_sentinel_for<iterator, const_reverse_iterator>);
-static_assert( std::indirectly_movable<iterator, iterator>);
-static_assert( std::indirectly_movable_storable<iterator, iterator>);
+static_assert(std::indirectly_movable<iterator, iterator>);
+static_assert(std::indirectly_movable_storable<iterator, iterator>);
static_assert(!std::indirectly_movable<iterator, const_iterator>);
static_assert(!std::indirectly_movable_storable<iterator, const_iterator>);
-static_assert( std::indirectly_movable<iterator, reverse_iterator>);
-static_assert( std::indirectly_movable_storable<iterator, reverse_iterator>);
+static_assert(std::indirectly_movable<iterator, reverse_iterator>);
+static_assert(std::indirectly_movable_storable<iterator, reverse_iterator>);
static_assert(!std::indirectly_movable<iterator, const_reverse_iterator>);
static_assert(!std::indirectly_movable_storable<iterator, const_reverse_iterator>);
-static_assert( std::indirectly_copyable<iterator, iterator>);
-static_assert( std::indirectly_copyable_storable<iterator, iterator>);
+static_assert(std::indirectly_copyable<iterator, iterator>);
+static_assert(std::indirectly_copyable_storable<iterator, iterator>);
static_assert(!std::indirectly_copyable<iterator, const_iterator>);
static_assert(!std::indirectly_copyable_storable<iterator, const_iterator>);
-static_assert( std::indirectly_copyable<iterator, reverse_iterator>);
-static_assert( std::indirectly_copyable_storable<iterator, reverse_iterator>);
+static_assert(std::indirectly_copyable<iterator, reverse_iterator>);
+static_assert(std::indirectly_copyable_storable<iterator, reverse_iterator>);
static_assert(!std::indirectly_copyable<iterator, const_reverse_iterator>);
static_assert(!std::indirectly_copyable_storable<iterator, const_reverse_iterator>);
static_assert(std::indirectly_swappable<iterator, iterator>);
@@ -60,20 +60,20 @@ static_assert(std::sized_sentinel_for<const_iterator, iterator>);
static_assert(std::sized_sentinel_for<const_iterator, const_iterator>);
static_assert(!std::sized_sentinel_for<const_iterator, reverse_iterator>);
static_assert(!std::sized_sentinel_for<const_iterator, const_reverse_iterator>);
-static_assert( std::indirectly_movable<const_iterator, iterator>);
-static_assert( std::indirectly_movable_storable<const_iterator, iterator>);
+static_assert(std::indirectly_movable<const_iterator, iterator>);
+static_assert(std::indirectly_movable_storable<const_iterator, iterator>);
static_assert(!std::indirectly_movable<const_iterator, const_iterator>);
static_assert(!std::indirectly_movable_storable<const_iterator, const_iterator>);
-static_assert( std::indirectly_movable<const_iterator, reverse_iterator>);
-static_assert( std::indirectly_movable_storable<const_iterator, reverse_iterator>);
+static_assert(std::indirectly_movable<const_iterator, reverse_iterator>);
+static_assert(std::indirectly_movable_storable<const_iterator, reverse_iterator>);
static_assert(!std::indirectly_movable<const_iterator, const_reverse_iterator>);
static_assert(!std::indirectly_movable_storable<const_iterator, const_reverse_iterator>);
-static_assert( std::indirectly_copyable<const_iterator, iterator>);
-static_assert( std::indirectly_copyable_storable<const_iterator, iterator>);
+static_assert(std::indirectly_copyable<const_iterator, iterator>);
+static_assert(std::indirectly_copyable_storable<const_iterator, iterator>);
static_assert(!std::indirectly_copyable<const_iterator, const_iterator>);
static_assert(!std::indirectly_copyable_storable<const_iterator, const_iterator>);
-static_assert( std::indirectly_copyable<const_iterator, reverse_iterator>);
-static_assert( std::indirectly_copyable_storable<const_iterator, reverse_iterator>);
+static_assert(std::indirectly_copyable<const_iterator, reverse_iterator>);
+static_assert(std::indirectly_copyable_storable<const_iterator, reverse_iterator>);
static_assert(!std::indirectly_copyable<const_iterator, const_reverse_iterator>);
static_assert(!std::indirectly_copyable_storable<const_iterator, const_reverse_iterator>);
static_assert(!std::indirectly_swappable<const_iterator, const_iterator>);
diff --git a/libcxx/test/std/containers/sequences/deque/iterators.pass.cpp b/libcxx/test/std/containers/sequences/deque/iterators.pass.cpp
index 484a2961fdb0c9e..337fd688ebcdbc8 100644
--- a/libcxx/test/std/containers/sequences/deque/iterators.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/iterators.pass.cpp
@@ -22,9 +22,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::deque<int> C;
C c;
C::iterator i;
@@ -32,9 +31,9 @@ int main(int, char**)
C::const_iterator j;
j = c.cbegin();
assert(i == j);
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::deque<int, min_allocator<int>> C;
C c;
C::iterator i;
@@ -62,48 +61,48 @@ int main(int, char**)
std::same_as<std::strong_ordering> decltype(auto) r1 = i <=> j;
assert(r1 == std::strong_ordering::equal);
# endif
- }
+ }
#endif
#if TEST_STD_VER > 11
- { // N3644 testing
- std::deque<int>::iterator ii1{}, ii2{};
- std::deque<int>::iterator ii4 = ii1;
- std::deque<int>::const_iterator cii{};
- assert ( ii1 == ii2 );
- assert ( ii1 == ii4 );
-
- assert (!(ii1 != ii2 ));
-
- assert ( (ii1 == cii ));
- assert ( (cii == ii1 ));
- assert (!(ii1 != cii ));
- assert (!(cii != ii1 ));
- assert (!(ii1 < cii ));
- assert (!(cii < ii1 ));
- assert ( (ii1 <= cii ));
- assert ( (cii <= ii1 ));
- assert (!(ii1 > cii ));
- assert (!(cii > ii1 ));
- assert ( (ii1 >= cii ));
- assert ( (cii >= ii1 ));
- assert (cii - ii1 == 0);
- assert (ii1 - cii == 0);
-
-// std::deque<int> c;
-// assert ( ii1 != c.cbegin());
-// assert ( cii != c.begin());
-// assert ( cii != c.cend());
-// assert ( ii1 != c.end());
+ { // N3644 testing
+ std::deque<int>::iterator ii1{}, ii2{};
+ std::deque<int>::iterator ii4 = ii1;
+ std::deque<int>::const_iterator cii{};
+ assert(ii1 == ii2);
+ assert(ii1 == ii4);
+
+ assert(!(ii1 != ii2));
+
+ assert((ii1 == cii));
+ assert((cii == ii1));
+ assert(!(ii1 != cii));
+ assert(!(cii != ii1));
+ assert(!(ii1 < cii));
+ assert(!(cii < ii1));
+ assert((ii1 <= cii));
+ assert((cii <= ii1));
+ assert(!(ii1 > cii));
+ assert(!(cii > ii1));
+ assert((ii1 >= cii));
+ assert((cii >= ii1));
+ assert(cii - ii1 == 0);
+ assert(ii1 - cii == 0);
+
+ // std::deque<int> c;
+ // assert ( ii1 != c.cbegin());
+ // assert ( cii != c.begin());
+ // assert ( cii != c.cend());
+ // assert ( ii1 != c.end());
# if TEST_STD_VER >= 20
- // P1614 + LWG3352
- std::same_as<std::strong_ordering> decltype(auto) r1 = ii1 <=> ii2;
- assert(r1 == std::strong_ordering::equal);
+ // P1614 + LWG3352
+ std::same_as<std::strong_ordering> decltype(auto) r1 = ii1 <=> ii2;
+ assert(r1 == std::strong_ordering::equal);
- std::same_as<std::strong_ordering> decltype(auto) r2 = cii <=> ii2;
- assert(r2 == std::strong_ordering::equal);
+ std::same_as<std::strong_ordering> decltype(auto) r2 = cii <=> ii2;
+ assert(r2 == std::strong_ordering::equal);
# endif // TEST_STD_VER > 20
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/deque/range_concept_conformance.compile.pass.cpp b/libcxx/test/std/containers/sequences/deque/range_concept_conformance.compile.pass.cpp
index b413badb9de1e14..925ff8d097fc339 100644
--- a/libcxx/test/std/containers/sequences/deque/range_concept_conformance.compile.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/range_concept_conformance.compile.pass.cpp
@@ -17,7 +17,6 @@
using range = std::deque<int>;
-
static_assert(std::same_as<std::ranges::iterator_t<range>, range::iterator>);
static_assert(std::ranges::common_range<range>);
static_assert(std::ranges::random_access_range<range>);
diff --git a/libcxx/test/std/containers/sequences/deque/types.pass.cpp b/libcxx/test/std/containers/sequences/deque/types.pass.cpp
index 8c14de0c77440a5..8184d55873d20c3 100644
--- a/libcxx/test/std/containers/sequences/deque/types.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/types.pass.cpp
@@ -38,76 +38,73 @@
#include "min_allocator.h"
template <class T, class Allocator>
-void
-test()
-{
- typedef std::deque<T, Allocator> C;
+void test() {
+ typedef std::deque<T, Allocator> C;
- static_assert((std::is_same<typename C::value_type, T>::value), "");
- static_assert(
- (std::is_same<typename C::value_type, typename std::allocator_traits<Allocator>::value_type>::value), "");
- static_assert((std::is_same<typename C::allocator_type, Allocator>::value), "");
- static_assert(
- (std::is_same<typename C::size_type, typename std::allocator_traits<Allocator>::size_type>::value), "");
- static_assert(
- (std::is_same<typename C::
diff erence_type, typename std::allocator_traits<Allocator>::
diff erence_type>::value),
- "");
- static_assert(
- (std::is_same<typename C::reference, typename std::allocator_traits<Allocator>::value_type&>::value), "");
- static_assert((std::is_same<typename C::const_reference,
- const typename std::allocator_traits<Allocator>::value_type&>::value),
- "");
- static_assert((std::is_same<typename C::pointer, typename std::allocator_traits<Allocator>::pointer>::value), "");
- static_assert(
- (std::is_same<typename C::const_pointer, typename std::allocator_traits<Allocator>::const_pointer>::value), "");
- static_assert((std::is_same<
- typename std::iterator_traits<typename C::iterator>::iterator_category,
- std::random_access_iterator_tag>::value), "");
- static_assert((std::is_same<
- typename std::iterator_traits<typename C::const_iterator>::iterator_category,
- std::random_access_iterator_tag>::value), "");
- static_assert((std::is_same<
- typename C::reverse_iterator,
- std::reverse_iterator<typename C::iterator> >::value), "");
- static_assert((std::is_same<
- typename C::const_reverse_iterator,
- std::reverse_iterator<typename C::const_iterator> >::value), "");
- static_assert((std::is_signed<typename C::
diff erence_type>::value), "");
- static_assert((std::is_unsigned<typename C::size_type>::value), "");
- static_assert((std::is_same<typename C::
diff erence_type,
- typename std::iterator_traits<typename C::iterator>::
diff erence_type>::value), "");
- static_assert((std::is_same<typename C::
diff erence_type,
- typename std::iterator_traits<typename C::const_iterator>::
diff erence_type>::value), "");
+ static_assert((std::is_same<typename C::value_type, T>::value), "");
+ static_assert(
+ (std::is_same<typename C::value_type, typename std::allocator_traits<Allocator>::value_type>::value), "");
+ static_assert((std::is_same<typename C::allocator_type, Allocator>::value), "");
+ static_assert((std::is_same<typename C::size_type, typename std::allocator_traits<Allocator>::size_type>::value), "");
+ static_assert(
+ (std::is_same<typename C::
diff erence_type, typename std::allocator_traits<Allocator>::
diff erence_type>::value),
+ "");
+ static_assert(
+ (std::is_same<typename C::reference, typename std::allocator_traits<Allocator>::value_type&>::value), "");
+ static_assert(
+ (std::is_same<typename C::const_reference, const typename std::allocator_traits<Allocator>::value_type&>::value),
+ "");
+ static_assert((std::is_same<typename C::pointer, typename std::allocator_traits<Allocator>::pointer>::value), "");
+ static_assert(
+ (std::is_same<typename C::const_pointer, typename std::allocator_traits<Allocator>::const_pointer>::value), "");
+ static_assert((std::is_same< typename std::iterator_traits<typename C::iterator>::iterator_category,
+ std::random_access_iterator_tag>::value),
+ "");
+ static_assert((std::is_same< typename std::iterator_traits<typename C::const_iterator>::iterator_category,
+ std::random_access_iterator_tag>::value),
+ "");
+ static_assert((std::is_same< typename C::reverse_iterator, std::reverse_iterator<typename C::iterator> >::value), "");
+ static_assert(
+ (std::is_same< typename C::const_reverse_iterator, std::reverse_iterator<typename C::const_iterator> >::value),
+ "");
+ static_assert((std::is_signed<typename C::
diff erence_type>::value), "");
+ static_assert((std::is_unsigned<typename C::size_type>::value), "");
+ static_assert((std::is_same<typename C::
diff erence_type,
+ typename std::iterator_traits<typename C::iterator>::
diff erence_type>::value),
+ "");
+ static_assert((std::is_same<typename C::
diff erence_type,
+ typename std::iterator_traits<typename C::const_iterator>::
diff erence_type>::value),
+ "");
}
-int main(int, char**)
-{
- test<int, test_allocator<int> >();
- test<int*, std::allocator<int*> >();
- test<Copyable, test_allocator<Copyable> >();
- static_assert((std::is_same<std::deque<char>::allocator_type,
- std::allocator<char> >::value), "");
+int main(int, char**) {
+ test<int, test_allocator<int> >();
+ test<int*, std::allocator<int*> >();
+ test<Copyable, test_allocator<Copyable> >();
+ static_assert((std::is_same<std::deque<char>::allocator_type, std::allocator<char> >::value), "");
#if TEST_STD_VER >= 11
- {
- typedef std::deque<short, min_allocator<short>> C;
- static_assert((std::is_same<C::value_type, short>::value), "");
- static_assert((std::is_same<C::allocator_type, min_allocator<C::value_type> >::value), "");
- static_assert((std::is_same<C::reference, C::value_type&>::value), "");
- static_assert((std::is_same<C::const_reference, const C::value_type&>::value), "");
- static_assert((std::is_same<C::pointer, min_pointer<C::value_type>>::value), "");
- static_assert((std::is_same<C::const_pointer, min_pointer<const C::value_type>>::value), "");
-// min_allocator doesn't have a size_type, so one gets synthesized
- static_assert((std::is_same<C::size_type, std::make_unsigned<C::
diff erence_type>::type>::value), "");
- static_assert((std::is_same<C::
diff erence_type, std::ptr
diff _t>::value), "");
+ {
+ typedef std::deque<short, min_allocator<short>> C;
+ static_assert((std::is_same<C::value_type, short>::value), "");
+ static_assert((std::is_same<C::allocator_type, min_allocator<C::value_type> >::value), "");
+ static_assert((std::is_same<C::reference, C::value_type&>::value), "");
+ static_assert((std::is_same<C::const_reference, const C::value_type&>::value), "");
+ static_assert((std::is_same<C::pointer, min_pointer<C::value_type>>::value), "");
+ static_assert((std::is_same<C::const_pointer, min_pointer<const C::value_type>>::value), "");
+ // min_allocator doesn't have a size_type, so one gets synthesized
+ static_assert((std::is_same<C::size_type, std::make_unsigned<C::
diff erence_type>::type>::value), "");
+ static_assert((std::is_same<C::
diff erence_type, std::ptr
diff _t>::value), "");
- static_assert((std::is_signed<typename C::
diff erence_type>::value), "");
- static_assert((std::is_unsigned<typename C::size_type>::value), "");
- static_assert((std::is_same<typename C::
diff erence_type,
- typename std::iterator_traits<typename C::iterator>::
diff erence_type>::value), "");
- static_assert((std::is_same<typename C::
diff erence_type,
- typename std::iterator_traits<typename C::const_iterator>::
diff erence_type>::value), "");
- }
+ static_assert((std::is_signed<typename C::
diff erence_type>::value), "");
+ static_assert((std::is_unsigned<typename C::size_type>::value), "");
+ static_assert((std::is_same<typename C::
diff erence_type,
+ typename std::iterator_traits<typename C::iterator>::
diff erence_type>::value),
+ "");
+ static_assert((std::is_same<typename C::
diff erence_type,
+ typename std::iterator_traits<typename C::const_iterator>::
diff erence_type>::value),
+ "");
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/forwardlist/allocator_mismatch.verify.cpp b/libcxx/test/std/containers/sequences/forwardlist/allocator_mismatch.verify.cpp
index d7133a1c5ac0faa..96c3a11264dc321 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/allocator_mismatch.verify.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/allocator_mismatch.verify.cpp
@@ -12,4 +12,4 @@
#include <forward_list>
std::forward_list<int, std::allocator<long> > fl;
- // expected-error-re@*:* {{static assertion failed{{.*}}Allocator::value_type must be same type as value_type}}
+// expected-error-re@*:* {{static assertion failed{{.*}}Allocator::value_type must be same type as value_type}}
diff --git a/libcxx/test/std/containers/sequences/forwardlist/empty.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/empty.pass.cpp
index 727904c9871338a..dbc0631d1193056 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/empty.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/empty.pass.cpp
@@ -18,9 +18,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::forward_list<int> C;
C c;
ASSERT_NOEXCEPT(c.empty());
@@ -29,9 +28,9 @@ int main(int, char**)
assert(!c.empty());
c.clear();
assert(c.empty());
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::forward_list<int, min_allocator<int>> C;
C c;
ASSERT_NOEXCEPT(c.empty());
@@ -40,7 +39,7 @@ int main(int, char**)
assert(!c.empty());
c.clear();
assert(c.empty());
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/forwardlist/empty.verify.cpp b/libcxx/test/std/containers/sequences/forwardlist/empty.verify.cpp
index 366094b09e8854c..d3755acecebb9d6 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/empty.verify.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/empty.verify.cpp
@@ -17,6 +17,6 @@
#include <forward_list>
void f() {
- std::forward_list<int> c;
- c.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::forward_list<int> c;
+ c.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}
diff --git a/libcxx/test/std/containers/sequences/forwardlist/exception_safety.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/exception_safety.pass.cpp
index a6f1a15bdd85c39..faf42202e951aa3 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/exception_safety.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/exception_safety.pass.cpp
@@ -55,23 +55,23 @@
#include "test_macros.h"
#if TEST_STD_VER >= 23
-#include <ranges>
+# include <ranges>
#endif
int main(int, char**) {
{
constexpr int ThrowOn = 1;
- constexpr int Size = 1;
- using T = ThrowingCopy<ThrowOn>;
+ constexpr int Size = 1;
+ using T = ThrowingCopy<ThrowOn>;
// void push_front(const value_type& v);
- test_exception_safety_throwing_copy<ThrowOn, Size>([](T* from, T*){
+ test_exception_safety_throwing_copy<ThrowOn, Size>([](T* from, T*) {
std::forward_list<T> c;
c.push_front(*from);
});
// iterator insert_after(const_iterator p, const value_type& v);
- test_exception_safety_throwing_copy</*ThrowOn=*/1, Size>([](T* from, T*){
+ test_exception_safety_throwing_copy</*ThrowOn=*/1, Size>([](T* from, T*) {
std::forward_list<T> c;
c.insert_after(c.before_begin(), *from);
});
@@ -79,26 +79,26 @@ int main(int, char**) {
{
constexpr int ThrowOn = 3;
- constexpr int Size = 5;
- using T = ThrowingCopy<ThrowOn>;
- using C = std::forward_list<T>;
- using Alloc = std::allocator<T>;
+ constexpr int Size = 5;
+ using T = ThrowingCopy<ThrowOn>;
+ using C = std::forward_list<T>;
+ using Alloc = std::allocator<T>;
// forward_list(size_type n, const value_type& v);
- test_exception_safety_throwing_copy<ThrowOn, Size>([](T* from, T*){
+ test_exception_safety_throwing_copy<ThrowOn, Size>([](T* from, T*) {
std::forward_list<T> c(Size, *from);
(void)c;
});
// forward_list(size_type n, const value_type& v, const allocator_type& a);
- test_exception_safety_throwing_copy<ThrowOn, Size>([](T* from, T*){
+ test_exception_safety_throwing_copy<ThrowOn, Size>([](T* from, T*) {
std::forward_list<T> c(Size, *from, Alloc());
(void)c;
});
// template <class InputIterator>
// forward_list(InputIterator first, InputIterator last);
- test_exception_safety_throwing_copy<ThrowOn, Size>([](T* from, T* to){
+ test_exception_safety_throwing_copy<ThrowOn, Size>([](T* from, T* to) {
std::forward_list<T> c(from, to);
(void)c;
});
@@ -106,7 +106,7 @@ int main(int, char**) {
#if TEST_STD_VER >= 23
// template<container-compatible-range<T> R>
// forward_list(from_range_t, R&& rg, const Allocator& = Allocator()); // C++23
- test_exception_safety_throwing_copy<ThrowOn, Size>([](T* from, T* to){
+ test_exception_safety_throwing_copy<ThrowOn, Size>([](T* from, T* to) {
{
std::forward_list<T> c(std::from_range, std::ranges::subrange(from, to));
(void)c;
@@ -121,7 +121,7 @@ int main(int, char**) {
// template <class InputIterator>
// forward_list(InputIterator first, InputIterator last, const allocator_type& a);
- test_exception_safety_throwing_copy<ThrowOn, Size>([](T* from, T* to){
+ test_exception_safety_throwing_copy<ThrowOn, Size>([](T* from, T* to) {
std::forward_list<T> c(from, to, Alloc());
(void)c;
});
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.access/front.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.access/front.pass.cpp
index 74eb3e65bb83cac..757db7d957f5ff1 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.access/front.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.access/front.pass.cpp
@@ -18,45 +18,44 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef int T;
- typedef std::forward_list<T> C;
- const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- C c(std::begin(t), std::end(t));
- assert(c.front() == 0);
- c.front() = 10;
- assert(c.front() == 10);
- assert(*c.begin() == 10);
- }
- {
- typedef int T;
- typedef std::forward_list<T> C;
- const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- const C c(std::begin(t), std::end(t));
- assert(c.front() == 0);
- assert(*c.begin() == 0);
- }
+int main(int, char**) {
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ C c(std::begin(t), std::end(t));
+ assert(c.front() == 0);
+ c.front() = 10;
+ assert(c.front() == 10);
+ assert(*c.begin() == 10);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ const C c(std::begin(t), std::end(t));
+ assert(c.front() == 0);
+ assert(*c.begin() == 0);
+ }
#if TEST_STD_VER >= 11
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- C c(std::begin(t), std::end(t));
- assert(c.front() == 0);
- c.front() = 10;
- assert(c.front() == 10);
- assert(*c.begin() == 10);
- }
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- const C c(std::begin(t), std::end(t));
- assert(c.front() == 0);
- assert(*c.begin() == 0);
- }
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ C c(std::begin(t), std::end(t));
+ assert(c.front() == 0);
+ c.front() = 10;
+ assert(c.front() == 10);
+ assert(*c.begin() == 10);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ const C c(std::begin(t), std::end(t));
+ assert(c.front() == 0);
+ assert(*c.begin() == 0);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/alloc.compile.fail.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/alloc.compile.fail.cpp
index bf43ee82ca069cc..31893a1b959948d 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/alloc.compile.fail.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/alloc.compile.fail.cpp
@@ -16,16 +16,15 @@
#include "test_allocator.h"
#include "../../../NotConstructible.h"
-int main(int, char**)
-{
- {
- typedef test_allocator<NotConstructible> A;
- typedef A::value_type T;
- typedef std::forward_list<T, A> C;
- C c = A(12);
- assert(c.get_allocator() == A(12));
- assert(c.empty());
- }
+int main(int, char**) {
+ {
+ typedef test_allocator<NotConstructible> A;
+ typedef A::value_type T;
+ typedef std::forward_list<T, A> C;
+ C c = A(12);
+ assert(c.get_allocator() == A(12));
+ assert(c.empty());
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/alloc.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/alloc.pass.cpp
index d2dda09d82cd900..bfb330fdaf9fc92 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/alloc.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/alloc.pass.cpp
@@ -18,33 +18,32 @@
#include "../../../NotConstructible.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef test_allocator<NotConstructible> A;
- typedef A::value_type T;
- typedef std::forward_list<T, A> C;
- C c(A(12));
- assert(c.get_allocator() == A(12));
- assert(c.empty());
- }
+int main(int, char**) {
+ {
+ typedef test_allocator<NotConstructible> A;
+ typedef A::value_type T;
+ typedef std::forward_list<T, A> C;
+ C c(A(12));
+ assert(c.get_allocator() == A(12));
+ assert(c.empty());
+ }
#if TEST_STD_VER >= 11
- {
- typedef min_allocator<NotConstructible> A;
- typedef A::value_type T;
- typedef std::forward_list<T, A> C;
- C c(A{});
- assert(c.get_allocator() == A());
- assert(c.empty());
- }
- {
- typedef explicit_allocator<NotConstructible> A;
- typedef A::value_type T;
- typedef std::forward_list<T, A> C;
- C c(A{});
- assert(c.get_allocator() == A());
- assert(c.empty());
- }
+ {
+ typedef min_allocator<NotConstructible> A;
+ typedef A::value_type T;
+ typedef std::forward_list<T, A> C;
+ C c(A{});
+ assert(c.get_allocator() == A());
+ assert(c.empty());
+ }
+ {
+ typedef explicit_allocator<NotConstructible> A;
+ typedef A::value_type T;
+ typedef std::forward_list<T, A> C;
+ C c(A{});
+ assert(c.get_allocator() == A());
+ assert(c.empty());
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_copy.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_copy.pass.cpp
index 07d34a1ac6ba571..27d450c63dcaefd 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_copy.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_copy.pass.cpp
@@ -18,130 +18,129 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef int T;
- typedef test_allocator<int> A;
- typedef std::forward_list<T, A> C;
- const T t0[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- const T t1[] = {10, 11, 12, 13};
- C c0(std::begin(t0), std::end(t0), A(10));
- C c1(std::begin(t1), std::end(t1), A(10));
- c1 = c0;
- assert(c1 == c0);
- assert(c1.get_allocator() == A(10));
- }
- {
- typedef int T;
- typedef test_allocator<int> A;
- typedef std::forward_list<T, A> C;
- const T t0[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- const T t1[] = {10, 11, 12, 13};
- C c0(std::begin(t0), std::end(t0), A(10));
- C c1(std::begin(t1), std::end(t1), A(11));
- c1 = c0;
- assert(c1 == c0);
- assert(c1.get_allocator() == A(11));
- }
- {
- typedef int T;
- typedef test_allocator<int> A;
- typedef std::forward_list<T, A> C;
- const T t0[] = {10, 11, 12, 13};
- const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- C c0(std::begin(t0), std::end(t0), A(10));
- C c1(std::begin(t1), std::end(t1), A(10));
- c1 = c0;
- assert(c1 == c0);
- assert(c1.get_allocator() == A(10));
- }
- {
- typedef int T;
- typedef test_allocator<int> A;
- typedef std::forward_list<T, A> C;
- const T t0[] = {10, 11, 12, 13};
- const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- C c0(std::begin(t0), std::end(t0), A(10));
- C c1(std::begin(t1), std::end(t1), A(11));
- c1 = c0;
- assert(c1 == c0);
- assert(c1.get_allocator() == A(11));
- }
+int main(int, char**) {
+ {
+ typedef int T;
+ typedef test_allocator<int> A;
+ typedef std::forward_list<T, A> C;
+ const T t0[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ const T t1[] = {10, 11, 12, 13};
+ C c0(std::begin(t0), std::end(t0), A(10));
+ C c1(std::begin(t1), std::end(t1), A(10));
+ c1 = c0;
+ assert(c1 == c0);
+ assert(c1.get_allocator() == A(10));
+ }
+ {
+ typedef int T;
+ typedef test_allocator<int> A;
+ typedef std::forward_list<T, A> C;
+ const T t0[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ const T t1[] = {10, 11, 12, 13};
+ C c0(std::begin(t0), std::end(t0), A(10));
+ C c1(std::begin(t1), std::end(t1), A(11));
+ c1 = c0;
+ assert(c1 == c0);
+ assert(c1.get_allocator() == A(11));
+ }
+ {
+ typedef int T;
+ typedef test_allocator<int> A;
+ typedef std::forward_list<T, A> C;
+ const T t0[] = {10, 11, 12, 13};
+ const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ C c0(std::begin(t0), std::end(t0), A(10));
+ C c1(std::begin(t1), std::end(t1), A(10));
+ c1 = c0;
+ assert(c1 == c0);
+ assert(c1.get_allocator() == A(10));
+ }
+ {
+ typedef int T;
+ typedef test_allocator<int> A;
+ typedef std::forward_list<T, A> C;
+ const T t0[] = {10, 11, 12, 13};
+ const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ C c0(std::begin(t0), std::end(t0), A(10));
+ C c1(std::begin(t1), std::end(t1), A(11));
+ c1 = c0;
+ assert(c1 == c0);
+ assert(c1.get_allocator() == A(11));
+ }
- {
- typedef int T;
- typedef other_allocator<int> A;
- typedef std::forward_list<T, A> C;
- const T t0[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- const T t1[] = {10, 11, 12, 13};
- C c0(std::begin(t0), std::end(t0), A(10));
- C c1(std::begin(t1), std::end(t1), A(10));
- c1 = c0;
- assert(c1 == c0);
- assert(c1.get_allocator() == A(10));
- }
- {
- typedef int T;
- typedef other_allocator<int> A;
- typedef std::forward_list<T, A> C;
- const T t0[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- const T t1[] = {10, 11, 12, 13};
- C c0(std::begin(t0), std::end(t0), A(10));
- C c1(std::begin(t1), std::end(t1), A(11));
- c1 = c0;
- assert(c1 == c0);
- assert(c1.get_allocator() == A(10));
- }
- {
- typedef int T;
- typedef other_allocator<int> A;
- typedef std::forward_list<T, A> C;
- const T t0[] = {10, 11, 12, 13};
- const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- C c0(std::begin(t0), std::end(t0), A(10));
- C c1(std::begin(t1), std::end(t1), A(10));
- c1 = c0;
- assert(c1 == c0);
- assert(c1.get_allocator() == A(10));
- }
- {
- typedef int T;
- typedef other_allocator<int> A;
- typedef std::forward_list<T, A> C;
- const T t0[] = {10, 11, 12, 13};
- const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- C c0(std::begin(t0), std::end(t0), A(10));
- C c1(std::begin(t1), std::end(t1), A(11));
- c1 = c0;
- assert(c1 == c0);
- assert(c1.get_allocator() == A(10));
- }
+ {
+ typedef int T;
+ typedef other_allocator<int> A;
+ typedef std::forward_list<T, A> C;
+ const T t0[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ const T t1[] = {10, 11, 12, 13};
+ C c0(std::begin(t0), std::end(t0), A(10));
+ C c1(std::begin(t1), std::end(t1), A(10));
+ c1 = c0;
+ assert(c1 == c0);
+ assert(c1.get_allocator() == A(10));
+ }
+ {
+ typedef int T;
+ typedef other_allocator<int> A;
+ typedef std::forward_list<T, A> C;
+ const T t0[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ const T t1[] = {10, 11, 12, 13};
+ C c0(std::begin(t0), std::end(t0), A(10));
+ C c1(std::begin(t1), std::end(t1), A(11));
+ c1 = c0;
+ assert(c1 == c0);
+ assert(c1.get_allocator() == A(10));
+ }
+ {
+ typedef int T;
+ typedef other_allocator<int> A;
+ typedef std::forward_list<T, A> C;
+ const T t0[] = {10, 11, 12, 13};
+ const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ C c0(std::begin(t0), std::end(t0), A(10));
+ C c1(std::begin(t1), std::end(t1), A(10));
+ c1 = c0;
+ assert(c1 == c0);
+ assert(c1.get_allocator() == A(10));
+ }
+ {
+ typedef int T;
+ typedef other_allocator<int> A;
+ typedef std::forward_list<T, A> C;
+ const T t0[] = {10, 11, 12, 13};
+ const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ C c0(std::begin(t0), std::end(t0), A(10));
+ C c1(std::begin(t1), std::end(t1), A(11));
+ c1 = c0;
+ assert(c1 == c0);
+ assert(c1.get_allocator() == A(10));
+ }
#if TEST_STD_VER >= 11
- {
- typedef int T;
- typedef min_allocator<int> A;
- typedef std::forward_list<T, A> C;
- const T t0[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- const T t1[] = {10, 11, 12, 13};
- C c0(std::begin(t0), std::end(t0), A());
- C c1(std::begin(t1), std::end(t1), A());
- c1 = c0;
- assert(c1 == c0);
- assert(c1.get_allocator() == A());
- }
- {
- typedef int T;
- typedef min_allocator<int> A;
- typedef std::forward_list<T, A> C;
- const T t0[] = {10, 11, 12, 13};
- const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- C c0(std::begin(t0), std::end(t0), A());
- C c1(std::begin(t1), std::end(t1), A());
- c1 = c0;
- assert(c1 == c0);
- assert(c1.get_allocator() == A());
- }
+ {
+ typedef int T;
+ typedef min_allocator<int> A;
+ typedef std::forward_list<T, A> C;
+ const T t0[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ const T t1[] = {10, 11, 12, 13};
+ C c0(std::begin(t0), std::end(t0), A());
+ C c1(std::begin(t1), std::end(t1), A());
+ c1 = c0;
+ assert(c1 == c0);
+ assert(c1.get_allocator() == A());
+ }
+ {
+ typedef int T;
+ typedef min_allocator<int> A;
+ typedef std::forward_list<T, A> C;
+ const T t0[] = {10, 11, 12, 13};
+ const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ C c0(std::begin(t0), std::end(t0), A());
+ C c1(std::begin(t1), std::end(t1), A());
+ c1 = c0;
+ assert(c1 == c0);
+ assert(c1.get_allocator() == A());
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_init.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_init.pass.cpp
index 6d6b2fa58c45495..1cdcca82d3352a2 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_init.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_init.pass.cpp
@@ -19,52 +19,51 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef int T;
- typedef std::forward_list<T> C;
- const T t1[] = {10, 11, 12, 13};
- C c(std::begin(t1), std::end(t1));
- c.assign({0, 1, 2, 3, 4, 5, 6, 7, 8, 9});
- int n = 0;
- for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, ++n)
- assert(*i == n);
- assert(n == 10);
- }
- {
- typedef int T;
- typedef std::forward_list<T> C;
- const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- C c(std::begin(t1), std::end(t1));
- c.assign({10, 11, 12, 13});
- int n = 0;
- for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, ++n)
- assert(*i == 10+n);
- assert(n == 4);
- }
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- const T t1[] = {10, 11, 12, 13};
- C c(std::begin(t1), std::end(t1));
- c.assign({0, 1, 2, 3, 4, 5, 6, 7, 8, 9});
- int n = 0;
- for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, ++n)
- assert(*i == n);
- assert(n == 10);
- }
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- C c(std::begin(t1), std::end(t1));
- c.assign({10, 11, 12, 13});
- int n = 0;
- for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, ++n)
- assert(*i == 10+n);
- assert(n == 4);
- }
+int main(int, char**) {
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ const T t1[] = {10, 11, 12, 13};
+ C c(std::begin(t1), std::end(t1));
+ c.assign({0, 1, 2, 3, 4, 5, 6, 7, 8, 9});
+ int n = 0;
+ for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, ++n)
+ assert(*i == n);
+ assert(n == 10);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ C c(std::begin(t1), std::end(t1));
+ c.assign({10, 11, 12, 13});
+ int n = 0;
+ for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, ++n)
+ assert(*i == 10 + n);
+ assert(n == 4);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ const T t1[] = {10, 11, 12, 13};
+ C c(std::begin(t1), std::end(t1));
+ c.assign({0, 1, 2, 3, 4, 5, 6, 7, 8, 9});
+ int n = 0;
+ for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, ++n)
+ assert(*i == n);
+ assert(n == 10);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ C c(std::begin(t1), std::end(t1));
+ c.assign({10, 11, 12, 13});
+ int n = 0;
+ for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, ++n)
+ assert(*i == 10 + n);
+ assert(n == 4);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_move.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_move.pass.cpp
index 1b2aabf25907dad..998a7e11ef34391 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_move.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_move.pass.cpp
@@ -21,179 +21,178 @@
#include "MoveOnly.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef MoveOnly T;
- typedef test_allocator<T> A;
- typedef std::forward_list<T, A> C;
- T t0[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- T t1[] = {10, 11, 12, 13};
- typedef std::move_iterator<T*> I;
- C c0(I(std::begin(t0)), I(std::end(t0)), A(10));
- C c1(I(std::begin(t1)), I(std::end(t1)), A(10));
- c1 = std::move(c0);
- int n = 0;
- for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, (void) ++n)
- assert(*i == n);
- assert(n == 10);
- assert(c1.get_allocator() == A(10));
- assert(c0.empty());
- }
- {
- typedef MoveOnly T;
- typedef test_allocator<T> A;
- typedef std::forward_list<T, A> C;
- T t0[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- T t1[] = {10, 11, 12, 13};
- typedef std::move_iterator<T*> I;
- C c0(I(std::begin(t0)), I(std::end(t0)), A(10));
- C c1(I(std::begin(t1)), I(std::end(t1)), A(11));
- c1 = std::move(c0);
- int n = 0;
- for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, (void) ++n)
- assert(*i == n);
- assert(n == 10);
- assert(c1.get_allocator() == A(11));
- assert(!c0.empty());
- }
- {
- typedef MoveOnly T;
- typedef test_allocator<T> A;
- typedef std::forward_list<T, A> C;
- T t0[] = {10, 11, 12, 13};
- T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- typedef std::move_iterator<T*> I;
- C c0(I(std::begin(t0)), I(std::end(t0)), A(10));
- C c1(I(std::begin(t1)), I(std::end(t1)), A(10));
- c1 = std::move(c0);
- int n = 0;
- for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, (void) ++n)
- assert(*i == 10+n);
- assert(n == 4);
- assert(c1.get_allocator() == A(10));
- assert(c0.empty());
- }
- {
- typedef MoveOnly T;
- typedef test_allocator<T> A;
- typedef std::forward_list<T, A> C;
- T t0[] = {10, 11, 12, 13};
- T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- typedef std::move_iterator<T*> I;
- C c0(I(std::begin(t0)), I(std::end(t0)), A(10));
- C c1(I(std::begin(t1)), I(std::end(t1)), A(11));
- c1 = std::move(c0);
- int n = 0;
- for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, (void) ++n)
- assert(*i == 10+n);
- assert(n == 4);
- assert(c1.get_allocator() == A(11));
- assert(!c0.empty());
- }
+int main(int, char**) {
+ {
+ typedef MoveOnly T;
+ typedef test_allocator<T> A;
+ typedef std::forward_list<T, A> C;
+ T t0[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ T t1[] = {10, 11, 12, 13};
+ typedef std::move_iterator<T*> I;
+ C c0(I(std::begin(t0)), I(std::end(t0)), A(10));
+ C c1(I(std::begin(t1)), I(std::end(t1)), A(10));
+ c1 = std::move(c0);
+ int n = 0;
+ for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, (void)++n)
+ assert(*i == n);
+ assert(n == 10);
+ assert(c1.get_allocator() == A(10));
+ assert(c0.empty());
+ }
+ {
+ typedef MoveOnly T;
+ typedef test_allocator<T> A;
+ typedef std::forward_list<T, A> C;
+ T t0[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ T t1[] = {10, 11, 12, 13};
+ typedef std::move_iterator<T*> I;
+ C c0(I(std::begin(t0)), I(std::end(t0)), A(10));
+ C c1(I(std::begin(t1)), I(std::end(t1)), A(11));
+ c1 = std::move(c0);
+ int n = 0;
+ for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, (void)++n)
+ assert(*i == n);
+ assert(n == 10);
+ assert(c1.get_allocator() == A(11));
+ assert(!c0.empty());
+ }
+ {
+ typedef MoveOnly T;
+ typedef test_allocator<T> A;
+ typedef std::forward_list<T, A> C;
+ T t0[] = {10, 11, 12, 13};
+ T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ typedef std::move_iterator<T*> I;
+ C c0(I(std::begin(t0)), I(std::end(t0)), A(10));
+ C c1(I(std::begin(t1)), I(std::end(t1)), A(10));
+ c1 = std::move(c0);
+ int n = 0;
+ for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, (void)++n)
+ assert(*i == 10 + n);
+ assert(n == 4);
+ assert(c1.get_allocator() == A(10));
+ assert(c0.empty());
+ }
+ {
+ typedef MoveOnly T;
+ typedef test_allocator<T> A;
+ typedef std::forward_list<T, A> C;
+ T t0[] = {10, 11, 12, 13};
+ T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ typedef std::move_iterator<T*> I;
+ C c0(I(std::begin(t0)), I(std::end(t0)), A(10));
+ C c1(I(std::begin(t1)), I(std::end(t1)), A(11));
+ c1 = std::move(c0);
+ int n = 0;
+ for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, (void)++n)
+ assert(*i == 10 + n);
+ assert(n == 4);
+ assert(c1.get_allocator() == A(11));
+ assert(!c0.empty());
+ }
- {
- typedef MoveOnly T;
- typedef other_allocator<T> A;
- typedef std::forward_list<T, A> C;
- T t0[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- T t1[] = {10, 11, 12, 13};
- typedef std::move_iterator<T*> I;
- C c0(I(std::begin(t0)), I(std::end(t0)), A(10));
- C c1(I(std::begin(t1)), I(std::end(t1)), A(10));
- c1 = std::move(c0);
- int n = 0;
- for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, (void) ++n)
- assert(*i == n);
- assert(n == 10);
- assert(c1.get_allocator() == A(10));
- assert(c0.empty());
- }
- {
- typedef MoveOnly T;
- typedef other_allocator<T> A;
- typedef std::forward_list<T, A> C;
- T t0[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- T t1[] = {10, 11, 12, 13};
- typedef std::move_iterator<T*> I;
- C c0(I(std::begin(t0)), I(std::end(t0)), A(10));
- C c1(I(std::begin(t1)), I(std::end(t1)), A(11));
- c1 = std::move(c0);
- int n = 0;
- for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, (void) ++n)
- assert(*i == n);
- assert(n == 10);
- assert(c1.get_allocator() == A(10));
- assert(c0.empty());
- }
- {
- typedef MoveOnly T;
- typedef other_allocator<T> A;
- typedef std::forward_list<T, A> C;
- T t0[] = {10, 11, 12, 13};
- T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- typedef std::move_iterator<T*> I;
- C c0(I(std::begin(t0)), I(std::end(t0)), A(10));
- C c1(I(std::begin(t1)), I(std::end(t1)), A(10));
- c1 = std::move(c0);
- int n = 0;
- for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, (void) ++n)
- assert(*i == 10+n);
- assert(n == 4);
- assert(c1.get_allocator() == A(10));
- assert(c0.empty());
- }
- {
- typedef MoveOnly T;
- typedef other_allocator<T> A;
- typedef std::forward_list<T, A> C;
- T t0[] = {10, 11, 12, 13};
- T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- typedef std::move_iterator<T*> I;
- C c0(I(std::begin(t0)), I(std::end(t0)), A(10));
- C c1(I(std::begin(t1)), I(std::end(t1)), A(11));
- c1 = std::move(c0);
- int n = 0;
- for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, (void) ++n)
- assert(*i == 10+n);
- assert(n == 4);
- assert(c1.get_allocator() == A(10));
- assert(c0.empty());
- }
- {
- typedef MoveOnly T;
- typedef min_allocator<T> A;
- typedef std::forward_list<T, A> C;
- T t0[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- T t1[] = {10, 11, 12, 13};
- typedef std::move_iterator<T*> I;
- C c0(I(std::begin(t0)), I(std::end(t0)), A());
- C c1(I(std::begin(t1)), I(std::end(t1)), A());
- c1 = std::move(c0);
- int n = 0;
- for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, (void) ++n)
- assert(*i == n);
- assert(n == 10);
- assert(c1.get_allocator() == A());
- assert(c0.empty());
- }
- {
- typedef MoveOnly T;
- typedef min_allocator<T> A;
- typedef std::forward_list<T, A> C;
- T t0[] = {10, 11, 12, 13};
- T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- typedef std::move_iterator<T*> I;
- C c0(I(std::begin(t0)), I(std::end(t0)), A());
- C c1(I(std::begin(t1)), I(std::end(t1)), A());
- c1 = std::move(c0);
- int n = 0;
- for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, (void) ++n)
- assert(*i == 10+n);
- assert(n == 4);
- assert(c1.get_allocator() == A());
- assert(c0.empty());
- }
+ {
+ typedef MoveOnly T;
+ typedef other_allocator<T> A;
+ typedef std::forward_list<T, A> C;
+ T t0[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ T t1[] = {10, 11, 12, 13};
+ typedef std::move_iterator<T*> I;
+ C c0(I(std::begin(t0)), I(std::end(t0)), A(10));
+ C c1(I(std::begin(t1)), I(std::end(t1)), A(10));
+ c1 = std::move(c0);
+ int n = 0;
+ for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, (void)++n)
+ assert(*i == n);
+ assert(n == 10);
+ assert(c1.get_allocator() == A(10));
+ assert(c0.empty());
+ }
+ {
+ typedef MoveOnly T;
+ typedef other_allocator<T> A;
+ typedef std::forward_list<T, A> C;
+ T t0[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ T t1[] = {10, 11, 12, 13};
+ typedef std::move_iterator<T*> I;
+ C c0(I(std::begin(t0)), I(std::end(t0)), A(10));
+ C c1(I(std::begin(t1)), I(std::end(t1)), A(11));
+ c1 = std::move(c0);
+ int n = 0;
+ for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, (void)++n)
+ assert(*i == n);
+ assert(n == 10);
+ assert(c1.get_allocator() == A(10));
+ assert(c0.empty());
+ }
+ {
+ typedef MoveOnly T;
+ typedef other_allocator<T> A;
+ typedef std::forward_list<T, A> C;
+ T t0[] = {10, 11, 12, 13};
+ T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ typedef std::move_iterator<T*> I;
+ C c0(I(std::begin(t0)), I(std::end(t0)), A(10));
+ C c1(I(std::begin(t1)), I(std::end(t1)), A(10));
+ c1 = std::move(c0);
+ int n = 0;
+ for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, (void)++n)
+ assert(*i == 10 + n);
+ assert(n == 4);
+ assert(c1.get_allocator() == A(10));
+ assert(c0.empty());
+ }
+ {
+ typedef MoveOnly T;
+ typedef other_allocator<T> A;
+ typedef std::forward_list<T, A> C;
+ T t0[] = {10, 11, 12, 13};
+ T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ typedef std::move_iterator<T*> I;
+ C c0(I(std::begin(t0)), I(std::end(t0)), A(10));
+ C c1(I(std::begin(t1)), I(std::end(t1)), A(11));
+ c1 = std::move(c0);
+ int n = 0;
+ for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, (void)++n)
+ assert(*i == 10 + n);
+ assert(n == 4);
+ assert(c1.get_allocator() == A(10));
+ assert(c0.empty());
+ }
+ {
+ typedef MoveOnly T;
+ typedef min_allocator<T> A;
+ typedef std::forward_list<T, A> C;
+ T t0[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ T t1[] = {10, 11, 12, 13};
+ typedef std::move_iterator<T*> I;
+ C c0(I(std::begin(t0)), I(std::end(t0)), A());
+ C c1(I(std::begin(t1)), I(std::end(t1)), A());
+ c1 = std::move(c0);
+ int n = 0;
+ for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, (void)++n)
+ assert(*i == n);
+ assert(n == 10);
+ assert(c1.get_allocator() == A());
+ assert(c0.empty());
+ }
+ {
+ typedef MoveOnly T;
+ typedef min_allocator<T> A;
+ typedef std::forward_list<T, A> C;
+ T t0[] = {10, 11, 12, 13};
+ T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ typedef std::move_iterator<T*> I;
+ C c0(I(std::begin(t0)), I(std::end(t0)), A());
+ C c1(I(std::begin(t1)), I(std::end(t1)), A());
+ c1 = std::move(c0);
+ int n = 0;
+ for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, (void)++n)
+ assert(*i == 10 + n);
+ assert(n == 4);
+ assert(c1.get_allocator() == A());
+ assert(c0.empty());
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_op_init.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_op_init.pass.cpp
index b6de0e97dfaeb64..a22d6c4985bc52e 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_op_init.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_op_init.pass.cpp
@@ -19,52 +19,51 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef int T;
- typedef std::forward_list<T> C;
- const T t1[] = {10, 11, 12, 13};
- C c(std::begin(t1), std::end(t1));
- c = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- int n = 0;
- for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, ++n)
- assert(*i == n);
- assert(n == 10);
- }
- {
- typedef int T;
- typedef std::forward_list<T> C;
- const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- C c(std::begin(t1), std::end(t1));
- c = {10, 11, 12, 13};
- int n = 0;
- for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, ++n)
- assert(*i == 10+n);
- assert(n == 4);
- }
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- const T t1[] = {10, 11, 12, 13};
- C c(std::begin(t1), std::end(t1));
- c = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- int n = 0;
- for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, ++n)
- assert(*i == n);
- assert(n == 10);
- }
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- C c(std::begin(t1), std::end(t1));
- c = {10, 11, 12, 13};
- int n = 0;
- for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, ++n)
- assert(*i == 10+n);
- assert(n == 4);
- }
+int main(int, char**) {
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ const T t1[] = {10, 11, 12, 13};
+ C c(std::begin(t1), std::end(t1));
+ c = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ int n = 0;
+ for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, ++n)
+ assert(*i == n);
+ assert(n == 10);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ C c(std::begin(t1), std::end(t1));
+ c = {10, 11, 12, 13};
+ int n = 0;
+ for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, ++n)
+ assert(*i == 10 + n);
+ assert(n == 4);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ const T t1[] = {10, 11, 12, 13};
+ C c(std::begin(t1), std::end(t1));
+ c = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ int n = 0;
+ for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, ++n)
+ assert(*i == n);
+ assert(n == 10);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ C c(std::begin(t1), std::end(t1));
+ c = {10, 11, 12, 13};
+ int n = 0;
+ for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, ++n)
+ assert(*i == 10 + n);
+ assert(n == 4);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_range.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_range.pass.cpp
index 552cf0443464596..9a3532874079090 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_range.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_range.pass.cpp
@@ -19,61 +19,60 @@
#include "test_iterators.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef int T;
- typedef std::forward_list<T> C;
- const T t0[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- const T t1[] = {10, 11, 12, 13};
- C c(std::begin(t1), std::end(t1));
- typedef cpp17_input_iterator<const T*> I;
- c.assign(I(std::begin(t0)), I(std::end(t0)));
- int n = 0;
- for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, ++n)
- assert(*i == n);
- assert(n == 10);
- }
- {
- typedef int T;
- typedef std::forward_list<T> C;
- const T t0[] = {10, 11, 12, 13};
- const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- C c(std::begin(t1), std::end(t1));
- typedef cpp17_input_iterator<const T*> I;
- c.assign(I(std::begin(t0)), I(std::end(t0)));
- int n = 0;
- for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, ++n)
- assert(*i == 10+n);
- assert(n == 4);
- }
+int main(int, char**) {
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ const T t0[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ const T t1[] = {10, 11, 12, 13};
+ C c(std::begin(t1), std::end(t1));
+ typedef cpp17_input_iterator<const T*> I;
+ c.assign(I(std::begin(t0)), I(std::end(t0)));
+ int n = 0;
+ for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, ++n)
+ assert(*i == n);
+ assert(n == 10);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ const T t0[] = {10, 11, 12, 13};
+ const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ C c(std::begin(t1), std::end(t1));
+ typedef cpp17_input_iterator<const T*> I;
+ c.assign(I(std::begin(t0)), I(std::end(t0)));
+ int n = 0;
+ for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, ++n)
+ assert(*i == 10 + n);
+ assert(n == 4);
+ }
#if TEST_STD_VER >= 11
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- const T t0[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- const T t1[] = {10, 11, 12, 13};
- C c(std::begin(t1), std::end(t1));
- typedef cpp17_input_iterator<const T*> I;
- c.assign(I(std::begin(t0)), I(std::end(t0)));
- int n = 0;
- for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, ++n)
- assert(*i == n);
- assert(n == 10);
- }
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- const T t0[] = {10, 11, 12, 13};
- const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- C c(std::begin(t1), std::end(t1));
- typedef cpp17_input_iterator<const T*> I;
- c.assign(I(std::begin(t0)), I(std::end(t0)));
- int n = 0;
- for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, (void) ++n)
- assert(*i == 10+n);
- assert(n == 4);
- }
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ const T t0[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ const T t1[] = {10, 11, 12, 13};
+ C c(std::begin(t1), std::end(t1));
+ typedef cpp17_input_iterator<const T*> I;
+ c.assign(I(std::begin(t0)), I(std::end(t0)));
+ int n = 0;
+ for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, ++n)
+ assert(*i == n);
+ assert(n == 10);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ const T t0[] = {10, 11, 12, 13};
+ const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ C c(std::begin(t1), std::end(t1));
+ typedef cpp17_input_iterator<const T*> I;
+ c.assign(I(std::begin(t0)), I(std::end(t0)));
+ int n = 0;
+ for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, (void)++n)
+ assert(*i == 10 + n);
+ assert(n == 4);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_size_value.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_size_value.pass.cpp
index 4824dd8890aaf23..b0fbfa3249e5ef5 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_size_value.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_size_value.pass.cpp
@@ -17,53 +17,52 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef int T;
- typedef std::forward_list<T> C;
- const T t1[] = {10, 11, 12, 13};
- C c(std::begin(t1), std::end(t1));
- c.assign(10, 1);
- int n = 0;
- for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, ++n)
- assert(*i == 1);
- assert(n == 10);
- }
- {
- typedef int T;
- typedef std::forward_list<T> C;
- const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- C c(std::begin(t1), std::end(t1));
- c.assign(4, 10);
- int n = 0;
- for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, ++n)
- assert(*i == 10);
- assert(n == 4);
- }
+int main(int, char**) {
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ const T t1[] = {10, 11, 12, 13};
+ C c(std::begin(t1), std::end(t1));
+ c.assign(10, 1);
+ int n = 0;
+ for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, ++n)
+ assert(*i == 1);
+ assert(n == 10);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ C c(std::begin(t1), std::end(t1));
+ c.assign(4, 10);
+ int n = 0;
+ for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, ++n)
+ assert(*i == 10);
+ assert(n == 4);
+ }
#if TEST_STD_VER >= 11
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- const T t1[] = {10, 11, 12, 13};
- C c(std::begin(t1), std::end(t1));
- c.assign(10, 1);
- int n = 0;
- for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, ++n)
- assert(*i == 1);
- assert(n == 10);
- }
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- C c(std::begin(t1), std::end(t1));
- c.assign(4, 10);
- int n = 0;
- for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, ++n)
- assert(*i == 10);
- assert(n == 4);
- }
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ const T t1[] = {10, 11, 12, 13};
+ C c(std::begin(t1), std::end(t1));
+ c.assign(10, 1);
+ int n = 0;
+ for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, ++n)
+ assert(*i == 1);
+ assert(n == 10);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ C c(std::begin(t1), std::end(t1));
+ c.assign(4, 10);
+ int n = 0;
+ for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, ++n)
+ assert(*i == 10);
+ assert(n == 4);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/copy.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/copy.pass.cpp
index 681629a2c5e3483..22d5054b9ae18b7 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/copy.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/copy.pass.cpp
@@ -18,51 +18,50 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef int T;
- typedef test_allocator<int> A;
- typedef std::forward_list<T, A> C;
- const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- C c0(std::begin(t), std::end(t), A(10));
- C c = c0;
- int n = 0;
- for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
- assert(*i == n);
- assert(n == std::end(t) - std::begin(t));
- assert(c == c0);
- assert(c.get_allocator() == A(10));
- }
+int main(int, char**) {
+ {
+ typedef int T;
+ typedef test_allocator<int> A;
+ typedef std::forward_list<T, A> C;
+ const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ C c0(std::begin(t), std::end(t), A(10));
+ C c = c0;
+ int n = 0;
+ for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
+ assert(*i == n);
+ assert(n == std::end(t) - std::begin(t));
+ assert(c == c0);
+ assert(c.get_allocator() == A(10));
+ }
#if TEST_STD_VER >= 11
- {
- typedef int T;
- typedef other_allocator<int> A;
- typedef std::forward_list<T, A> C;
- const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- C c0(std::begin(t), std::end(t), A(10));
- C c = c0;
- int n = 0;
- for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
- assert(*i == n);
- assert(n == std::end(t) - std::begin(t));
- assert(c == c0);
- assert(c.get_allocator() == A(-2));
- }
- {
- typedef int T;
- typedef min_allocator<int> A;
- typedef std::forward_list<T, A> C;
- const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- C c0(std::begin(t), std::end(t), A());
- C c = c0;
- int n = 0;
- for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
- assert(*i == n);
- assert(n == std::end(t) - std::begin(t));
- assert(c == c0);
- assert(c.get_allocator() == A());
- }
+ {
+ typedef int T;
+ typedef other_allocator<int> A;
+ typedef std::forward_list<T, A> C;
+ const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ C c0(std::begin(t), std::end(t), A(10));
+ C c = c0;
+ int n = 0;
+ for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
+ assert(*i == n);
+ assert(n == std::end(t) - std::begin(t));
+ assert(c == c0);
+ assert(c.get_allocator() == A(-2));
+ }
+ {
+ typedef int T;
+ typedef min_allocator<int> A;
+ typedef std::forward_list<T, A> C;
+ const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ C c0(std::begin(t), std::end(t), A());
+ C c = c0;
+ int n = 0;
+ for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
+ assert(*i == n);
+ assert(n == std::end(t) - std::begin(t));
+ assert(c == c0);
+ assert(c.get_allocator() == A());
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/copy_alloc.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/copy_alloc.pass.cpp
index 3eb33a66d15ebf8..a61233e4b5d2225 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/copy_alloc.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/copy_alloc.pass.cpp
@@ -18,51 +18,50 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef int T;
- typedef test_allocator<int> A;
- typedef std::forward_list<T, A> C;
- const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- C c0(std::begin(t), std::end(t), A(10));
- C c(c0, A(9));
- int n = 0;
- for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
- assert(*i == n);
- assert(n == std::end(t) - std::begin(t));
- assert(c == c0);
- assert(c.get_allocator() == A(9));
- }
- {
- typedef int T;
- typedef other_allocator<int> A;
- typedef std::forward_list<T, A> C;
- const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- C c0(std::begin(t), std::end(t), A(10));
- C c(c0, A(9));
- int n = 0;
- for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
- assert(*i == n);
- assert(n == std::end(t) - std::begin(t));
- assert(c == c0);
- assert(c.get_allocator() == A(9));
- }
+int main(int, char**) {
+ {
+ typedef int T;
+ typedef test_allocator<int> A;
+ typedef std::forward_list<T, A> C;
+ const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ C c0(std::begin(t), std::end(t), A(10));
+ C c(c0, A(9));
+ int n = 0;
+ for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
+ assert(*i == n);
+ assert(n == std::end(t) - std::begin(t));
+ assert(c == c0);
+ assert(c.get_allocator() == A(9));
+ }
+ {
+ typedef int T;
+ typedef other_allocator<int> A;
+ typedef std::forward_list<T, A> C;
+ const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ C c0(std::begin(t), std::end(t), A(10));
+ C c(c0, A(9));
+ int n = 0;
+ for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
+ assert(*i == n);
+ assert(n == std::end(t) - std::begin(t));
+ assert(c == c0);
+ assert(c.get_allocator() == A(9));
+ }
#if TEST_STD_VER >= 11
- {
- typedef int T;
- typedef min_allocator<int> A;
- typedef std::forward_list<T, A> C;
- const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- C c0(std::begin(t), std::end(t), A());
- C c(c0, A());
- int n = 0;
- for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
- assert(*i == n);
- assert(n == std::end(t) - std::begin(t));
- assert(c == c0);
- assert(c.get_allocator() == A());
- }
+ {
+ typedef int T;
+ typedef min_allocator<int> A;
+ typedef std::forward_list<T, A> C;
+ const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ C c0(std::begin(t), std::end(t), A());
+ C c(c0, A());
+ int n = 0;
+ for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
+ assert(*i == n);
+ assert(n == std::end(t) - std::begin(t));
+ assert(c == c0);
+ assert(c.get_allocator() == A());
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/deduct.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/deduct.pass.cpp
index 81b70a95df43c60..2358e62db55b72d 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/deduct.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/deduct.pass.cpp
@@ -32,20 +32,18 @@
struct A {};
-int main(int, char**)
-{
-
-// Test the explicit deduction guides
- {
- const int arr[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
+int main(int, char**) {
+ // Test the explicit deduction guides
+ {
+ const int arr[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
std::forward_list fwl(std::begin(arr), std::end(arr));
static_assert(std::is_same_v<decltype(fwl), std::forward_list<int>>, "");
assert(std::equal(fwl.begin(), fwl.end(), std::begin(arr), std::end(arr)));
- }
+ }
- {
- const long arr[] = {INT_MAX, 1L, 2L, 3L };
+ {
+ const long arr[] = {INT_MAX, 1L, 2L, 3L};
std::forward_list fwl(std::begin(arr), std::end(arr), std::allocator<long>());
static_assert(std::is_same_v<decltype(fwl)::value_type, long>, "");
assert(std::distance(fwl.begin(), fwl.end()) == 4); // no size for forward_list
@@ -53,39 +51,39 @@ int main(int, char**)
assert(*it++ == INT_MAX);
assert(*it++ == 1L);
assert(*it++ == 2L);
- }
+ }
-// Test the implicit deduction guides
+ // Test the implicit deduction guides
- {
-// We don't expect this one to work.
-// std::forward_list fwl(std::allocator<int>()); // deque (allocator &)
- }
+ {
+ // We don't expect this one to work.
+ // std::forward_list fwl(std::allocator<int>()); // deque (allocator &)
+ }
- {
+ {
std::forward_list fwl(1, A{}); // deque (size_type, T)
static_assert(std::is_same_v<decltype(fwl)::value_type, A>, "");
static_assert(std::is_same_v<decltype(fwl)::allocator_type, std::allocator<A>>, "");
assert(std::distance(fwl.begin(), fwl.end()) == 1); // no size for forward_list
- }
+ }
- {
+ {
std::forward_list fwl(1, A{}, test_allocator<A>()); // deque (size_type, T, allocator)
static_assert(std::is_same_v<decltype(fwl)::value_type, A>, "");
static_assert(std::is_same_v<decltype(fwl)::allocator_type, test_allocator<A>>, "");
assert(std::distance(fwl.begin(), fwl.end()) == 1); // no size for forward_list
- }
+ }
- {
+ {
std::forward_list fwl{1U, 2U, 3U, 4U, 5U}; // deque(initializer-list)
static_assert(std::is_same_v<decltype(fwl)::value_type, unsigned>, "");
assert(std::distance(fwl.begin(), fwl.end()) == 5); // no size for forward_list
auto it = fwl.begin();
std::advance(it, 2);
assert(*it == 3U);
- }
+ }
- {
+ {
std::forward_list fwl({1.0, 2.0, 3.0, 4.0}, test_allocator<double>()); // deque(initializer-list, allocator)
static_assert(std::is_same_v<decltype(fwl)::value_type, double>, "");
static_assert(std::is_same_v<decltype(fwl)::allocator_type, test_allocator<double>>, "");
@@ -93,61 +91,61 @@ int main(int, char**)
auto it = fwl.begin();
std::advance(it, 3);
assert(*it == 4.0);
- }
+ }
- {
+ {
std::forward_list<long double> source;
std::forward_list fwl(source); // deque(deque &)
static_assert(std::is_same_v<decltype(fwl)::value_type, long double>, "");
static_assert(std::is_same_v<decltype(fwl)::allocator_type, std::allocator<long double>>, "");
assert(std::distance(fwl.begin(), fwl.end()) == 0); // no size for forward_list
+ }
+
+ {
+ typedef test_allocator<short> Alloc;
+ typedef test_allocator<int> ConvertibleToAlloc;
+
+ {
+ std::forward_list<short, Alloc> source;
+ std::forward_list fwl(source, Alloc(2));
+ static_assert(std::is_same_v<decltype(fwl), decltype(source)>);
+ }
+
+ {
+ std::forward_list<short, Alloc> source;
+ std::forward_list fwl(source, ConvertibleToAlloc(2));
+ static_assert(std::is_same_v<decltype(fwl), decltype(source)>);
+ }
+
+ {
+ std::forward_list<short, Alloc> source;
+ std::forward_list fwl(std::move(source), Alloc(2));
+ static_assert(std::is_same_v<decltype(fwl), decltype(source)>);
}
{
- typedef test_allocator<short> Alloc;
- typedef test_allocator<int> ConvertibleToAlloc;
-
- {
- std::forward_list<short, Alloc> source;
- std::forward_list fwl(source, Alloc(2));
- static_assert(std::is_same_v<decltype(fwl), decltype(source)>);
- }
-
- {
- std::forward_list<short, Alloc> source;
- std::forward_list fwl(source, ConvertibleToAlloc(2));
- static_assert(std::is_same_v<decltype(fwl), decltype(source)>);
- }
-
- {
- std::forward_list<short, Alloc> source;
- std::forward_list fwl(std::move(source), Alloc(2));
- static_assert(std::is_same_v<decltype(fwl), decltype(source)>);
- }
-
- {
- std::forward_list<short, Alloc> source;
- std::forward_list fwl(std::move(source), ConvertibleToAlloc(2));
- static_assert(std::is_same_v<decltype(fwl), decltype(source)>);
- }
+ std::forward_list<short, Alloc> source;
+ std::forward_list fwl(std::move(source), ConvertibleToAlloc(2));
+ static_assert(std::is_same_v<decltype(fwl), decltype(source)>);
}
+ }
#if TEST_STD_VER >= 23
+ {
+ {
+ std::forward_list c(std::from_range, std::array<int, 0>());
+ static_assert(std::is_same_v<decltype(c), std::forward_list<int>>);
+ }
+
{
- {
- std::forward_list c(std::from_range, std::array<int, 0>());
- static_assert(std::is_same_v<decltype(c), std::forward_list<int>>);
- }
-
- {
- using Alloc = test_allocator<int>;
- std::forward_list c(std::from_range, std::array<int, 0>(), Alloc());
- static_assert(std::is_same_v<decltype(c), std::forward_list<int, Alloc>>);
- }
+ using Alloc = test_allocator<int>;
+ std::forward_list c(std::from_range, std::array<int, 0>(), Alloc());
+ static_assert(std::is_same_v<decltype(c), std::forward_list<int, Alloc>>);
}
+ }
#endif
- SequenceContainerDeductionGuidesSfinaeAway<std::forward_list, std::forward_list<int>>();
+ SequenceContainerDeductionGuidesSfinaeAway<std::forward_list, std::forward_list<int>>();
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/deduct.verify.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/deduct.verify.cpp
index b3c3f73270f325b..7726787d0fd3d95 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/deduct.verify.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/deduct.verify.cpp
@@ -22,19 +22,18 @@
struct A {};
-int main(int, char**)
-{
-// Test the explicit deduction guides
-
-// Test the implicit deduction guides
- {
-// forward_list (allocator &)
- std::forward_list fwl((std::allocator<int>())); // expected-error-re {{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}forward_list'}}
-// Note: The extra parens are necessary, since otherwise clang decides it is a function declaration.
-// Also, we can't use {} instead of parens, because that constructs a
-// forward_list<allocator<int>, allocator<allocator<int>>>
- }
-
+int main(int, char**) {
+ // Test the explicit deduction guides
+
+ // Test the implicit deduction guides
+ {
+ // forward_list (allocator &)
+ std::forward_list fwl((std::allocator< int>()));
+ // expected-error-re at -1 {{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}forward_list'}}
+ // Note: The extra parens are necessary, since otherwise clang decides it is a function declaration.
+ // Also, we can't use {} instead of parens, because that constructs a
+ // forward_list<allocator<int>, allocator<allocator<int>>>
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/default.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/default.pass.cpp
index 7313909af5a4f96..b493a89b78003de 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/default.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/default.pass.cpp
@@ -16,27 +16,26 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef int T;
- typedef std::forward_list<T> C;
- C c;
- assert(c.empty());
- }
+int main(int, char**) {
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ C c;
+ assert(c.empty());
+ }
#if TEST_STD_VER >= 11
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- C c;
- assert(c.empty());
- }
- {
- typedef int T;
- typedef std::forward_list<T> C;
- C c = {};
- assert(c.empty());
- }
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ C c;
+ assert(c.empty());
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ C c = {};
+ assert(c.empty());
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/default_noexcept.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/default_noexcept.pass.cpp
index b131cc9cdcafc19..8ac87718357252e 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/default_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/default_noexcept.pass.cpp
@@ -23,33 +23,31 @@
#include "test_allocator.h"
template <class T>
-struct some_alloc
-{
- typedef T value_type;
- some_alloc(const some_alloc&);
- void allocate(std::size_t);
+struct some_alloc {
+ typedef T value_type;
+ some_alloc(const some_alloc&);
+ void allocate(std::size_t);
};
-int main(int, char**)
-{
+int main(int, char**) {
#if defined(_LIBCPP_VERSION)
- {
- typedef std::forward_list<MoveOnly> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
- }
- {
- typedef std::forward_list<MoveOnly, test_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
- }
+ {
+ typedef std::forward_list<MoveOnly> C;
+ static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ }
+ {
+ typedef std::forward_list<MoveOnly, test_allocator<MoveOnly>> C;
+ static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ }
#endif // _LIBCPP_VERSION
- {
- typedef std::forward_list<MoveOnly, other_allocator<MoveOnly>> C;
- static_assert(!std::is_nothrow_default_constructible<C>::value, "");
- }
- {
- typedef std::forward_list<MoveOnly, some_alloc<MoveOnly>> C;
- static_assert(!std::is_nothrow_default_constructible<C>::value, "");
- }
+ {
+ typedef std::forward_list<MoveOnly, other_allocator<MoveOnly>> C;
+ static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+ }
+ {
+ typedef std::forward_list<MoveOnly, some_alloc<MoveOnly>> C;
+ static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/default_recursive.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/default_recursive.pass.cpp
index affe050564b873c..c2f0570da848e18 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/default_recursive.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/default_recursive.pass.cpp
@@ -16,13 +16,8 @@
#include "test_macros.h"
-struct X
-{
- std::forward_list<X> q;
+struct X {
+ std::forward_list<X> q;
};
-int main(int, char**)
-{
-
- return 0;
-}
+int main(int, char**) { return 0; }
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/dtor_noexcept.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/dtor_noexcept.pass.cpp
index db8f0d22e62f7fc..64c60af1fdcb7ec 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/dtor_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/dtor_noexcept.pass.cpp
@@ -20,33 +20,31 @@
#include "test_allocator.h"
template <class T>
-struct some_alloc
-{
- typedef T value_type;
- some_alloc(const some_alloc&);
- ~some_alloc() noexcept(false);
- void allocate(std::size_t);
+struct some_alloc {
+ typedef T value_type;
+ some_alloc(const some_alloc&);
+ ~some_alloc() noexcept(false);
+ void allocate(std::size_t);
};
-int main(int, char**)
-{
- {
- typedef std::forward_list<MoveOnly> C;
- static_assert(std::is_nothrow_destructible<C>::value, "");
- }
- {
- typedef std::forward_list<MoveOnly, test_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_destructible<C>::value, "");
- }
- {
- typedef std::forward_list<MoveOnly, other_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_destructible<C>::value, "");
- }
+int main(int, char**) {
+ {
+ typedef std::forward_list<MoveOnly> C;
+ static_assert(std::is_nothrow_destructible<C>::value, "");
+ }
+ {
+ typedef std::forward_list<MoveOnly, test_allocator<MoveOnly>> C;
+ static_assert(std::is_nothrow_destructible<C>::value, "");
+ }
+ {
+ typedef std::forward_list<MoveOnly, other_allocator<MoveOnly>> C;
+ static_assert(std::is_nothrow_destructible<C>::value, "");
+ }
#if defined(_LIBCPP_VERSION)
- {
- typedef std::forward_list<MoveOnly, some_alloc<MoveOnly>> C;
- static_assert(!std::is_nothrow_destructible<C>::value, "");
- }
+ {
+ typedef std::forward_list<MoveOnly, some_alloc<MoveOnly>> C;
+ static_assert(!std::is_nothrow_destructible<C>::value, "");
+ }
#endif // _LIBCPP_VERSION
return 0;
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/init.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/init.pass.cpp
index 8db81e220e58bc7..b42242b0a83d4d3 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/init.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/init.pass.cpp
@@ -18,26 +18,25 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef int T;
- typedef std::forward_list<T> C;
- C c = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- int n = 0;
- for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
- assert(*i == n);
- assert(n == 10);
- }
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- C c = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- int n = 0;
- for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
- assert(*i == n);
- assert(n == 10);
- }
+int main(int, char**) {
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ C c = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ int n = 0;
+ for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
+ assert(*i == n);
+ assert(n == 10);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ C c = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ int n = 0;
+ for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
+ assert(*i == n);
+ assert(n == 10);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/init_alloc.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/init_alloc.pass.cpp
index f742ba18c6ce6bb..0b29cbfa9254d69 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/init_alloc.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/init_alloc.pass.cpp
@@ -19,30 +19,29 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef int T;
- typedef test_allocator<T> A;
- typedef std::forward_list<T, A> C;
- C c({0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, A(14));
- int n = 0;
- for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
- assert(*i == n);
- assert(n == 10);
- assert(c.get_allocator() == A(14));
- }
- {
- typedef int T;
- typedef min_allocator<T> A;
- typedef std::forward_list<T, A> C;
- C c({0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, A());
- int n = 0;
- for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
- assert(*i == n);
- assert(n == 10);
- assert(c.get_allocator() == A());
- }
+int main(int, char**) {
+ {
+ typedef int T;
+ typedef test_allocator<T> A;
+ typedef std::forward_list<T, A> C;
+ C c({0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, A(14));
+ int n = 0;
+ for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
+ assert(*i == n);
+ assert(n == 10);
+ assert(c.get_allocator() == A(14));
+ }
+ {
+ typedef int T;
+ typedef min_allocator<T> A;
+ typedef std::forward_list<T, A> C;
+ C c({0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, A());
+ int n = 0;
+ for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
+ assert(*i == n);
+ assert(n == 10);
+ assert(c.get_allocator() == A());
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/move.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/move.pass.cpp
index c64baf79f46e06c..762e252ca76fe71 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/move.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/move.pass.cpp
@@ -21,53 +21,52 @@
#include "MoveOnly.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef MoveOnly T;
- typedef test_allocator<T> A;
- typedef std::forward_list<T, A> C;
- T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- typedef std::move_iterator<T*> I;
- C c0(I(std::begin(t)), I(std::end(t)), A(10));
- C c = std::move(c0);
- int n = 0;
- for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, (void) ++n)
- assert(*i == n);
- assert(n == std::end(t) - std::begin(t));
- assert(c0.empty());
- assert(c.get_allocator() == A(10));
- }
- {
- typedef MoveOnly T;
- typedef other_allocator<T> A;
- typedef std::forward_list<T, A> C;
- T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- typedef std::move_iterator<T*> I;
- C c0(I(std::begin(t)), I(std::end(t)), A(10));
- C c = std::move(c0);
- int n = 0;
- for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, (void) ++n)
- assert(*i == n);
- assert(n == std::end(t) - std::begin(t));
- assert(c0.empty());
- assert(c.get_allocator() == A(10));
- }
- {
- typedef MoveOnly T;
- typedef min_allocator<T> A;
- typedef std::forward_list<T, A> C;
- T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- typedef std::move_iterator<T*> I;
- C c0(I(std::begin(t)), I(std::end(t)), A());
- C c = std::move(c0);
- int n = 0;
- for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, (void) ++n)
- assert(*i == n);
- assert(n == std::end(t) - std::begin(t));
- assert(c0.empty());
- assert(c.get_allocator() == A());
- }
+int main(int, char**) {
+ {
+ typedef MoveOnly T;
+ typedef test_allocator<T> A;
+ typedef std::forward_list<T, A> C;
+ T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ typedef std::move_iterator<T*> I;
+ C c0(I(std::begin(t)), I(std::end(t)), A(10));
+ C c = std::move(c0);
+ int n = 0;
+ for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, (void)++n)
+ assert(*i == n);
+ assert(n == std::end(t) - std::begin(t));
+ assert(c0.empty());
+ assert(c.get_allocator() == A(10));
+ }
+ {
+ typedef MoveOnly T;
+ typedef other_allocator<T> A;
+ typedef std::forward_list<T, A> C;
+ T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ typedef std::move_iterator<T*> I;
+ C c0(I(std::begin(t)), I(std::end(t)), A(10));
+ C c = std::move(c0);
+ int n = 0;
+ for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, (void)++n)
+ assert(*i == n);
+ assert(n == std::end(t) - std::begin(t));
+ assert(c0.empty());
+ assert(c.get_allocator() == A(10));
+ }
+ {
+ typedef MoveOnly T;
+ typedef min_allocator<T> A;
+ typedef std::forward_list<T, A> C;
+ T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ typedef std::move_iterator<T*> I;
+ C c0(I(std::begin(t)), I(std::end(t)), A());
+ C c = std::move(c0);
+ int n = 0;
+ for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, (void)++n)
+ assert(*i == n);
+ assert(n == std::end(t) - std::begin(t));
+ assert(c0.empty());
+ assert(c.get_allocator() == A());
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/move_alloc.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/move_alloc.pass.cpp
index 56eaa56d52b22c9..a9bc2cb12f28884 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/move_alloc.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/move_alloc.pass.cpp
@@ -21,53 +21,52 @@
#include "MoveOnly.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef MoveOnly T;
- typedef test_allocator<T> A;
- typedef std::forward_list<T, A> C;
- T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- typedef std::move_iterator<T*> I;
- C c0(I(std::begin(t)), I(std::end(t)), A(10));
- C c(std::move(c0), A(10));
- unsigned n = 0;
- for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, (void) ++n)
- assert(*i == n);
- assert(n == static_cast<unsigned>(std::end(t) - std::begin(t)));
- assert(c0.empty());
- assert(c.get_allocator() == A(10));
- }
- {
- typedef MoveOnly T;
- typedef test_allocator<T> A;
- typedef std::forward_list<T, A> C;
- T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- typedef std::move_iterator<T*> I;
- C c0(I(std::begin(t)), I(std::end(t)), A(10));
- C c(std::move(c0), A(9));
- unsigned n = 0;
- for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, (void) ++n)
- assert(*i == n);
- assert(n == static_cast<unsigned>(std::end(t) - std::begin(t)));
- assert(!c0.empty());
- assert(c.get_allocator() == A(9));
- }
- {
- typedef MoveOnly T;
- typedef min_allocator<T> A;
- typedef std::forward_list<T, A> C;
- T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- typedef std::move_iterator<T*> I;
- C c0(I(std::begin(t)), I(std::end(t)), A());
- C c(std::move(c0), A());
- unsigned n = 0;
- for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, (void) ++n)
- assert(*i == n);
- assert(n == static_cast<unsigned>(std::end(t) - std::begin(t)));
- assert(c0.empty());
- assert(c.get_allocator() == A());
- }
+int main(int, char**) {
+ {
+ typedef MoveOnly T;
+ typedef test_allocator<T> A;
+ typedef std::forward_list<T, A> C;
+ T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ typedef std::move_iterator<T*> I;
+ C c0(I(std::begin(t)), I(std::end(t)), A(10));
+ C c(std::move(c0), A(10));
+ unsigned n = 0;
+ for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, (void)++n)
+ assert(*i == n);
+ assert(n == static_cast<unsigned>(std::end(t) - std::begin(t)));
+ assert(c0.empty());
+ assert(c.get_allocator() == A(10));
+ }
+ {
+ typedef MoveOnly T;
+ typedef test_allocator<T> A;
+ typedef std::forward_list<T, A> C;
+ T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ typedef std::move_iterator<T*> I;
+ C c0(I(std::begin(t)), I(std::end(t)), A(10));
+ C c(std::move(c0), A(9));
+ unsigned n = 0;
+ for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, (void)++n)
+ assert(*i == n);
+ assert(n == static_cast<unsigned>(std::end(t) - std::begin(t)));
+ assert(!c0.empty());
+ assert(c.get_allocator() == A(9));
+ }
+ {
+ typedef MoveOnly T;
+ typedef min_allocator<T> A;
+ typedef std::forward_list<T, A> C;
+ T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ typedef std::move_iterator<T*> I;
+ C c0(I(std::begin(t)), I(std::end(t)), A());
+ C c(std::move(c0), A());
+ unsigned n = 0;
+ for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, (void)++n)
+ assert(*i == n);
+ assert(n == static_cast<unsigned>(std::end(t) - std::begin(t)));
+ assert(c0.empty());
+ assert(c.get_allocator() == A());
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/move_noexcept.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/move_noexcept.pass.cpp
index f132f0ed0b25df9..8dcf00b49c78ba9 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/move_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/move_noexcept.pass.cpp
@@ -23,32 +23,30 @@
#include "test_allocator.h"
template <class T>
-struct some_alloc
-{
- typedef T value_type;
- some_alloc(const some_alloc&);
- void allocate(std::size_t);
+struct some_alloc {
+ typedef T value_type;
+ some_alloc(const some_alloc&);
+ void allocate(std::size_t);
};
-int main(int, char**)
-{
+int main(int, char**) {
#if defined(_LIBCPP_VERSION)
- {
- typedef std::forward_list<MoveOnly> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
- }
- {
- typedef std::forward_list<MoveOnly, test_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
- }
- {
- typedef std::forward_list<MoveOnly, other_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
- }
- {
- typedef std::forward_list<MoveOnly, some_alloc<MoveOnly>> C;
- static_assert(!std::is_nothrow_move_constructible<C>::value, "");
- }
+ {
+ typedef std::forward_list<MoveOnly> C;
+ static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ }
+ {
+ typedef std::forward_list<MoveOnly, test_allocator<MoveOnly>> C;
+ static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ }
+ {
+ typedef std::forward_list<MoveOnly, other_allocator<MoveOnly>> C;
+ static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ }
+ {
+ typedef std::forward_list<MoveOnly, some_alloc<MoveOnly>> C;
+ static_assert(!std::is_nothrow_move_constructible<C>::value, "");
+ }
#endif // _LIBCPP_VERSION
return 0;
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/range.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/range.pass.cpp
index e8c54c84c2c59fc..ebd0e6a5bd1e088 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/range.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/range.pass.cpp
@@ -19,31 +19,30 @@
#include "test_iterators.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef int T;
- typedef std::forward_list<T> C;
- typedef cpp17_input_iterator<const T*> I;
- const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- C c(I(std::begin(t)), I(std::end(t)));
- int n = 0;
- for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
- assert(*i == n);
- assert(n == std::end(t) - std::begin(t));
- }
+int main(int, char**) {
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ typedef cpp17_input_iterator<const T*> I;
+ const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ C c(I(std::begin(t)), I(std::end(t)));
+ int n = 0;
+ for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
+ assert(*i == n);
+ assert(n == std::end(t) - std::begin(t));
+ }
#if TEST_STD_VER >= 11
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- typedef cpp17_input_iterator<const T*> I;
- const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- C c(I(std::begin(t)), I(std::end(t)));
- int n = 0;
- for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
- assert(*i == n);
- assert(n == std::end(t) - std::begin(t));
- }
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ typedef cpp17_input_iterator<const T*> I;
+ const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ C c(I(std::begin(t)), I(std::end(t)));
+ int n = 0;
+ for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
+ assert(*i == n);
+ assert(n == std::end(t) - std::begin(t));
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/range_alloc.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/range_alloc.pass.cpp
index 67712fc5e5d602c..4a28041ad2cbc2c 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/range_alloc.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/range_alloc.pass.cpp
@@ -21,35 +21,34 @@
#include "test_iterators.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef int T;
- typedef test_allocator<T> A;
- typedef std::forward_list<T, A> C;
- typedef cpp17_input_iterator<const T*> I;
- const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- C c(I(std::begin(t)), I(std::end(t)), A(13));
- int n = 0;
- for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
- assert(*i == n);
- assert(n == std::end(t) - std::begin(t));
- assert(c.get_allocator() == A(13));
- }
+int main(int, char**) {
+ {
+ typedef int T;
+ typedef test_allocator<T> A;
+ typedef std::forward_list<T, A> C;
+ typedef cpp17_input_iterator<const T*> I;
+ const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ C c(I(std::begin(t)), I(std::end(t)), A(13));
+ int n = 0;
+ for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
+ assert(*i == n);
+ assert(n == std::end(t) - std::begin(t));
+ assert(c.get_allocator() == A(13));
+ }
#if TEST_STD_VER >= 11
- {
- typedef int T;
- typedef min_allocator<T> A;
- typedef std::forward_list<T, A> C;
- typedef cpp17_input_iterator<const T*> I;
- const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- C c(I(std::begin(t)), I(std::end(t)), A());
- int n = 0;
- for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
- assert(*i == n);
- assert(n == std::end(t) - std::begin(t));
- assert(c.get_allocator() == A());
- }
+ {
+ typedef int T;
+ typedef min_allocator<T> A;
+ typedef std::forward_list<T, A> C;
+ typedef cpp17_input_iterator<const T*> I;
+ const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ C c(I(std::begin(t)), I(std::end(t)), A());
+ int n = 0;
+ for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
+ assert(*i == n);
+ assert(n == std::end(t) - std::begin(t));
+ assert(c.get_allocator() == A());
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/size.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/size.pass.cpp
index 3c27a6dfa34f18c..81b128d2149e358 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/size.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/size.pass.cpp
@@ -20,55 +20,53 @@
#include "min_allocator.h"
template <class T, class Allocator>
-void check_allocator(unsigned n, Allocator const &alloc = Allocator())
-{
+void check_allocator(unsigned n, Allocator const& alloc = Allocator()) {
#if TEST_STD_VER > 11
- typedef std::forward_list<T, Allocator> C;
- C d(n, alloc);
- assert(d.get_allocator() == alloc);
- assert(static_cast<std::size_t>(std::distance(d.begin(), d.end())) == n);
+ typedef std::forward_list<T, Allocator> C;
+ C d(n, alloc);
+ assert(d.get_allocator() == alloc);
+ assert(static_cast<std::size_t>(std::distance(d.begin(), d.end())) == n);
#else
- ((void)n);
- ((void)alloc);
+ ((void)n);
+ ((void)alloc);
#endif
}
-int main(int, char**)
-{
- { // test that the ctor is explicit
- typedef std::forward_list<DefaultOnly> C;
- static_assert((std::is_constructible<C, std::size_t>::value), "");
- static_assert((!std::is_convertible<std::size_t, C>::value), "");
- }
- {
- typedef DefaultOnly T;
- typedef std::forward_list<T> C;
- unsigned N = 10;
- C c(N);
- unsigned n = 0;
+int main(int, char**) {
+ { // test that the ctor is explicit
+ typedef std::forward_list<DefaultOnly> C;
+ static_assert((std::is_constructible<C, std::size_t>::value), "");
+ static_assert((!std::is_convertible<std::size_t, C>::value), "");
+ }
+ {
+ typedef DefaultOnly T;
+ typedef std::forward_list<T> C;
+ unsigned N = 10;
+ C c(N);
+ unsigned n = 0;
- for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n) {
+ for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n) {
#if TEST_STD_VER >= 11
- assert(*i == T());
+ assert(*i == T());
#else
- ((void)0);
+ ((void)0);
#endif
- }
- assert(n == N);
}
+ assert(n == N);
+ }
#if TEST_STD_VER >= 11
- {
- typedef DefaultOnly T;
- typedef std::forward_list<T, min_allocator<T>> C;
- unsigned N = 10;
- C c(N);
- unsigned n = 0;
- for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
- assert(*i == T());
- assert(n == N);
- check_allocator<T, min_allocator<T>> ( 0 );
- check_allocator<T, min_allocator<T>> ( 3 );
- }
+ {
+ typedef DefaultOnly T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ unsigned N = 10;
+ C c(N);
+ unsigned n = 0;
+ for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
+ assert(*i == T());
+ assert(n == N);
+ check_allocator<T, min_allocator<T>>(0);
+ check_allocator<T, min_allocator<T>>(3);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/size_value.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/size_value.pass.cpp
index 4da7394a8b66e9b..663422d1c3c3092 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/size_value.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/size_value.pass.cpp
@@ -16,31 +16,30 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef int T;
- typedef std::forward_list<T> C;
- T v(6);
- unsigned N = 10;
- C c(N, v);
- unsigned n = 0;
- for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
- assert(*i == v);
- assert(n == N);
- }
+int main(int, char**) {
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ T v(6);
+ unsigned N = 10;
+ C c(N, v);
+ unsigned n = 0;
+ for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
+ assert(*i == v);
+ assert(n == N);
+ }
#if TEST_STD_VER >= 11
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- T v(6);
- unsigned N = 10;
- C c(N, v);
- unsigned n = 0;
- for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
- assert(*i == v);
- assert(n == N);
- }
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ T v(6);
+ unsigned N = 10;
+ C c(N, v);
+ unsigned n = 0;
+ for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
+ assert(*i == v);
+ assert(n == N);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/size_value_alloc.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/size_value_alloc.pass.cpp
index fb37e8dbdbbd913..af7f7471d4c98d5 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/size_value_alloc.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/size_value_alloc.pass.cpp
@@ -17,35 +17,34 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef test_allocator<int> A;
- typedef A::value_type T;
- typedef std::forward_list<T, A> C;
- T v(6);
- unsigned N = 10;
- C c(N, v, A(12));
- unsigned n = 0;
- for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
- assert(*i == v);
- assert(n == N);
- assert(c.get_allocator() == A(12));
- }
+int main(int, char**) {
+ {
+ typedef test_allocator<int> A;
+ typedef A::value_type T;
+ typedef std::forward_list<T, A> C;
+ T v(6);
+ unsigned N = 10;
+ C c(N, v, A(12));
+ unsigned n = 0;
+ for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
+ assert(*i == v);
+ assert(n == N);
+ assert(c.get_allocator() == A(12));
+ }
#if TEST_STD_VER >= 11
- {
- typedef min_allocator<int> A;
- typedef A::value_type T;
- typedef std::forward_list<T, A> C;
- T v(6);
- unsigned N = 10;
- C c(N, v, A());
- unsigned n = 0;
- for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
- assert(*i == v);
- assert(n == N);
- assert(c.get_allocator() == A());
- }
+ {
+ typedef min_allocator<int> A;
+ typedef A::value_type T;
+ typedef std::forward_list<T, A> C;
+ T v(6);
+ unsigned N = 10;
+ C c(N, v, A());
+ unsigned n = 0;
+ for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
+ assert(*i == v);
+ assert(n == N);
+ assert(c.get_allocator() == A());
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.erasure/erase.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.erasure/erase.pass.cpp
index df9aa4139f736fa..1044d779220ee54 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.erasure/erase.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.erasure/erase.pass.cpp
@@ -28,8 +28,7 @@ void test0(S s, U val, S expected, std::size_t expected_erased_count) {
}
template <class S>
-void test()
-{
+void test() {
test0(S(), 1, S(), 0);
test0(S({1}), 1, S(), 1);
@@ -63,14 +62,13 @@ void test()
test0(S({1, 2, 1}), opt(3), S({1, 2, 1}), 0);
}
-int main(int, char**)
-{
- test<std::forward_list<int>>();
- test<std::forward_list<int, min_allocator<int>>> ();
- test<std::forward_list<int, test_allocator<int>>> ();
+int main(int, char**) {
+ test<std::forward_list<int>>();
+ test<std::forward_list<int, min_allocator<int>>>();
+ test<std::forward_list<int, test_allocator<int>>>();
- test<std::forward_list<long>>();
- test<std::forward_list<double>>();
+ test<std::forward_list<long>>();
+ test<std::forward_list<double>>();
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.erasure/erase_if.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.erasure/erase_if.pass.cpp
index 756febd1a1f17b1..c4f45a1069a2bc2 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.erasure/erase_if.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.erasure/erase_if.pass.cpp
@@ -27,52 +27,50 @@ void test0(S s, Pred p, S expected, std::size_t expected_erased_count) {
}
template <typename S>
-void test()
-{
- auto is1 = [](auto v) { return v == 1;};
- auto is2 = [](auto v) { return v == 2;};
- auto is3 = [](auto v) { return v == 3;};
- auto is4 = [](auto v) { return v == 4;};
- auto True = [](auto) { return true; };
- auto False = [](auto) { return false; };
+void test() {
+ auto is1 = [](auto v) { return v == 1; };
+ auto is2 = [](auto v) { return v == 2; };
+ auto is3 = [](auto v) { return v == 3; };
+ auto is4 = [](auto v) { return v == 4; };
+ auto True = [](auto) { return true; };
+ auto False = [](auto) { return false; };
- test0(S(), is1, S(), 0);
+ test0(S(), is1, S(), 0);
- test0(S({1}), is1, S(), 1);
- test0(S({1}), is2, S({1}), 0);
+ test0(S({1}), is1, S(), 1);
+ test0(S({1}), is2, S({1}), 0);
- test0(S({1, 2}), is1, S({2}), 1);
- test0(S({1, 2}), is2, S({1}), 1);
- test0(S({1, 2}), is3, S({1, 2}), 0);
- test0(S({1, 1}), is1, S(), 2);
- test0(S({1, 1}), is3, S({1, 1}), 0);
+ test0(S({1, 2}), is1, S({2}), 1);
+ test0(S({1, 2}), is2, S({1}), 1);
+ test0(S({1, 2}), is3, S({1, 2}), 0);
+ test0(S({1, 1}), is1, S(), 2);
+ test0(S({1, 1}), is3, S({1, 1}), 0);
- test0(S({1, 2, 3}), is1, S({2, 3}), 1);
- test0(S({1, 2, 3}), is2, S({1, 3}), 1);
- test0(S({1, 2, 3}), is3, S({1, 2}), 1);
- test0(S({1, 2, 3}), is4, S({1, 2, 3}), 0);
+ test0(S({1, 2, 3}), is1, S({2, 3}), 1);
+ test0(S({1, 2, 3}), is2, S({1, 3}), 1);
+ test0(S({1, 2, 3}), is3, S({1, 2}), 1);
+ test0(S({1, 2, 3}), is4, S({1, 2, 3}), 0);
- test0(S({1, 1, 1}), is1, S(), 3);
- test0(S({1, 1, 1}), is2, S({1, 1, 1}), 0);
- test0(S({1, 1, 2}), is1, S({2}), 2);
- test0(S({1, 1, 2}), is2, S({1, 1}), 1);
- test0(S({1, 1, 2}), is3, S({1, 1, 2}), 0);
- test0(S({1, 2, 2}), is1, S({2, 2}), 1);
- test0(S({1, 2, 2}), is2, S({1}), 2);
- test0(S({1, 2, 2}), is3, S({1, 2, 2}), 0);
+ test0(S({1, 1, 1}), is1, S(), 3);
+ test0(S({1, 1, 1}), is2, S({1, 1, 1}), 0);
+ test0(S({1, 1, 2}), is1, S({2}), 2);
+ test0(S({1, 1, 2}), is2, S({1, 1}), 1);
+ test0(S({1, 1, 2}), is3, S({1, 1, 2}), 0);
+ test0(S({1, 2, 2}), is1, S({2, 2}), 1);
+ test0(S({1, 2, 2}), is2, S({1}), 2);
+ test0(S({1, 2, 2}), is3, S({1, 2, 2}), 0);
- test0(S({1, 2, 3}), True, S(), 3);
- test0(S({1, 2, 3}), False, S({1, 2, 3}), 0);
+ test0(S({1, 2, 3}), True, S(), 3);
+ test0(S({1, 2, 3}), False, S({1, 2, 3}), 0);
}
-int main(int, char**)
-{
- test<std::forward_list<int>>();
- test<std::forward_list<int, min_allocator<int>>> ();
- test<std::forward_list<int, test_allocator<int>>> ();
+int main(int, char**) {
+ test<std::forward_list<int>>();
+ test<std::forward_list<int, min_allocator<int>>>();
+ test<std::forward_list<int, test_allocator<int>>>();
- test<std::forward_list<long>>();
- test<std::forward_list<double>>();
+ test<std::forward_list<long>>();
+ test<std::forward_list<double>>();
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.iter/before_begin.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.iter/before_begin.pass.cpp
index d633a64d6a54113..d66d2cd8795150d 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.iter/before_begin.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.iter/before_begin.pass.cpp
@@ -19,87 +19,86 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef int T;
- typedef std::forward_list<T> C;
- C c;
- C::iterator i = c.before_begin();
- assert(std::distance(i, c.end()) == 1);
- }
- {
- typedef int T;
- typedef std::forward_list<T> C;
- const C c;
- C::const_iterator i = c.before_begin();
- assert(std::distance(i, c.end()) == 1);
- }
- {
- typedef int T;
- typedef std::forward_list<T> C;
- const C c;
- C::const_iterator i = c.cbefore_begin();
- assert(std::distance(i, c.end()) == 1);
- assert(c.cbefore_begin() == c.before_begin());
- }
- {
- typedef int T;
- typedef std::forward_list<T> C;
- const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- C c(std::begin(t), std::end(t));
- C::iterator i = c.before_begin();
- assert(std::distance(i, c.end()) == 11);
- assert(std::next(c.before_begin()) == c.begin());
- }
- {
- typedef int T;
- typedef std::forward_list<T> C;
- const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- const C c(std::begin(t), std::end(t));
- C::const_iterator i = c.before_begin();
- assert(std::distance(i, c.end()) == 11);
- }
+int main(int, char**) {
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ C c;
+ C::iterator i = c.before_begin();
+ assert(std::distance(i, c.end()) == 1);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ const C c;
+ C::const_iterator i = c.before_begin();
+ assert(std::distance(i, c.end()) == 1);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ const C c;
+ C::const_iterator i = c.cbefore_begin();
+ assert(std::distance(i, c.end()) == 1);
+ assert(c.cbefore_begin() == c.before_begin());
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ C c(std::begin(t), std::end(t));
+ C::iterator i = c.before_begin();
+ assert(std::distance(i, c.end()) == 11);
+ assert(std::next(c.before_begin()) == c.begin());
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ const C c(std::begin(t), std::end(t));
+ C::const_iterator i = c.before_begin();
+ assert(std::distance(i, c.end()) == 11);
+ }
#if TEST_STD_VER >= 11
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- C c;
- C::iterator i = c.before_begin();
- assert(std::distance(i, c.end()) == 1);
- }
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- const C c;
- C::const_iterator i = c.before_begin();
- assert(std::distance(i, c.end()) == 1);
- }
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- const C c;
- C::const_iterator i = c.cbefore_begin();
- assert(std::distance(i, c.end()) == 1);
- assert(c.cbefore_begin() == c.before_begin());
- }
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- C c(std::begin(t), std::end(t));
- C::iterator i = c.before_begin();
- assert(std::distance(i, c.end()) == 11);
- assert(std::next(c.before_begin()) == c.begin());
- }
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- const C c(std::begin(t), std::end(t));
- C::const_iterator i = c.before_begin();
- assert(std::distance(i, c.end()) == 11);
- }
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ C c;
+ C::iterator i = c.before_begin();
+ assert(std::distance(i, c.end()) == 1);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ const C c;
+ C::const_iterator i = c.before_begin();
+ assert(std::distance(i, c.end()) == 1);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ const C c;
+ C::const_iterator i = c.cbefore_begin();
+ assert(std::distance(i, c.end()) == 1);
+ assert(c.cbefore_begin() == c.before_begin());
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ C c(std::begin(t), std::end(t));
+ C::iterator i = c.before_begin();
+ assert(std::distance(i, c.end()) == 11);
+ assert(std::next(c.before_begin()) == c.begin());
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ const C c(std::begin(t), std::end(t));
+ C::const_iterator i = c.before_begin();
+ assert(std::distance(i, c.end()) == 11);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.iter/iterator_concept_conformance.compile.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.iter/iterator_concept_conformance.compile.pass.cpp
index 4a1c455df6622da..23563e80177a67c 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.iter/iterator_concept_conformance.compile.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.iter/iterator_concept_conformance.compile.pass.cpp
@@ -14,9 +14,9 @@
#include <iterator>
-using iterator = std::forward_list<int>::iterator;
+using iterator = std::forward_list<int>::iterator;
using const_iterator = std::forward_list<int>::const_iterator;
-using value_type = int;
+using value_type = int;
static_assert(std::forward_iterator<iterator>);
static_assert(!std::bidirectional_iterator<iterator>);
@@ -25,12 +25,12 @@ static_assert(std::sentinel_for<iterator, iterator>);
static_assert(std::sentinel_for<iterator, const_iterator>);
static_assert(!std::sized_sentinel_for<iterator, iterator>);
static_assert(!std::sized_sentinel_for<iterator, const_iterator>);
-static_assert( std::indirectly_movable<iterator, iterator>);
-static_assert( std::indirectly_movable_storable<iterator, iterator>);
+static_assert(std::indirectly_movable<iterator, iterator>);
+static_assert(std::indirectly_movable_storable<iterator, iterator>);
static_assert(!std::indirectly_movable<iterator, const_iterator>);
static_assert(!std::indirectly_movable_storable<iterator, const_iterator>);
-static_assert( std::indirectly_copyable<iterator, iterator>);
-static_assert( std::indirectly_copyable_storable<iterator, iterator>);
+static_assert(std::indirectly_copyable<iterator, iterator>);
+static_assert(std::indirectly_copyable_storable<iterator, iterator>);
static_assert(!std::indirectly_copyable<iterator, const_iterator>);
static_assert(!std::indirectly_copyable_storable<iterator, const_iterator>);
static_assert(std::indirectly_swappable<iterator, iterator>);
@@ -42,12 +42,12 @@ static_assert(std::sentinel_for<const_iterator, iterator>);
static_assert(std::sentinel_for<const_iterator, const_iterator>);
static_assert(!std::sized_sentinel_for<const_iterator, iterator>);
static_assert(!std::sized_sentinel_for<const_iterator, const_iterator>);
-static_assert( std::indirectly_movable<const_iterator, iterator>);
-static_assert( std::indirectly_movable_storable<const_iterator, iterator>);
+static_assert(std::indirectly_movable<const_iterator, iterator>);
+static_assert(std::indirectly_movable_storable<const_iterator, iterator>);
static_assert(!std::indirectly_movable<const_iterator, const_iterator>);
static_assert(!std::indirectly_movable_storable<const_iterator, const_iterator>);
-static_assert( std::indirectly_copyable<const_iterator, iterator>);
-static_assert( std::indirectly_copyable_storable<const_iterator, iterator>);
+static_assert(std::indirectly_copyable<const_iterator, iterator>);
+static_assert(std::indirectly_copyable_storable<const_iterator, iterator>);
static_assert(!std::indirectly_copyable<const_iterator, const_iterator>);
static_assert(!std::indirectly_copyable_storable<const_iterator, const_iterator>);
static_assert(!std::indirectly_swappable<const_iterator, const_iterator>);
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.iter/iterators.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.iter/iterators.pass.cpp
index e5441109bf37336..135689b2321c3a2 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.iter/iterators.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.iter/iterators.pass.cpp
@@ -22,125 +22,124 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef int T;
- typedef std::forward_list<T> C;
- C c;
- C::iterator i = c.begin();
- C::iterator j = c.end();
- assert(std::distance(i, j) == 0);
- assert(i == j);
- }
- {
- typedef int T;
- typedef std::forward_list<T> C;
- const C c;
- C::const_iterator i = c.begin();
- C::const_iterator j = c.end();
- assert(std::distance(i, j) == 0);
- assert(i == j);
- }
- {
- typedef int T;
- typedef std::forward_list<T> C;
- C c;
- C::const_iterator i = c.cbegin();
- C::const_iterator j = c.cend();
- assert(std::distance(i, j) == 0);
- assert(i == j);
- assert(i == c.end());
- }
- {
- typedef int T;
- typedef std::forward_list<T> C;
- const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- C c(std::begin(t), std::end(t));
- C::iterator i = c.begin();
- assert(*i == 0);
- ++i;
- assert(*i == 1);
- *i = 10;
- assert(*i == 10);
- assert(std::distance(c.begin(), c.end()) == 10);
- }
- {
- typedef int T;
- typedef std::forward_list<T> C;
- C::iterator i;
- C::const_iterator j;
- }
+int main(int, char**) {
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ C c;
+ C::iterator i = c.begin();
+ C::iterator j = c.end();
+ assert(std::distance(i, j) == 0);
+ assert(i == j);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ const C c;
+ C::const_iterator i = c.begin();
+ C::const_iterator j = c.end();
+ assert(std::distance(i, j) == 0);
+ assert(i == j);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ C c;
+ C::const_iterator i = c.cbegin();
+ C::const_iterator j = c.cend();
+ assert(std::distance(i, j) == 0);
+ assert(i == j);
+ assert(i == c.end());
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ C c(std::begin(t), std::end(t));
+ C::iterator i = c.begin();
+ assert(*i == 0);
+ ++i;
+ assert(*i == 1);
+ *i = 10;
+ assert(*i == 10);
+ assert(std::distance(c.begin(), c.end()) == 10);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ C::iterator i;
+ C::const_iterator j;
+ }
#if TEST_STD_VER >= 11
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- C c;
- C::iterator i = c.begin();
- C::iterator j = c.end();
- assert(std::distance(i, j) == 0);
- assert(i == j);
- }
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- const C c;
- C::const_iterator i = c.begin();
- C::const_iterator j = c.end();
- assert(std::distance(i, j) == 0);
- assert(i == j);
- }
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- C c;
- C::const_iterator i = c.cbegin();
- C::const_iterator j = c.cend();
- assert(std::distance(i, j) == 0);
- assert(i == j);
- assert(i == c.end());
- }
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- C c(std::begin(t), std::end(t));
- C::iterator i = c.begin();
- assert(*i == 0);
- ++i;
- assert(*i == 1);
- *i = 10;
- assert(*i == 10);
- assert(std::distance(c.begin(), c.end()) == 10);
- }
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- C::iterator i;
- C::const_iterator j;
- }
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ C c;
+ C::iterator i = c.begin();
+ C::iterator j = c.end();
+ assert(std::distance(i, j) == 0);
+ assert(i == j);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ const C c;
+ C::const_iterator i = c.begin();
+ C::const_iterator j = c.end();
+ assert(std::distance(i, j) == 0);
+ assert(i == j);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ C c;
+ C::const_iterator i = c.cbegin();
+ C::const_iterator j = c.cend();
+ assert(std::distance(i, j) == 0);
+ assert(i == j);
+ assert(i == c.end());
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ C c(std::begin(t), std::end(t));
+ C::iterator i = c.begin();
+ assert(*i == 0);
+ ++i;
+ assert(*i == 1);
+ *i = 10;
+ assert(*i == 10);
+ assert(std::distance(c.begin(), c.end()) == 10);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ C::iterator i;
+ C::const_iterator j;
+ }
#endif
#if TEST_STD_VER > 11
- { // N3644 testing
- std::forward_list<int>::iterator ii1{}, ii2{};
- std::forward_list<int>::iterator ii4 = ii1;
- std::forward_list<int>::const_iterator cii{};
- assert ( ii1 == ii2 );
- assert ( ii1 == ii4 );
+ { // N3644 testing
+ std::forward_list<int>::iterator ii1{}, ii2{};
+ std::forward_list<int>::iterator ii4 = ii1;
+ std::forward_list<int>::const_iterator cii{};
+ assert(ii1 == ii2);
+ assert(ii1 == ii4);
- assert (!(ii1 != ii2 ));
+ assert(!(ii1 != ii2));
- assert ( (ii1 == cii ));
- assert ( (cii == ii1 ));
- assert (!(ii1 != cii ));
- assert (!(cii != ii1 ));
+ assert((ii1 == cii));
+ assert((cii == ii1));
+ assert(!(ii1 != cii));
+ assert(!(cii != ii1));
-// std::forward_list<int> c;
-// assert ( ii1 != c.cbegin());
-// assert ( cii != c.begin());
-// assert ( cii != c.cend());
-// assert ( ii1 != c.end());
- }
+ // std::forward_list<int> c;
+ // assert ( ii1 != c.cbegin());
+ // assert ( cii != c.begin());
+ // assert ( cii != c.cend());
+ // assert ( ii1 != c.end());
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/clear.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/clear.pass.cpp
index 55ce87cfe174ccd..9f6d34b701df7d3 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/clear.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/clear.pass.cpp
@@ -18,51 +18,50 @@
#include "../../../NotConstructible.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef NotConstructible T;
- typedef std::forward_list<T> C;
- C c;
- ASSERT_NOEXCEPT(c.clear());
- c.clear();
- assert(std::distance(c.begin(), c.end()) == 0);
- }
- {
- typedef int T;
- typedef std::forward_list<T> C;
- const T t[] = {0, 1, 2, 3, 4};
- C c(std::begin(t), std::end(t));
+int main(int, char**) {
+ {
+ typedef NotConstructible T;
+ typedef std::forward_list<T> C;
+ C c;
+ ASSERT_NOEXCEPT(c.clear());
+ c.clear();
+ assert(std::distance(c.begin(), c.end()) == 0);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ const T t[] = {0, 1, 2, 3, 4};
+ C c(std::begin(t), std::end(t));
- ASSERT_NOEXCEPT(c.clear());
- c.clear();
- assert(std::distance(c.begin(), c.end()) == 0);
+ ASSERT_NOEXCEPT(c.clear());
+ c.clear();
+ assert(std::distance(c.begin(), c.end()) == 0);
- c.clear();
- assert(std::distance(c.begin(), c.end()) == 0);
- }
+ c.clear();
+ assert(std::distance(c.begin(), c.end()) == 0);
+ }
#if TEST_STD_VER >= 11
- {
- typedef NotConstructible T;
- typedef std::forward_list<T, min_allocator<T>> C;
- C c;
- ASSERT_NOEXCEPT(c.clear());
- c.clear();
- assert(std::distance(c.begin(), c.end()) == 0);
- }
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- const T t[] = {0, 1, 2, 3, 4};
- C c(std::begin(t), std::end(t));
+ {
+ typedef NotConstructible T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ C c;
+ ASSERT_NOEXCEPT(c.clear());
+ c.clear();
+ assert(std::distance(c.begin(), c.end()) == 0);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ const T t[] = {0, 1, 2, 3, 4};
+ C c(std::begin(t), std::end(t));
- ASSERT_NOEXCEPT(c.clear());
- c.clear();
- assert(std::distance(c.begin(), c.end()) == 0);
+ ASSERT_NOEXCEPT(c.clear());
+ c.clear();
+ assert(std::distance(c.begin(), c.end()) == 0);
- c.clear();
- assert(std::distance(c.begin(), c.end()) == 0);
- }
+ c.clear();
+ assert(std::distance(c.begin(), c.end()) == 0);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_after.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_after.pass.cpp
index 0d45323a5f7a91e..f77d47ee7c74f79 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_after.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_after.pass.cpp
@@ -20,70 +20,69 @@
#include "../../../Emplaceable.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef Emplaceable T;
- typedef std::forward_list<T> C;
- typedef C::iterator I;
- C c;
- I i = c.emplace_after(c.cbefore_begin());
- assert(i == c.begin());
- assert(c.front() == Emplaceable());
- assert(std::distance(c.begin(), c.end()) == 1);
+int main(int, char**) {
+ {
+ typedef Emplaceable T;
+ typedef std::forward_list<T> C;
+ typedef C::iterator I;
+ C c;
+ I i = c.emplace_after(c.cbefore_begin());
+ assert(i == c.begin());
+ assert(c.front() == Emplaceable());
+ assert(std::distance(c.begin(), c.end()) == 1);
- i = c.emplace_after(c.cbegin(), 1, 2.5);
- assert(i == std::next(c.begin()));
- assert(c.front() == Emplaceable());
- assert(*std::next(c.begin()) == Emplaceable(1, 2.5));
- assert(std::distance(c.begin(), c.end()) == 2);
+ i = c.emplace_after(c.cbegin(), 1, 2.5);
+ assert(i == std::next(c.begin()));
+ assert(c.front() == Emplaceable());
+ assert(*std::next(c.begin()) == Emplaceable(1, 2.5));
+ assert(std::distance(c.begin(), c.end()) == 2);
- i = c.emplace_after(std::next(c.cbegin()), 2, 3.5);
- assert(i == std::next(c.begin(), 2));
- assert(c.front() == Emplaceable());
- assert(*std::next(c.begin()) == Emplaceable(1, 2.5));
- assert(*std::next(c.begin(), 2) == Emplaceable(2, 3.5));
- assert(std::distance(c.begin(), c.end()) == 3);
+ i = c.emplace_after(std::next(c.cbegin()), 2, 3.5);
+ assert(i == std::next(c.begin(), 2));
+ assert(c.front() == Emplaceable());
+ assert(*std::next(c.begin()) == Emplaceable(1, 2.5));
+ assert(*std::next(c.begin(), 2) == Emplaceable(2, 3.5));
+ assert(std::distance(c.begin(), c.end()) == 3);
- i = c.emplace_after(c.cbegin(), 3, 4.5);
- assert(i == std::next(c.begin()));
- assert(c.front() == Emplaceable());
- assert(*std::next(c.begin(), 1) == Emplaceable(3, 4.5));
- assert(*std::next(c.begin(), 2) == Emplaceable(1, 2.5));
- assert(*std::next(c.begin(), 3) == Emplaceable(2, 3.5));
- assert(std::distance(c.begin(), c.end()) == 4);
- }
- {
- typedef Emplaceable T;
- typedef std::forward_list<T, min_allocator<T>> C;
- typedef C::iterator I;
- C c;
- I i = c.emplace_after(c.cbefore_begin());
- assert(i == c.begin());
- assert(c.front() == Emplaceable());
- assert(std::distance(c.begin(), c.end()) == 1);
+ i = c.emplace_after(c.cbegin(), 3, 4.5);
+ assert(i == std::next(c.begin()));
+ assert(c.front() == Emplaceable());
+ assert(*std::next(c.begin(), 1) == Emplaceable(3, 4.5));
+ assert(*std::next(c.begin(), 2) == Emplaceable(1, 2.5));
+ assert(*std::next(c.begin(), 3) == Emplaceable(2, 3.5));
+ assert(std::distance(c.begin(), c.end()) == 4);
+ }
+ {
+ typedef Emplaceable T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ typedef C::iterator I;
+ C c;
+ I i = c.emplace_after(c.cbefore_begin());
+ assert(i == c.begin());
+ assert(c.front() == Emplaceable());
+ assert(std::distance(c.begin(), c.end()) == 1);
- i = c.emplace_after(c.cbegin(), 1, 2.5);
- assert(i == std::next(c.begin()));
- assert(c.front() == Emplaceable());
- assert(*std::next(c.begin()) == Emplaceable(1, 2.5));
- assert(std::distance(c.begin(), c.end()) == 2);
+ i = c.emplace_after(c.cbegin(), 1, 2.5);
+ assert(i == std::next(c.begin()));
+ assert(c.front() == Emplaceable());
+ assert(*std::next(c.begin()) == Emplaceable(1, 2.5));
+ assert(std::distance(c.begin(), c.end()) == 2);
- i = c.emplace_after(std::next(c.cbegin()), 2, 3.5);
- assert(i == std::next(c.begin(), 2));
- assert(c.front() == Emplaceable());
- assert(*std::next(c.begin()) == Emplaceable(1, 2.5));
- assert(*std::next(c.begin(), 2) == Emplaceable(2, 3.5));
- assert(std::distance(c.begin(), c.end()) == 3);
+ i = c.emplace_after(std::next(c.cbegin()), 2, 3.5);
+ assert(i == std::next(c.begin(), 2));
+ assert(c.front() == Emplaceable());
+ assert(*std::next(c.begin()) == Emplaceable(1, 2.5));
+ assert(*std::next(c.begin(), 2) == Emplaceable(2, 3.5));
+ assert(std::distance(c.begin(), c.end()) == 3);
- i = c.emplace_after(c.cbegin(), 3, 4.5);
- assert(i == std::next(c.begin()));
- assert(c.front() == Emplaceable());
- assert(*std::next(c.begin(), 1) == Emplaceable(3, 4.5));
- assert(*std::next(c.begin(), 2) == Emplaceable(1, 2.5));
- assert(*std::next(c.begin(), 3) == Emplaceable(2, 3.5));
- assert(std::distance(c.begin(), c.end()) == 4);
- }
+ i = c.emplace_after(c.cbegin(), 3, 4.5);
+ assert(i == std::next(c.begin()));
+ assert(c.front() == Emplaceable());
+ assert(*std::next(c.begin(), 1) == Emplaceable(3, 4.5));
+ assert(*std::next(c.begin(), 2) == Emplaceable(1, 2.5));
+ assert(*std::next(c.begin(), 3) == Emplaceable(2, 3.5));
+ assert(std::distance(c.begin(), c.end()) == 4);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_front.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_front.pass.cpp
index 47e79cb5136bb9c..cd3bb20c52ae5e8 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_front.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_front.pass.cpp
@@ -21,52 +21,51 @@
#include "../../../Emplaceable.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef Emplaceable T;
- typedef std::forward_list<T> C;
- C c;
+int main(int, char**) {
+ {
+ typedef Emplaceable T;
+ typedef std::forward_list<T> C;
+ C c;
#if TEST_STD_VER > 14
- T& r1 = c.emplace_front();
- assert(c.front() == Emplaceable());
- assert(&r1 == &c.front());
- assert(std::distance(c.begin(), c.end()) == 1);
- T& r2 = c.emplace_front(1, 2.5);
- assert(c.front() == Emplaceable(1, 2.5));
- assert(&r2 == &c.front());
+ T& r1 = c.emplace_front();
+ assert(c.front() == Emplaceable());
+ assert(&r1 == &c.front());
+ assert(std::distance(c.begin(), c.end()) == 1);
+ T& r2 = c.emplace_front(1, 2.5);
+ assert(c.front() == Emplaceable(1, 2.5));
+ assert(&r2 == &c.front());
#else
- c.emplace_front();
- assert(c.front() == Emplaceable());
- assert(std::distance(c.begin(), c.end()) == 1);
- c.emplace_front(1, 2.5);
- assert(c.front() == Emplaceable(1, 2.5));
+ c.emplace_front();
+ assert(c.front() == Emplaceable());
+ assert(std::distance(c.begin(), c.end()) == 1);
+ c.emplace_front(1, 2.5);
+ assert(c.front() == Emplaceable(1, 2.5));
#endif
- assert(*std::next(c.begin()) == Emplaceable());
- assert(std::distance(c.begin(), c.end()) == 2);
- }
- {
- typedef Emplaceable T;
- typedef std::forward_list<T, min_allocator<T>> C;
- C c;
+ assert(*std::next(c.begin()) == Emplaceable());
+ assert(std::distance(c.begin(), c.end()) == 2);
+ }
+ {
+ typedef Emplaceable T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ C c;
#if TEST_STD_VER > 14
- T& r1 = c.emplace_front();
- assert(c.front() == Emplaceable());
- assert(&r1 == &c.front());
- assert(std::distance(c.begin(), c.end()) == 1);
- T& r2 = c.emplace_front(1, 2.5);
- assert(c.front() == Emplaceable(1, 2.5));
- assert(&r2 == &c.front());
+ T& r1 = c.emplace_front();
+ assert(c.front() == Emplaceable());
+ assert(&r1 == &c.front());
+ assert(std::distance(c.begin(), c.end()) == 1);
+ T& r2 = c.emplace_front(1, 2.5);
+ assert(c.front() == Emplaceable(1, 2.5));
+ assert(&r2 == &c.front());
#else
- c.emplace_front();
- assert(c.front() == Emplaceable());
- assert(std::distance(c.begin(), c.end()) == 1);
- c.emplace_front(1, 2.5);
- assert(c.front() == Emplaceable(1, 2.5));
+ c.emplace_front();
+ assert(c.front() == Emplaceable());
+ assert(std::distance(c.begin(), c.end()) == 1);
+ c.emplace_front(1, 2.5);
+ assert(c.front() == Emplaceable(1, 2.5));
#endif
- assert(*std::next(c.begin()) == Emplaceable());
- assert(std::distance(c.begin(), c.end()) == 2);
- }
+ assert(*std::next(c.begin()) == Emplaceable());
+ assert(std::distance(c.begin(), c.end()) == 2);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/erase_after_many.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/erase_after_many.pass.cpp
index 51476559b60ab5a..e85951798526d58 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/erase_after_many.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/erase_after_many.pass.cpp
@@ -17,141 +17,140 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef int T;
- typedef std::forward_list<T> C;
- const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- C c(std::begin(t), std::end(t));
-
- C::iterator i = c.erase_after(std::next(c.cbefore_begin(), 4), std::next(c.cbefore_begin(), 4));
- assert(i == std::next(c.cbefore_begin(), 4));
- assert(std::distance(c.begin(), c.end()) == 10);
- assert(*std::next(c.begin(), 0) == 0);
- assert(*std::next(c.begin(), 1) == 1);
- assert(*std::next(c.begin(), 2) == 2);
- assert(*std::next(c.begin(), 3) == 3);
- assert(*std::next(c.begin(), 4) == 4);
- assert(*std::next(c.begin(), 5) == 5);
- assert(*std::next(c.begin(), 6) == 6);
- assert(*std::next(c.begin(), 7) == 7);
- assert(*std::next(c.begin(), 8) == 8);
- assert(*std::next(c.begin(), 9) == 9);
-
- i = c.erase_after(std::next(c.cbefore_begin(), 2), std::next(c.cbefore_begin(), 5));
- assert(i == std::next(c.begin(), 2));
- assert(std::distance(c.begin(), c.end()) == 8);
- assert(*std::next(c.begin(), 0) == 0);
- assert(*std::next(c.begin(), 1) == 1);
- assert(*std::next(c.begin(), 2) == 4);
- assert(*std::next(c.begin(), 3) == 5);
- assert(*std::next(c.begin(), 4) == 6);
- assert(*std::next(c.begin(), 5) == 7);
- assert(*std::next(c.begin(), 6) == 8);
- assert(*std::next(c.begin(), 7) == 9);
-
- i = c.erase_after(std::next(c.cbefore_begin(), 2), std::next(c.cbefore_begin(), 3));
- assert(i == std::next(c.begin(), 2));
- assert(std::distance(c.begin(), c.end()) == 8);
- assert(*std::next(c.begin(), 0) == 0);
- assert(*std::next(c.begin(), 1) == 1);
- assert(*std::next(c.begin(), 2) == 4);
- assert(*std::next(c.begin(), 3) == 5);
- assert(*std::next(c.begin(), 4) == 6);
- assert(*std::next(c.begin(), 5) == 7);
- assert(*std::next(c.begin(), 6) == 8);
- assert(*std::next(c.begin(), 7) == 9);
-
- i = c.erase_after(std::next(c.cbefore_begin(), 5), std::next(c.cbefore_begin(), 9));
- assert(i == c.end());
- assert(std::distance(c.begin(), c.end()) == 5);
- assert(*std::next(c.begin(), 0) == 0);
- assert(*std::next(c.begin(), 1) == 1);
- assert(*std::next(c.begin(), 2) == 4);
- assert(*std::next(c.begin(), 3) == 5);
- assert(*std::next(c.begin(), 4) == 6);
-
- i = c.erase_after(std::next(c.cbefore_begin(), 0), std::next(c.cbefore_begin(), 2));
- assert(i == c.begin());
- assert(std::distance(c.begin(), c.end()) == 4);
- assert(*std::next(c.begin(), 0) == 1);
- assert(*std::next(c.begin(), 1) == 4);
- assert(*std::next(c.begin(), 2) == 5);
- assert(*std::next(c.begin(), 3) == 6);
-
- i = c.erase_after(std::next(c.cbefore_begin(), 0), std::next(c.cbefore_begin(), 5));
- assert(i == c.begin());
- assert(i == c.end());
- assert(std::distance(c.begin(), c.end()) == 0);
- }
+int main(int, char**) {
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ C c(std::begin(t), std::end(t));
+
+ C::iterator i = c.erase_after(std::next(c.cbefore_begin(), 4), std::next(c.cbefore_begin(), 4));
+ assert(i == std::next(c.cbefore_begin(), 4));
+ assert(std::distance(c.begin(), c.end()) == 10);
+ assert(*std::next(c.begin(), 0) == 0);
+ assert(*std::next(c.begin(), 1) == 1);
+ assert(*std::next(c.begin(), 2) == 2);
+ assert(*std::next(c.begin(), 3) == 3);
+ assert(*std::next(c.begin(), 4) == 4);
+ assert(*std::next(c.begin(), 5) == 5);
+ assert(*std::next(c.begin(), 6) == 6);
+ assert(*std::next(c.begin(), 7) == 7);
+ assert(*std::next(c.begin(), 8) == 8);
+ assert(*std::next(c.begin(), 9) == 9);
+
+ i = c.erase_after(std::next(c.cbefore_begin(), 2), std::next(c.cbefore_begin(), 5));
+ assert(i == std::next(c.begin(), 2));
+ assert(std::distance(c.begin(), c.end()) == 8);
+ assert(*std::next(c.begin(), 0) == 0);
+ assert(*std::next(c.begin(), 1) == 1);
+ assert(*std::next(c.begin(), 2) == 4);
+ assert(*std::next(c.begin(), 3) == 5);
+ assert(*std::next(c.begin(), 4) == 6);
+ assert(*std::next(c.begin(), 5) == 7);
+ assert(*std::next(c.begin(), 6) == 8);
+ assert(*std::next(c.begin(), 7) == 9);
+
+ i = c.erase_after(std::next(c.cbefore_begin(), 2), std::next(c.cbefore_begin(), 3));
+ assert(i == std::next(c.begin(), 2));
+ assert(std::distance(c.begin(), c.end()) == 8);
+ assert(*std::next(c.begin(), 0) == 0);
+ assert(*std::next(c.begin(), 1) == 1);
+ assert(*std::next(c.begin(), 2) == 4);
+ assert(*std::next(c.begin(), 3) == 5);
+ assert(*std::next(c.begin(), 4) == 6);
+ assert(*std::next(c.begin(), 5) == 7);
+ assert(*std::next(c.begin(), 6) == 8);
+ assert(*std::next(c.begin(), 7) == 9);
+
+ i = c.erase_after(std::next(c.cbefore_begin(), 5), std::next(c.cbefore_begin(), 9));
+ assert(i == c.end());
+ assert(std::distance(c.begin(), c.end()) == 5);
+ assert(*std::next(c.begin(), 0) == 0);
+ assert(*std::next(c.begin(), 1) == 1);
+ assert(*std::next(c.begin(), 2) == 4);
+ assert(*std::next(c.begin(), 3) == 5);
+ assert(*std::next(c.begin(), 4) == 6);
+
+ i = c.erase_after(std::next(c.cbefore_begin(), 0), std::next(c.cbefore_begin(), 2));
+ assert(i == c.begin());
+ assert(std::distance(c.begin(), c.end()) == 4);
+ assert(*std::next(c.begin(), 0) == 1);
+ assert(*std::next(c.begin(), 1) == 4);
+ assert(*std::next(c.begin(), 2) == 5);
+ assert(*std::next(c.begin(), 3) == 6);
+
+ i = c.erase_after(std::next(c.cbefore_begin(), 0), std::next(c.cbefore_begin(), 5));
+ assert(i == c.begin());
+ assert(i == c.end());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ }
#if TEST_STD_VER >= 11
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- C c(std::begin(t), std::end(t));
-
- C::iterator i = c.erase_after(std::next(c.cbefore_begin(), 4), std::next(c.cbefore_begin(), 4));
- assert(i == std::next(c.cbefore_begin(), 4));
- assert(std::distance(c.begin(), c.end()) == 10);
- assert(*std::next(c.begin(), 0) == 0);
- assert(*std::next(c.begin(), 1) == 1);
- assert(*std::next(c.begin(), 2) == 2);
- assert(*std::next(c.begin(), 3) == 3);
- assert(*std::next(c.begin(), 4) == 4);
- assert(*std::next(c.begin(), 5) == 5);
- assert(*std::next(c.begin(), 6) == 6);
- assert(*std::next(c.begin(), 7) == 7);
- assert(*std::next(c.begin(), 8) == 8);
- assert(*std::next(c.begin(), 9) == 9);
-
- i = c.erase_after(std::next(c.cbefore_begin(), 2), std::next(c.cbefore_begin(), 5));
- assert(i == std::next(c.begin(), 2));
- assert(std::distance(c.begin(), c.end()) == 8);
- assert(*std::next(c.begin(), 0) == 0);
- assert(*std::next(c.begin(), 1) == 1);
- assert(*std::next(c.begin(), 2) == 4);
- assert(*std::next(c.begin(), 3) == 5);
- assert(*std::next(c.begin(), 4) == 6);
- assert(*std::next(c.begin(), 5) == 7);
- assert(*std::next(c.begin(), 6) == 8);
- assert(*std::next(c.begin(), 7) == 9);
-
- i = c.erase_after(std::next(c.cbefore_begin(), 2), std::next(c.cbefore_begin(), 3));
- assert(i == std::next(c.begin(), 2));
- assert(std::distance(c.begin(), c.end()) == 8);
- assert(*std::next(c.begin(), 0) == 0);
- assert(*std::next(c.begin(), 1) == 1);
- assert(*std::next(c.begin(), 2) == 4);
- assert(*std::next(c.begin(), 3) == 5);
- assert(*std::next(c.begin(), 4) == 6);
- assert(*std::next(c.begin(), 5) == 7);
- assert(*std::next(c.begin(), 6) == 8);
- assert(*std::next(c.begin(), 7) == 9);
-
- i = c.erase_after(std::next(c.cbefore_begin(), 5), std::next(c.cbefore_begin(), 9));
- assert(i == c.end());
- assert(std::distance(c.begin(), c.end()) == 5);
- assert(*std::next(c.begin(), 0) == 0);
- assert(*std::next(c.begin(), 1) == 1);
- assert(*std::next(c.begin(), 2) == 4);
- assert(*std::next(c.begin(), 3) == 5);
- assert(*std::next(c.begin(), 4) == 6);
-
- i = c.erase_after(std::next(c.cbefore_begin(), 0), std::next(c.cbefore_begin(), 2));
- assert(i == c.begin());
- assert(std::distance(c.begin(), c.end()) == 4);
- assert(*std::next(c.begin(), 0) == 1);
- assert(*std::next(c.begin(), 1) == 4);
- assert(*std::next(c.begin(), 2) == 5);
- assert(*std::next(c.begin(), 3) == 6);
-
- i = c.erase_after(std::next(c.cbefore_begin(), 0), std::next(c.cbefore_begin(), 5));
- assert(i == c.begin());
- assert(i == c.end());
- assert(std::distance(c.begin(), c.end()) == 0);
- }
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ C c(std::begin(t), std::end(t));
+
+ C::iterator i = c.erase_after(std::next(c.cbefore_begin(), 4), std::next(c.cbefore_begin(), 4));
+ assert(i == std::next(c.cbefore_begin(), 4));
+ assert(std::distance(c.begin(), c.end()) == 10);
+ assert(*std::next(c.begin(), 0) == 0);
+ assert(*std::next(c.begin(), 1) == 1);
+ assert(*std::next(c.begin(), 2) == 2);
+ assert(*std::next(c.begin(), 3) == 3);
+ assert(*std::next(c.begin(), 4) == 4);
+ assert(*std::next(c.begin(), 5) == 5);
+ assert(*std::next(c.begin(), 6) == 6);
+ assert(*std::next(c.begin(), 7) == 7);
+ assert(*std::next(c.begin(), 8) == 8);
+ assert(*std::next(c.begin(), 9) == 9);
+
+ i = c.erase_after(std::next(c.cbefore_begin(), 2), std::next(c.cbefore_begin(), 5));
+ assert(i == std::next(c.begin(), 2));
+ assert(std::distance(c.begin(), c.end()) == 8);
+ assert(*std::next(c.begin(), 0) == 0);
+ assert(*std::next(c.begin(), 1) == 1);
+ assert(*std::next(c.begin(), 2) == 4);
+ assert(*std::next(c.begin(), 3) == 5);
+ assert(*std::next(c.begin(), 4) == 6);
+ assert(*std::next(c.begin(), 5) == 7);
+ assert(*std::next(c.begin(), 6) == 8);
+ assert(*std::next(c.begin(), 7) == 9);
+
+ i = c.erase_after(std::next(c.cbefore_begin(), 2), std::next(c.cbefore_begin(), 3));
+ assert(i == std::next(c.begin(), 2));
+ assert(std::distance(c.begin(), c.end()) == 8);
+ assert(*std::next(c.begin(), 0) == 0);
+ assert(*std::next(c.begin(), 1) == 1);
+ assert(*std::next(c.begin(), 2) == 4);
+ assert(*std::next(c.begin(), 3) == 5);
+ assert(*std::next(c.begin(), 4) == 6);
+ assert(*std::next(c.begin(), 5) == 7);
+ assert(*std::next(c.begin(), 6) == 8);
+ assert(*std::next(c.begin(), 7) == 9);
+
+ i = c.erase_after(std::next(c.cbefore_begin(), 5), std::next(c.cbefore_begin(), 9));
+ assert(i == c.end());
+ assert(std::distance(c.begin(), c.end()) == 5);
+ assert(*std::next(c.begin(), 0) == 0);
+ assert(*std::next(c.begin(), 1) == 1);
+ assert(*std::next(c.begin(), 2) == 4);
+ assert(*std::next(c.begin(), 3) == 5);
+ assert(*std::next(c.begin(), 4) == 6);
+
+ i = c.erase_after(std::next(c.cbefore_begin(), 0), std::next(c.cbefore_begin(), 2));
+ assert(i == c.begin());
+ assert(std::distance(c.begin(), c.end()) == 4);
+ assert(*std::next(c.begin(), 0) == 1);
+ assert(*std::next(c.begin(), 1) == 4);
+ assert(*std::next(c.begin(), 2) == 5);
+ assert(*std::next(c.begin(), 3) == 6);
+
+ i = c.erase_after(std::next(c.cbefore_begin(), 0), std::next(c.cbefore_begin(), 5));
+ assert(i == c.begin());
+ assert(i == c.end());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/erase_after_one.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/erase_after_one.pass.cpp
index ce035955862b8f5..892228e76def764 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/erase_after_one.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/erase_after_one.pass.cpp
@@ -17,83 +17,82 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef int T;
- typedef std::forward_list<T> C;
- const T t[] = {0, 1, 2, 3, 4};
- C c(std::begin(t), std::end(t));
-
- C::iterator i = c.erase_after(std::next(c.cbefore_begin(), 4));
- assert(i == c.end());
- assert(std::distance(c.begin(), c.end()) == 4);
- assert(*std::next(c.begin(), 0) == 0);
- assert(*std::next(c.begin(), 1) == 1);
- assert(*std::next(c.begin(), 2) == 2);
- assert(*std::next(c.begin(), 3) == 3);
-
- i = c.erase_after(std::next(c.cbefore_begin(), 0));
- assert(i == c.begin());
- assert(std::distance(c.begin(), c.end()) == 3);
- assert(*std::next(c.begin(), 0) == 1);
- assert(*std::next(c.begin(), 1) == 2);
- assert(*std::next(c.begin(), 2) == 3);
-
- i = c.erase_after(std::next(c.cbefore_begin(), 1));
- assert(i == std::next(c.begin()));
- assert(std::distance(c.begin(), c.end()) == 2);
- assert(*std::next(c.begin(), 0) == 1);
- assert(*std::next(c.begin(), 1) == 3);
-
- i = c.erase_after(std::next(c.cbefore_begin(), 1));
- assert(i == c.end());
- assert(std::distance(c.begin(), c.end()) == 1);
- assert(*std::next(c.begin(), 0) == 1);
-
- i = c.erase_after(std::next(c.cbefore_begin(), 0));
- assert(i == c.begin());
- assert(i == c.end());
- assert(std::distance(c.begin(), c.end()) == 0);
- }
+int main(int, char**) {
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ const T t[] = {0, 1, 2, 3, 4};
+ C c(std::begin(t), std::end(t));
+
+ C::iterator i = c.erase_after(std::next(c.cbefore_begin(), 4));
+ assert(i == c.end());
+ assert(std::distance(c.begin(), c.end()) == 4);
+ assert(*std::next(c.begin(), 0) == 0);
+ assert(*std::next(c.begin(), 1) == 1);
+ assert(*std::next(c.begin(), 2) == 2);
+ assert(*std::next(c.begin(), 3) == 3);
+
+ i = c.erase_after(std::next(c.cbefore_begin(), 0));
+ assert(i == c.begin());
+ assert(std::distance(c.begin(), c.end()) == 3);
+ assert(*std::next(c.begin(), 0) == 1);
+ assert(*std::next(c.begin(), 1) == 2);
+ assert(*std::next(c.begin(), 2) == 3);
+
+ i = c.erase_after(std::next(c.cbefore_begin(), 1));
+ assert(i == std::next(c.begin()));
+ assert(std::distance(c.begin(), c.end()) == 2);
+ assert(*std::next(c.begin(), 0) == 1);
+ assert(*std::next(c.begin(), 1) == 3);
+
+ i = c.erase_after(std::next(c.cbefore_begin(), 1));
+ assert(i == c.end());
+ assert(std::distance(c.begin(), c.end()) == 1);
+ assert(*std::next(c.begin(), 0) == 1);
+
+ i = c.erase_after(std::next(c.cbefore_begin(), 0));
+ assert(i == c.begin());
+ assert(i == c.end());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ }
#if TEST_STD_VER >= 11
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- const T t[] = {0, 1, 2, 3, 4};
- C c(std::begin(t), std::end(t));
-
- C::iterator i = c.erase_after(std::next(c.cbefore_begin(), 4));
- assert(i == c.end());
- assert(std::distance(c.begin(), c.end()) == 4);
- assert(*std::next(c.begin(), 0) == 0);
- assert(*std::next(c.begin(), 1) == 1);
- assert(*std::next(c.begin(), 2) == 2);
- assert(*std::next(c.begin(), 3) == 3);
-
- i = c.erase_after(std::next(c.cbefore_begin(), 0));
- assert(i == c.begin());
- assert(std::distance(c.begin(), c.end()) == 3);
- assert(*std::next(c.begin(), 0) == 1);
- assert(*std::next(c.begin(), 1) == 2);
- assert(*std::next(c.begin(), 2) == 3);
-
- i = c.erase_after(std::next(c.cbefore_begin(), 1));
- assert(i == std::next(c.begin()));
- assert(std::distance(c.begin(), c.end()) == 2);
- assert(*std::next(c.begin(), 0) == 1);
- assert(*std::next(c.begin(), 1) == 3);
-
- i = c.erase_after(std::next(c.cbefore_begin(), 1));
- assert(i == c.end());
- assert(std::distance(c.begin(), c.end()) == 1);
- assert(*std::next(c.begin(), 0) == 1);
-
- i = c.erase_after(std::next(c.cbefore_begin(), 0));
- assert(i == c.begin());
- assert(i == c.end());
- assert(std::distance(c.begin(), c.end()) == 0);
- }
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ const T t[] = {0, 1, 2, 3, 4};
+ C c(std::begin(t), std::end(t));
+
+ C::iterator i = c.erase_after(std::next(c.cbefore_begin(), 4));
+ assert(i == c.end());
+ assert(std::distance(c.begin(), c.end()) == 4);
+ assert(*std::next(c.begin(), 0) == 0);
+ assert(*std::next(c.begin(), 1) == 1);
+ assert(*std::next(c.begin(), 2) == 2);
+ assert(*std::next(c.begin(), 3) == 3);
+
+ i = c.erase_after(std::next(c.cbefore_begin(), 0));
+ assert(i == c.begin());
+ assert(std::distance(c.begin(), c.end()) == 3);
+ assert(*std::next(c.begin(), 0) == 1);
+ assert(*std::next(c.begin(), 1) == 2);
+ assert(*std::next(c.begin(), 2) == 3);
+
+ i = c.erase_after(std::next(c.cbefore_begin(), 1));
+ assert(i == std::next(c.begin()));
+ assert(std::distance(c.begin(), c.end()) == 2);
+ assert(*std::next(c.begin(), 0) == 1);
+ assert(*std::next(c.begin(), 1) == 3);
+
+ i = c.erase_after(std::next(c.cbefore_begin(), 1));
+ assert(i == c.end());
+ assert(std::distance(c.begin(), c.end()) == 1);
+ assert(*std::next(c.begin(), 0) == 1);
+
+ i = c.erase_after(std::next(c.cbefore_begin(), 0));
+ assert(i == c.begin());
+ assert(i == c.end());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_const.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_const.pass.cpp
index 46cbc0b6b9fa5bb..8443158413e7fb4 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_const.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_const.pass.cpp
@@ -16,73 +16,72 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef int T;
- typedef std::forward_list<T> C;
- typedef C::iterator I;
- C c;
- I i = c.insert_after(c.cbefore_begin(), 0);
- assert(i == c.begin());
- assert(c.front() == 0);
- assert(c.front() == 0);
- assert(std::distance(c.begin(), c.end()) == 1);
+int main(int, char**) {
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ typedef C::iterator I;
+ C c;
+ I i = c.insert_after(c.cbefore_begin(), 0);
+ assert(i == c.begin());
+ assert(c.front() == 0);
+ assert(c.front() == 0);
+ assert(std::distance(c.begin(), c.end()) == 1);
- i = c.insert_after(c.cbegin(), 1);
- assert(i == std::next(c.begin()));
- assert(c.front() == 0);
- assert(*std::next(c.begin()) == 1);
- assert(std::distance(c.begin(), c.end()) == 2);
+ i = c.insert_after(c.cbegin(), 1);
+ assert(i == std::next(c.begin()));
+ assert(c.front() == 0);
+ assert(*std::next(c.begin()) == 1);
+ assert(std::distance(c.begin(), c.end()) == 2);
- i = c.insert_after(std::next(c.cbegin()), 2);
- assert(i == std::next(c.begin(), 2));
- assert(c.front() == 0);
- assert(*std::next(c.begin()) == 1);
- assert(*std::next(c.begin(), 2) == 2);
- assert(std::distance(c.begin(), c.end()) == 3);
+ i = c.insert_after(std::next(c.cbegin()), 2);
+ assert(i == std::next(c.begin(), 2));
+ assert(c.front() == 0);
+ assert(*std::next(c.begin()) == 1);
+ assert(*std::next(c.begin(), 2) == 2);
+ assert(std::distance(c.begin(), c.end()) == 3);
- i = c.insert_after(c.cbegin(), 3);
- assert(i == std::next(c.begin()));
- assert(c.front() == 0);
- assert(*std::next(c.begin(), 1) == 3);
- assert(*std::next(c.begin(), 2) == 1);
- assert(*std::next(c.begin(), 3) == 2);
- assert(std::distance(c.begin(), c.end()) == 4);
- }
+ i = c.insert_after(c.cbegin(), 3);
+ assert(i == std::next(c.begin()));
+ assert(c.front() == 0);
+ assert(*std::next(c.begin(), 1) == 3);
+ assert(*std::next(c.begin(), 2) == 1);
+ assert(*std::next(c.begin(), 3) == 2);
+ assert(std::distance(c.begin(), c.end()) == 4);
+ }
#if TEST_STD_VER >= 11
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- typedef C::iterator I;
- C c;
- I i = c.insert_after(c.cbefore_begin(), 0);
- assert(i == c.begin());
- assert(c.front() == 0);
- assert(c.front() == 0);
- assert(std::distance(c.begin(), c.end()) == 1);
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ typedef C::iterator I;
+ C c;
+ I i = c.insert_after(c.cbefore_begin(), 0);
+ assert(i == c.begin());
+ assert(c.front() == 0);
+ assert(c.front() == 0);
+ assert(std::distance(c.begin(), c.end()) == 1);
- i = c.insert_after(c.cbegin(), 1);
- assert(i == std::next(c.begin()));
- assert(c.front() == 0);
- assert(*std::next(c.begin()) == 1);
- assert(std::distance(c.begin(), c.end()) == 2);
+ i = c.insert_after(c.cbegin(), 1);
+ assert(i == std::next(c.begin()));
+ assert(c.front() == 0);
+ assert(*std::next(c.begin()) == 1);
+ assert(std::distance(c.begin(), c.end()) == 2);
- i = c.insert_after(std::next(c.cbegin()), 2);
- assert(i == std::next(c.begin(), 2));
- assert(c.front() == 0);
- assert(*std::next(c.begin()) == 1);
- assert(*std::next(c.begin(), 2) == 2);
- assert(std::distance(c.begin(), c.end()) == 3);
+ i = c.insert_after(std::next(c.cbegin()), 2);
+ assert(i == std::next(c.begin(), 2));
+ assert(c.front() == 0);
+ assert(*std::next(c.begin()) == 1);
+ assert(*std::next(c.begin(), 2) == 2);
+ assert(std::distance(c.begin(), c.end()) == 3);
- i = c.insert_after(c.cbegin(), 3);
- assert(i == std::next(c.begin()));
- assert(c.front() == 0);
- assert(*std::next(c.begin(), 1) == 3);
- assert(*std::next(c.begin(), 2) == 1);
- assert(*std::next(c.begin(), 3) == 2);
- assert(std::distance(c.begin(), c.end()) == 4);
- }
+ i = c.insert_after(c.cbegin(), 3);
+ assert(i == std::next(c.begin()));
+ assert(c.front() == 0);
+ assert(*std::next(c.begin(), 1) == 3);
+ assert(*std::next(c.begin(), 2) == 1);
+ assert(*std::next(c.begin(), 3) == 2);
+ assert(std::distance(c.begin(), c.end()) == 4);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_init.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_init.pass.cpp
index 193cb24886ba73b..de924a10c18f066 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_init.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_init.pass.cpp
@@ -18,58 +18,57 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef int T;
- typedef std::forward_list<T> C;
- typedef C::iterator I;
- C c;
- I i = c.insert_after(c.cbefore_begin(), {});
- assert(i == c.before_begin());
- assert(std::distance(c.begin(), c.end()) == 0);
+int main(int, char**) {
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ typedef C::iterator I;
+ C c;
+ I i = c.insert_after(c.cbefore_begin(), {});
+ assert(i == c.before_begin());
+ assert(std::distance(c.begin(), c.end()) == 0);
- i = c.insert_after(c.cbefore_begin(), {0, 1, 2});
- assert(i == std::next(c.before_begin(), 3));
- assert(std::distance(c.begin(), c.end()) == 3);
- assert(*std::next(c.begin(), 0) == 0);
- assert(*std::next(c.begin(), 1) == 1);
- assert(*std::next(c.begin(), 2) == 2);
+ i = c.insert_after(c.cbefore_begin(), {0, 1, 2});
+ assert(i == std::next(c.before_begin(), 3));
+ assert(std::distance(c.begin(), c.end()) == 3);
+ assert(*std::next(c.begin(), 0) == 0);
+ assert(*std::next(c.begin(), 1) == 1);
+ assert(*std::next(c.begin(), 2) == 2);
- i = c.insert_after(c.begin(), {3, 4});
- assert(i == std::next(c.begin(), 2));
- assert(std::distance(c.begin(), c.end()) == 5);
- assert(*std::next(c.begin(), 0) == 0);
- assert(*std::next(c.begin(), 1) == 3);
- assert(*std::next(c.begin(), 2) == 4);
- assert(*std::next(c.begin(), 3) == 1);
- assert(*std::next(c.begin(), 4) == 2);
- }
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- typedef C::iterator I;
- C c;
- I i = c.insert_after(c.cbefore_begin(), {});
- assert(i == c.before_begin());
- assert(std::distance(c.begin(), c.end()) == 0);
+ i = c.insert_after(c.begin(), {3, 4});
+ assert(i == std::next(c.begin(), 2));
+ assert(std::distance(c.begin(), c.end()) == 5);
+ assert(*std::next(c.begin(), 0) == 0);
+ assert(*std::next(c.begin(), 1) == 3);
+ assert(*std::next(c.begin(), 2) == 4);
+ assert(*std::next(c.begin(), 3) == 1);
+ assert(*std::next(c.begin(), 4) == 2);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ typedef C::iterator I;
+ C c;
+ I i = c.insert_after(c.cbefore_begin(), {});
+ assert(i == c.before_begin());
+ assert(std::distance(c.begin(), c.end()) == 0);
- i = c.insert_after(c.cbefore_begin(), {0, 1, 2});
- assert(i == std::next(c.before_begin(), 3));
- assert(std::distance(c.begin(), c.end()) == 3);
- assert(*std::next(c.begin(), 0) == 0);
- assert(*std::next(c.begin(), 1) == 1);
- assert(*std::next(c.begin(), 2) == 2);
+ i = c.insert_after(c.cbefore_begin(), {0, 1, 2});
+ assert(i == std::next(c.before_begin(), 3));
+ assert(std::distance(c.begin(), c.end()) == 3);
+ assert(*std::next(c.begin(), 0) == 0);
+ assert(*std::next(c.begin(), 1) == 1);
+ assert(*std::next(c.begin(), 2) == 2);
- i = c.insert_after(c.begin(), {3, 4});
- assert(i == std::next(c.begin(), 2));
- assert(std::distance(c.begin(), c.end()) == 5);
- assert(*std::next(c.begin(), 0) == 0);
- assert(*std::next(c.begin(), 1) == 3);
- assert(*std::next(c.begin(), 2) == 4);
- assert(*std::next(c.begin(), 3) == 1);
- assert(*std::next(c.begin(), 4) == 2);
- }
+ i = c.insert_after(c.begin(), {3, 4});
+ assert(i == std::next(c.begin(), 2));
+ assert(std::distance(c.begin(), c.end()) == 5);
+ assert(*std::next(c.begin(), 0) == 0);
+ assert(*std::next(c.begin(), 1) == 3);
+ assert(*std::next(c.begin(), 2) == 4);
+ assert(*std::next(c.begin(), 3) == 1);
+ assert(*std::next(c.begin(), 4) == 2);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_range.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_range.pass.cpp
index 8d70b0bdb41c005..af810d0f6961c75 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_range.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_range.pass.cpp
@@ -19,63 +19,62 @@
#include "test_iterators.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef int T;
- typedef std::forward_list<T> C;
- typedef C::iterator I;
- typedef cpp17_input_iterator<const T*> J;
- C c;
- const T t[] = {0, 1, 2, 3, 4};
- I i = c.insert_after(c.cbefore_begin(), J(t), J(t));
- assert(i == c.before_begin());
- assert(std::distance(c.begin(), c.end()) == 0);
+int main(int, char**) {
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ typedef C::iterator I;
+ typedef cpp17_input_iterator<const T*> J;
+ C c;
+ const T t[] = {0, 1, 2, 3, 4};
+ I i = c.insert_after(c.cbefore_begin(), J(t), J(t));
+ assert(i == c.before_begin());
+ assert(std::distance(c.begin(), c.end()) == 0);
- i = c.insert_after(c.cbefore_begin(), J(t), J(t+3));
- assert(i == std::next(c.before_begin(), 3));
- assert(std::distance(c.begin(), c.end()) == 3);
- assert(*std::next(c.begin(), 0) == 0);
- assert(*std::next(c.begin(), 1) == 1);
- assert(*std::next(c.begin(), 2) == 2);
+ i = c.insert_after(c.cbefore_begin(), J(t), J(t + 3));
+ assert(i == std::next(c.before_begin(), 3));
+ assert(std::distance(c.begin(), c.end()) == 3);
+ assert(*std::next(c.begin(), 0) == 0);
+ assert(*std::next(c.begin(), 1) == 1);
+ assert(*std::next(c.begin(), 2) == 2);
- i = c.insert_after(c.begin(), J(t+3), J(t+5));
- assert(i == std::next(c.begin(), 2));
- assert(std::distance(c.begin(), c.end()) == 5);
- assert(*std::next(c.begin(), 0) == 0);
- assert(*std::next(c.begin(), 1) == 3);
- assert(*std::next(c.begin(), 2) == 4);
- assert(*std::next(c.begin(), 3) == 1);
- assert(*std::next(c.begin(), 4) == 2);
- }
+ i = c.insert_after(c.begin(), J(t + 3), J(t + 5));
+ assert(i == std::next(c.begin(), 2));
+ assert(std::distance(c.begin(), c.end()) == 5);
+ assert(*std::next(c.begin(), 0) == 0);
+ assert(*std::next(c.begin(), 1) == 3);
+ assert(*std::next(c.begin(), 2) == 4);
+ assert(*std::next(c.begin(), 3) == 1);
+ assert(*std::next(c.begin(), 4) == 2);
+ }
#if TEST_STD_VER >= 11
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- typedef C::iterator I;
- typedef cpp17_input_iterator<const T*> J;
- C c;
- const T t[] = {0, 1, 2, 3, 4};
- I i = c.insert_after(c.cbefore_begin(), J(t), J(t));
- assert(i == c.before_begin());
- assert(std::distance(c.begin(), c.end()) == 0);
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ typedef C::iterator I;
+ typedef cpp17_input_iterator<const T*> J;
+ C c;
+ const T t[] = {0, 1, 2, 3, 4};
+ I i = c.insert_after(c.cbefore_begin(), J(t), J(t));
+ assert(i == c.before_begin());
+ assert(std::distance(c.begin(), c.end()) == 0);
- i = c.insert_after(c.cbefore_begin(), J(t), J(t+3));
- assert(i == std::next(c.before_begin(), 3));
- assert(std::distance(c.begin(), c.end()) == 3);
- assert(*std::next(c.begin(), 0) == 0);
- assert(*std::next(c.begin(), 1) == 1);
- assert(*std::next(c.begin(), 2) == 2);
+ i = c.insert_after(c.cbefore_begin(), J(t), J(t + 3));
+ assert(i == std::next(c.before_begin(), 3));
+ assert(std::distance(c.begin(), c.end()) == 3);
+ assert(*std::next(c.begin(), 0) == 0);
+ assert(*std::next(c.begin(), 1) == 1);
+ assert(*std::next(c.begin(), 2) == 2);
- i = c.insert_after(c.begin(), J(t+3), J(t+5));
- assert(i == std::next(c.begin(), 2));
- assert(std::distance(c.begin(), c.end()) == 5);
- assert(*std::next(c.begin(), 0) == 0);
- assert(*std::next(c.begin(), 1) == 3);
- assert(*std::next(c.begin(), 2) == 4);
- assert(*std::next(c.begin(), 3) == 1);
- assert(*std::next(c.begin(), 4) == 2);
- }
+ i = c.insert_after(c.begin(), J(t + 3), J(t + 5));
+ assert(i == std::next(c.begin(), 2));
+ assert(std::distance(c.begin(), c.end()) == 5);
+ assert(*std::next(c.begin(), 0) == 0);
+ assert(*std::next(c.begin(), 1) == 3);
+ assert(*std::next(c.begin(), 2) == 4);
+ assert(*std::next(c.begin(), 3) == 1);
+ assert(*std::next(c.begin(), 4) == 2);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_rv.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_rv.pass.cpp
index 083bdd90b0aa551..acd4bc73f724e98 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_rv.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_rv.pass.cpp
@@ -19,72 +19,71 @@
#include "MoveOnly.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef MoveOnly T;
- typedef std::forward_list<T> C;
- typedef C::iterator I;
- C c;
- I i = c.insert_after(c.cbefore_begin(), 0);
- assert(i == c.begin());
- assert(c.front() == 0);
- assert(c.front() == 0);
- assert(std::distance(c.begin(), c.end()) == 1);
+int main(int, char**) {
+ {
+ typedef MoveOnly T;
+ typedef std::forward_list<T> C;
+ typedef C::iterator I;
+ C c;
+ I i = c.insert_after(c.cbefore_begin(), 0);
+ assert(i == c.begin());
+ assert(c.front() == 0);
+ assert(c.front() == 0);
+ assert(std::distance(c.begin(), c.end()) == 1);
- i = c.insert_after(c.cbegin(), 1);
- assert(i == std::next(c.begin()));
- assert(c.front() == 0);
- assert(*std::next(c.begin()) == 1);
- assert(std::distance(c.begin(), c.end()) == 2);
+ i = c.insert_after(c.cbegin(), 1);
+ assert(i == std::next(c.begin()));
+ assert(c.front() == 0);
+ assert(*std::next(c.begin()) == 1);
+ assert(std::distance(c.begin(), c.end()) == 2);
- i = c.insert_after(std::next(c.cbegin()), 2);
- assert(i == std::next(c.begin(), 2));
- assert(c.front() == 0);
- assert(*std::next(c.begin()) == 1);
- assert(*std::next(c.begin(), 2) == 2);
- assert(std::distance(c.begin(), c.end()) == 3);
+ i = c.insert_after(std::next(c.cbegin()), 2);
+ assert(i == std::next(c.begin(), 2));
+ assert(c.front() == 0);
+ assert(*std::next(c.begin()) == 1);
+ assert(*std::next(c.begin(), 2) == 2);
+ assert(std::distance(c.begin(), c.end()) == 3);
- i = c.insert_after(c.cbegin(), 3);
- assert(i == std::next(c.begin()));
- assert(c.front() == 0);
- assert(*std::next(c.begin(), 1) == 3);
- assert(*std::next(c.begin(), 2) == 1);
- assert(*std::next(c.begin(), 3) == 2);
- assert(std::distance(c.begin(), c.end()) == 4);
- }
- {
- typedef MoveOnly T;
- typedef std::forward_list<T, min_allocator<T>> C;
- typedef C::iterator I;
- C c;
- I i = c.insert_after(c.cbefore_begin(), 0);
- assert(i == c.begin());
- assert(c.front() == 0);
- assert(c.front() == 0);
- assert(std::distance(c.begin(), c.end()) == 1);
+ i = c.insert_after(c.cbegin(), 3);
+ assert(i == std::next(c.begin()));
+ assert(c.front() == 0);
+ assert(*std::next(c.begin(), 1) == 3);
+ assert(*std::next(c.begin(), 2) == 1);
+ assert(*std::next(c.begin(), 3) == 2);
+ assert(std::distance(c.begin(), c.end()) == 4);
+ }
+ {
+ typedef MoveOnly T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ typedef C::iterator I;
+ C c;
+ I i = c.insert_after(c.cbefore_begin(), 0);
+ assert(i == c.begin());
+ assert(c.front() == 0);
+ assert(c.front() == 0);
+ assert(std::distance(c.begin(), c.end()) == 1);
- i = c.insert_after(c.cbegin(), 1);
- assert(i == std::next(c.begin()));
- assert(c.front() == 0);
- assert(*std::next(c.begin()) == 1);
- assert(std::distance(c.begin(), c.end()) == 2);
+ i = c.insert_after(c.cbegin(), 1);
+ assert(i == std::next(c.begin()));
+ assert(c.front() == 0);
+ assert(*std::next(c.begin()) == 1);
+ assert(std::distance(c.begin(), c.end()) == 2);
- i = c.insert_after(std::next(c.cbegin()), 2);
- assert(i == std::next(c.begin(), 2));
- assert(c.front() == 0);
- assert(*std::next(c.begin()) == 1);
- assert(*std::next(c.begin(), 2) == 2);
- assert(std::distance(c.begin(), c.end()) == 3);
+ i = c.insert_after(std::next(c.cbegin()), 2);
+ assert(i == std::next(c.begin(), 2));
+ assert(c.front() == 0);
+ assert(*std::next(c.begin()) == 1);
+ assert(*std::next(c.begin(), 2) == 2);
+ assert(std::distance(c.begin(), c.end()) == 3);
- i = c.insert_after(c.cbegin(), 3);
- assert(i == std::next(c.begin()));
- assert(c.front() == 0);
- assert(*std::next(c.begin(), 1) == 3);
- assert(*std::next(c.begin(), 2) == 1);
- assert(*std::next(c.begin(), 3) == 2);
- assert(std::distance(c.begin(), c.end()) == 4);
- }
+ i = c.insert_after(c.cbegin(), 3);
+ assert(i == std::next(c.begin()));
+ assert(c.front() == 0);
+ assert(*std::next(c.begin(), 1) == 3);
+ assert(*std::next(c.begin(), 2) == 1);
+ assert(*std::next(c.begin(), 3) == 2);
+ assert(std::distance(c.begin(), c.end()) == 4);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_size_value.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_size_value.pass.cpp
index 1ef7f16b7029209..2506f04311e0ed8 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_size_value.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_size_value.pass.cpp
@@ -16,59 +16,58 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef int T;
- typedef std::forward_list<T> C;
- typedef C::iterator I;
- C c;
- I i = c.insert_after(c.cbefore_begin(), 0, 0);
- assert(i == c.before_begin());
- assert(std::distance(c.begin(), c.end()) == 0);
+int main(int, char**) {
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ typedef C::iterator I;
+ C c;
+ I i = c.insert_after(c.cbefore_begin(), 0, 0);
+ assert(i == c.before_begin());
+ assert(std::distance(c.begin(), c.end()) == 0);
- i = c.insert_after(c.cbefore_begin(), 3, 3);
- assert(i == std::next(c.before_begin(), 3));
- assert(std::distance(c.begin(), c.end()) == 3);
- assert(*std::next(c.begin(), 0) == 3);
- assert(*std::next(c.begin(), 1) == 3);
- assert(*std::next(c.begin(), 2) == 3);
+ i = c.insert_after(c.cbefore_begin(), 3, 3);
+ assert(i == std::next(c.before_begin(), 3));
+ assert(std::distance(c.begin(), c.end()) == 3);
+ assert(*std::next(c.begin(), 0) == 3);
+ assert(*std::next(c.begin(), 1) == 3);
+ assert(*std::next(c.begin(), 2) == 3);
- i = c.insert_after(c.begin(), 2, 2);
- assert(i == std::next(c.begin(), 2));
- assert(std::distance(c.begin(), c.end()) == 5);
- assert(*std::next(c.begin(), 0) == 3);
- assert(*std::next(c.begin(), 1) == 2);
- assert(*std::next(c.begin(), 2) == 2);
- assert(*std::next(c.begin(), 3) == 3);
- assert(*std::next(c.begin(), 4) == 3);
- }
+ i = c.insert_after(c.begin(), 2, 2);
+ assert(i == std::next(c.begin(), 2));
+ assert(std::distance(c.begin(), c.end()) == 5);
+ assert(*std::next(c.begin(), 0) == 3);
+ assert(*std::next(c.begin(), 1) == 2);
+ assert(*std::next(c.begin(), 2) == 2);
+ assert(*std::next(c.begin(), 3) == 3);
+ assert(*std::next(c.begin(), 4) == 3);
+ }
#if TEST_STD_VER >= 11
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- typedef C::iterator I;
- C c;
- I i = c.insert_after(c.cbefore_begin(), 0, 0);
- assert(i == c.before_begin());
- assert(std::distance(c.begin(), c.end()) == 0);
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ typedef C::iterator I;
+ C c;
+ I i = c.insert_after(c.cbefore_begin(), 0, 0);
+ assert(i == c.before_begin());
+ assert(std::distance(c.begin(), c.end()) == 0);
- i = c.insert_after(c.cbefore_begin(), 3, 3);
- assert(i == std::next(c.before_begin(), 3));
- assert(std::distance(c.begin(), c.end()) == 3);
- assert(*std::next(c.begin(), 0) == 3);
- assert(*std::next(c.begin(), 1) == 3);
- assert(*std::next(c.begin(), 2) == 3);
+ i = c.insert_after(c.cbefore_begin(), 3, 3);
+ assert(i == std::next(c.before_begin(), 3));
+ assert(std::distance(c.begin(), c.end()) == 3);
+ assert(*std::next(c.begin(), 0) == 3);
+ assert(*std::next(c.begin(), 1) == 3);
+ assert(*std::next(c.begin(), 2) == 3);
- i = c.insert_after(c.begin(), 2, 2);
- assert(i == std::next(c.begin(), 2));
- assert(std::distance(c.begin(), c.end()) == 5);
- assert(*std::next(c.begin(), 0) == 3);
- assert(*std::next(c.begin(), 1) == 2);
- assert(*std::next(c.begin(), 2) == 2);
- assert(*std::next(c.begin(), 3) == 3);
- assert(*std::next(c.begin(), 4) == 3);
- }
+ i = c.insert_after(c.begin(), 2, 2);
+ assert(i == std::next(c.begin(), 2));
+ assert(std::distance(c.begin(), c.end()) == 5);
+ assert(*std::next(c.begin(), 0) == 3);
+ assert(*std::next(c.begin(), 1) == 2);
+ assert(*std::next(c.begin(), 2) == 2);
+ assert(*std::next(c.begin(), 3) == 3);
+ assert(*std::next(c.begin(), 4) == 3);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_range_after.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_range_after.pass.cpp
index 1b9133e7c3a7a69..25f4c43f3848630 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_range_after.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_range_after.pass.cpp
@@ -17,9 +17,7 @@
#include "test_macros.h"
template <class Container, class Range>
-concept HasInsertRangeAfter = requires (Container& c, Range&& range) {
- c.insert_range_after(c.begin(), range);
-};
+concept HasInsertRangeAfter = requires(Container& c, Range&& range) { c.insert_range_after(c.begin(), range); };
template <template <class...> class Container, class T, class U>
constexpr bool test_constraints_insert_range_after() {
@@ -53,12 +51,12 @@ constexpr void test_sequence_insert_range_after() {
return std::ranges::next(c.before_begin(), test_case.index + test_case.input.size());
};
- { // Empty container.
+ { // Empty container.
{ // empty_c.insert_range_after(end, empty_range)
auto& test_case = EmptyContainer_EmptyRange<T>;
Container c(test_case.initial.begin(), test_case.initial.end());
- auto in = wrap_input<Iter, Sent>(test_case.input);
+ auto in = wrap_input<Iter, Sent>(test_case.input);
auto pos = get_insert_pos(c, test_case);
auto result = c.insert_range_after(pos, in);
@@ -70,7 +68,7 @@ constexpr void test_sequence_insert_range_after() {
auto& test_case = EmptyContainer_OneElementRange<T>;
Container c(test_case.initial.begin(), test_case.initial.end());
- auto in = wrap_input<Iter, Sent>(test_case.input);
+ auto in = wrap_input<Iter, Sent>(test_case.input);
auto pos = get_insert_pos(c, test_case);
auto result = c.insert_range_after(pos, in);
@@ -82,7 +80,7 @@ constexpr void test_sequence_insert_range_after() {
auto& test_case = EmptyContainer_MidRange<T>;
Container c(test_case.initial.begin(), test_case.initial.end());
- auto in = wrap_input<Iter, Sent>(test_case.input);
+ auto in = wrap_input<Iter, Sent>(test_case.input);
auto pos = get_insert_pos(c, test_case);
auto result = c.insert_range_after(pos, in);
@@ -91,12 +89,12 @@ constexpr void test_sequence_insert_range_after() {
}
}
- { // One-element container.
+ { // One-element container.
{ // one_element_c.insert_range_after(begin, empty_range)
auto& test_case = OneElementContainer_Begin_EmptyRange<T>;
Container c(test_case.initial.begin(), test_case.initial.end());
- auto in = wrap_input<Iter, Sent>(test_case.input);
+ auto in = wrap_input<Iter, Sent>(test_case.input);
auto pos = get_insert_pos(c, test_case);
auto result = c.insert_range_after(pos, in);
@@ -108,7 +106,7 @@ constexpr void test_sequence_insert_range_after() {
auto& test_case = OneElementContainer_End_EmptyRange<T>;
Container c(test_case.initial.begin(), test_case.initial.end());
- auto in = wrap_input<Iter, Sent>(test_case.input);
+ auto in = wrap_input<Iter, Sent>(test_case.input);
auto pos = get_insert_pos(c, test_case);
auto result = c.insert_range_after(pos, in);
@@ -120,7 +118,7 @@ constexpr void test_sequence_insert_range_after() {
auto& test_case = OneElementContainer_Begin_OneElementRange<T>;
Container c(test_case.initial.begin(), test_case.initial.end());
- auto in = wrap_input<Iter, Sent>(test_case.input);
+ auto in = wrap_input<Iter, Sent>(test_case.input);
auto pos = get_insert_pos(c, test_case);
auto result = c.insert_range_after(pos, in);
@@ -132,7 +130,7 @@ constexpr void test_sequence_insert_range_after() {
auto& test_case = OneElementContainer_End_OneElementRange<T>;
Container c(test_case.initial.begin(), test_case.initial.end());
- auto in = wrap_input<Iter, Sent>(test_case.input);
+ auto in = wrap_input<Iter, Sent>(test_case.input);
auto pos = get_insert_pos(c, test_case);
auto result = c.insert_range_after(pos, in);
@@ -144,7 +142,7 @@ constexpr void test_sequence_insert_range_after() {
auto& test_case = OneElementContainer_Begin_MidRange<T>;
Container c(test_case.initial.begin(), test_case.initial.end());
- auto in = wrap_input<Iter, Sent>(test_case.input);
+ auto in = wrap_input<Iter, Sent>(test_case.input);
auto pos = get_insert_pos(c, test_case);
auto result = c.insert_range_after(pos, in);
@@ -156,7 +154,7 @@ constexpr void test_sequence_insert_range_after() {
auto& test_case = OneElementContainer_End_MidRange<T>;
Container c(test_case.initial.begin(), test_case.initial.end());
- auto in = wrap_input<Iter, Sent>(test_case.input);
+ auto in = wrap_input<Iter, Sent>(test_case.input);
auto pos = get_insert_pos(c, test_case);
auto result = c.insert_range_after(pos, in);
@@ -165,12 +163,12 @@ constexpr void test_sequence_insert_range_after() {
}
}
- { // Full container.
+ { // Full container.
{ // full_container.insert_range_after(begin, empty_range)
auto& test_case = FullContainer_Begin_EmptyRange<T>;
Container c(test_case.initial.begin(), test_case.initial.end());
- auto in = wrap_input<Iter, Sent>(test_case.input);
+ auto in = wrap_input<Iter, Sent>(test_case.input);
auto pos = get_insert_pos(c, test_case);
auto result = c.insert_range_after(pos, in);
@@ -182,7 +180,7 @@ constexpr void test_sequence_insert_range_after() {
auto& test_case = FullContainer_Mid_EmptyRange<T>;
Container c(test_case.initial.begin(), test_case.initial.end());
- auto in = wrap_input<Iter, Sent>(test_case.input);
+ auto in = wrap_input<Iter, Sent>(test_case.input);
auto pos = get_insert_pos(c, test_case);
auto result = c.insert_range_after(pos, in);
@@ -194,7 +192,7 @@ constexpr void test_sequence_insert_range_after() {
auto& test_case = FullContainer_End_EmptyRange<T>;
Container c(test_case.initial.begin(), test_case.initial.end());
- auto in = wrap_input<Iter, Sent>(test_case.input);
+ auto in = wrap_input<Iter, Sent>(test_case.input);
auto pos = get_insert_pos(c, test_case);
auto result = c.insert_range_after(pos, in);
@@ -206,7 +204,7 @@ constexpr void test_sequence_insert_range_after() {
auto& test_case = FullContainer_Begin_OneElementRange<T>;
Container c(test_case.initial.begin(), test_case.initial.end());
- auto in = wrap_input<Iter, Sent>(test_case.input);
+ auto in = wrap_input<Iter, Sent>(test_case.input);
auto pos = get_insert_pos(c, test_case);
auto result = c.insert_range_after(pos, in);
@@ -218,7 +216,7 @@ constexpr void test_sequence_insert_range_after() {
auto& test_case = FullContainer_Mid_OneElementRange<T>;
Container c(test_case.initial.begin(), test_case.initial.end());
- auto in = wrap_input<Iter, Sent>(test_case.input);
+ auto in = wrap_input<Iter, Sent>(test_case.input);
auto pos = get_insert_pos(c, test_case);
auto result = c.insert_range_after(pos, in);
@@ -230,7 +228,7 @@ constexpr void test_sequence_insert_range_after() {
auto& test_case = FullContainer_End_OneElementRange<T>;
Container c(test_case.initial.begin(), test_case.initial.end());
- auto in = wrap_input<Iter, Sent>(test_case.input);
+ auto in = wrap_input<Iter, Sent>(test_case.input);
auto pos = get_insert_pos(c, test_case);
auto result = c.insert_range_after(pos, in);
@@ -242,7 +240,7 @@ constexpr void test_sequence_insert_range_after() {
auto& test_case = FullContainer_Begin_MidRange<T>;
Container c(test_case.initial.begin(), test_case.initial.end());
- auto in = wrap_input<Iter, Sent>(test_case.input);
+ auto in = wrap_input<Iter, Sent>(test_case.input);
auto pos = get_insert_pos(c, test_case);
auto result = c.insert_range_after(pos, in);
@@ -254,7 +252,7 @@ constexpr void test_sequence_insert_range_after() {
auto& test_case = FullContainer_Mid_MidRange<T>;
Container c(test_case.initial.begin(), test_case.initial.end());
- auto in = wrap_input<Iter, Sent>(test_case.input);
+ auto in = wrap_input<Iter, Sent>(test_case.input);
auto pos = get_insert_pos(c, test_case);
auto result = c.insert_range_after(pos, in);
@@ -266,7 +264,7 @@ constexpr void test_sequence_insert_range_after() {
auto& test_case = FullContainer_End_MidRange<T>;
Container c(test_case.initial.begin(), test_case.initial.end());
- auto in = wrap_input<Iter, Sent>(test_case.input);
+ auto in = wrap_input<Iter, Sent>(test_case.input);
auto pos = get_insert_pos(c, test_case);
auto result = c.insert_range_after(pos, in);
@@ -278,7 +276,7 @@ constexpr void test_sequence_insert_range_after() {
auto& test_case = FullContainer_Begin_LongRange<T>;
Container c(test_case.initial.begin(), test_case.initial.end());
- auto in = wrap_input<Iter, Sent>(test_case.input);
+ auto in = wrap_input<Iter, Sent>(test_case.input);
auto pos = get_insert_pos(c, test_case);
auto result = c.insert_range_after(pos, in);
@@ -290,7 +288,7 @@ constexpr void test_sequence_insert_range_after() {
auto& test_case = FullContainer_Mid_LongRange<T>;
Container c(test_case.initial.begin(), test_case.initial.end());
- auto in = wrap_input<Iter, Sent>(test_case.input);
+ auto in = wrap_input<Iter, Sent>(test_case.input);
auto pos = get_insert_pos(c, test_case);
auto result = c.insert_range_after(pos, in);
@@ -302,7 +300,7 @@ constexpr void test_sequence_insert_range_after() {
auto& test_case = FullContainer_End_LongRange<T>;
Container c(test_case.initial.begin(), test_case.initial.end());
- auto in = wrap_input<Iter, Sent>(test_case.input);
+ auto in = wrap_input<Iter, Sent>(test_case.input);
auto pos = get_insert_pos(c, test_case);
auto result = c.insert_range_after(pos, in);
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/pop_front.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/pop_front.pass.cpp
index 5022353cac76ca4..98c7a2634117950 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/pop_front.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/pop_front.pass.cpp
@@ -17,59 +17,58 @@
#include "MoveOnly.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef int T;
- typedef std::forward_list<T> C;
- typedef std::forward_list<T> C;
- C c;
- c.push_front(1);
- c.push_front(3);
- c.pop_front();
- assert(std::distance(c.begin(), c.end()) == 1);
- assert(c.front() == 1);
- c.pop_front();
- assert(std::distance(c.begin(), c.end()) == 0);
- }
+int main(int, char**) {
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ typedef std::forward_list<T> C;
+ C c;
+ c.push_front(1);
+ c.push_front(3);
+ c.pop_front();
+ assert(std::distance(c.begin(), c.end()) == 1);
+ assert(c.front() == 1);
+ c.pop_front();
+ assert(std::distance(c.begin(), c.end()) == 0);
+ }
#if TEST_STD_VER >= 11
- {
- typedef MoveOnly T;
- typedef std::forward_list<T> C;
- C c;
- c.push_front(1);
- c.push_front(3);
- c.pop_front();
- assert(std::distance(c.begin(), c.end()) == 1);
- assert(c.front() == 1);
- c.pop_front();
- assert(std::distance(c.begin(), c.end()) == 0);
- }
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- typedef std::forward_list<T, min_allocator<T>> C;
- C c;
- c.push_front(1);
- c.push_front(3);
- c.pop_front();
- assert(std::distance(c.begin(), c.end()) == 1);
- assert(c.front() == 1);
- c.pop_front();
- assert(std::distance(c.begin(), c.end()) == 0);
- }
- {
- typedef MoveOnly T;
- typedef std::forward_list<T, min_allocator<T>> C;
- C c;
- c.push_front(1);
- c.push_front(3);
- c.pop_front();
- assert(std::distance(c.begin(), c.end()) == 1);
- assert(c.front() == 1);
- c.pop_front();
- assert(std::distance(c.begin(), c.end()) == 0);
- }
+ {
+ typedef MoveOnly T;
+ typedef std::forward_list<T> C;
+ C c;
+ c.push_front(1);
+ c.push_front(3);
+ c.pop_front();
+ assert(std::distance(c.begin(), c.end()) == 1);
+ assert(c.front() == 1);
+ c.pop_front();
+ assert(std::distance(c.begin(), c.end()) == 0);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ C c;
+ c.push_front(1);
+ c.push_front(3);
+ c.pop_front();
+ assert(std::distance(c.begin(), c.end()) == 1);
+ assert(c.front() == 1);
+ c.pop_front();
+ assert(std::distance(c.begin(), c.end()) == 0);
+ }
+ {
+ typedef MoveOnly T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ C c;
+ c.push_front(1);
+ c.push_front(3);
+ c.pop_front();
+ assert(std::distance(c.begin(), c.end()) == 1);
+ assert(c.front() == 1);
+ c.pop_front();
+ assert(std::distance(c.begin(), c.end()) == 0);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_const.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_const.pass.cpp
index e2a1638d3dd31d3..f99c40fa0c1a031 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_const.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_const.pass.cpp
@@ -16,33 +16,32 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef int T;
- typedef std::forward_list<T> C;
- C c;
- c.push_front(1);
- assert(c.front() == 1);
- assert(std::distance(c.begin(), c.end()) == 1);
- c.push_front(3);
- assert(c.front() == 3);
- assert(*std::next(c.begin()) == 1);
- assert(std::distance(c.begin(), c.end()) == 2);
- }
+int main(int, char**) {
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ C c;
+ c.push_front(1);
+ assert(c.front() == 1);
+ assert(std::distance(c.begin(), c.end()) == 1);
+ c.push_front(3);
+ assert(c.front() == 3);
+ assert(*std::next(c.begin()) == 1);
+ assert(std::distance(c.begin(), c.end()) == 2);
+ }
#if TEST_STD_VER >= 11
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- C c;
- c.push_front(1);
- assert(c.front() == 1);
- assert(std::distance(c.begin(), c.end()) == 1);
- c.push_front(3);
- assert(c.front() == 3);
- assert(*std::next(c.begin()) == 1);
- assert(std::distance(c.begin(), c.end()) == 2);
- }
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ C c;
+ c.push_front(1);
+ assert(c.front() == 1);
+ assert(std::distance(c.begin(), c.end()) == 1);
+ c.push_front(3);
+ assert(c.front() == 3);
+ assert(*std::next(c.begin()) == 1);
+ assert(std::distance(c.begin(), c.end()) == 2);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_exception_safety.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_exception_safety.pass.cpp
index 2d0f11c2bf92238..467037465eeddd1 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_exception_safety.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_exception_safety.pass.cpp
@@ -21,14 +21,23 @@
static bool gCopyConstructorShouldThrow = false;
class CMyClass {
- public: CMyClass();
- public: CMyClass(const CMyClass& iOther);
- public: ~CMyClass();
+public:
+ CMyClass();
- private: int fMagicValue;
+public:
+ CMyClass(const CMyClass& iOther);
- private: static int kStartedConstructionMagicValue;
- private: static int kFinishedConstructionMagicValue;
+public:
+ ~CMyClass();
+
+private:
+ int fMagicValue;
+
+private:
+ static int kStartedConstructionMagicValue;
+
+private:
+ static int kFinishedConstructionMagicValue;
};
// Value for fMagicValue when the constructor has started running, but not yet finished
@@ -36,42 +45,36 @@ int CMyClass::kStartedConstructionMagicValue = 0;
// Value for fMagicValue when the constructor has finished running
int CMyClass::kFinishedConstructionMagicValue = 12345;
-CMyClass::CMyClass() :
- fMagicValue(kStartedConstructionMagicValue)
-{
- // Signal that the constructor has finished running
- fMagicValue = kFinishedConstructionMagicValue;
+CMyClass::CMyClass() : fMagicValue(kStartedConstructionMagicValue) {
+ // Signal that the constructor has finished running
+ fMagicValue = kFinishedConstructionMagicValue;
}
-CMyClass::CMyClass(const CMyClass& /*iOther*/) :
- fMagicValue(kStartedConstructionMagicValue)
-{
- // If requested, throw an exception _before_ setting fMagicValue to kFinishedConstructionMagicValue
- if (gCopyConstructorShouldThrow) {
- throw std::exception();
- }
- // Signal that the constructor has finished running
- fMagicValue = kFinishedConstructionMagicValue;
+CMyClass::CMyClass(const CMyClass& /*iOther*/) : fMagicValue(kStartedConstructionMagicValue) {
+ // If requested, throw an exception _before_ setting fMagicValue to kFinishedConstructionMagicValue
+ if (gCopyConstructorShouldThrow) {
+ throw std::exception();
+ }
+ // Signal that the constructor has finished running
+ fMagicValue = kFinishedConstructionMagicValue;
}
CMyClass::~CMyClass() {
- // Only instances for which the constructor has finished running should be destructed
- assert(fMagicValue == kFinishedConstructionMagicValue);
+ // Only instances for which the constructor has finished running should be destructed
+ assert(fMagicValue == kFinishedConstructionMagicValue);
}
-int main(int, char**)
-{
- CMyClass instance;
- std::forward_list<CMyClass> vec;
+int main(int, char**) {
+ CMyClass instance;
+ std::forward_list<CMyClass> vec;
- vec.push_front(instance);
+ vec.push_front(instance);
- gCopyConstructorShouldThrow = true;
- try {
- vec.push_front(instance);
- }
- catch (...) {
- }
+ gCopyConstructorShouldThrow = true;
+ try {
+ vec.push_front(instance);
+ } catch (...) {
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_rv.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_rv.pass.cpp
index 7294a454c294677..d3156c5fdd38a41 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_rv.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_rv.pass.cpp
@@ -19,32 +19,31 @@
#include "MoveOnly.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef MoveOnly T;
- typedef std::forward_list<T> C;
- C c;
- c.push_front(1);
- assert(c.front() == 1);
- assert(std::distance(c.begin(), c.end()) == 1);
- c.push_front(3);
- assert(c.front() == 3);
- assert(*std::next(c.begin()) == 1);
- assert(std::distance(c.begin(), c.end()) == 2);
- }
- {
- typedef MoveOnly T;
- typedef std::forward_list<T, min_allocator<T>> C;
- C c;
- c.push_front(1);
- assert(c.front() == 1);
- assert(std::distance(c.begin(), c.end()) == 1);
- c.push_front(3);
- assert(c.front() == 3);
- assert(*std::next(c.begin()) == 1);
- assert(std::distance(c.begin(), c.end()) == 2);
- }
+int main(int, char**) {
+ {
+ typedef MoveOnly T;
+ typedef std::forward_list<T> C;
+ C c;
+ c.push_front(1);
+ assert(c.front() == 1);
+ assert(std::distance(c.begin(), c.end()) == 1);
+ c.push_front(3);
+ assert(c.front() == 3);
+ assert(*std::next(c.begin()) == 1);
+ assert(std::distance(c.begin(), c.end()) == 2);
+ }
+ {
+ typedef MoveOnly T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ C c;
+ c.push_front(1);
+ assert(c.front() == 1);
+ assert(std::distance(c.begin(), c.end()) == 1);
+ c.push_front(3);
+ assert(c.front() == 3);
+ assert(*std::next(c.begin()) == 1);
+ assert(std::distance(c.begin(), c.end()) == 2);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/resize_size.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/resize_size.pass.cpp
index 606440ca21e6cd7..2dacf458d7d9de2 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/resize_size.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/resize_size.pass.cpp
@@ -18,99 +18,98 @@
#include "DefaultOnly.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef DefaultOnly T;
- typedef std::forward_list<T> C;
- C c;
- c.resize(0);
- assert(std::distance(c.begin(), c.end()) == 0);
- c.resize(10);
- assert(std::distance(c.begin(), c.end()) == 10);
- c.resize(20);
- assert(std::distance(c.begin(), c.end()) == 20);
- c.resize(5);
- assert(std::distance(c.begin(), c.end()) == 5);
- c.resize(0);
- assert(std::distance(c.begin(), c.end()) == 0);
- }
- {
- typedef int T;
- typedef std::forward_list<T> C;
- const T t[] = {0, 1, 2, 3, 4};
- C c(std::begin(t), std::end(t));
+int main(int, char**) {
+ {
+ typedef DefaultOnly T;
+ typedef std::forward_list<T> C;
+ C c;
+ c.resize(0);
+ assert(std::distance(c.begin(), c.end()) == 0);
+ c.resize(10);
+ assert(std::distance(c.begin(), c.end()) == 10);
+ c.resize(20);
+ assert(std::distance(c.begin(), c.end()) == 20);
+ c.resize(5);
+ assert(std::distance(c.begin(), c.end()) == 5);
+ c.resize(0);
+ assert(std::distance(c.begin(), c.end()) == 0);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ const T t[] = {0, 1, 2, 3, 4};
+ C c(std::begin(t), std::end(t));
- c.resize(3);
- assert(std::distance(c.begin(), c.end()) == 3);
- assert(*std::next(c.begin(), 0) == 0);
- assert(*std::next(c.begin(), 1) == 1);
- assert(*std::next(c.begin(), 2) == 2);
+ c.resize(3);
+ assert(std::distance(c.begin(), c.end()) == 3);
+ assert(*std::next(c.begin(), 0) == 0);
+ assert(*std::next(c.begin(), 1) == 1);
+ assert(*std::next(c.begin(), 2) == 2);
- c.resize(6);
- assert(std::distance(c.begin(), c.end()) == 6);
- assert(*std::next(c.begin(), 0) == 0);
- assert(*std::next(c.begin(), 1) == 1);
- assert(*std::next(c.begin(), 2) == 2);
- assert(*std::next(c.begin(), 3) == 0);
- assert(*std::next(c.begin(), 4) == 0);
- assert(*std::next(c.begin(), 5) == 0);
+ c.resize(6);
+ assert(std::distance(c.begin(), c.end()) == 6);
+ assert(*std::next(c.begin(), 0) == 0);
+ assert(*std::next(c.begin(), 1) == 1);
+ assert(*std::next(c.begin(), 2) == 2);
+ assert(*std::next(c.begin(), 3) == 0);
+ assert(*std::next(c.begin(), 4) == 0);
+ assert(*std::next(c.begin(), 5) == 0);
- c.resize(6);
- assert(std::distance(c.begin(), c.end()) == 6);
- assert(*std::next(c.begin(), 0) == 0);
- assert(*std::next(c.begin(), 1) == 1);
- assert(*std::next(c.begin(), 2) == 2);
- assert(*std::next(c.begin(), 3) == 0);
- assert(*std::next(c.begin(), 4) == 0);
- assert(*std::next(c.begin(), 5) == 0);
- }
+ c.resize(6);
+ assert(std::distance(c.begin(), c.end()) == 6);
+ assert(*std::next(c.begin(), 0) == 0);
+ assert(*std::next(c.begin(), 1) == 1);
+ assert(*std::next(c.begin(), 2) == 2);
+ assert(*std::next(c.begin(), 3) == 0);
+ assert(*std::next(c.begin(), 4) == 0);
+ assert(*std::next(c.begin(), 5) == 0);
+ }
#if TEST_STD_VER >= 11
- {
- typedef DefaultOnly T;
- typedef std::forward_list<T, min_allocator<T>> C;
- C c;
- c.resize(0);
- assert(std::distance(c.begin(), c.end()) == 0);
- c.resize(10);
- assert(std::distance(c.begin(), c.end()) == 10);
- c.resize(20);
- assert(std::distance(c.begin(), c.end()) == 20);
- c.resize(5);
- assert(std::distance(c.begin(), c.end()) == 5);
- c.resize(0);
- assert(std::distance(c.begin(), c.end()) == 0);
- }
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- const T t[] = {0, 1, 2, 3, 4};
- C c(std::begin(t), std::end(t));
+ {
+ typedef DefaultOnly T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ C c;
+ c.resize(0);
+ assert(std::distance(c.begin(), c.end()) == 0);
+ c.resize(10);
+ assert(std::distance(c.begin(), c.end()) == 10);
+ c.resize(20);
+ assert(std::distance(c.begin(), c.end()) == 20);
+ c.resize(5);
+ assert(std::distance(c.begin(), c.end()) == 5);
+ c.resize(0);
+ assert(std::distance(c.begin(), c.end()) == 0);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ const T t[] = {0, 1, 2, 3, 4};
+ C c(std::begin(t), std::end(t));
- c.resize(3);
- assert(std::distance(c.begin(), c.end()) == 3);
- assert(*std::next(c.begin(), 0) == 0);
- assert(*std::next(c.begin(), 1) == 1);
- assert(*std::next(c.begin(), 2) == 2);
+ c.resize(3);
+ assert(std::distance(c.begin(), c.end()) == 3);
+ assert(*std::next(c.begin(), 0) == 0);
+ assert(*std::next(c.begin(), 1) == 1);
+ assert(*std::next(c.begin(), 2) == 2);
- c.resize(6);
- assert(std::distance(c.begin(), c.end()) == 6);
- assert(*std::next(c.begin(), 0) == 0);
- assert(*std::next(c.begin(), 1) == 1);
- assert(*std::next(c.begin(), 2) == 2);
- assert(*std::next(c.begin(), 3) == 0);
- assert(*std::next(c.begin(), 4) == 0);
- assert(*std::next(c.begin(), 5) == 0);
+ c.resize(6);
+ assert(std::distance(c.begin(), c.end()) == 6);
+ assert(*std::next(c.begin(), 0) == 0);
+ assert(*std::next(c.begin(), 1) == 1);
+ assert(*std::next(c.begin(), 2) == 2);
+ assert(*std::next(c.begin(), 3) == 0);
+ assert(*std::next(c.begin(), 4) == 0);
+ assert(*std::next(c.begin(), 5) == 0);
- c.resize(6);
- assert(std::distance(c.begin(), c.end()) == 6);
- assert(*std::next(c.begin(), 0) == 0);
- assert(*std::next(c.begin(), 1) == 1);
- assert(*std::next(c.begin(), 2) == 2);
- assert(*std::next(c.begin(), 3) == 0);
- assert(*std::next(c.begin(), 4) == 0);
- assert(*std::next(c.begin(), 5) == 0);
- }
+ c.resize(6);
+ assert(std::distance(c.begin(), c.end()) == 6);
+ assert(*std::next(c.begin(), 0) == 0);
+ assert(*std::next(c.begin(), 1) == 1);
+ assert(*std::next(c.begin(), 2) == 2);
+ assert(*std::next(c.begin(), 3) == 0);
+ assert(*std::next(c.begin(), 4) == 0);
+ assert(*std::next(c.begin(), 5) == 0);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/resize_size_value.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/resize_size_value.pass.cpp
index 3c0b64e85a1bf5e..a6af763e6937f47 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/resize_size_value.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/resize_size_value.pass.cpp
@@ -19,85 +19,84 @@
#include "min_allocator.h"
#if TEST_STD_VER >= 11
-#include "container_test_types.h"
+# include "container_test_types.h"
#endif
-int main(int, char**)
-{
- {
- typedef int T;
- typedef std::forward_list<T> C;
- const T t[] = {0, 1, 2, 3, 4};
- C c(std::begin(t), std::end(t));
+int main(int, char**) {
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ const T t[] = {0, 1, 2, 3, 4};
+ C c(std::begin(t), std::end(t));
- c.resize(3, 10);
- assert(std::distance(c.begin(), c.end()) == 3);
- assert(*std::next(c.begin(), 0) == 0);
- assert(*std::next(c.begin(), 1) == 1);
- assert(*std::next(c.begin(), 2) == 2);
+ c.resize(3, 10);
+ assert(std::distance(c.begin(), c.end()) == 3);
+ assert(*std::next(c.begin(), 0) == 0);
+ assert(*std::next(c.begin(), 1) == 1);
+ assert(*std::next(c.begin(), 2) == 2);
- c.resize(6, 10);
- assert(std::distance(c.begin(), c.end()) == 6);
- assert(*std::next(c.begin(), 0) == 0);
- assert(*std::next(c.begin(), 1) == 1);
- assert(*std::next(c.begin(), 2) == 2);
- assert(*std::next(c.begin(), 3) == 10);
- assert(*std::next(c.begin(), 4) == 10);
- assert(*std::next(c.begin(), 5) == 10);
+ c.resize(6, 10);
+ assert(std::distance(c.begin(), c.end()) == 6);
+ assert(*std::next(c.begin(), 0) == 0);
+ assert(*std::next(c.begin(), 1) == 1);
+ assert(*std::next(c.begin(), 2) == 2);
+ assert(*std::next(c.begin(), 3) == 10);
+ assert(*std::next(c.begin(), 4) == 10);
+ assert(*std::next(c.begin(), 5) == 10);
- c.resize(6, 12);
- assert(std::distance(c.begin(), c.end()) == 6);
- assert(*std::next(c.begin(), 0) == 0);
- assert(*std::next(c.begin(), 1) == 1);
- assert(*std::next(c.begin(), 2) == 2);
- assert(*std::next(c.begin(), 3) == 10);
- assert(*std::next(c.begin(), 4) == 10);
- assert(*std::next(c.begin(), 5) == 10);
- }
+ c.resize(6, 12);
+ assert(std::distance(c.begin(), c.end()) == 6);
+ assert(*std::next(c.begin(), 0) == 0);
+ assert(*std::next(c.begin(), 1) == 1);
+ assert(*std::next(c.begin(), 2) == 2);
+ assert(*std::next(c.begin(), 3) == 10);
+ assert(*std::next(c.begin(), 4) == 10);
+ assert(*std::next(c.begin(), 5) == 10);
+ }
#if TEST_STD_VER >= 11
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- const T t[] = {0, 1, 2, 3, 4};
- C c(std::begin(t), std::end(t));
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ const T t[] = {0, 1, 2, 3, 4};
+ C c(std::begin(t), std::end(t));
- c.resize(3, 10);
- assert(std::distance(c.begin(), c.end()) == 3);
- assert(*std::next(c.begin(), 0) == 0);
- assert(*std::next(c.begin(), 1) == 1);
- assert(*std::next(c.begin(), 2) == 2);
+ c.resize(3, 10);
+ assert(std::distance(c.begin(), c.end()) == 3);
+ assert(*std::next(c.begin(), 0) == 0);
+ assert(*std::next(c.begin(), 1) == 1);
+ assert(*std::next(c.begin(), 2) == 2);
- c.resize(6, 10);
- assert(std::distance(c.begin(), c.end()) == 6);
- assert(*std::next(c.begin(), 0) == 0);
- assert(*std::next(c.begin(), 1) == 1);
- assert(*std::next(c.begin(), 2) == 2);
- assert(*std::next(c.begin(), 3) == 10);
- assert(*std::next(c.begin(), 4) == 10);
- assert(*std::next(c.begin(), 5) == 10);
+ c.resize(6, 10);
+ assert(std::distance(c.begin(), c.end()) == 6);
+ assert(*std::next(c.begin(), 0) == 0);
+ assert(*std::next(c.begin(), 1) == 1);
+ assert(*std::next(c.begin(), 2) == 2);
+ assert(*std::next(c.begin(), 3) == 10);
+ assert(*std::next(c.begin(), 4) == 10);
+ assert(*std::next(c.begin(), 5) == 10);
- c.resize(6, 12);
- assert(std::distance(c.begin(), c.end()) == 6);
- assert(*std::next(c.begin(), 0) == 0);
- assert(*std::next(c.begin(), 1) == 1);
- assert(*std::next(c.begin(), 2) == 2);
- assert(*std::next(c.begin(), 3) == 10);
- assert(*std::next(c.begin(), 4) == 10);
- assert(*std::next(c.begin(), 5) == 10);
- }
+ c.resize(6, 12);
+ assert(std::distance(c.begin(), c.end()) == 6);
+ assert(*std::next(c.begin(), 0) == 0);
+ assert(*std::next(c.begin(), 1) == 1);
+ assert(*std::next(c.begin(), 2) == 2);
+ assert(*std::next(c.begin(), 3) == 10);
+ assert(*std::next(c.begin(), 4) == 10);
+ assert(*std::next(c.begin(), 5) == 10);
+ }
+ {
+ // Test that the allocator's construct method is being used to
+ // construct the new elements and that it's called exactly N times.
+ typedef std::forward_list<int, ContainerTestAllocator<int, int>> Container;
+ ConstructController* cc = getConstructController();
+ cc->reset();
{
- // Test that the allocator's construct method is being used to
- // construct the new elements and that it's called exactly N times.
- typedef std::forward_list<int, ContainerTestAllocator<int, int>> Container;
- ConstructController* cc = getConstructController();
- cc->reset();
- {
- Container c;
- cc->expect<int const&>(6);
- c.resize(6, 42);
- assert(!cc->unchecked());
- }
+ Container c;
+ cc->expect<int const&>(6);
+ c.resize(6, 42);
+ assert(!cc->unchecked());
}
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/merge_rvalue.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/merge_rvalue.pass.cpp
index 3a7a8744ad46a0b..d5084eccd98da70 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/merge_rvalue.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/merge_rvalue.pass.cpp
@@ -57,9 +57,9 @@ int main(int, char**) {
const T to[3] = {0, 1, 2};
C c2(std::begin(to), std::end(to));
- I io[3] = {c2.begin(), ++c2.begin(), ++ ++c2.begin()};
+ I io[3] = {c2.begin(), ++c2.begin(), ++ ++c2.begin()};
std::reference_wrapper<T> ro[3] = {*io[0], *io[1], *io[2]};
- P po[3] = {&*io[0], &*io[1], &*io[2]};
+ P po[3] = {&*io[0], &*io[1], &*io[2]};
C c1;
c1.merge(std::move(c2));
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/merge_rvalue_pred.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/merge_rvalue_pred.pass.cpp
index f1ddbfb620d2994..235707c65370d17 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/merge_rvalue_pred.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/merge_rvalue_pred.pass.cpp
@@ -57,9 +57,9 @@ int main(int, char**) {
const T to[3] = {2, 1, 0};
C c2(std::begin(to), std::end(to));
- I io[3] = {c2.begin(), ++c2.begin(), ++ ++c2.begin()};
+ I io[3] = {c2.begin(), ++c2.begin(), ++ ++c2.begin()};
std::reference_wrapper<T> ro[3] = {*io[0], *io[1], *io[2]};
- P po[3] = {&*io[0], &*io[1], &*io[2]};
+ P po[3] = {&*io[0], &*io[1], &*io[2]};
C c1;
c1.merge(std::move(c2), std::greater<T>());
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/remove.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/remove.pass.cpp
index c475468549cfe8e..ec3bf845dcc5ab1 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/remove.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/remove.pass.cpp
@@ -19,154 +19,156 @@
#include "min_allocator.h"
template <class L>
-void do_remove(L &l, const typename L::value_type &value, typename L::size_type expected)
-{
- typename L::size_type old_size = std::distance(l.begin(), l.end());
+void do_remove(L& l, const typename L::value_type& value, typename L::size_type expected) {
+ typename L::size_type old_size = std::distance(l.begin(), l.end());
#if TEST_STD_VER > 17
- ASSERT_SAME_TYPE(decltype(l.remove(value)), typename L::size_type);
- assert(l.remove(value) == expected);
+ ASSERT_SAME_TYPE(decltype(l.remove(value)), typename L::size_type);
+ assert(l.remove(value) == expected);
#else
- ASSERT_SAME_TYPE(decltype(l.remove(value)), void);
- l.remove(value);
+ ASSERT_SAME_TYPE(decltype(l.remove(value)), void);
+ l.remove(value);
#endif
- assert(old_size - std::distance(l.begin(), l.end()) == expected);
+ assert(old_size - std::distance(l.begin(), l.end()) == expected);
}
-
struct S {
- S(int i) : i_(new int(i)) {}
- S(const S &rhs) : i_(new int(*rhs.i_)) {}
- S& operator = (const S &rhs) { *i_ = *rhs.i_; return *this; }
- ~S () { delete i_; i_ = NULL; }
- bool operator == (const S &rhs) const { return *i_ == *rhs.i_; }
- int get () const { return *i_; }
- int *i_;
- };
-
+ S(int i) : i_(new int(i)) {}
+ S(const S& rhs) : i_(new int(*rhs.i_)) {}
+ S& operator=(const S& rhs) {
+ *i_ = *rhs.i_;
+ return *this;
+ }
+ ~S() {
+ delete i_;
+ i_ = NULL;
+ }
+ bool operator==(const S& rhs) const { return *i_ == *rhs.i_; }
+ int get() const { return *i_; }
+ int* i_;
+};
-int main(int, char**)
-{
- {
- typedef int T;
- typedef std::forward_list<T> C;
- const T t1[] = {0, 5, 5, 0, 0, 0, 5};
- const T t2[] = {5, 5, 5};
- C c1(std::begin(t1), std::end(t1));
- C c2(std::begin(t2), std::end(t2));
- do_remove(c1, 0, 4);
- assert(c1 == c2);
- }
- {
- typedef int T;
- typedef std::forward_list<T> C;
- const T t1[] = {0, 0, 0, 0};
- C c1(std::begin(t1), std::end(t1));
- C c2;
- do_remove(c1, 0, 4);
- assert(c1 == c2);
- }
- {
- typedef int T;
- typedef std::forward_list<T> C;
- const T t1[] = {5, 5, 5};
- const T t2[] = {5, 5, 5};
- C c1(std::begin(t1), std::end(t1));
- C c2(std::begin(t2), std::end(t2));
- do_remove(c1, 0, 0);
- assert(c1 == c2);
- }
- {
- typedef int T;
- typedef std::forward_list<T> C;
- C c1;
- C c2;
- do_remove(c1, 0, 0);
- assert(c1 == c2);
- }
- {
- typedef int T;
- typedef std::forward_list<T> C;
- const T t1[] = {5, 5, 5, 0};
- const T t2[] = {5, 5, 5};
- C c1(std::begin(t1), std::end(t1));
- C c2(std::begin(t2), std::end(t2));
- do_remove(c1, 0, 1);
- assert(c1 == c2);
- }
- { // LWG issue #526
+int main(int, char**) {
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ const T t1[] = {0, 5, 5, 0, 0, 0, 5};
+ const T t2[] = {5, 5, 5};
+ C c1(std::begin(t1), std::end(t1));
+ C c2(std::begin(t2), std::end(t2));
+ do_remove(c1, 0, 4);
+ assert(c1 == c2);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ const T t1[] = {0, 0, 0, 0};
+ C c1(std::begin(t1), std::end(t1));
+ C c2;
+ do_remove(c1, 0, 4);
+ assert(c1 == c2);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ const T t1[] = {5, 5, 5};
+ const T t2[] = {5, 5, 5};
+ C c1(std::begin(t1), std::end(t1));
+ C c2(std::begin(t2), std::end(t2));
+ do_remove(c1, 0, 0);
+ assert(c1 == c2);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ C c1;
+ C c2;
+ do_remove(c1, 0, 0);
+ assert(c1 == c2);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ const T t1[] = {5, 5, 5, 0};
+ const T t2[] = {5, 5, 5};
+ C c1(std::begin(t1), std::end(t1));
+ C c2(std::begin(t2), std::end(t2));
+ do_remove(c1, 0, 1);
+ assert(c1 == c2);
+ }
+ { // LWG issue #526
typedef int T;
typedef std::forward_list<T> C;
int t1[] = {1, 2, 1, 3, 5, 8, 11};
- int t2[] = { 2, 3, 5, 8, 11};
+ int t2[] = {2, 3, 5, 8, 11};
C c1(std::begin(t1), std::end(t1));
C c2(std::begin(t2), std::end(t2));
do_remove(c1, c1.front(), 2);
assert(c1 == c2);
- }
- {
+ }
+ {
typedef S T;
typedef std::forward_list<T> C;
int t1[] = {1, 2, 1, 3, 5, 8, 11, 1};
- int t2[] = { 2, 3, 5, 8, 11 };
+ int t2[] = {2, 3, 5, 8, 11};
C c;
- for(int *ip = std::end(t1); ip != std::begin(t1);)
- c.push_front(S(*--ip));
+ for (int* ip = std::end(t1); ip != std::begin(t1);)
+ c.push_front(S(*--ip));
do_remove(c, c.front(), 3);
C::const_iterator it = c.begin();
- for(int *ip = std::begin(t2); ip != std::end(t2); ++ip, ++it) {
- assert ( it != c.end());
- assert ( *ip == it->get());
- }
- assert ( it == c.end ());
+ for (int* ip = std::begin(t2); ip != std::end(t2); ++ip, ++it) {
+ assert(it != c.end());
+ assert(*ip == it->get());
}
+ assert(it == c.end());
+ }
#if TEST_STD_VER >= 11
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- const T t1[] = {0, 5, 5, 0, 0, 0, 5};
- const T t2[] = {5, 5, 5};
- C c1(std::begin(t1), std::end(t1));
- C c2(std::begin(t2), std::end(t2));
- do_remove(c1, 0, 4);
- assert(c1 == c2);
- }
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- const T t1[] = {0, 0, 0, 0};
- C c1(std::begin(t1), std::end(t1));
- C c2;
- do_remove(c1, 0, 4);
- assert(c1 == c2);
- }
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- const T t1[] = {5, 5, 5};
- const T t2[] = {5, 5, 5};
- C c1(std::begin(t1), std::end(t1));
- C c2(std::begin(t2), std::end(t2));
- do_remove(c1, 0, 0);
- assert(c1 == c2);
- }
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- C c1;
- C c2;
- do_remove(c1, 0, 0);
- assert(c1 == c2);
- }
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- const T t1[] = {5, 5, 5, 0};
- const T t2[] = {5, 5, 5};
- C c1(std::begin(t1), std::end(t1));
- C c2(std::begin(t2), std::end(t2));
- do_remove(c1, 0, 1);
- assert(c1 == c2);
- }
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ const T t1[] = {0, 5, 5, 0, 0, 0, 5};
+ const T t2[] = {5, 5, 5};
+ C c1(std::begin(t1), std::end(t1));
+ C c2(std::begin(t2), std::end(t2));
+ do_remove(c1, 0, 4);
+ assert(c1 == c2);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ const T t1[] = {0, 0, 0, 0};
+ C c1(std::begin(t1), std::end(t1));
+ C c2;
+ do_remove(c1, 0, 4);
+ assert(c1 == c2);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ const T t1[] = {5, 5, 5};
+ const T t2[] = {5, 5, 5};
+ C c1(std::begin(t1), std::end(t1));
+ C c2(std::begin(t2), std::end(t2));
+ do_remove(c1, 0, 0);
+ assert(c1 == c2);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ C c1;
+ C c2;
+ do_remove(c1, 0, 0);
+ assert(c1 == c2);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ const T t1[] = {5, 5, 5, 0};
+ const T t2[] = {5, 5, 5};
+ C c1(std::begin(t1), std::end(t1));
+ C c2(std::begin(t2), std::end(t2));
+ do_remove(c1, 0, 1);
+ assert(c1 == c2);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/remove_if.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/remove_if.pass.cpp
index 4e5b9bce14eb444..c6325baea2590dd 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/remove_if.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/remove_if.pass.cpp
@@ -21,25 +21,20 @@
#include "min_allocator.h"
#include "counting_predicates.h"
-
template <class L, class Predicate>
-void do_remove_if(L &l, Predicate pred, typename L::size_type expected)
-{
- typename L::size_type old_size = std::distance(l.begin(), l.end());
+void do_remove_if(L& l, Predicate pred, typename L::size_type expected) {
+ typename L::size_type old_size = std::distance(l.begin(), l.end());
#if TEST_STD_VER > 17
- ASSERT_SAME_TYPE(decltype(l.remove_if(pred)), typename L::size_type);
- assert(l.remove_if(pred) == expected);
+ ASSERT_SAME_TYPE(decltype(l.remove_if(pred)), typename L::size_type);
+ assert(l.remove_if(pred) == expected);
#else
- ASSERT_SAME_TYPE(decltype(l.remove_if(pred)), void);
- l.remove_if(pred);
+ ASSERT_SAME_TYPE(decltype(l.remove_if(pred)), void);
+ l.remove_if(pred);
#endif
- assert(old_size - std::distance(l.begin(), l.end()) == expected);
+ assert(old_size - std::distance(l.begin(), l.end()) == expected);
}
-bool g(int i)
-{
- return i < 3;
-}
+bool g(int i) { return i < 3; }
struct PredLWG526 {
PredLWG526(int i) : i_(i) {}
@@ -50,148 +45,146 @@ struct PredLWG526 {
int i_;
};
-int main(int, char**)
-{
- {
- typedef int T;
- typedef unary_counting_predicate<bool(*)(T), T> Predicate;
- typedef std::forward_list<T> C;
- const T t1[] = {0, 5, 5, 0, 0, 0, 5};
- const T t2[] = {5, 5, 5};
- C c1(std::begin(t1), std::end(t1));
- C c2(std::begin(t2), std::end(t2));
- Predicate cp(g);
- do_remove_if(c1, std::ref(cp), 4);
- assert(c1 == c2);
- assert(cp.count() == static_cast<std::size_t>(std::distance(std::begin(t1), std::end(t1))));
- }
- {
- typedef int T;
- typedef unary_counting_predicate<bool(*)(T), T> Predicate;
- typedef std::forward_list<T> C;
- const T t1[] = {0, 0, 0, 0};
- C c1(std::begin(t1), std::end(t1));
- C c2;
- Predicate cp(g);
- do_remove_if(c1, std::ref(cp), 4);
- assert(c1 == c2);
- assert(cp.count() == static_cast<std::size_t>(std::distance(std::begin(t1), std::end(t1))));
- }
- {
- typedef int T;
- typedef unary_counting_predicate<bool(*)(T), T> Predicate;
- typedef std::forward_list<T> C;
- const T t1[] = {5, 5, 5};
- const T t2[] = {5, 5, 5};
- C c1(std::begin(t1), std::end(t1));
- C c2(std::begin(t2), std::end(t2));
- Predicate cp(g);
- do_remove_if(c1, std::ref(cp), 0);
- assert(c1 == c2);
- assert(cp.count() == static_cast<std::size_t>(std::distance(std::begin(t1), std::end(t1))));
- }
- {
- typedef int T;
- typedef unary_counting_predicate<bool(*)(T), T> Predicate;
- typedef std::forward_list<T> C;
- C c1;
- C c2;
- Predicate cp(g);
- do_remove_if(c1, std::ref(cp), 0);
- assert(c1 == c2);
- assert(cp.count() == 0);
- }
- {
- typedef int T;
- typedef unary_counting_predicate<bool(*)(T), T> Predicate;
- typedef std::forward_list<T> C;
- const T t1[] = {5, 5, 5, 0};
- const T t2[] = {5, 5, 5};
- C c1(std::begin(t1), std::end(t1));
- C c2(std::begin(t2), std::end(t2));
- Predicate cp(g);
- do_remove_if(c1, std::ref(cp), 1);
- assert(c1 == c2);
- assert(cp.count() == static_cast<std::size_t>(std::distance(std::begin(t1), std::end(t1))));
- }
+int main(int, char**) {
+ {
+ typedef int T;
+ typedef unary_counting_predicate<bool (*)(T), T> Predicate;
+ typedef std::forward_list<T> C;
+ const T t1[] = {0, 5, 5, 0, 0, 0, 5};
+ const T t2[] = {5, 5, 5};
+ C c1(std::begin(t1), std::end(t1));
+ C c2(std::begin(t2), std::end(t2));
+ Predicate cp(g);
+ do_remove_if(c1, std::ref(cp), 4);
+ assert(c1 == c2);
+ assert(cp.count() == static_cast<std::size_t>(std::distance(std::begin(t1), std::end(t1))));
+ }
+ {
+ typedef int T;
+ typedef unary_counting_predicate<bool (*)(T), T> Predicate;
+ typedef std::forward_list<T> C;
+ const T t1[] = {0, 0, 0, 0};
+ C c1(std::begin(t1), std::end(t1));
+ C c2;
+ Predicate cp(g);
+ do_remove_if(c1, std::ref(cp), 4);
+ assert(c1 == c2);
+ assert(cp.count() == static_cast<std::size_t>(std::distance(std::begin(t1), std::end(t1))));
+ }
+ {
+ typedef int T;
+ typedef unary_counting_predicate<bool (*)(T), T> Predicate;
+ typedef std::forward_list<T> C;
+ const T t1[] = {5, 5, 5};
+ const T t2[] = {5, 5, 5};
+ C c1(std::begin(t1), std::end(t1));
+ C c2(std::begin(t2), std::end(t2));
+ Predicate cp(g);
+ do_remove_if(c1, std::ref(cp), 0);
+ assert(c1 == c2);
+ assert(cp.count() == static_cast<std::size_t>(std::distance(std::begin(t1), std::end(t1))));
+ }
+ {
+ typedef int T;
+ typedef unary_counting_predicate<bool (*)(T), T> Predicate;
+ typedef std::forward_list<T> C;
+ C c1;
+ C c2;
+ Predicate cp(g);
+ do_remove_if(c1, std::ref(cp), 0);
+ assert(c1 == c2);
+ assert(cp.count() == 0);
+ }
+ {
+ typedef int T;
+ typedef unary_counting_predicate<bool (*)(T), T> Predicate;
+ typedef std::forward_list<T> C;
+ const T t1[] = {5, 5, 5, 0};
+ const T t2[] = {5, 5, 5};
+ C c1(std::begin(t1), std::end(t1));
+ C c2(std::begin(t2), std::end(t2));
+ Predicate cp(g);
+ do_remove_if(c1, std::ref(cp), 1);
+ assert(c1 == c2);
+ assert(cp.count() == static_cast<std::size_t>(std::distance(std::begin(t1), std::end(t1))));
+ }
- { // LWG issue #526
+ { // LWG issue #526
int a1[] = {1, 2, 1, 3, 5, 8, 11};
- int a2[] = { 2, 3, 5, 8, 11};
+ int a2[] = {2, 3, 5, 8, 11};
std::forward_list<PredLWG526> c(a1, a1 + 7);
do_remove_if(c, std::ref(c.front()), 2);
- for (std::size_t i = 0; i < 5; ++i)
- {
- assert(!c.empty());
- assert(c.front() == a2[i]);
- c.pop_front();
+ for (std::size_t i = 0; i < 5; ++i) {
+ assert(!c.empty());
+ assert(c.front() == a2[i]);
+ c.pop_front();
}
assert(c.empty());
- }
+ }
#if TEST_STD_VER >= 11
- {
- typedef int T;
- typedef unary_counting_predicate<bool(*)(T), T> Predicate;
- typedef std::forward_list<T, min_allocator<T>> C;
- const T t1[] = {0, 5, 5, 0, 0, 0, 5};
- const T t2[] = {5, 5, 5};
- C c1(std::begin(t1), std::end(t1));
- C c2(std::begin(t2), std::end(t2));
- Predicate cp(g);
- do_remove_if(c1, std::ref(cp), 4);
- assert(c1 == c2);
- assert(cp.count() == static_cast<std::size_t>(std::distance(std::begin(t1), std::end(t1))));
- }
- {
- typedef int T;
- typedef unary_counting_predicate<bool(*)(T), T> Predicate;
- typedef std::forward_list<T, min_allocator<T>> C;
- const T t1[] = {0, 0, 0, 0};
- C c1(std::begin(t1), std::end(t1));
- C c2;
- Predicate cp(g);
- do_remove_if(c1, std::ref(cp), 4);
- assert(c1 == c2);
- assert(cp.count() == static_cast<std::size_t>(std::distance(std::begin(t1), std::end(t1))));
- }
- {
- typedef int T;
- typedef unary_counting_predicate<bool(*)(T), T> Predicate;
- typedef std::forward_list<T, min_allocator<T>> C;
- const T t1[] = {5, 5, 5};
- const T t2[] = {5, 5, 5};
- C c1(std::begin(t1), std::end(t1));
- C c2(std::begin(t2), std::end(t2));
- Predicate cp(g);
- do_remove_if(c1, std::ref(cp), 0);
- assert(c1 == c2);
- assert(cp.count() == static_cast<std::size_t>(std::distance(std::begin(t1), std::end(t1))));
- }
- {
- typedef int T;
- typedef unary_counting_predicate<bool(*)(T), T> Predicate;
- typedef std::forward_list<T, min_allocator<T>> C;
- C c1;
- C c2;
- Predicate cp(g);
- do_remove_if(c1, std::ref(cp), 0);
- assert(c1 == c2);
- assert(cp.count() == 0);
- }
- {
- typedef int T;
- typedef unary_counting_predicate<bool(*)(T), T> Predicate;
- typedef std::forward_list<T, min_allocator<T>> C;
- const T t1[] = {5, 5, 5, 0};
- const T t2[] = {5, 5, 5};
- C c1(std::begin(t1), std::end(t1));
- C c2(std::begin(t2), std::end(t2));
- Predicate cp(g);
- do_remove_if(c1, std::ref(cp), 1);
- assert(c1 == c2);
- assert(cp.count() == static_cast<std::size_t>(std::distance(std::begin(t1), std::end(t1))));
- }
+ {
+ typedef int T;
+ typedef unary_counting_predicate<bool (*)(T), T> Predicate;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ const T t1[] = {0, 5, 5, 0, 0, 0, 5};
+ const T t2[] = {5, 5, 5};
+ C c1(std::begin(t1), std::end(t1));
+ C c2(std::begin(t2), std::end(t2));
+ Predicate cp(g);
+ do_remove_if(c1, std::ref(cp), 4);
+ assert(c1 == c2);
+ assert(cp.count() == static_cast<std::size_t>(std::distance(std::begin(t1), std::end(t1))));
+ }
+ {
+ typedef int T;
+ typedef unary_counting_predicate<bool (*)(T), T> Predicate;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ const T t1[] = {0, 0, 0, 0};
+ C c1(std::begin(t1), std::end(t1));
+ C c2;
+ Predicate cp(g);
+ do_remove_if(c1, std::ref(cp), 4);
+ assert(c1 == c2);
+ assert(cp.count() == static_cast<std::size_t>(std::distance(std::begin(t1), std::end(t1))));
+ }
+ {
+ typedef int T;
+ typedef unary_counting_predicate<bool (*)(T), T> Predicate;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ const T t1[] = {5, 5, 5};
+ const T t2[] = {5, 5, 5};
+ C c1(std::begin(t1), std::end(t1));
+ C c2(std::begin(t2), std::end(t2));
+ Predicate cp(g);
+ do_remove_if(c1, std::ref(cp), 0);
+ assert(c1 == c2);
+ assert(cp.count() == static_cast<std::size_t>(std::distance(std::begin(t1), std::end(t1))));
+ }
+ {
+ typedef int T;
+ typedef unary_counting_predicate<bool (*)(T), T> Predicate;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ C c1;
+ C c2;
+ Predicate cp(g);
+ do_remove_if(c1, std::ref(cp), 0);
+ assert(c1 == c2);
+ assert(cp.count() == 0);
+ }
+ {
+ typedef int T;
+ typedef unary_counting_predicate<bool (*)(T), T> Predicate;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ const T t1[] = {5, 5, 5, 0};
+ const T t2[] = {5, 5, 5};
+ C c1(std::begin(t1), std::end(t1));
+ C c2(std::begin(t2), std::end(t2));
+ Predicate cp(g);
+ do_remove_if(c1, std::ref(cp), 1);
+ assert(c1 == c2);
+ assert(cp.count() == static_cast<std::size_t>(std::distance(std::begin(t1), std::end(t1))));
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/reverse.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/reverse.pass.cpp
index c337d138ef799a9..0d0656897f34e80 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/reverse.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/reverse.pass.cpp
@@ -19,25 +19,23 @@
#include "min_allocator.h"
template <class C>
-void test(int N)
-{
- C c;
- for (int i = 0; i < N; ++i)
- c.push_front(i);
- c.reverse();
- assert(std::distance(c.begin(), c.end()) == N);
- typename C::const_iterator j = c.begin();
- for (int i = 0; i < N; ++i, ++j)
- assert(*j == i);
+void test(int N) {
+ C c;
+ for (int i = 0; i < N; ++i)
+ c.push_front(i);
+ c.reverse();
+ assert(std::distance(c.begin(), c.end()) == N);
+ typename C::const_iterator j = c.begin();
+ for (int i = 0; i < N; ++i, ++j)
+ assert(*j == i);
}
-int main(int, char**)
-{
- for (int i = 0; i < 10; ++i)
- test<std::forward_list<int> >(i);
+int main(int, char**) {
+ for (int i = 0; i < 10; ++i)
+ test<std::forward_list<int> >(i);
#if TEST_STD_VER >= 11
- for (int i = 0; i < 10; ++i)
- test<std::forward_list<int, min_allocator<int>> >(i);
+ for (int i = 0; i < 10; ++i)
+ test<std::forward_list<int, min_allocator<int>> >(i);
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/sort.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/sort.pass.cpp
index 4789e73584b6bba..95d6147be9b0c3a 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/sort.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/sort.pass.cpp
@@ -23,73 +23,68 @@
std::mt19937 randomness;
template <class C>
-void test(int N)
-{
- typedef typename C::value_type T;
- typedef std::vector<T> V;
- V v;
- for (int i = 0; i < N; ++i)
- v.push_back(i);
- std::shuffle(v.begin(), v.end(), randomness);
- C c(v.begin(), v.end());
- c.sort();
- assert(std::distance(c.begin(), c.end()) == N);
- typename C::const_iterator j = c.begin();
- for (int i = 0; i < N; ++i, ++j)
- assert(*j == i);
+void test(int N) {
+ typedef typename C::value_type T;
+ typedef std::vector<T> V;
+ V v;
+ for (int i = 0; i < N; ++i)
+ v.push_back(i);
+ std::shuffle(v.begin(), v.end(), randomness);
+ C c(v.begin(), v.end());
+ c.sort();
+ assert(std::distance(c.begin(), c.end()) == N);
+ typename C::const_iterator j = c.begin();
+ for (int i = 0; i < N; ++i, ++j)
+ assert(*j == i);
}
-struct Payload
-{
- int val;
- int side;
- Payload(int v) : val(v), side(0) {}
- Payload(int v, int s) : val(v), side(s) {}
- bool operator< (const Payload &rhs) const { return val < rhs.val;}
-// bool operator==(const Payload &rhs) const { return val == rhs.val;}
+struct Payload {
+ int val;
+ int side;
+ Payload(int v) : val(v), side(0) {}
+ Payload(int v, int s) : val(v), side(s) {}
+ bool operator<(const Payload& rhs) const { return val < rhs.val; }
+ // bool operator==(const Payload &rhs) const { return val == rhs.val;}
};
-void test_stable(int N)
-{
- typedef Payload T;
- typedef std::forward_list<T> C;
- typedef std::vector<T> V;
- V v;
- for (int i = 0; i < N; ++i)
- v.push_back(Payload(i/2));
- std::shuffle(v.begin(), v.end(), randomness);
- for (int i = 0; i < N; ++i)
- v[i].side = i;
+void test_stable(int N) {
+ typedef Payload T;
+ typedef std::forward_list<T> C;
+ typedef std::vector<T> V;
+ V v;
+ for (int i = 0; i < N; ++i)
+ v.push_back(Payload(i / 2));
+ std::shuffle(v.begin(), v.end(), randomness);
+ for (int i = 0; i < N; ++i)
+ v[i].side = i;
- C c(v.begin(), v.end());
- c.sort();
- assert(std::distance(c.begin(), c.end()) == N);
+ C c(v.begin(), v.end());
+ c.sort();
+ assert(std::distance(c.begin(), c.end()) == N);
-// Are we sorted?
- typename C::const_iterator j = c.begin();
- for (int i = 0; i < N; ++i, ++j)
- assert(j->val == i/2);
+ // Are we sorted?
+ typename C::const_iterator j = c.begin();
+ for (int i = 0; i < N; ++i, ++j)
+ assert(j->val == i / 2);
-// Are we stable?
- for (C::const_iterator it = c.begin(); it != c.end(); ++it)
- {
- C::const_iterator next = std::next(it);
- if (next != c.end() && it->val == next->val)
- assert(it->side < next->side);
- }
+ // Are we stable?
+ for (C::const_iterator it = c.begin(); it != c.end(); ++it) {
+ C::const_iterator next = std::next(it);
+ if (next != c.end() && it->val == next->val)
+ assert(it->side < next->side);
+ }
}
-int main(int, char**)
-{
- for (int i = 0; i < 40; ++i)
- test<std::forward_list<int> >(i);
+int main(int, char**) {
+ for (int i = 0; i < 40; ++i)
+ test<std::forward_list<int> >(i);
#if TEST_STD_VER >= 11
- for (int i = 0; i < 40; ++i)
- test<std::forward_list<int, min_allocator<int>> >(i);
+ for (int i = 0; i < 40; ++i)
+ test<std::forward_list<int, min_allocator<int>> >(i);
#endif
- for (int i = 0; i < 40; ++i)
- test_stable(i);
+ for (int i = 0; i < 40; ++i)
+ test_stable(i);
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/sort_pred.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/sort_pred.pass.cpp
index 6db1599448608ec..2644aed6fe65b4a 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/sort_pred.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/sort_pred.pass.cpp
@@ -23,75 +23,70 @@
std::mt19937 randomness;
-struct Payload
-{
- int val;
- int side;
- Payload(int v) : val(v), side(0) {}
- Payload(int v, int s) : val(v), side(s) {}
- bool operator< (const Payload &rhs) const { return val < rhs.val;}
+struct Payload {
+ int val;
+ int side;
+ Payload(int v) : val(v), side(0) {}
+ Payload(int v, int s) : val(v), side(s) {}
+ bool operator<(const Payload& rhs) const { return val < rhs.val; }
};
-bool greater(const Payload &lhs, const Payload &rhs) { return lhs.val > rhs.val; }
+bool greater(const Payload& lhs, const Payload& rhs) { return lhs.val > rhs.val; }
-void test_stable(int N)
-{
- typedef Payload T;
- typedef std::forward_list<T> C;
- typedef std::vector<T> V;
- V v;
- for (int i = 0; i < N; ++i)
- v.push_back(Payload(i/2));
- std::shuffle(v.begin(), v.end(), randomness);
- for (int i = 0; i < N; ++i)
- v[i].side = i;
+void test_stable(int N) {
+ typedef Payload T;
+ typedef std::forward_list<T> C;
+ typedef std::vector<T> V;
+ V v;
+ for (int i = 0; i < N; ++i)
+ v.push_back(Payload(i / 2));
+ std::shuffle(v.begin(), v.end(), randomness);
+ for (int i = 0; i < N; ++i)
+ v[i].side = i;
- C c(v.begin(), v.end());
- c.sort(greater);
- assert(std::distance(c.begin(), c.end()) == N);
+ C c(v.begin(), v.end());
+ c.sort(greater);
+ assert(std::distance(c.begin(), c.end()) == N);
-// Are we sorted?
- typename C::const_iterator j = c.begin();
- for (int i = 0; i < N; ++i, ++j)
- assert(j->val == (N-1-i)/2);
+ // Are we sorted?
+ typename C::const_iterator j = c.begin();
+ for (int i = 0; i < N; ++i, ++j)
+ assert(j->val == (N - 1 - i) / 2);
-// Are we stable?
- for (C::const_iterator it = c.begin(); it != c.end(); ++it)
- {
- C::const_iterator next = std::next(it);
- if (next != c.end() && it->val == next->val)
- assert(it->side < next->side);
- }
+ // Are we stable?
+ for (C::const_iterator it = c.begin(); it != c.end(); ++it) {
+ C::const_iterator next = std::next(it);
+ if (next != c.end() && it->val == next->val)
+ assert(it->side < next->side);
+ }
}
template <class C>
-void test(int N)
-{
- typedef typename C::value_type T;
- typedef std::vector<T> V;
- V v;
- for (int i = 0; i < N; ++i)
- v.push_back(i);
- std::shuffle(v.begin(), v.end(), randomness);
- C c(v.begin(), v.end());
- c.sort(std::greater<T>());
- assert(std::distance(c.begin(), c.end()) == N);
- typename C::const_iterator j = c.begin();
- for (int i = 0; i < N; ++i, ++j)
- assert(*j == N-1-i);
+void test(int N) {
+ typedef typename C::value_type T;
+ typedef std::vector<T> V;
+ V v;
+ for (int i = 0; i < N; ++i)
+ v.push_back(i);
+ std::shuffle(v.begin(), v.end(), randomness);
+ C c(v.begin(), v.end());
+ c.sort(std::greater<T>());
+ assert(std::distance(c.begin(), c.end()) == N);
+ typename C::const_iterator j = c.begin();
+ for (int i = 0; i < N; ++i, ++j)
+ assert(*j == N - 1 - i);
}
-int main(int, char**)
-{
- for (int i = 0; i < 40; ++i)
- test<std::forward_list<int> >(i);
+int main(int, char**) {
+ for (int i = 0; i < 40; ++i)
+ test<std::forward_list<int> >(i);
#if TEST_STD_VER >= 11
- for (int i = 0; i < 40; ++i)
- test<std::forward_list<int, min_allocator<int>> >(i);
+ for (int i = 0; i < 40; ++i)
+ test<std::forward_list<int, min_allocator<int>> >(i);
#endif
- for (int i = 0; i < 40; ++i)
- test_stable(i);
+ for (int i = 0; i < 40; ++i)
+ test_stable(i);
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_flist.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_flist.pass.cpp
index d5d95b96919eaf5..4c91d7397adf039 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_flist.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_flist.pass.cpp
@@ -19,59 +19,52 @@
#include "min_allocator.h"
typedef int T;
-const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7};
-const T t2[] = {10, 11, 12, 13, 14, 15};
+const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7};
+const T t2[] = {10, 11, 12, 13, 14, 15};
const std::ptr
diff _t size_t1 = std::end(t1) - std::begin(t1);
const std::ptr
diff _t size_t2 = std::end(t2) - std::begin(t2);
template <class C>
-void
-testd(const C& c, int p, int l)
-{
- typename C::const_iterator i = c.begin();
- int n1 = 0;
- for (; n1 < p; ++n1, ++i)
- assert(*i == t1[n1]);
- for (int n2 = 0; n2 < l; ++n2, ++i)
- assert(*i == t2[n2]);
- for (; n1 < size_t1; ++n1, ++i)
- assert(*i == t1[n1]);
- assert(std::distance(c.begin(), c.end()) == size_t1 + l);
+void testd(const C& c, int p, int l) {
+ typename C::const_iterator i = c.begin();
+ int n1 = 0;
+ for (; n1 < p; ++n1, ++i)
+ assert(*i == t1[n1]);
+ for (int n2 = 0; n2 < l; ++n2, ++i)
+ assert(*i == t2[n2]);
+ for (; n1 < size_t1; ++n1, ++i)
+ assert(*i == t1[n1]);
+ assert(std::distance(c.begin(), c.end()) == size_t1 + l);
}
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
// splicing
diff erent containers
typedef std::forward_list<T> C;
- for (int l = 0; l <= size_t2; ++l)
- {
- for (int p = 0; p <= size_t1; ++p)
- {
- C c1(std::begin(t1), std::end(t1));
- C c2(t2, t2+l);
+ for (int l = 0; l <= size_t2; ++l) {
+ for (int p = 0; p <= size_t1; ++p) {
+ C c1(std::begin(t1), std::end(t1));
+ C c2(t2, t2 + l);
- c1.splice_after(std::next(c1.cbefore_begin(), p), std::move(c2));
- testd(c1, p, l);
- }
- }
+ c1.splice_after(std::next(c1.cbefore_begin(), p), std::move(c2));
+ testd(c1, p, l);
+ }
}
+ }
#if TEST_STD_VER >= 11
- {
+ {
// splicing
diff erent containers
typedef std::forward_list<T, min_allocator<T>> C;
- for (int l = 0; l <= size_t2; ++l)
- {
- for (int p = 0; p <= size_t1; ++p)
- {
- C c1(std::begin(t1), std::end(t1));
- C c2(t2, t2+l);
+ for (int l = 0; l <= size_t2; ++l) {
+ for (int p = 0; p <= size_t1; ++p) {
+ C c1(std::begin(t1), std::end(t1));
+ C c2(t2, t2 + l);
- c1.splice_after(std::next(c1.cbefore_begin(), p), std::move(c2));
- testd(c1, p, l);
- }
- }
+ c1.splice_after(std::next(c1.cbefore_begin(), p), std::move(c2));
+ testd(c1, p, l);
+ }
}
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_one.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_one.pass.cpp
index f54ff2ca1deaaf3..bb8bdea632547e2 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_one.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_one.pass.cpp
@@ -19,123 +19,102 @@
#include "min_allocator.h"
typedef int T;
-const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7};
-const T t2[] = {10, 11, 12};
+const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7};
+const T t2[] = {10, 11, 12};
const std::ptr
diff _t size_t1 = std::end(t1) - std::begin(t1);
const std::ptr
diff _t size_t2 = std::end(t2) - std::begin(t2);
template <class C>
-void
-testd(const C& c, int p, int f)
-{
- typename C::const_iterator i = c.begin();
- int n1 = 0;
- for (; n1 < p; ++n1, ++i)
- assert(*i == t1[n1]);
- for (int n2 = f; n2 < f+1; ++n2, ++i)
- assert(*i == t2[n2]);
- for (; n1 < size_t1; ++n1, ++i)
- assert(*i == t1[n1]);
- assert(std::distance(c.begin(), c.end()) == size_t1 + 1);
+void testd(const C& c, int p, int f) {
+ typename C::const_iterator i = c.begin();
+ int n1 = 0;
+ for (; n1 < p; ++n1, ++i)
+ assert(*i == t1[n1]);
+ for (int n2 = f; n2 < f + 1; ++n2, ++i)
+ assert(*i == t2[n2]);
+ for (; n1 < size_t1; ++n1, ++i)
+ assert(*i == t1[n1]);
+ assert(std::distance(c.begin(), c.end()) == size_t1 + 1);
}
template <class C>
-void
-tests(const C& c, int p, int f)
-{
- typename C::const_iterator i = c.begin();
- int n = 0;
- if (p == f || p == f+1)
- {
- for (n = 0; n < size_t1; ++n, ++i)
- assert(*i == t1[n]);
- }
- else if (p < f)
- {
- for (n = 0; n < p; ++n, ++i)
- assert(*i == t1[n]);
- for (n = f; n < f+1; ++n, ++i)
- assert(*i == t1[n]);
- for (n = p; n < f; ++n, ++i)
- assert(*i == t1[n]);
- for (n = f+1; n < size_t1; ++n, ++i)
- assert(*i == t1[n]);
- }
- else // p > f+1
- {
- for (n = 0; n < f; ++n, ++i)
- assert(*i == t1[n]);
- for (n = f+1; n < p; ++n, ++i)
- assert(*i == t1[n]);
- for (n = f; n < f+1; ++n, ++i)
- assert(*i == t1[n]);
- for (n = p; n < size_t1; ++n, ++i)
- assert(*i == t1[n]);
- }
- assert(std::distance(c.begin(), c.end()) == size_t1);
+void tests(const C& c, int p, int f) {
+ typename C::const_iterator i = c.begin();
+ int n = 0;
+ if (p == f || p == f + 1) {
+ for (n = 0; n < size_t1; ++n, ++i)
+ assert(*i == t1[n]);
+ } else if (p < f) {
+ for (n = 0; n < p; ++n, ++i)
+ assert(*i == t1[n]);
+ for (n = f; n < f + 1; ++n, ++i)
+ assert(*i == t1[n]);
+ for (n = p; n < f; ++n, ++i)
+ assert(*i == t1[n]);
+ for (n = f + 1; n < size_t1; ++n, ++i)
+ assert(*i == t1[n]);
+ } else // p > f+1
+ {
+ for (n = 0; n < f; ++n, ++i)
+ assert(*i == t1[n]);
+ for (n = f + 1; n < p; ++n, ++i)
+ assert(*i == t1[n]);
+ for (n = f; n < f + 1; ++n, ++i)
+ assert(*i == t1[n]);
+ for (n = p; n < size_t1; ++n, ++i)
+ assert(*i == t1[n]);
+ }
+ assert(std::distance(c.begin(), c.end()) == size_t1);
}
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
// splicing
diff erent containers
typedef std::forward_list<T> C;
- for (int f = 0; f <= size_t2-1; ++f)
- {
- for (int p = 0; p <= size_t1; ++p)
- {
- C c1(std::begin(t1), std::end(t1));
- C c2(std::begin(t2), std::end(t2));
+ for (int f = 0; f <= size_t2 - 1; ++f) {
+ for (int p = 0; p <= size_t1; ++p) {
+ C c1(std::begin(t1), std::end(t1));
+ C c2(std::begin(t2), std::end(t2));
- c1.splice_after(std::next(c1.cbefore_begin(), p), std::move(c2),
- std::next(c2.cbefore_begin(), f));
- testd(c1, p, f);
- }
+ c1.splice_after(std::next(c1.cbefore_begin(), p), std::move(c2), std::next(c2.cbefore_begin(), f));
+ testd(c1, p, f);
+ }
}
// splicing within same container
- for (int f = 0; f <= size_t1-1; ++f)
- {
- for (int p = 0; p <= size_t1; ++p)
- {
- C c1(std::begin(t1), std::end(t1));
+ for (int f = 0; f <= size_t1 - 1; ++f) {
+ for (int p = 0; p <= size_t1; ++p) {
+ C c1(std::begin(t1), std::end(t1));
- c1.splice_after(std::next(c1.cbefore_begin(), p), std::move(c1),
- std::next(c1.cbefore_begin(), f));
- tests(c1, p, f);
- }
- }
+ c1.splice_after(std::next(c1.cbefore_begin(), p), std::move(c1), std::next(c1.cbefore_begin(), f));
+ tests(c1, p, f);
+ }
}
+ }
#if TEST_STD_VER >= 11
- {
+ {
// splicing
diff erent containers
typedef std::forward_list<T, min_allocator<T>> C;
- for (int f = 0; f <= size_t2-1; ++f)
- {
- for (int p = 0; p <= size_t1; ++p)
- {
- C c1(std::begin(t1), std::end(t1));
- C c2(std::begin(t2), std::end(t2));
+ for (int f = 0; f <= size_t2 - 1; ++f) {
+ for (int p = 0; p <= size_t1; ++p) {
+ C c1(std::begin(t1), std::end(t1));
+ C c2(std::begin(t2), std::end(t2));
- c1.splice_after(std::next(c1.cbefore_begin(), p), std::move(c2),
- std::next(c2.cbefore_begin(), f));
- testd(c1, p, f);
- }
+ c1.splice_after(std::next(c1.cbefore_begin(), p), std::move(c2), std::next(c2.cbefore_begin(), f));
+ testd(c1, p, f);
+ }
}
// splicing within same container
- for (int f = 0; f <= size_t1-1; ++f)
- {
- for (int p = 0; p <= size_t1; ++p)
- {
- C c1(std::begin(t1), std::end(t1));
+ for (int f = 0; f <= size_t1 - 1; ++f) {
+ for (int p = 0; p <= size_t1; ++p) {
+ C c1(std::begin(t1), std::end(t1));
- c1.splice_after(std::next(c1.cbefore_begin(), p), std::move(c1),
- std::next(c1.cbefore_begin(), f));
- tests(c1, p, f);
- }
- }
+ c1.splice_after(std::next(c1.cbefore_begin(), p), std::move(c1), std::next(c1.cbefore_begin(), f));
+ tests(c1, p, f);
+ }
}
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_range.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_range.pass.cpp
index f2ab6e5faa19d92..99b3ed1c7836be9 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_range.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_range.pass.cpp
@@ -20,152 +20,141 @@
#include "min_allocator.h"
typedef std::ptr
diff _t T;
-const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7};
-const T t2[] = {10, 11, 12, 13, 14, 15};
+const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7};
+const T t2[] = {10, 11, 12, 13, 14, 15};
const std::ptr
diff _t size_t1 = std::end(t1) - std::begin(t1);
const std::ptr
diff _t size_t2 = std::end(t2) - std::begin(t2);
template <class C>
-void
-testd(const C& c, std::ptr
diff _t p, ptr
diff _t f, ptr
diff _t l)
-{
- typename C::const_iterator i = c.begin();
- std::ptr
diff _t n1 = 0;
- for (; n1 < p; ++n1, ++i)
- assert(*i == t1[n1]);
- for (std::ptr
diff _t n2 = f; n2 < l-1; ++n2, ++i)
- assert(*i == t2[n2]);
- for (; n1 < size_t1; ++n1, ++i)
- assert(*i == t1[n1]);
- assert(std::distance(c.begin(), c.end()) == size_t1 + (l > f+1 ? l-1-f : 0));
+void testd(const C& c, std::ptr
diff _t p, ptr
diff _t f, ptr
diff _t l) {
+ typename C::const_iterator i = c.begin();
+ std::ptr
diff _t n1 = 0;
+ for (; n1 < p; ++n1, ++i)
+ assert(*i == t1[n1]);
+ for (std::ptr
diff _t n2 = f; n2 < l - 1; ++n2, ++i)
+ assert(*i == t2[n2]);
+ for (; n1 < size_t1; ++n1, ++i)
+ assert(*i == t1[n1]);
+ assert(std::distance(c.begin(), c.end()) == size_t1 + (l > f + 1 ? l - 1 - f : 0));
}
template <class C>
-void
-tests(const C& c, std::ptr
diff _t p, ptr
diff _t f, ptr
diff _t l)
-{
- typename C::const_iterator i = c.begin();
- std::ptr
diff _t n = 0;
- std::ptr
diff _t d = l > f+1 ? l-1-f : 0;
- if (d == 0 || p == f)
- {
- for (n = 0; n < size_t1; ++n, ++i)
- assert(*i == t1[n]);
- }
- else if (p < f)
- {
- for (n = 0; n < p; ++n, ++i)
- assert(*i == t1[n]);
- for (n = f; n < l-1; ++n, ++i)
- assert(*i == t1[n]);
- for (n = p; n < f; ++n, ++i)
- assert(*i == t1[n]);
- for (n = l-1; n < size_t1; ++n, ++i)
- assert(*i == t1[n]);
- }
- else // p > f
- {
- for (n = 0; n < f; ++n, ++i)
- assert(*i == t1[n]);
- for (n = l-1; n < p; ++n, ++i)
- assert(*i == t1[n]);
- for (n = f; n < l-1; ++n, ++i)
- assert(*i == t1[n]);
- for (n = p; n < size_t1; ++n, ++i)
- assert(*i == t1[n]);
- }
- assert(std::distance(c.begin(), c.end()) == size_t1);
+void tests(const C& c, std::ptr
diff _t p, ptr
diff _t f, ptr
diff _t l) {
+ typename C::const_iterator i = c.begin();
+ std::ptr
diff _t n = 0;
+ std::ptr
diff _t d = l > f + 1 ? l - 1 - f : 0;
+ if (d == 0 || p == f) {
+ for (n = 0; n < size_t1; ++n, ++i)
+ assert(*i == t1[n]);
+ } else if (p < f) {
+ for (n = 0; n < p; ++n, ++i)
+ assert(*i == t1[n]);
+ for (n = f; n < l - 1; ++n, ++i)
+ assert(*i == t1[n]);
+ for (n = p; n < f; ++n, ++i)
+ assert(*i == t1[n]);
+ for (n = l - 1; n < size_t1; ++n, ++i)
+ assert(*i == t1[n]);
+ } else // p > f
+ {
+ for (n = 0; n < f; ++n, ++i)
+ assert(*i == t1[n]);
+ for (n = l - 1; n < p; ++n, ++i)
+ assert(*i == t1[n]);
+ for (n = f; n < l - 1; ++n, ++i)
+ assert(*i == t1[n]);
+ for (n = p; n < size_t1; ++n, ++i)
+ assert(*i == t1[n]);
+ }
+ assert(std::distance(c.begin(), c.end()) == size_t1);
}
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
// splicing
diff erent containers
typedef std::forward_list<T> C;
- for (std::ptr
diff _t f = 0; f <= size_t2+1; ++f)
- {
- for (std::ptr
diff _t l = f; l <= size_t2+1; ++l)
- {
- for (std::ptr
diff _t p = 0; p <= size_t1; ++p)
- {
- C c1(std::begin(t1), std::end(t1));
- C c2(std::begin(t2), std::end(t2));
-
- c1.splice_after(std::next(c1.cbefore_begin(), p), std::move(c2),
- std::next(c2.cbefore_begin(), f), std::next(c2.cbefore_begin(), l));
- testd(c1, p, f, l);
- }
+ for (std::ptr
diff _t f = 0; f <= size_t2 + 1; ++f) {
+ for (std::ptr
diff _t l = f; l <= size_t2 + 1; ++l) {
+ for (std::ptr
diff _t p = 0; p <= size_t1; ++p) {
+ C c1(std::begin(t1), std::end(t1));
+ C c2(std::begin(t2), std::end(t2));
+
+ c1.splice_after(std::next(c1.cbefore_begin(), p),
+ std::move(c2),
+ std::next(c2.cbefore_begin(), f),
+ std::next(c2.cbefore_begin(), l));
+ testd(c1, p, f, l);
}
+ }
}
// splicing within same container
- for (std::ptr
diff _t f = 0; f <= size_t1+1; ++f)
- {
- for (std::ptr
diff _t l = f; l <= size_t1; ++l)
- {
- for (std::ptr
diff _t p = 0; p <= f; ++p)
- {
- C c1(std::begin(t1), std::end(t1));
-
- c1.splice_after(std::next(c1.cbefore_begin(), p), std::move(c1),
- std::next(c1.cbefore_begin(), f), std::next(c1.cbefore_begin(), l));
- tests(c1, p, f, l);
- }
- for (std::ptr
diff _t p = l; p <= size_t1; ++p)
- {
- C c1(std::begin(t1), std::end(t1));
-
- c1.splice_after(std::next(c1.cbefore_begin(), p), std::move(c1),
- std::next(c1.cbefore_begin(), f), std::next(c1.cbefore_begin(), l));
- tests(c1, p, f, l);
- }
+ for (std::ptr
diff _t f = 0; f <= size_t1 + 1; ++f) {
+ for (std::ptr
diff _t l = f; l <= size_t1; ++l) {
+ for (std::ptr
diff _t p = 0; p <= f; ++p) {
+ C c1(std::begin(t1), std::end(t1));
+
+ c1.splice_after(std::next(c1.cbefore_begin(), p),
+ std::move(c1),
+ std::next(c1.cbefore_begin(), f),
+ std::next(c1.cbefore_begin(), l));
+ tests(c1, p, f, l);
}
+ for (std::ptr
diff _t p = l; p <= size_t1; ++p) {
+ C c1(std::begin(t1), std::end(t1));
+
+ c1.splice_after(std::next(c1.cbefore_begin(), p),
+ std::move(c1),
+ std::next(c1.cbefore_begin(), f),
+ std::next(c1.cbefore_begin(), l));
+ tests(c1, p, f, l);
+ }
+ }
}
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
// splicing
diff erent containers
typedef std::forward_list<T, min_allocator<T>> C;
- for (std::ptr
diff _t f = 0; f <= size_t2+1; ++f)
- {
- for (std::ptr
diff _t l = f; l <= size_t2+1; ++l)
- {
- for (std::ptr
diff _t p = 0; p <= size_t1; ++p)
- {
- C c1(std::begin(t1), std::end(t1));
- C c2(std::begin(t2), std::end(t2));
-
- c1.splice_after(std::next(c1.cbefore_begin(), p), std::move(c2),
- std::next(c2.cbefore_begin(), f), std::next(c2.cbefore_begin(), l));
- testd(c1, p, f, l);
- }
+ for (std::ptr
diff _t f = 0; f <= size_t2 + 1; ++f) {
+ for (std::ptr
diff _t l = f; l <= size_t2 + 1; ++l) {
+ for (std::ptr
diff _t p = 0; p <= size_t1; ++p) {
+ C c1(std::begin(t1), std::end(t1));
+ C c2(std::begin(t2), std::end(t2));
+
+ c1.splice_after(std::next(c1.cbefore_begin(), p),
+ std::move(c2),
+ std::next(c2.cbefore_begin(), f),
+ std::next(c2.cbefore_begin(), l));
+ testd(c1, p, f, l);
}
+ }
}
// splicing within same container
- for (std::ptr
diff _t f = 0; f <= size_t1+1; ++f)
- {
- for (std::ptr
diff _t l = f; l <= size_t1; ++l)
- {
- for (std::ptr
diff _t p = 0; p <= f; ++p)
- {
- C c1(std::begin(t1), std::end(t1));
-
- c1.splice_after(std::next(c1.cbefore_begin(), p), std::move(c1),
- std::next(c1.cbefore_begin(), f), std::next(c1.cbefore_begin(), l));
- tests(c1, p, f, l);
- }
- for (std::ptr
diff _t p = l; p <= size_t1; ++p)
- {
- C c1(std::begin(t1), std::end(t1));
-
- c1.splice_after(std::next(c1.cbefore_begin(), p), std::move(c1),
- std::next(c1.cbefore_begin(), f), std::next(c1.cbefore_begin(), l));
- tests(c1, p, f, l);
- }
+ for (std::ptr
diff _t f = 0; f <= size_t1 + 1; ++f) {
+ for (std::ptr
diff _t l = f; l <= size_t1; ++l) {
+ for (std::ptr
diff _t p = 0; p <= f; ++p) {
+ C c1(std::begin(t1), std::end(t1));
+
+ c1.splice_after(std::next(c1.cbefore_begin(), p),
+ std::move(c1),
+ std::next(c1.cbefore_begin(), f),
+ std::next(c1.cbefore_begin(), l));
+ tests(c1, p, f, l);
}
+ for (std::ptr
diff _t p = l; p <= size_t1; ++p) {
+ C c1(std::begin(t1), std::end(t1));
+
+ c1.splice_after(std::next(c1.cbefore_begin(), p),
+ std::move(c1),
+ std::next(c1.cbefore_begin(), f),
+ std::next(c1.cbefore_begin(), l));
+ tests(c1, p, f, l);
+ }
+ }
}
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/unique.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/unique.pass.cpp
index 793fcf382da43dd..ebd1a79cdb4bcd9 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/unique.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/unique.pass.cpp
@@ -19,118 +19,116 @@
#include "min_allocator.h"
template <class L>
-void do_unique(L &l, typename L::size_type expected)
-{
- typename L::size_type old_size = std::distance(l.begin(), l.end());
+void do_unique(L& l, typename L::size_type expected) {
+ typename L::size_type old_size = std::distance(l.begin(), l.end());
#if TEST_STD_VER > 17
- ASSERT_SAME_TYPE(decltype(l.unique()), typename L::size_type);
- assert(l.unique() == expected);
+ ASSERT_SAME_TYPE(decltype(l.unique()), typename L::size_type);
+ assert(l.unique() == expected);
#else
- ASSERT_SAME_TYPE(decltype(l.unique()), void);
- l.unique();
+ ASSERT_SAME_TYPE(decltype(l.unique()), void);
+ l.unique();
#endif
- assert(old_size - std::distance(l.begin(), l.end()) == expected);
+ assert(old_size - std::distance(l.begin(), l.end()) == expected);
}
-int main(int, char**)
-{
- {
- typedef int T;
- typedef std::forward_list<T> C;
- const T t1[] = {0, 5, 5, 0, 0, 0, 5};
- const T t2[] = {0, 5, 0, 5};
- C c1(std::begin(t1), std::end(t1));
- C c2(std::begin(t2), std::end(t2));
- do_unique(c1, 3);
- assert(c1 == c2);
- }
- {
- typedef int T;
- typedef std::forward_list<T> C;
- const T t1[] = {0, 0, 0, 0};
- const T t2[] = {0};
- C c1(std::begin(t1), std::end(t1));
- C c2(std::begin(t2), std::end(t2));
- do_unique(c1, 3);
- assert(c1 == c2);
- }
- {
- typedef int T;
- typedef std::forward_list<T> C;
- const T t1[] = {5, 5, 5};
- const T t2[] = {5};
- C c1(std::begin(t1), std::end(t1));
- C c2(std::begin(t2), std::end(t2));
- do_unique(c1, 2);
- assert(c1 == c2);
- }
- {
- typedef int T;
- typedef std::forward_list<T> C;
- C c1;
- C c2;
- do_unique(c1, 0);
- assert(c1 == c2);
- }
- {
- typedef int T;
- typedef std::forward_list<T> C;
- const T t1[] = {5, 5, 5, 0};
- const T t2[] = {5, 0};
- C c1(std::begin(t1), std::end(t1));
- C c2(std::begin(t2), std::end(t2));
- do_unique(c1, 2);
- assert(c1 == c2);
- }
+int main(int, char**) {
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ const T t1[] = {0, 5, 5, 0, 0, 0, 5};
+ const T t2[] = {0, 5, 0, 5};
+ C c1(std::begin(t1), std::end(t1));
+ C c2(std::begin(t2), std::end(t2));
+ do_unique(c1, 3);
+ assert(c1 == c2);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ const T t1[] = {0, 0, 0, 0};
+ const T t2[] = {0};
+ C c1(std::begin(t1), std::end(t1));
+ C c2(std::begin(t2), std::end(t2));
+ do_unique(c1, 3);
+ assert(c1 == c2);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ const T t1[] = {5, 5, 5};
+ const T t2[] = {5};
+ C c1(std::begin(t1), std::end(t1));
+ C c2(std::begin(t2), std::end(t2));
+ do_unique(c1, 2);
+ assert(c1 == c2);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ C c1;
+ C c2;
+ do_unique(c1, 0);
+ assert(c1 == c2);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ const T t1[] = {5, 5, 5, 0};
+ const T t2[] = {5, 0};
+ C c1(std::begin(t1), std::end(t1));
+ C c2(std::begin(t2), std::end(t2));
+ do_unique(c1, 2);
+ assert(c1 == c2);
+ }
#if TEST_STD_VER >= 11
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- const T t1[] = {0, 5, 5, 0, 0, 0, 5};
- const T t2[] = {0, 5, 0, 5};
- C c1(std::begin(t1), std::end(t1));
- C c2(std::begin(t2), std::end(t2));
- do_unique(c1, 3);
- assert(c1 == c2);
- }
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- const T t1[] = {0, 0, 0, 0};
- const T t2[] = {0};
- C c1(std::begin(t1), std::end(t1));
- C c2(std::begin(t2), std::end(t2));
- do_unique(c1, 3);
- assert(c1 == c2);
- }
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- const T t1[] = {5, 5, 5};
- const T t2[] = {5};
- C c1(std::begin(t1), std::end(t1));
- C c2(std::begin(t2), std::end(t2));
- do_unique(c1, 2);
- assert(c1 == c2);
- }
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- C c1;
- C c2;
- do_unique(c1, 0);
- assert(c1 == c2);
- }
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- const T t1[] = {5, 5, 5, 0};
- const T t2[] = {5, 0};
- C c1(std::begin(t1), std::end(t1));
- C c2(std::begin(t2), std::end(t2));
- do_unique(c1, 2);
- assert(c1 == c2);
- }
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ const T t1[] = {0, 5, 5, 0, 0, 0, 5};
+ const T t2[] = {0, 5, 0, 5};
+ C c1(std::begin(t1), std::end(t1));
+ C c2(std::begin(t2), std::end(t2));
+ do_unique(c1, 3);
+ assert(c1 == c2);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ const T t1[] = {0, 0, 0, 0};
+ const T t2[] = {0};
+ C c1(std::begin(t1), std::end(t1));
+ C c2(std::begin(t2), std::end(t2));
+ do_unique(c1, 3);
+ assert(c1 == c2);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ const T t1[] = {5, 5, 5};
+ const T t2[] = {5};
+ C c1(std::begin(t1), std::end(t1));
+ C c2(std::begin(t2), std::end(t2));
+ do_unique(c1, 2);
+ assert(c1 == c2);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ C c1;
+ C c2;
+ do_unique(c1, 0);
+ assert(c1 == c2);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ const T t1[] = {5, 5, 5, 0};
+ const T t2[] = {5, 0};
+ C c1(std::begin(t1), std::end(t1));
+ C c2(std::begin(t2), std::end(t2));
+ do_unique(c1, 2);
+ assert(c1 == c2);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/unique_pred.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/unique_pred.pass.cpp
index 3216717811d86b8..408cbf6ae9c20d7 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/unique_pred.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.ops/unique_pred.pass.cpp
@@ -20,20 +20,18 @@
#include "min_allocator.h"
template <class L, class Predicate>
-void do_unique(L &l, Predicate pred, typename L::size_type expected)
-{
- typename L::size_type old_size = std::distance(l.begin(), l.end());
+void do_unique(L& l, Predicate pred, typename L::size_type expected) {
+ typename L::size_type old_size = std::distance(l.begin(), l.end());
#if TEST_STD_VER > 17
- ASSERT_SAME_TYPE(decltype(l.unique(pred)), typename L::size_type);
- assert(l.unique(pred) == expected);
+ ASSERT_SAME_TYPE(decltype(l.unique(pred)), typename L::size_type);
+ assert(l.unique(pred) == expected);
#else
- ASSERT_SAME_TYPE(decltype(l.unique(pred)), void);
- l.unique(pred);
+ ASSERT_SAME_TYPE(decltype(l.unique(pred)), void);
+ l.unique(pred);
#endif
- assert(old_size - std::distance(l.begin(), l.end()) == expected);
+ assert(old_size - std::distance(l.begin(), l.end()) == expected);
}
-
struct PredLWG526 {
PredLWG526(int i) : i_(i) {}
~PredLWG526() { i_ = -32767; }
@@ -43,126 +41,120 @@ struct PredLWG526 {
int i_;
};
+bool g(int x, int y) { return x == y; }
-bool g(int x, int y)
-{
- return x == y;
-}
-
-int main(int, char**)
-{
- {
- typedef int T;
- typedef std::forward_list<T> C;
- const T t1[] = {0, 5, 5, 0, 0, 0, 5};
- const T t2[] = {0, 5, 0, 5};
- C c1(std::begin(t1), std::end(t1));
- C c2(std::begin(t2), std::end(t2));
- do_unique(c1, g, 3);
- assert(c1 == c2);
- }
- {
- typedef int T;
- typedef std::forward_list<T> C;
- const T t1[] = {0, 0, 0, 0};
- const T t2[] = {0};
- C c1(std::begin(t1), std::end(t1));
- C c2(std::begin(t2), std::end(t2));
- do_unique(c1, g, 3);
- assert(c1 == c2);
- }
- {
- typedef int T;
- typedef std::forward_list<T> C;
- const T t1[] = {5, 5, 5};
- const T t2[] = {5};
- C c1(std::begin(t1), std::end(t1));
- C c2(std::begin(t2), std::end(t2));
- do_unique(c1, g, 2);
- assert(c1 == c2);
- }
- {
- typedef int T;
- typedef std::forward_list<T> C;
- C c1;
- C c2;
- do_unique(c1, g, 0);
- assert(c1 == c2);
- }
- {
- typedef int T;
- typedef std::forward_list<T> C;
- const T t1[] = {5, 5, 5, 0};
- const T t2[] = {5, 0};
- C c1(std::begin(t1), std::end(t1));
- C c2(std::begin(t2), std::end(t2));
- do_unique(c1, g, 2);
- assert(c1 == c2);
- }
+int main(int, char**) {
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ const T t1[] = {0, 5, 5, 0, 0, 0, 5};
+ const T t2[] = {0, 5, 0, 5};
+ C c1(std::begin(t1), std::end(t1));
+ C c2(std::begin(t2), std::end(t2));
+ do_unique(c1, g, 3);
+ assert(c1 == c2);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ const T t1[] = {0, 0, 0, 0};
+ const T t2[] = {0};
+ C c1(std::begin(t1), std::end(t1));
+ C c2(std::begin(t2), std::end(t2));
+ do_unique(c1, g, 3);
+ assert(c1 == c2);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ const T t1[] = {5, 5, 5};
+ const T t2[] = {5};
+ C c1(std::begin(t1), std::end(t1));
+ C c2(std::begin(t2), std::end(t2));
+ do_unique(c1, g, 2);
+ assert(c1 == c2);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ C c1;
+ C c2;
+ do_unique(c1, g, 0);
+ assert(c1 == c2);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T> C;
+ const T t1[] = {5, 5, 5, 0};
+ const T t2[] = {5, 0};
+ C c1(std::begin(t1), std::end(t1));
+ C c2(std::begin(t2), std::end(t2));
+ do_unique(c1, g, 2);
+ assert(c1 == c2);
+ }
- { // LWG issue #526
+ { // LWG issue #526
int a1[] = {1, 1, 1, 2, 3, 5, 2, 11};
- int a2[] = {1, 2, 3, 5, 2, 11};
+ int a2[] = {1, 2, 3, 5, 2, 11};
std::forward_list<PredLWG526> c1(a1, a1 + 8);
do_unique(c1, std::ref(c1.front()), 2);
- for (std::size_t i = 0; i < 6; ++i)
- {
- assert(!c1.empty());
- assert(c1.front() == a2[i]);
- c1.pop_front();
+ for (std::size_t i = 0; i < 6; ++i) {
+ assert(!c1.empty());
+ assert(c1.front() == a2[i]);
+ c1.pop_front();
}
assert(c1.empty());
- }
+ }
#if TEST_STD_VER >= 11
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- const T t1[] = {0, 5, 5, 0, 0, 0, 5};
- const T t2[] = {0, 5, 0, 5};
- C c1(std::begin(t1), std::end(t1));
- C c2(std::begin(t2), std::end(t2));
- do_unique(c1, g, 3);
- assert(c1 == c2);
- }
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- const T t1[] = {0, 0, 0, 0};
- const T t2[] = {0};
- C c1(std::begin(t1), std::end(t1));
- C c2(std::begin(t2), std::end(t2));
- do_unique(c1, g, 3);
- assert(c1 == c2);
- }
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- const T t1[] = {5, 5, 5};
- const T t2[] = {5};
- C c1(std::begin(t1), std::end(t1));
- C c2(std::begin(t2), std::end(t2));
- do_unique(c1, g, 2);
- assert(c1 == c2);
- }
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- C c1;
- C c2;
- do_unique(c1, g, 0);
- assert(c1 == c2);
- }
- {
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- const T t1[] = {5, 5, 5, 0};
- const T t2[] = {5, 0};
- C c1(std::begin(t1), std::end(t1));
- C c2(std::begin(t2), std::end(t2));
- do_unique(c1, g, 2);
- assert(c1 == c2);
- }
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ const T t1[] = {0, 5, 5, 0, 0, 0, 5};
+ const T t2[] = {0, 5, 0, 5};
+ C c1(std::begin(t1), std::end(t1));
+ C c2(std::begin(t2), std::end(t2));
+ do_unique(c1, g, 3);
+ assert(c1 == c2);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ const T t1[] = {0, 0, 0, 0};
+ const T t2[] = {0};
+ C c1(std::begin(t1), std::end(t1));
+ C c2(std::begin(t2), std::end(t2));
+ do_unique(c1, g, 3);
+ assert(c1 == c2);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ const T t1[] = {5, 5, 5};
+ const T t2[] = {5};
+ C c1(std::begin(t1), std::end(t1));
+ C c2(std::begin(t2), std::end(t2));
+ do_unique(c1, g, 2);
+ assert(c1 == c2);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ C c1;
+ C c2;
+ do_unique(c1, g, 0);
+ assert(c1 == c2);
+ }
+ {
+ typedef int T;
+ typedef std::forward_list<T, min_allocator<T>> C;
+ const T t1[] = {5, 5, 5, 0};
+ const T t2[] = {5, 0};
+ C c1(std::begin(t1), std::end(t1));
+ C c2(std::begin(t2), std::end(t2));
+ do_unique(c1, g, 2);
+ assert(c1 == c2);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.spec/equal.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.spec/equal.pass.cpp
index b21035f7dd7468a..ef6b72ee360a93b 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.spec/equal.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.spec/equal.pass.cpp
@@ -25,36 +25,33 @@
#include "min_allocator.h"
template <class C>
-void test(int N, int M)
-{
- C c1;
- for (int i = 0; i < N; ++i)
- c1.push_front(i);
- C c2;
- for (int i = 0; i < M; ++i)
- c2.push_front(i);
- if (N == M)
- assert(c1 == c2);
- else
- assert(c1 != c2);
- c2 = c1;
+void test(int N, int M) {
+ C c1;
+ for (int i = 0; i < N; ++i)
+ c1.push_front(i);
+ C c2;
+ for (int i = 0; i < M; ++i)
+ c2.push_front(i);
+ if (N == M)
assert(c1 == c2);
- if (N > 0)
- {
- c2.front() = N+1;
- assert(c1 != c2);
- }
+ else
+ assert(c1 != c2);
+ c2 = c1;
+ assert(c1 == c2);
+ if (N > 0) {
+ c2.front() = N + 1;
+ assert(c1 != c2);
+ }
}
-int main(int, char**)
-{
- for (int i = 0; i < 10; ++i)
- for (int j = 0; j < 10; ++j)
- test<std::forward_list<int> >(i, j);
+int main(int, char**) {
+ for (int i = 0; i < 10; ++i)
+ for (int j = 0; j < 10; ++j)
+ test<std::forward_list<int> >(i, j);
#if TEST_STD_VER >= 11
- for (int i = 0; i < 10; ++i)
- for (int j = 0; j < 10; ++j)
- test<std::forward_list<int, min_allocator<int>> >(i, j);
+ for (int i = 0; i < 10; ++i)
+ for (int j = 0; j < 10; ++j)
+ test<std::forward_list<int, min_allocator<int>> >(i, j);
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.spec/member_swap.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.spec/member_swap.pass.cpp
index e7eea2e87bfec35..e50f9e6e9e47372 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.spec/member_swap.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.spec/member_swap.pass.cpp
@@ -18,244 +18,243 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef int T;
- typedef test_allocator<T> A;
- typedef std::forward_list<T, A> C;
- const T t1[] = {0, 1, 2, 3, 4, 5};
- C c1(std::begin(t1), std::end(t1), A(1, 1));
- const T t2[] = {10, 11, 12};
- C c2(std::begin(t2), std::end(t2), A(1, 2));
- c1.swap(c2);
+int main(int, char**) {
+ {
+ typedef int T;
+ typedef test_allocator<T> A;
+ typedef std::forward_list<T, A> C;
+ const T t1[] = {0, 1, 2, 3, 4, 5};
+ C c1(std::begin(t1), std::end(t1), A(1, 1));
+ const T t2[] = {10, 11, 12};
+ C c2(std::begin(t2), std::end(t2), A(1, 2));
+ c1.swap(c2);
- assert(std::distance(c1.begin(), c1.end()) == 3);
- assert(*std::next(c1.begin(), 0) == 10);
- assert(*std::next(c1.begin(), 1) == 11);
- assert(*std::next(c1.begin(), 2) == 12);
- assert(c1.get_allocator().get_id() == 1);
+ assert(std::distance(c1.begin(), c1.end()) == 3);
+ assert(*std::next(c1.begin(), 0) == 10);
+ assert(*std::next(c1.begin(), 1) == 11);
+ assert(*std::next(c1.begin(), 2) == 12);
+ assert(c1.get_allocator().get_id() == 1);
- assert(std::distance(c2.begin(), c2.end()) == 6);
- assert(*std::next(c2.begin(), 0) == 0);
- assert(*std::next(c2.begin(), 1) == 1);
- assert(*std::next(c2.begin(), 2) == 2);
- assert(*std::next(c2.begin(), 3) == 3);
- assert(*std::next(c2.begin(), 4) == 4);
- assert(*std::next(c2.begin(), 5) == 5);
- assert(c2.get_allocator().get_id() == 2);
- }
- {
- typedef int T;
- typedef test_allocator<T> A;
- typedef std::forward_list<T, A> C;
- const T t1[] = {0, 1, 2, 3, 4, 5};
- C c1(std::begin(t1), std::end(t1), A(1, 1));
- C c2(A(1, 2));
- c1.swap(c2);
+ assert(std::distance(c2.begin(), c2.end()) == 6);
+ assert(*std::next(c2.begin(), 0) == 0);
+ assert(*std::next(c2.begin(), 1) == 1);
+ assert(*std::next(c2.begin(), 2) == 2);
+ assert(*std::next(c2.begin(), 3) == 3);
+ assert(*std::next(c2.begin(), 4) == 4);
+ assert(*std::next(c2.begin(), 5) == 5);
+ assert(c2.get_allocator().get_id() == 2);
+ }
+ {
+ typedef int T;
+ typedef test_allocator<T> A;
+ typedef std::forward_list<T, A> C;
+ const T t1[] = {0, 1, 2, 3, 4, 5};
+ C c1(std::begin(t1), std::end(t1), A(1, 1));
+ C c2(A(1, 2));
+ c1.swap(c2);
- assert(std::distance(c1.begin(), c1.end()) == 0);
- assert(c1.get_allocator().get_id() == 1);
+ assert(std::distance(c1.begin(), c1.end()) == 0);
+ assert(c1.get_allocator().get_id() == 1);
- assert(std::distance(c2.begin(), c2.end()) == 6);
- assert(*std::next(c2.begin(), 0) == 0);
- assert(*std::next(c2.begin(), 1) == 1);
- assert(*std::next(c2.begin(), 2) == 2);
- assert(*std::next(c2.begin(), 3) == 3);
- assert(*std::next(c2.begin(), 4) == 4);
- assert(*std::next(c2.begin(), 5) == 5);
- assert(c2.get_allocator().get_id() == 2);
- }
- {
- typedef int T;
- typedef test_allocator<T> A;
- typedef std::forward_list<T, A> C;
- C c1(A(1, 1));
- const T t2[] = {10, 11, 12};
- C c2(std::begin(t2), std::end(t2), A(1, 2));
- c1.swap(c2);
+ assert(std::distance(c2.begin(), c2.end()) == 6);
+ assert(*std::next(c2.begin(), 0) == 0);
+ assert(*std::next(c2.begin(), 1) == 1);
+ assert(*std::next(c2.begin(), 2) == 2);
+ assert(*std::next(c2.begin(), 3) == 3);
+ assert(*std::next(c2.begin(), 4) == 4);
+ assert(*std::next(c2.begin(), 5) == 5);
+ assert(c2.get_allocator().get_id() == 2);
+ }
+ {
+ typedef int T;
+ typedef test_allocator<T> A;
+ typedef std::forward_list<T, A> C;
+ C c1(A(1, 1));
+ const T t2[] = {10, 11, 12};
+ C c2(std::begin(t2), std::end(t2), A(1, 2));
+ c1.swap(c2);
- assert(std::distance(c1.begin(), c1.end()) == 3);
- assert(*std::next(c1.begin(), 0) == 10);
- assert(*std::next(c1.begin(), 1) == 11);
- assert(*std::next(c1.begin(), 2) == 12);
- assert(c1.get_allocator().get_id() == 1);
+ assert(std::distance(c1.begin(), c1.end()) == 3);
+ assert(*std::next(c1.begin(), 0) == 10);
+ assert(*std::next(c1.begin(), 1) == 11);
+ assert(*std::next(c1.begin(), 2) == 12);
+ assert(c1.get_allocator().get_id() == 1);
- assert(std::distance(c2.begin(), c2.end()) == 0);
- assert(c2.get_allocator().get_id() == 2);
- }
- {
- typedef int T;
- typedef test_allocator<T> A;
- typedef std::forward_list<T, A> C;
- C c1(A(1, 1));
- C c2(A(1, 2));
- c1.swap(c2);
+ assert(std::distance(c2.begin(), c2.end()) == 0);
+ assert(c2.get_allocator().get_id() == 2);
+ }
+ {
+ typedef int T;
+ typedef test_allocator<T> A;
+ typedef std::forward_list<T, A> C;
+ C c1(A(1, 1));
+ C c2(A(1, 2));
+ c1.swap(c2);
- assert(std::distance(c1.begin(), c1.end()) == 0);
- assert(c1.get_allocator().get_id() == 1);
+ assert(std::distance(c1.begin(), c1.end()) == 0);
+ assert(c1.get_allocator().get_id() == 1);
- assert(std::distance(c2.begin(), c2.end()) == 0);
- assert(c2.get_allocator().get_id() == 2);
- }
+ assert(std::distance(c2.begin(), c2.end()) == 0);
+ assert(c2.get_allocator().get_id() == 2);
+ }
- {
- typedef int T;
- typedef other_allocator<T> A;
- typedef std::forward_list<T, A> C;
- const T t1[] = {0, 1, 2, 3, 4, 5};
- C c1(std::begin(t1), std::end(t1), A(1));
- const T t2[] = {10, 11, 12};
- C c2(std::begin(t2), std::end(t2), A(2));
- c1.swap(c2);
+ {
+ typedef int T;
+ typedef other_allocator<T> A;
+ typedef std::forward_list<T, A> C;
+ const T t1[] = {0, 1, 2, 3, 4, 5};
+ C c1(std::begin(t1), std::end(t1), A(1));
+ const T t2[] = {10, 11, 12};
+ C c2(std::begin(t2), std::end(t2), A(2));
+ c1.swap(c2);
- assert(std::distance(c1.begin(), c1.end()) == 3);
- assert(*std::next(c1.begin(), 0) == 10);
- assert(*std::next(c1.begin(), 1) == 11);
- assert(*std::next(c1.begin(), 2) == 12);
- assert(c1.get_allocator() == A(2));
+ assert(std::distance(c1.begin(), c1.end()) == 3);
+ assert(*std::next(c1.begin(), 0) == 10);
+ assert(*std::next(c1.begin(), 1) == 11);
+ assert(*std::next(c1.begin(), 2) == 12);
+ assert(c1.get_allocator() == A(2));
- assert(std::distance(c2.begin(), c2.end()) == 6);
- assert(*std::next(c2.begin(), 0) == 0);
- assert(*std::next(c2.begin(), 1) == 1);
- assert(*std::next(c2.begin(), 2) == 2);
- assert(*std::next(c2.begin(), 3) == 3);
- assert(*std::next(c2.begin(), 4) == 4);
- assert(*std::next(c2.begin(), 5) == 5);
- assert(c2.get_allocator() == A(1));
- }
- {
- typedef int T;
- typedef other_allocator<T> A;
- typedef std::forward_list<T, A> C;
- const T t1[] = {0, 1, 2, 3, 4, 5};
- C c1(std::begin(t1), std::end(t1), A(1));
- C c2(A(2));
- c1.swap(c2);
+ assert(std::distance(c2.begin(), c2.end()) == 6);
+ assert(*std::next(c2.begin(), 0) == 0);
+ assert(*std::next(c2.begin(), 1) == 1);
+ assert(*std::next(c2.begin(), 2) == 2);
+ assert(*std::next(c2.begin(), 3) == 3);
+ assert(*std::next(c2.begin(), 4) == 4);
+ assert(*std::next(c2.begin(), 5) == 5);
+ assert(c2.get_allocator() == A(1));
+ }
+ {
+ typedef int T;
+ typedef other_allocator<T> A;
+ typedef std::forward_list<T, A> C;
+ const T t1[] = {0, 1, 2, 3, 4, 5};
+ C c1(std::begin(t1), std::end(t1), A(1));
+ C c2(A(2));
+ c1.swap(c2);
- assert(std::distance(c1.begin(), c1.end()) == 0);
- assert(c1.get_allocator() == A(2));
+ assert(std::distance(c1.begin(), c1.end()) == 0);
+ assert(c1.get_allocator() == A(2));
- assert(std::distance(c2.begin(), c2.end()) == 6);
- assert(*std::next(c2.begin(), 0) == 0);
- assert(*std::next(c2.begin(), 1) == 1);
- assert(*std::next(c2.begin(), 2) == 2);
- assert(*std::next(c2.begin(), 3) == 3);
- assert(*std::next(c2.begin(), 4) == 4);
- assert(*std::next(c2.begin(), 5) == 5);
- assert(c2.get_allocator() == A(1));
- }
- {
- typedef int T;
- typedef other_allocator<T> A;
- typedef std::forward_list<T, A> C;
- C c1(A(1));
- const T t2[] = {10, 11, 12};
- C c2(std::begin(t2), std::end(t2), A(2));
- c1.swap(c2);
+ assert(std::distance(c2.begin(), c2.end()) == 6);
+ assert(*std::next(c2.begin(), 0) == 0);
+ assert(*std::next(c2.begin(), 1) == 1);
+ assert(*std::next(c2.begin(), 2) == 2);
+ assert(*std::next(c2.begin(), 3) == 3);
+ assert(*std::next(c2.begin(), 4) == 4);
+ assert(*std::next(c2.begin(), 5) == 5);
+ assert(c2.get_allocator() == A(1));
+ }
+ {
+ typedef int T;
+ typedef other_allocator<T> A;
+ typedef std::forward_list<T, A> C;
+ C c1(A(1));
+ const T t2[] = {10, 11, 12};
+ C c2(std::begin(t2), std::end(t2), A(2));
+ c1.swap(c2);
- assert(std::distance(c1.begin(), c1.end()) == 3);
- assert(*std::next(c1.begin(), 0) == 10);
- assert(*std::next(c1.begin(), 1) == 11);
- assert(*std::next(c1.begin(), 2) == 12);
- assert(c1.get_allocator() == A(2));
+ assert(std::distance(c1.begin(), c1.end()) == 3);
+ assert(*std::next(c1.begin(), 0) == 10);
+ assert(*std::next(c1.begin(), 1) == 11);
+ assert(*std::next(c1.begin(), 2) == 12);
+ assert(c1.get_allocator() == A(2));
- assert(std::distance(c2.begin(), c2.end()) == 0);
- assert(c2.get_allocator() == A(1));
- }
- {
- typedef int T;
- typedef other_allocator<T> A;
- typedef std::forward_list<T, A> C;
- C c1(A(1));
- C c2(A(2));
- c1.swap(c2);
+ assert(std::distance(c2.begin(), c2.end()) == 0);
+ assert(c2.get_allocator() == A(1));
+ }
+ {
+ typedef int T;
+ typedef other_allocator<T> A;
+ typedef std::forward_list<T, A> C;
+ C c1(A(1));
+ C c2(A(2));
+ c1.swap(c2);
- assert(std::distance(c1.begin(), c1.end()) == 0);
- assert(c1.get_allocator() == A(2));
+ assert(std::distance(c1.begin(), c1.end()) == 0);
+ assert(c1.get_allocator() == A(2));
- assert(std::distance(c2.begin(), c2.end()) == 0);
- assert(c2.get_allocator() == A(1));
- }
+ assert(std::distance(c2.begin(), c2.end()) == 0);
+ assert(c2.get_allocator() == A(1));
+ }
#if TEST_STD_VER >= 11
- {
- typedef int T;
- typedef min_allocator<T> A;
- typedef std::forward_list<T, A> C;
- const T t1[] = {0, 1, 2, 3, 4, 5};
- C c1(std::begin(t1), std::end(t1), A());
- const T t2[] = {10, 11, 12};
- C c2(std::begin(t2), std::end(t2), A());
- c1.swap(c2);
+ {
+ typedef int T;
+ typedef min_allocator<T> A;
+ typedef std::forward_list<T, A> C;
+ const T t1[] = {0, 1, 2, 3, 4, 5};
+ C c1(std::begin(t1), std::end(t1), A());
+ const T t2[] = {10, 11, 12};
+ C c2(std::begin(t2), std::end(t2), A());
+ c1.swap(c2);
- assert(std::distance(c1.begin(), c1.end()) == 3);
- assert(*std::next(c1.begin(), 0) == 10);
- assert(*std::next(c1.begin(), 1) == 11);
- assert(*std::next(c1.begin(), 2) == 12);
- assert(c1.get_allocator() == A());
+ assert(std::distance(c1.begin(), c1.end()) == 3);
+ assert(*std::next(c1.begin(), 0) == 10);
+ assert(*std::next(c1.begin(), 1) == 11);
+ assert(*std::next(c1.begin(), 2) == 12);
+ assert(c1.get_allocator() == A());
- assert(std::distance(c2.begin(), c2.end()) == 6);
- assert(*std::next(c2.begin(), 0) == 0);
- assert(*std::next(c2.begin(), 1) == 1);
- assert(*std::next(c2.begin(), 2) == 2);
- assert(*std::next(c2.begin(), 3) == 3);
- assert(*std::next(c2.begin(), 4) == 4);
- assert(*std::next(c2.begin(), 5) == 5);
- assert(c2.get_allocator() == A());
- }
- {
- typedef int T;
- typedef min_allocator<T> A;
- typedef std::forward_list<T, A> C;
- const T t1[] = {0, 1, 2, 3, 4, 5};
- C c1(std::begin(t1), std::end(t1), A());
- C c2(A{});
- c1.swap(c2);
+ assert(std::distance(c2.begin(), c2.end()) == 6);
+ assert(*std::next(c2.begin(), 0) == 0);
+ assert(*std::next(c2.begin(), 1) == 1);
+ assert(*std::next(c2.begin(), 2) == 2);
+ assert(*std::next(c2.begin(), 3) == 3);
+ assert(*std::next(c2.begin(), 4) == 4);
+ assert(*std::next(c2.begin(), 5) == 5);
+ assert(c2.get_allocator() == A());
+ }
+ {
+ typedef int T;
+ typedef min_allocator<T> A;
+ typedef std::forward_list<T, A> C;
+ const T t1[] = {0, 1, 2, 3, 4, 5};
+ C c1(std::begin(t1), std::end(t1), A());
+ C c2(A{});
+ c1.swap(c2);
- assert(std::distance(c1.begin(), c1.end()) == 0);
- assert(c1.get_allocator() == A());
+ assert(std::distance(c1.begin(), c1.end()) == 0);
+ assert(c1.get_allocator() == A());
- assert(std::distance(c2.begin(), c2.end()) == 6);
- assert(*std::next(c2.begin(), 0) == 0);
- assert(*std::next(c2.begin(), 1) == 1);
- assert(*std::next(c2.begin(), 2) == 2);
- assert(*std::next(c2.begin(), 3) == 3);
- assert(*std::next(c2.begin(), 4) == 4);
- assert(*std::next(c2.begin(), 5) == 5);
- assert(c2.get_allocator() == A());
- }
- {
- typedef int T;
- typedef min_allocator<T> A;
- typedef std::forward_list<T, A> C;
- C c1(A{});
- const T t2[] = {10, 11, 12};
- C c2(std::begin(t2), std::end(t2), A());
- c1.swap(c2);
+ assert(std::distance(c2.begin(), c2.end()) == 6);
+ assert(*std::next(c2.begin(), 0) == 0);
+ assert(*std::next(c2.begin(), 1) == 1);
+ assert(*std::next(c2.begin(), 2) == 2);
+ assert(*std::next(c2.begin(), 3) == 3);
+ assert(*std::next(c2.begin(), 4) == 4);
+ assert(*std::next(c2.begin(), 5) == 5);
+ assert(c2.get_allocator() == A());
+ }
+ {
+ typedef int T;
+ typedef min_allocator<T> A;
+ typedef std::forward_list<T, A> C;
+ C c1(A{});
+ const T t2[] = {10, 11, 12};
+ C c2(std::begin(t2), std::end(t2), A());
+ c1.swap(c2);
- assert(std::distance(c1.begin(), c1.end()) == 3);
- assert(*std::next(c1.begin(), 0) == 10);
- assert(*std::next(c1.begin(), 1) == 11);
- assert(*std::next(c1.begin(), 2) == 12);
- assert(c1.get_allocator() == A());
+ assert(std::distance(c1.begin(), c1.end()) == 3);
+ assert(*std::next(c1.begin(), 0) == 10);
+ assert(*std::next(c1.begin(), 1) == 11);
+ assert(*std::next(c1.begin(), 2) == 12);
+ assert(c1.get_allocator() == A());
- assert(std::distance(c2.begin(), c2.end()) == 0);
- assert(c2.get_allocator() == A());
- }
- {
- typedef int T;
- typedef min_allocator<T> A;
- typedef std::forward_list<T, A> C;
- C c1(A{});
- C c2(A{});
- c1.swap(c2);
+ assert(std::distance(c2.begin(), c2.end()) == 0);
+ assert(c2.get_allocator() == A());
+ }
+ {
+ typedef int T;
+ typedef min_allocator<T> A;
+ typedef std::forward_list<T, A> C;
+ C c1(A{});
+ C c2(A{});
+ c1.swap(c2);
- assert(std::distance(c1.begin(), c1.end()) == 0);
- assert(c1.get_allocator() == A());
+ assert(std::distance(c1.begin(), c1.end()) == 0);
+ assert(c1.get_allocator() == A());
- assert(std::distance(c2.begin(), c2.end()) == 0);
- assert(c2.get_allocator() == A());
- }
+ assert(std::distance(c2.begin(), c2.end()) == 0);
+ assert(c2.get_allocator() == A());
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.spec/non_member_swap.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.spec/non_member_swap.pass.cpp
index 54d26d0a6491797..cae6950436deefb 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.spec/non_member_swap.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.spec/non_member_swap.pass.cpp
@@ -19,244 +19,243 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef int T;
- typedef test_allocator<T> A;
- typedef std::forward_list<T, A> C;
- const T t1[] = {0, 1, 2, 3, 4, 5};
- C c1(std::begin(t1), std::end(t1), A(1, 1));
- const T t2[] = {10, 11, 12};
- C c2(std::begin(t2), std::end(t2), A(1, 2));
- swap(c1, c2);
+int main(int, char**) {
+ {
+ typedef int T;
+ typedef test_allocator<T> A;
+ typedef std::forward_list<T, A> C;
+ const T t1[] = {0, 1, 2, 3, 4, 5};
+ C c1(std::begin(t1), std::end(t1), A(1, 1));
+ const T t2[] = {10, 11, 12};
+ C c2(std::begin(t2), std::end(t2), A(1, 2));
+ swap(c1, c2);
- assert(std::distance(c1.begin(), c1.end()) == 3);
- assert(*std::next(c1.begin(), 0) == 10);
- assert(*std::next(c1.begin(), 1) == 11);
- assert(*std::next(c1.begin(), 2) == 12);
- assert(c1.get_allocator().get_id() == 1);
+ assert(std::distance(c1.begin(), c1.end()) == 3);
+ assert(*std::next(c1.begin(), 0) == 10);
+ assert(*std::next(c1.begin(), 1) == 11);
+ assert(*std::next(c1.begin(), 2) == 12);
+ assert(c1.get_allocator().get_id() == 1);
- assert(std::distance(c2.begin(), c2.end()) == 6);
- assert(*std::next(c2.begin(), 0) == 0);
- assert(*std::next(c2.begin(), 1) == 1);
- assert(*std::next(c2.begin(), 2) == 2);
- assert(*std::next(c2.begin(), 3) == 3);
- assert(*std::next(c2.begin(), 4) == 4);
- assert(*std::next(c2.begin(), 5) == 5);
- assert(c2.get_allocator().get_id() == 2);
- }
- {
- typedef int T;
- typedef test_allocator<T> A;
- typedef std::forward_list<T, A> C;
- const T t1[] = {0, 1, 2, 3, 4, 5};
- C c1(std::begin(t1), std::end(t1), A(1, 1));
- C c2(A(1, 2));
- swap(c1, c2);
+ assert(std::distance(c2.begin(), c2.end()) == 6);
+ assert(*std::next(c2.begin(), 0) == 0);
+ assert(*std::next(c2.begin(), 1) == 1);
+ assert(*std::next(c2.begin(), 2) == 2);
+ assert(*std::next(c2.begin(), 3) == 3);
+ assert(*std::next(c2.begin(), 4) == 4);
+ assert(*std::next(c2.begin(), 5) == 5);
+ assert(c2.get_allocator().get_id() == 2);
+ }
+ {
+ typedef int T;
+ typedef test_allocator<T> A;
+ typedef std::forward_list<T, A> C;
+ const T t1[] = {0, 1, 2, 3, 4, 5};
+ C c1(std::begin(t1), std::end(t1), A(1, 1));
+ C c2(A(1, 2));
+ swap(c1, c2);
- assert(std::distance(c1.begin(), c1.end()) == 0);
- assert(c1.get_allocator().get_id() == 1);
+ assert(std::distance(c1.begin(), c1.end()) == 0);
+ assert(c1.get_allocator().get_id() == 1);
- assert(std::distance(c2.begin(), c2.end()) == 6);
- assert(*std::next(c2.begin(), 0) == 0);
- assert(*std::next(c2.begin(), 1) == 1);
- assert(*std::next(c2.begin(), 2) == 2);
- assert(*std::next(c2.begin(), 3) == 3);
- assert(*std::next(c2.begin(), 4) == 4);
- assert(*std::next(c2.begin(), 5) == 5);
- assert(c2.get_allocator().get_id() == 2);
- }
- {
- typedef int T;
- typedef test_allocator<T> A;
- typedef std::forward_list<T, A> C;
- C c1(A(1, 1));
- const T t2[] = {10, 11, 12};
- C c2(std::begin(t2), std::end(t2), A(1, 2));
- swap(c1, c2);
+ assert(std::distance(c2.begin(), c2.end()) == 6);
+ assert(*std::next(c2.begin(), 0) == 0);
+ assert(*std::next(c2.begin(), 1) == 1);
+ assert(*std::next(c2.begin(), 2) == 2);
+ assert(*std::next(c2.begin(), 3) == 3);
+ assert(*std::next(c2.begin(), 4) == 4);
+ assert(*std::next(c2.begin(), 5) == 5);
+ assert(c2.get_allocator().get_id() == 2);
+ }
+ {
+ typedef int T;
+ typedef test_allocator<T> A;
+ typedef std::forward_list<T, A> C;
+ C c1(A(1, 1));
+ const T t2[] = {10, 11, 12};
+ C c2(std::begin(t2), std::end(t2), A(1, 2));
+ swap(c1, c2);
- assert(std::distance(c1.begin(), c1.end()) == 3);
- assert(*std::next(c1.begin(), 0) == 10);
- assert(*std::next(c1.begin(), 1) == 11);
- assert(*std::next(c1.begin(), 2) == 12);
- assert(c1.get_allocator().get_id() == 1);
+ assert(std::distance(c1.begin(), c1.end()) == 3);
+ assert(*std::next(c1.begin(), 0) == 10);
+ assert(*std::next(c1.begin(), 1) == 11);
+ assert(*std::next(c1.begin(), 2) == 12);
+ assert(c1.get_allocator().get_id() == 1);
- assert(std::distance(c2.begin(), c2.end()) == 0);
- assert(c2.get_allocator().get_id() == 2);
- }
- {
- typedef int T;
- typedef test_allocator<T> A;
- typedef std::forward_list<T, A> C;
- C c1(A(1, 1));
- C c2(A(1, 2));
- swap(c1, c2);
+ assert(std::distance(c2.begin(), c2.end()) == 0);
+ assert(c2.get_allocator().get_id() == 2);
+ }
+ {
+ typedef int T;
+ typedef test_allocator<T> A;
+ typedef std::forward_list<T, A> C;
+ C c1(A(1, 1));
+ C c2(A(1, 2));
+ swap(c1, c2);
- assert(std::distance(c1.begin(), c1.end()) == 0);
- assert(c1.get_allocator().get_id() == 1);
+ assert(std::distance(c1.begin(), c1.end()) == 0);
+ assert(c1.get_allocator().get_id() == 1);
- assert(std::distance(c2.begin(), c2.end()) == 0);
- assert(c2.get_allocator().get_id() == 2);
- }
+ assert(std::distance(c2.begin(), c2.end()) == 0);
+ assert(c2.get_allocator().get_id() == 2);
+ }
- {
- typedef int T;
- typedef other_allocator<T> A;
- typedef std::forward_list<T, A> C;
- const T t1[] = {0, 1, 2, 3, 4, 5};
- C c1(std::begin(t1), std::end(t1), A(1));
- const T t2[] = {10, 11, 12};
- C c2(std::begin(t2), std::end(t2), A(2));
- swap(c1, c2);
+ {
+ typedef int T;
+ typedef other_allocator<T> A;
+ typedef std::forward_list<T, A> C;
+ const T t1[] = {0, 1, 2, 3, 4, 5};
+ C c1(std::begin(t1), std::end(t1), A(1));
+ const T t2[] = {10, 11, 12};
+ C c2(std::begin(t2), std::end(t2), A(2));
+ swap(c1, c2);
- assert(std::distance(c1.begin(), c1.end()) == 3);
- assert(*std::next(c1.begin(), 0) == 10);
- assert(*std::next(c1.begin(), 1) == 11);
- assert(*std::next(c1.begin(), 2) == 12);
- assert(c1.get_allocator() == A(2));
+ assert(std::distance(c1.begin(), c1.end()) == 3);
+ assert(*std::next(c1.begin(), 0) == 10);
+ assert(*std::next(c1.begin(), 1) == 11);
+ assert(*std::next(c1.begin(), 2) == 12);
+ assert(c1.get_allocator() == A(2));
- assert(std::distance(c2.begin(), c2.end()) == 6);
- assert(*std::next(c2.begin(), 0) == 0);
- assert(*std::next(c2.begin(), 1) == 1);
- assert(*std::next(c2.begin(), 2) == 2);
- assert(*std::next(c2.begin(), 3) == 3);
- assert(*std::next(c2.begin(), 4) == 4);
- assert(*std::next(c2.begin(), 5) == 5);
- assert(c2.get_allocator() == A(1));
- }
- {
- typedef int T;
- typedef other_allocator<T> A;
- typedef std::forward_list<T, A> C;
- const T t1[] = {0, 1, 2, 3, 4, 5};
- C c1(std::begin(t1), std::end(t1), A(1));
- C c2(A(2));
- swap(c1, c2);
+ assert(std::distance(c2.begin(), c2.end()) == 6);
+ assert(*std::next(c2.begin(), 0) == 0);
+ assert(*std::next(c2.begin(), 1) == 1);
+ assert(*std::next(c2.begin(), 2) == 2);
+ assert(*std::next(c2.begin(), 3) == 3);
+ assert(*std::next(c2.begin(), 4) == 4);
+ assert(*std::next(c2.begin(), 5) == 5);
+ assert(c2.get_allocator() == A(1));
+ }
+ {
+ typedef int T;
+ typedef other_allocator<T> A;
+ typedef std::forward_list<T, A> C;
+ const T t1[] = {0, 1, 2, 3, 4, 5};
+ C c1(std::begin(t1), std::end(t1), A(1));
+ C c2(A(2));
+ swap(c1, c2);
- assert(std::distance(c1.begin(), c1.end()) == 0);
- assert(c1.get_allocator() == A(2));
+ assert(std::distance(c1.begin(), c1.end()) == 0);
+ assert(c1.get_allocator() == A(2));
- assert(std::distance(c2.begin(), c2.end()) == 6);
- assert(*std::next(c2.begin(), 0) == 0);
- assert(*std::next(c2.begin(), 1) == 1);
- assert(*std::next(c2.begin(), 2) == 2);
- assert(*std::next(c2.begin(), 3) == 3);
- assert(*std::next(c2.begin(), 4) == 4);
- assert(*std::next(c2.begin(), 5) == 5);
- assert(c2.get_allocator() == A(1));
- }
- {
- typedef int T;
- typedef other_allocator<T> A;
- typedef std::forward_list<T, A> C;
- C c1(A(1));
- const T t2[] = {10, 11, 12};
- C c2(std::begin(t2), std::end(t2), A(2));
- swap(c1, c2);
+ assert(std::distance(c2.begin(), c2.end()) == 6);
+ assert(*std::next(c2.begin(), 0) == 0);
+ assert(*std::next(c2.begin(), 1) == 1);
+ assert(*std::next(c2.begin(), 2) == 2);
+ assert(*std::next(c2.begin(), 3) == 3);
+ assert(*std::next(c2.begin(), 4) == 4);
+ assert(*std::next(c2.begin(), 5) == 5);
+ assert(c2.get_allocator() == A(1));
+ }
+ {
+ typedef int T;
+ typedef other_allocator<T> A;
+ typedef std::forward_list<T, A> C;
+ C c1(A(1));
+ const T t2[] = {10, 11, 12};
+ C c2(std::begin(t2), std::end(t2), A(2));
+ swap(c1, c2);
- assert(std::distance(c1.begin(), c1.end()) == 3);
- assert(*std::next(c1.begin(), 0) == 10);
- assert(*std::next(c1.begin(), 1) == 11);
- assert(*std::next(c1.begin(), 2) == 12);
- assert(c1.get_allocator() == A(2));
+ assert(std::distance(c1.begin(), c1.end()) == 3);
+ assert(*std::next(c1.begin(), 0) == 10);
+ assert(*std::next(c1.begin(), 1) == 11);
+ assert(*std::next(c1.begin(), 2) == 12);
+ assert(c1.get_allocator() == A(2));
- assert(std::distance(c2.begin(), c2.end()) == 0);
- assert(c2.get_allocator() == A(1));
- }
- {
- typedef int T;
- typedef other_allocator<T> A;
- typedef std::forward_list<T, A> C;
- C c1(A(1));
- C c2(A(2));
- swap(c1, c2);
+ assert(std::distance(c2.begin(), c2.end()) == 0);
+ assert(c2.get_allocator() == A(1));
+ }
+ {
+ typedef int T;
+ typedef other_allocator<T> A;
+ typedef std::forward_list<T, A> C;
+ C c1(A(1));
+ C c2(A(2));
+ swap(c1, c2);
- assert(std::distance(c1.begin(), c1.end()) == 0);
- assert(c1.get_allocator() == A(2));
+ assert(std::distance(c1.begin(), c1.end()) == 0);
+ assert(c1.get_allocator() == A(2));
- assert(std::distance(c2.begin(), c2.end()) == 0);
- assert(c2.get_allocator() == A(1));
- }
+ assert(std::distance(c2.begin(), c2.end()) == 0);
+ assert(c2.get_allocator() == A(1));
+ }
#if TEST_STD_VER >= 11
- {
- typedef int T;
- typedef min_allocator<T> A;
- typedef std::forward_list<T, A> C;
- const T t1[] = {0, 1, 2, 3, 4, 5};
- C c1(std::begin(t1), std::end(t1), A());
- const T t2[] = {10, 11, 12};
- C c2(std::begin(t2), std::end(t2), A());
- swap(c1, c2);
+ {
+ typedef int T;
+ typedef min_allocator<T> A;
+ typedef std::forward_list<T, A> C;
+ const T t1[] = {0, 1, 2, 3, 4, 5};
+ C c1(std::begin(t1), std::end(t1), A());
+ const T t2[] = {10, 11, 12};
+ C c2(std::begin(t2), std::end(t2), A());
+ swap(c1, c2);
- assert(std::distance(c1.begin(), c1.end()) == 3);
- assert(*std::next(c1.begin(), 0) == 10);
- assert(*std::next(c1.begin(), 1) == 11);
- assert(*std::next(c1.begin(), 2) == 12);
- assert(c1.get_allocator() == A());
+ assert(std::distance(c1.begin(), c1.end()) == 3);
+ assert(*std::next(c1.begin(), 0) == 10);
+ assert(*std::next(c1.begin(), 1) == 11);
+ assert(*std::next(c1.begin(), 2) == 12);
+ assert(c1.get_allocator() == A());
- assert(std::distance(c2.begin(), c2.end()) == 6);
- assert(*std::next(c2.begin(), 0) == 0);
- assert(*std::next(c2.begin(), 1) == 1);
- assert(*std::next(c2.begin(), 2) == 2);
- assert(*std::next(c2.begin(), 3) == 3);
- assert(*std::next(c2.begin(), 4) == 4);
- assert(*std::next(c2.begin(), 5) == 5);
- assert(c2.get_allocator() == A());
- }
- {
- typedef int T;
- typedef min_allocator<T> A;
- typedef std::forward_list<T, A> C;
- const T t1[] = {0, 1, 2, 3, 4, 5};
- C c1(std::begin(t1), std::end(t1), A());
- C c2(A{});
- swap(c1, c2);
+ assert(std::distance(c2.begin(), c2.end()) == 6);
+ assert(*std::next(c2.begin(), 0) == 0);
+ assert(*std::next(c2.begin(), 1) == 1);
+ assert(*std::next(c2.begin(), 2) == 2);
+ assert(*std::next(c2.begin(), 3) == 3);
+ assert(*std::next(c2.begin(), 4) == 4);
+ assert(*std::next(c2.begin(), 5) == 5);
+ assert(c2.get_allocator() == A());
+ }
+ {
+ typedef int T;
+ typedef min_allocator<T> A;
+ typedef std::forward_list<T, A> C;
+ const T t1[] = {0, 1, 2, 3, 4, 5};
+ C c1(std::begin(t1), std::end(t1), A());
+ C c2(A{});
+ swap(c1, c2);
- assert(std::distance(c1.begin(), c1.end()) == 0);
- assert(c1.get_allocator() == A());
+ assert(std::distance(c1.begin(), c1.end()) == 0);
+ assert(c1.get_allocator() == A());
- assert(std::distance(c2.begin(), c2.end()) == 6);
- assert(*std::next(c2.begin(), 0) == 0);
- assert(*std::next(c2.begin(), 1) == 1);
- assert(*std::next(c2.begin(), 2) == 2);
- assert(*std::next(c2.begin(), 3) == 3);
- assert(*std::next(c2.begin(), 4) == 4);
- assert(*std::next(c2.begin(), 5) == 5);
- assert(c2.get_allocator() == A());
- }
- {
- typedef int T;
- typedef min_allocator<T> A;
- typedef std::forward_list<T, A> C;
- C c1(A{});
- const T t2[] = {10, 11, 12};
- C c2(std::begin(t2), std::end(t2), A());
- swap(c1, c2);
+ assert(std::distance(c2.begin(), c2.end()) == 6);
+ assert(*std::next(c2.begin(), 0) == 0);
+ assert(*std::next(c2.begin(), 1) == 1);
+ assert(*std::next(c2.begin(), 2) == 2);
+ assert(*std::next(c2.begin(), 3) == 3);
+ assert(*std::next(c2.begin(), 4) == 4);
+ assert(*std::next(c2.begin(), 5) == 5);
+ assert(c2.get_allocator() == A());
+ }
+ {
+ typedef int T;
+ typedef min_allocator<T> A;
+ typedef std::forward_list<T, A> C;
+ C c1(A{});
+ const T t2[] = {10, 11, 12};
+ C c2(std::begin(t2), std::end(t2), A());
+ swap(c1, c2);
- assert(std::distance(c1.begin(), c1.end()) == 3);
- assert(*std::next(c1.begin(), 0) == 10);
- assert(*std::next(c1.begin(), 1) == 11);
- assert(*std::next(c1.begin(), 2) == 12);
- assert(c1.get_allocator() == A());
+ assert(std::distance(c1.begin(), c1.end()) == 3);
+ assert(*std::next(c1.begin(), 0) == 10);
+ assert(*std::next(c1.begin(), 1) == 11);
+ assert(*std::next(c1.begin(), 2) == 12);
+ assert(c1.get_allocator() == A());
- assert(std::distance(c2.begin(), c2.end()) == 0);
- assert(c2.get_allocator() == A());
- }
- {
- typedef int T;
- typedef min_allocator<T> A;
- typedef std::forward_list<T, A> C;
- C c1(A{});
- C c2(A{});
- swap(c1, c2);
+ assert(std::distance(c2.begin(), c2.end()) == 0);
+ assert(c2.get_allocator() == A());
+ }
+ {
+ typedef int T;
+ typedef min_allocator<T> A;
+ typedef std::forward_list<T, A> C;
+ C c1(A{});
+ C c2(A{});
+ swap(c1, c2);
- assert(std::distance(c1.begin(), c1.end()) == 0);
- assert(c1.get_allocator() == A());
+ assert(std::distance(c1.begin(), c1.end()) == 0);
+ assert(c1.get_allocator() == A());
- assert(std::distance(c2.begin(), c2.end()) == 0);
- assert(c2.get_allocator() == A());
- }
+ assert(std::distance(c2.begin(), c2.end()) == 0);
+ assert(c2.get_allocator() == A());
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.spec/relational.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.spec/relational.pass.cpp
index 9ca19486a54b9ca..d16acadaeb893e8 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.spec/relational.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.spec/relational.pass.cpp
@@ -33,33 +33,31 @@
#include "min_allocator.h"
template <class C>
-void test(int N, int M)
-{
- C c1;
- for (int i = 0; i < N; ++i)
- c1.push_front(i);
- C c2;
- for (int i = 0; i < M; ++i)
- c2.push_front(i);
- if (N < M)
- assert(c1 < c2);
- if (N <= M)
- assert(c1 <= c2);
- if (N >= M)
- assert(c1 >= c2);
- if (N > M)
- assert(c1 > c2);
+void test(int N, int M) {
+ C c1;
+ for (int i = 0; i < N; ++i)
+ c1.push_front(i);
+ C c2;
+ for (int i = 0; i < M; ++i)
+ c2.push_front(i);
+ if (N < M)
+ assert(c1 < c2);
+ if (N <= M)
+ assert(c1 <= c2);
+ if (N >= M)
+ assert(c1 >= c2);
+ if (N > M)
+ assert(c1 > c2);
}
-int main(int, char**)
-{
- for (int i = 0; i < 10; ++i)
- for (int j = 0; j < 10; ++j)
- test<std::forward_list<int> >(i, j);
+int main(int, char**) {
+ for (int i = 0; i < 10; ++i)
+ for (int j = 0; j < 10; ++j)
+ test<std::forward_list<int> >(i, j);
#if TEST_STD_VER >= 11
- for (int i = 0; i < 10; ++i)
- for (int j = 0; j < 10; ++j)
- test<std::forward_list<int, min_allocator<int>> >(i, j);
+ for (int i = 0; i < 10; ++i)
+ for (int j = 0; j < 10; ++j)
+ test<std::forward_list<int, min_allocator<int>> >(i, j);
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.spec/swap_noexcept.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.spec/swap_noexcept.pass.cpp
index 76f8b6213908b02..b83ec3c3c121013 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.spec/swap_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.spec/swap_noexcept.pass.cpp
@@ -28,63 +28,60 @@
#include "test_allocator.h"
template <class T>
-struct some_alloc
-{
- typedef T value_type;
+struct some_alloc {
+ typedef T value_type;
- some_alloc() {}
- some_alloc(const some_alloc&);
- void allocate(std::size_t);
- void deallocate(void*, unsigned) {}
+ some_alloc() {}
+ some_alloc(const some_alloc&);
+ void allocate(std::size_t);
+ void deallocate(void*, unsigned) {}
- typedef std::true_type propagate_on_container_swap;
+ typedef std::true_type propagate_on_container_swap;
};
template <class T>
-struct some_alloc2
-{
- typedef T value_type;
+struct some_alloc2 {
+ typedef T value_type;
- some_alloc2() {}
- some_alloc2(const some_alloc2&);
- void allocate(std::size_t);
- void deallocate(void*, unsigned) {}
+ some_alloc2() {}
+ some_alloc2(const some_alloc2&);
+ void allocate(std::size_t);
+ void deallocate(void*, unsigned) {}
- typedef std::false_type propagate_on_container_swap;
- typedef std::true_type is_always_equal;
+ typedef std::false_type propagate_on_container_swap;
+ typedef std::true_type is_always_equal;
};
-int main(int, char**)
-{
- {
- typedef std::forward_list<MoveOnly> C;
- static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
+int main(int, char**) {
+ {
+ typedef std::forward_list<MoveOnly> C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
#if defined(_LIBCPP_VERSION)
- {
- typedef std::forward_list<MoveOnly, test_allocator<MoveOnly>> C;
- static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- {
- typedef std::forward_list<MoveOnly, other_allocator<MoveOnly>> C;
- static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
+ {
+ typedef std::forward_list<MoveOnly, test_allocator<MoveOnly>> C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
+ {
+ typedef std::forward_list<MoveOnly, other_allocator<MoveOnly>> C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
#endif // _LIBCPP_VERSION
- {
- typedef std::forward_list<MoveOnly, some_alloc<MoveOnly>> C;
+ {
+ typedef std::forward_list<MoveOnly, some_alloc<MoveOnly>> C;
#if TEST_STD_VER >= 14
// In C++14, if POCS is set, swapping the allocator is required not to throw
- static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
#else
- static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
#endif
- }
+ }
#if TEST_STD_VER >= 14
- {
- typedef std::forward_list<MoveOnly, some_alloc2<MoveOnly>> C;
+ {
+ typedef std::forward_list<MoveOnly, some_alloc2<MoveOnly>> C;
// if the allocators are always equal, then the swap can be noexcept
- static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/forwardlist/get_allocator.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/get_allocator.pass.cpp
index 9d88e7c0fe878a8..f37f5c2f513bd6f 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/get_allocator.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/get_allocator.pass.cpp
@@ -19,16 +19,16 @@
#include "test_macros.h"
int main(int, char**) {
- {
- std::allocator<int> alloc;
- const std::forward_list<int> fl(alloc);
- assert(fl.get_allocator() == alloc);
- }
- {
- other_allocator<int> alloc(1);
- const std::forward_list<int, other_allocator<int> > fl(alloc);
- assert(fl.get_allocator() == alloc);
- }
+ {
+ std::allocator<int> alloc;
+ const std::forward_list<int> fl(alloc);
+ assert(fl.get_allocator() == alloc);
+ }
+ {
+ other_allocator<int> alloc(1);
+ const std::forward_list<int, other_allocator<int> > fl(alloc);
+ assert(fl.get_allocator() == alloc);
+ }
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/forwardlist/incomplete.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/incomplete.pass.cpp
index 2bdfad777e8dfb1..b7be03f1062dc57 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/incomplete.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/incomplete.pass.cpp
@@ -33,19 +33,18 @@ struct B {
};
#endif
-int main(int, char**)
-{
+int main(int, char**) {
{
A a;
assert(a.d.empty());
- a.it = a.d.begin();
+ a.it = a.d.begin();
a.it2 = a.d.cbefore_begin();
}
#if TEST_STD_VER >= 11
{
B b;
assert(b.d.empty());
- b.it = b.d.begin();
+ b.it = b.d.begin();
b.it2 = b.d.cbefore_begin();
}
#endif
diff --git a/libcxx/test/std/containers/sequences/forwardlist/max_size.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/max_size.pass.cpp
index c5145fde52af7fd..5ba0d61f104e09e 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/max_size.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/max_size.pass.cpp
@@ -18,32 +18,29 @@
#include "test_allocator.h"
#include "test_macros.h"
-int main(int, char**)
-{
- {
- typedef limited_allocator<int, 10> A;
- typedef std::forward_list<int, A> C;
- C c;
- assert(c.max_size() <= 10);
- LIBCPP_ASSERT(c.max_size() == 10);
- }
- {
- typedef limited_allocator<int, (std::size_t)-1> A;
- typedef std::forward_list<int, A> C;
- const C::size_type max_dist =
- static_cast<C::size_type>(std::numeric_limits<C::
diff erence_type>::max());
- C c;
- assert(c.max_size() <= max_dist);
- LIBCPP_ASSERT(c.max_size() == max_dist);
- }
- {
- typedef std::forward_list<char> C;
- const C::size_type max_dist =
- static_cast<C::size_type>(std::numeric_limits<C::
diff erence_type>::max());
- C c;
- assert(c.max_size() <= max_dist);
- assert(c.max_size() <= alloc_max_size(c.get_allocator()));
- }
+int main(int, char**) {
+ {
+ typedef limited_allocator<int, 10> A;
+ typedef std::forward_list<int, A> C;
+ C c;
+ assert(c.max_size() <= 10);
+ LIBCPP_ASSERT(c.max_size() == 10);
+ }
+ {
+ typedef limited_allocator<int, (std::size_t)-1> A;
+ typedef std::forward_list<int, A> C;
+ const C::size_type max_dist = static_cast<C::size_type>(std::numeric_limits<C::
diff erence_type>::max());
+ C c;
+ assert(c.max_size() <= max_dist);
+ LIBCPP_ASSERT(c.max_size() == max_dist);
+ }
+ {
+ typedef std::forward_list<char> C;
+ const C::size_type max_dist = static_cast<C::size_type>(std::numeric_limits<C::
diff erence_type>::max());
+ C c;
+ assert(c.max_size() <= max_dist);
+ assert(c.max_size() <= alloc_max_size(c.get_allocator()));
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/forwardlist/range_concept_conformance.compile.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/range_concept_conformance.compile.pass.cpp
index f3e7fd258a63f78..53078c91cf885ea 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/range_concept_conformance.compile.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/range_concept_conformance.compile.pass.cpp
@@ -17,7 +17,6 @@
using range = std::forward_list<int>;
-
static_assert(std::same_as<std::ranges::iterator_t<range>, range::iterator>);
static_assert(std::ranges::common_range<range>);
static_assert(std::ranges::forward_range<range>);
diff --git a/libcxx/test/std/containers/sequences/forwardlist/types.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/types.pass.cpp
index 116891d4980be9c..d2e48b351fc73f4 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/types.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/types.pass.cpp
@@ -50,11 +50,12 @@ static_assert(std::is_same<my_derived<int, min_allocator<int>>::base, my_base>::
static_assert(std::is_same<my_derived<my_base, min_allocator<my_base>>::base, my_base>::value, "");
#endif
-struct A { std::forward_list<A> v; }; // incomplete type support
+struct A {
+ std::forward_list<A> v;
+}; // incomplete type support
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::forward_list<char> C;
static_assert((std::is_same<C::value_type, char>::value), "");
static_assert((std::is_same<C::allocator_type, std::allocator<char> >::value), "");
@@ -68,12 +69,14 @@ int main(int, char**)
static_assert((std::is_signed<typename C::
diff erence_type>::value), "");
static_assert((std::is_unsigned<typename C::size_type>::value), "");
static_assert((std::is_same<typename C::
diff erence_type,
- typename std::iterator_traits<typename C::iterator>::
diff erence_type>::value), "");
+ typename std::iterator_traits<typename C::iterator>::
diff erence_type>::value),
+ "");
static_assert((std::is_same<typename C::
diff erence_type,
- typename std::iterator_traits<typename C::const_iterator>::
diff erence_type>::value), "");
- }
+ typename std::iterator_traits<typename C::const_iterator>::
diff erence_type>::value),
+ "");
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::forward_list<char, min_allocator<char>> C;
static_assert((std::is_same<C::value_type, char>::value), "");
static_assert((std::is_same<C::allocator_type, min_allocator<char> >::value), "");
@@ -81,17 +84,19 @@ int main(int, char**)
static_assert((std::is_same<C::const_reference, const char&>::value), "");
static_assert((std::is_same<C::pointer, min_pointer<char>>::value), "");
static_assert((std::is_same<C::const_pointer, min_pointer<const char>>::value), "");
-// min_allocator doesn't have a size_type, so one gets synthesized
+ // min_allocator doesn't have a size_type, so one gets synthesized
static_assert((std::is_same<C::size_type, std::make_unsigned<C::
diff erence_type>::type>::value), "");
static_assert((std::is_same<C::
diff erence_type, std::ptr
diff _t>::value), "");
static_assert((std::is_signed<typename C::
diff erence_type>::value), "");
static_assert((std::is_unsigned<typename C::size_type>::value), "");
static_assert((std::is_same<typename C::
diff erence_type,
- typename std::iterator_traits<typename C::iterator>::
diff erence_type>::value), "");
+ typename std::iterator_traits<typename C::iterator>::
diff erence_type>::value),
+ "");
static_assert((std::is_same<typename C::
diff erence_type,
- typename std::iterator_traits<typename C::const_iterator>::
diff erence_type>::value), "");
- }
+ typename std::iterator_traits<typename C::const_iterator>::
diff erence_type>::value),
+ "");
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/from_range_sequence_containers.h b/libcxx/test/std/containers/sequences/from_range_sequence_containers.h
index df66bc91808078f..0d04d26ef3c3117 100644
--- a/libcxx/test/std/containers/sequences/from_range_sequence_containers.h
+++ b/libcxx/test/std/containers/sequences/from_range_sequence_containers.h
@@ -26,10 +26,10 @@
#include "test_macros.h"
template <class T>
-concept HasSize = requires (const T& value) { value.size(); };
+concept HasSize = requires(const T& value) { value.size(); };
template <class Container, class Range>
-concept HasFromRangeCtr = requires (Range&& range) {
+concept HasFromRangeCtr = requires(Range&& range) {
Container(std::from_range, std::forward<Range>(range));
Container(std::from_range, std::forward<Range>(range), std::allocator<typename Container::value_type>());
};
@@ -53,7 +53,7 @@ constexpr bool test_constraints() {
}
// Note: `std::array` is used to avoid dealing with `vector<bool>`.
-template <template <class ...> class Container,
+template <template <class...> class Container,
class T,
class Iter,
class Sent,
@@ -86,12 +86,7 @@ constexpr void test_sequence_container_with_input(std::array<T, N>&& input, Vali
}
}
-template <template <class ...> class Container,
- class T,
- class Iter,
- class Sent,
- class Alloc,
- class ValidateFunc>
+template <template <class...> class Container, class T, class Iter, class Sent, class Alloc, class ValidateFunc>
constexpr void test_sequence_container(ValidateFunc validate) {
// Normal input.
test_sequence_container_with_input<Container, T, Iter, Sent, Alloc>(std::array{0, 5, 12, 7, -1, 8, 26}, validate);
@@ -101,7 +96,7 @@ constexpr void test_sequence_container(ValidateFunc validate) {
test_sequence_container_with_input<Container, T, Iter, Sent, Alloc>(std::array{5}, validate);
}
-template <template <class ...> class Container>
+template <template <class...> class Container>
constexpr void test_sequence_container_move_only() {
MoveOnly input[5];
std::ranges::subrange in(std::move_iterator{input}, std::move_iterator{input + 5});
@@ -109,10 +104,7 @@ constexpr void test_sequence_container_move_only() {
[[maybe_unused]] Container<MoveOnly> c(std::from_range, in);
}
-template <class Iter,
- class Sent,
- class Alloc,
- class ValidateFunc>
+template <class Iter, class Sent, class Alloc, class ValidateFunc>
constexpr void test_vector_bool(ValidateFunc validate) {
// Normal input.
test_sequence_container_with_input<std::vector, bool, Iter, Sent, Alloc>(
@@ -123,18 +115,18 @@ constexpr void test_vector_bool(ValidateFunc validate) {
test_sequence_container_with_input<std::vector, bool, Iter, Sent, Alloc>(std::array{true}, validate);
}
-template <template <class ...> class Container>
+template <template <class...> class Container>
void test_exception_safety_throwing_copy() {
#if !defined(TEST_HAS_NO_EXCEPTIONS)
constexpr int ThrowOn = 3;
- using T = ThrowingCopy<ThrowOn>;
+ using T = ThrowingCopy<ThrowOn>;
test_exception_safety_throwing_copy<ThrowOn, /*Size=*/5>([](T* from, T* to) {
[[maybe_unused]] Container<T> c(std::from_range, std::ranges::subrange(from, to));
});
#endif
}
-template <template <class ...> class Container, class T>
+template <template <class...> class Container, class T>
void test_exception_safety_throwing_allocator() {
#if !defined(TEST_HAS_NO_EXCEPTIONS)
T in[] = {0, 1};
diff --git a/libcxx/test/std/containers/sequences/insert_range_sequence_containers.h b/libcxx/test/std/containers/sequences/insert_range_sequence_containers.h
index 352ee474cae7672..9f404c46df778a5 100644
--- a/libcxx/test/std/containers/sequences/insert_range_sequence_containers.h
+++ b/libcxx/test/std/containers/sequences/insert_range_sequence_containers.h
@@ -31,9 +31,7 @@
#include "type_algorithms.h"
template <class Container, class Range>
-concept HasInsertRange = requires (Container& c, Range&& range) {
- c.insert_range(c.end(), range);
-};
+concept HasInsertRange = requires(Container& c, Range&& range) { c.insert_range(c.end(), range); };
template <template <class...> class Container, class T, class U>
constexpr bool test_constraints_insert_range() {
@@ -52,9 +50,7 @@ constexpr bool test_constraints_insert_range() {
}
template <class Container, class Range>
-concept HasAppendRange = requires (Container& c, Range&& range) {
- c.append_range(range);
-};
+concept HasAppendRange = requires(Container& c, Range&& range) { c.append_range(range); };
template <template <class...> class Container, class T, class U>
constexpr bool test_constraints_append_range() {
@@ -73,9 +69,7 @@ constexpr bool test_constraints_append_range() {
}
template <class Container, class Range>
-concept HasPrependRange = requires (Container& c, Range&& range) {
- c.prepend_range(range);
-};
+concept HasPrependRange = requires(Container& c, Range&& range) { c.prepend_range(range); };
template <template <class...> class Container, class T, class U>
constexpr bool test_constraints_prepend_range() {
@@ -94,9 +88,7 @@ constexpr bool test_constraints_prepend_range() {
}
template <class Container, class Range>
-concept HasAssignRange = requires (Container& c, Range&& range) {
- c.assign_range(range);
-};
+concept HasAssignRange = requires(Container& c, Range&& range) { c.assign_range(range); };
template <template <class...> class Container, class T, class U>
constexpr bool test_constraints_assign_range() {
@@ -117,322 +109,301 @@ constexpr bool test_constraints_assign_range() {
// Empty container.
template <class T>
-TestCase<T> constexpr EmptyContainer_EmptyRange {
- .initial = {}, .index = 0, .input = {}, .expected = {}
-};
+TestCase<T> constexpr EmptyContainer_EmptyRange{.initial = {}, .index = 0, .input = {}, .expected = {}};
// Note: specializations for `bool` still use `vector<int>` for inputs. This is to avoid dealing with `vector<bool>` and
// its iterators over proxy types.
-template <> constexpr TestCase<int> EmptyContainer_EmptyRange<bool> {
- .initial = {}, .index = 0, .input = {}, .expected = {}
-};
-
-template <class T> constexpr TestCase<T> EmptyContainer_OneElementRange;
-template <> constexpr TestCase<int> EmptyContainer_OneElementRange<int> {
- .initial = {}, .index = 0, .input = {5}, .expected = {5}
-};
-template <> constexpr TestCase<char> EmptyContainer_OneElementRange<char> {
- .initial = {}, .index = 0, .input = "a", .expected = "a"
-};
-template <> constexpr TestCase<int> EmptyContainer_OneElementRange<bool> {
- .initial = {}, .index = 0, .input = {true}, .expected = {true}
-};
-
-template <class T> constexpr TestCase<T> EmptyContainer_MidRange;
-template <> constexpr TestCase<int> EmptyContainer_MidRange<int> {
- .initial = {}, .index = 0, .input = {5, 3, 1, 7, 9}, .expected = {5, 3, 1, 7, 9}
-};
-template <> constexpr TestCase<char> EmptyContainer_MidRange<char> {
- .initial = {}, .index = 0, .input = "aeiou", .expected = "aeiou"
-};
-template <> constexpr TestCase<int> EmptyContainer_MidRange<bool> {
- .initial = {}, .index = 0, .input = {1, 1, 0, 1, 1}, .expected = {1, 1, 0, 1, 1}
-};
+template <>
+constexpr TestCase<int> EmptyContainer_EmptyRange<bool>{.initial = {}, .index = 0, .input = {}, .expected = {}};
+
+template <class T>
+constexpr TestCase<T> EmptyContainer_OneElementRange;
+template <>
+constexpr TestCase<int> EmptyContainer_OneElementRange<int>{.initial = {}, .index = 0, .input = {5}, .expected = {5}};
+template <>
+constexpr TestCase<char> EmptyContainer_OneElementRange<char>{.initial = {}, .index = 0, .input = "a", .expected = "a"};
+template <>
+constexpr TestCase<int> EmptyContainer_OneElementRange<bool>{
+ .initial = {}, .index = 0, .input = {true}, .expected = {true}};
+
+template <class T>
+constexpr TestCase<T> EmptyContainer_MidRange;
+template <>
+constexpr TestCase<int> EmptyContainer_MidRange<int>{
+ .initial = {}, .index = 0, .input = {5, 3, 1, 7, 9}, .expected = {5, 3, 1, 7, 9}};
+template <>
+constexpr TestCase<char> EmptyContainer_MidRange<char>{
+ .initial = {}, .index = 0, .input = "aeiou", .expected = "aeiou"};
+template <>
+constexpr TestCase<int> EmptyContainer_MidRange<bool>{
+ .initial = {}, .index = 0, .input = {1, 1, 0, 1, 1}, .expected = {1, 1, 0, 1, 1}};
// One-element container.
-template <class T> constexpr TestCase<T> OneElementContainer_Begin_EmptyRange;
-template <> constexpr TestCase<int> OneElementContainer_Begin_EmptyRange<int> {
- .initial = {3}, .index = 0, .input = {}, .expected = {3}
-};
-template <> constexpr TestCase<char> OneElementContainer_Begin_EmptyRange<char> {
- .initial = "B", .index = 0, .input = {}, .expected = "B"
-};
-template <> constexpr TestCase<int> OneElementContainer_Begin_EmptyRange<bool> {
- .initial = {0}, .index = 0, .input = {}, .expected = {0}
-};
-
-template <class T> constexpr TestCase<T> OneElementContainer_End_EmptyRange;
-template <> constexpr TestCase<int> OneElementContainer_End_EmptyRange<int> {
- .initial = {3}, .index = 1, .input = {}, .expected = {3}
-};
-template <> constexpr TestCase<char> OneElementContainer_End_EmptyRange<char> {
- .initial = "B", .index = 1, .input = {}, .expected = "B"
-};
-template <> constexpr TestCase<int> OneElementContainer_End_EmptyRange<bool> {
- .initial = {0}, .index = 1, .input = {}, .expected = {0}
-};
-
-template <class T> constexpr TestCase<T> OneElementContainer_Begin_OneElementRange;
-template <> constexpr TestCase<int> OneElementContainer_Begin_OneElementRange<int> {
- .initial = {3}, .index = 0, .input = {-5}, .expected = {-5, 3}
-};
-template <> constexpr TestCase<char> OneElementContainer_Begin_OneElementRange<char> {
- .initial = "B", .index = 0, .input = "a", .expected = "aB"
-};
-template <> constexpr TestCase<int> OneElementContainer_Begin_OneElementRange<bool> {
- .initial = {0}, .index = 0, .input = {1}, .expected = {1, 0}
-};
-
-template <class T> constexpr TestCase<T> OneElementContainer_End_OneElementRange;
-template <> constexpr TestCase<int> OneElementContainer_End_OneElementRange<int> {
- .initial = {3}, .index = 1, .input = {-5}, .expected = {3, -5}
-};
-template <> constexpr TestCase<char> OneElementContainer_End_OneElementRange<char> {
- .initial = "B", .index = 1, .input = "a", .expected = "Ba"
-};
-template <> constexpr TestCase<int> OneElementContainer_End_OneElementRange<bool> {
- .initial = {0}, .index = 1, .input = {1}, .expected = {0, 1}
-};
-
-template <class T> constexpr TestCase<T> OneElementContainer_Begin_MidRange;
-template <> constexpr TestCase<int> OneElementContainer_Begin_MidRange<int> {
- .initial = {3}, .index = 0, .input = {-5, -3, -1, -7, -9}, .expected = {-5, -3, -1, -7, -9, 3}
-};
-template <> constexpr TestCase<char> OneElementContainer_Begin_MidRange<char> {
- .initial = "B", .index = 0, .input = "aeiou", .expected = "aeiouB"
-};
-template <> constexpr TestCase<int> OneElementContainer_Begin_MidRange<bool> {
- .initial = {0}, .index = 0, .input = {1, 1, 0, 1, 1}, .expected = {1, 1, 0, 1, 1, 0}
-};
-
-template <class T> constexpr TestCase<T> OneElementContainer_End_MidRange;
-template <> constexpr TestCase<int> OneElementContainer_End_MidRange<int> {
- .initial = {3}, .index = 1, .input = {-5, -3, -1, -7, -9}, .expected = {3, -5, -3, -1, -7, -9}
-};
-template <> constexpr TestCase<char> OneElementContainer_End_MidRange<char> {
- .initial = "B", .index = 1, .input = "aeiou", .expected = "Baeiou"
-};
-template <> constexpr TestCase<int> OneElementContainer_End_MidRange<bool> {
- .initial = {0}, .index = 1, .input = {1, 1, 0, 1, 1}, .expected = {0, 1, 1, 0, 1, 1}
-};
+template <class T>
+constexpr TestCase<T> OneElementContainer_Begin_EmptyRange;
+template <>
+constexpr TestCase<int> OneElementContainer_Begin_EmptyRange<int>{
+ .initial = {3}, .index = 0, .input = {}, .expected = {3}};
+template <>
+constexpr TestCase<char> OneElementContainer_Begin_EmptyRange<char>{
+ .initial = "B", .index = 0, .input = {}, .expected = "B"};
+template <>
+constexpr TestCase<int> OneElementContainer_Begin_EmptyRange<bool>{
+ .initial = {0}, .index = 0, .input = {}, .expected = {0}};
+
+template <class T>
+constexpr TestCase<T> OneElementContainer_End_EmptyRange;
+template <>
+constexpr TestCase<int> OneElementContainer_End_EmptyRange<int>{
+ .initial = {3}, .index = 1, .input = {}, .expected = {3}};
+template <>
+constexpr TestCase<char> OneElementContainer_End_EmptyRange<char>{
+ .initial = "B", .index = 1, .input = {}, .expected = "B"};
+template <>
+constexpr TestCase<int> OneElementContainer_End_EmptyRange<bool>{
+ .initial = {0}, .index = 1, .input = {}, .expected = {0}};
+
+template <class T>
+constexpr TestCase<T> OneElementContainer_Begin_OneElementRange;
+template <>
+constexpr TestCase<int> OneElementContainer_Begin_OneElementRange<int>{
+ .initial = {3}, .index = 0, .input = {-5}, .expected = {-5, 3}};
+template <>
+constexpr TestCase<char> OneElementContainer_Begin_OneElementRange<char>{
+ .initial = "B", .index = 0, .input = "a", .expected = "aB"};
+template <>
+constexpr TestCase<int> OneElementContainer_Begin_OneElementRange<bool>{
+ .initial = {0}, .index = 0, .input = {1}, .expected = {1, 0}};
+
+template <class T>
+constexpr TestCase<T> OneElementContainer_End_OneElementRange;
+template <>
+constexpr TestCase<int> OneElementContainer_End_OneElementRange<int>{
+ .initial = {3}, .index = 1, .input = {-5}, .expected = {3, -5}};
+template <>
+constexpr TestCase<char> OneElementContainer_End_OneElementRange<char>{
+ .initial = "B", .index = 1, .input = "a", .expected = "Ba"};
+template <>
+constexpr TestCase<int> OneElementContainer_End_OneElementRange<bool>{
+ .initial = {0}, .index = 1, .input = {1}, .expected = {0, 1}};
+
+template <class T>
+constexpr TestCase<T> OneElementContainer_Begin_MidRange;
+template <>
+constexpr TestCase<int> OneElementContainer_Begin_MidRange<int>{
+ .initial = {3}, .index = 0, .input = {-5, -3, -1, -7, -9}, .expected = {-5, -3, -1, -7, -9, 3}};
+template <>
+constexpr TestCase<char> OneElementContainer_Begin_MidRange<char>{
+ .initial = "B", .index = 0, .input = "aeiou", .expected = "aeiouB"};
+template <>
+constexpr TestCase<int> OneElementContainer_Begin_MidRange<bool>{
+ .initial = {0}, .index = 0, .input = {1, 1, 0, 1, 1}, .expected = {1, 1, 0, 1, 1, 0}};
+
+template <class T>
+constexpr TestCase<T> OneElementContainer_End_MidRange;
+template <>
+constexpr TestCase<int> OneElementContainer_End_MidRange<int>{
+ .initial = {3}, .index = 1, .input = {-5, -3, -1, -7, -9}, .expected = {3, -5, -3, -1, -7, -9}};
+template <>
+constexpr TestCase<char> OneElementContainer_End_MidRange<char>{
+ .initial = "B", .index = 1, .input = "aeiou", .expected = "Baeiou"};
+template <>
+constexpr TestCase<int> OneElementContainer_End_MidRange<bool>{
+ .initial = {0}, .index = 1, .input = {1, 1, 0, 1, 1}, .expected = {0, 1, 1, 0, 1, 1}};
// Full container / empty range.
-template <class T> constexpr TestCase<T> FullContainer_Begin_EmptyRange;
-template <> constexpr TestCase<int> FullContainer_Begin_EmptyRange<int> {
- .initial = {11, 29, 35, 14, 84}, .index = 0, .input = {}, .expected = {11, 29, 35, 14, 84}
-};
-template <> constexpr TestCase<char> FullContainer_Begin_EmptyRange<char> {
- .initial = "_BCD_", .index = 0, .input = {}, .expected = "_BCD_"
-};
-template <> constexpr TestCase<int> FullContainer_Begin_EmptyRange<bool> {
- .initial = {0, 0, 1, 0, 0}, .index = 0, .input = {}, .expected = {0, 0, 1, 0, 0}
-};
-
-template <class T> constexpr TestCase<T> FullContainer_Mid_EmptyRange;
-template <> constexpr TestCase<int> FullContainer_Mid_EmptyRange<int> {
- .initial = {11, 29, 35, 14, 84}, .index = 2, .input = {}, .expected = {11, 29, 35, 14, 84}
-};
-template <> constexpr TestCase<char> FullContainer_Mid_EmptyRange<char> {
- .initial = "_BCD_", .index = 2, .input = {}, .expected = "_BCD_"
-};
-template <> constexpr TestCase<int> FullContainer_Mid_EmptyRange<bool> {
- .initial = {0, 0, 1, 0, 0}, .index = 2, .input = {}, .expected = {0, 0, 1, 0, 0}
-};
-
-template <class T> constexpr TestCase<T> FullContainer_End_EmptyRange;
-template <> constexpr TestCase<int> FullContainer_End_EmptyRange<int> {
- .initial = {11, 29, 35, 14, 84}, .index = 5, .input = {}, .expected = {11, 29, 35, 14, 84}
-};
-template <> constexpr TestCase<char> FullContainer_End_EmptyRange<char> {
- .initial = "_BCD_", .index = 5, .input = {}, .expected = "_BCD_"
-};
-template <> constexpr TestCase<int> FullContainer_End_EmptyRange<bool> {
- .initial = {0, 0, 1, 0, 0}, .index = 5, .input = {}, .expected = {0, 0, 1, 0, 0}
-};
+template <class T>
+constexpr TestCase<T> FullContainer_Begin_EmptyRange;
+template <>
+constexpr TestCase<int> FullContainer_Begin_EmptyRange<int>{
+ .initial = {11, 29, 35, 14, 84}, .index = 0, .input = {}, .expected = {11, 29, 35, 14, 84}};
+template <>
+constexpr TestCase<char> FullContainer_Begin_EmptyRange<char>{
+ .initial = "_BCD_", .index = 0, .input = {}, .expected = "_BCD_"};
+template <>
+constexpr TestCase<int> FullContainer_Begin_EmptyRange<bool>{
+ .initial = {0, 0, 1, 0, 0}, .index = 0, .input = {}, .expected = {0, 0, 1, 0, 0}};
+
+template <class T>
+constexpr TestCase<T> FullContainer_Mid_EmptyRange;
+template <>
+constexpr TestCase<int> FullContainer_Mid_EmptyRange<int>{
+ .initial = {11, 29, 35, 14, 84}, .index = 2, .input = {}, .expected = {11, 29, 35, 14, 84}};
+template <>
+constexpr TestCase<char> FullContainer_Mid_EmptyRange<char>{
+ .initial = "_BCD_", .index = 2, .input = {}, .expected = "_BCD_"};
+template <>
+constexpr TestCase<int> FullContainer_Mid_EmptyRange<bool>{
+ .initial = {0, 0, 1, 0, 0}, .index = 2, .input = {}, .expected = {0, 0, 1, 0, 0}};
+
+template <class T>
+constexpr TestCase<T> FullContainer_End_EmptyRange;
+template <>
+constexpr TestCase<int> FullContainer_End_EmptyRange<int>{
+ .initial = {11, 29, 35, 14, 84}, .index = 5, .input = {}, .expected = {11, 29, 35, 14, 84}};
+template <>
+constexpr TestCase<char> FullContainer_End_EmptyRange<char>{
+ .initial = "_BCD_", .index = 5, .input = {}, .expected = "_BCD_"};
+template <>
+constexpr TestCase<int> FullContainer_End_EmptyRange<bool>{
+ .initial = {0, 0, 1, 0, 0}, .index = 5, .input = {}, .expected = {0, 0, 1, 0, 0}};
// Full container / one-element range.
-template <class T> constexpr TestCase<T> FullContainer_Begin_OneElementRange;
-template <> constexpr TestCase<int> FullContainer_Begin_OneElementRange<int> {
- .initial = {11, 29, 35, 14, 84}, .index = 0, .input = {-5}, .expected = {-5, 11, 29, 35, 14, 84}
-};
-template <> constexpr TestCase<char> FullContainer_Begin_OneElementRange<char> {
- .initial = "_BCD_", .index = 0, .input = "a", .expected = "a_BCD_"
-};
-template <> constexpr TestCase<int> FullContainer_Begin_OneElementRange<bool> {
- .initial = {0, 0, 1, 0, 0}, .index = 0, .input = {1}, .expected = {1, 0, 0, 1, 0, 0}
-};
-
-template <class T> constexpr TestCase<T> FullContainer_Mid_OneElementRange;
-template <> constexpr TestCase<int> FullContainer_Mid_OneElementRange<int> {
- .initial = {11, 29, 35, 14, 84}, .index = 2, .input = {-5}, .expected = {11, 29, -5, 35, 14, 84}
-};
-template <> constexpr TestCase<char> FullContainer_Mid_OneElementRange<char> {
- .initial = "_BCD_", .index = 2, .input = "a", .expected = "_BaCD_"
-};
-template <> constexpr TestCase<int> FullContainer_Mid_OneElementRange<bool> {
- .initial = {0, 0, 1, 0, 0}, .index = 2, .input = {1}, .expected = {0, 0, 1, 1, 0, 0}
-};
-
-template <class T> constexpr TestCase<T> FullContainer_End_OneElementRange;
-template <> constexpr TestCase<int> FullContainer_End_OneElementRange<int> {
- .initial = {11, 29, 35, 14, 84}, .index = 5, .input = {-5}, .expected = {11, 29, 35, 14, 84, -5}
-};
-template <> constexpr TestCase<char> FullContainer_End_OneElementRange<char> {
- .initial = "_BCD_", .index = 5, .input = "a", .expected = "_BCD_a"
-};
-template <> constexpr TestCase<int> FullContainer_End_OneElementRange<bool> {
- .initial = {0, 0, 1, 0, 0}, .index = 5, .input = {1}, .expected = {0, 0, 1, 0, 0, 1}
-};
+template <class T>
+constexpr TestCase<T> FullContainer_Begin_OneElementRange;
+template <>
+constexpr TestCase<int> FullContainer_Begin_OneElementRange<int>{
+ .initial = {11, 29, 35, 14, 84}, .index = 0, .input = {-5}, .expected = {-5, 11, 29, 35, 14, 84}};
+template <>
+constexpr TestCase<char> FullContainer_Begin_OneElementRange<char>{
+ .initial = "_BCD_", .index = 0, .input = "a", .expected = "a_BCD_"};
+template <>
+constexpr TestCase<int> FullContainer_Begin_OneElementRange<bool>{
+ .initial = {0, 0, 1, 0, 0}, .index = 0, .input = {1}, .expected = {1, 0, 0, 1, 0, 0}};
+
+template <class T>
+constexpr TestCase<T> FullContainer_Mid_OneElementRange;
+template <>
+constexpr TestCase<int> FullContainer_Mid_OneElementRange<int>{
+ .initial = {11, 29, 35, 14, 84}, .index = 2, .input = {-5}, .expected = {11, 29, -5, 35, 14, 84}};
+template <>
+constexpr TestCase<char> FullContainer_Mid_OneElementRange<char>{
+ .initial = "_BCD_", .index = 2, .input = "a", .expected = "_BaCD_"};
+template <>
+constexpr TestCase<int> FullContainer_Mid_OneElementRange<bool>{
+ .initial = {0, 0, 1, 0, 0}, .index = 2, .input = {1}, .expected = {0, 0, 1, 1, 0, 0}};
+
+template <class T>
+constexpr TestCase<T> FullContainer_End_OneElementRange;
+template <>
+constexpr TestCase<int> FullContainer_End_OneElementRange<int>{
+ .initial = {11, 29, 35, 14, 84}, .index = 5, .input = {-5}, .expected = {11, 29, 35, 14, 84, -5}};
+template <>
+constexpr TestCase<char> FullContainer_End_OneElementRange<char>{
+ .initial = "_BCD_", .index = 5, .input = "a", .expected = "_BCD_a"};
+template <>
+constexpr TestCase<int> FullContainer_End_OneElementRange<bool>{
+ .initial = {0, 0, 1, 0, 0}, .index = 5, .input = {1}, .expected = {0, 0, 1, 0, 0, 1}};
// Full container / mid-sized range.
-template <class T> constexpr TestCase<T> FullContainer_Begin_MidRange;
-template <> constexpr TestCase<int> FullContainer_Begin_MidRange<int> {
- .initial = {11, 29, 35, 14, 84},
- .index = 0,
- .input = {-5, -3, -1, -7, -9},
- .expected = {-5, -3, -1, -7, -9, 11, 29, 35, 14, 84}
-};
-template <> constexpr TestCase<char> FullContainer_Begin_MidRange<char> {
- .initial = "_BCD_",
- .index = 0,
- .input = "aeiou",
- .expected = "aeiou_BCD_"
-};
-template <> constexpr TestCase<int> FullContainer_Begin_MidRange<bool> {
- .initial = {0, 0, 1, 0, 1},
- .index = 0,
- .input = {1, 1, 0, 1, 1},
- .expected = {1, 1, 0, 1, 1, 0, 0, 1, 0, 1}
-};
-
-template <class T> constexpr TestCase<T> FullContainer_Mid_MidRange;
-template <> constexpr TestCase<int> FullContainer_Mid_MidRange<int> {
- .initial = {11, 29, 35, 14, 84},
- .index = 2,
- .input = {-5, -3, -1, -7, -9},
- .expected = {11, 29, -5, -3, -1, -7, -9, 35, 14, 84}
-};
-template <> constexpr TestCase<char> FullContainer_Mid_MidRange<char> {
- .initial = "_BCD_",
- .index = 2,
- .input = "aeiou",
- .expected = "_BaeiouCD_"
-};
-template <> constexpr TestCase<int> FullContainer_Mid_MidRange<bool> {
- .initial = {0, 0, 1, 0, 1},
- .index = 2,
- .input = {1, 1, 0, 1, 1},
- .expected = {0, 0, 1, 1, 0, 1, 1, 1, 0, 1}
-};
-
-template <class T> constexpr TestCase<T> FullContainer_End_MidRange;
-template <> constexpr TestCase<int> FullContainer_End_MidRange<int> {
- .initial = {11, 29, 35, 14, 84},
- .index = 5,
- .input = {-5, -3, -1, -7, -9},
- .expected = {11, 29, 35, 14, 84, -5, -3, -1, -7, -9}
-};
-template <> constexpr TestCase<char> FullContainer_End_MidRange<char> {
- .initial = "_BCD_",
- .index = 5,
- .input = "aeiou",
- .expected = "_BCD_aeiou"
-};
-template <> constexpr TestCase<int> FullContainer_End_MidRange<bool> {
- .initial = {0, 0, 1, 0, 1},
- .index = 5,
- .input = {1, 1, 0, 1, 1},
- .expected = {0, 0, 1, 0, 1, 1, 1, 0, 1, 1}
-};
+template <class T>
+constexpr TestCase<T> FullContainer_Begin_MidRange;
+template <>
+constexpr TestCase<int> FullContainer_Begin_MidRange<int>{
+ .initial = {11, 29, 35, 14, 84},
+ .index = 0,
+ .input = {-5, -3, -1, -7, -9},
+ .expected = {-5, -3, -1, -7, -9, 11, 29, 35, 14, 84}};
+template <>
+constexpr TestCase<char> FullContainer_Begin_MidRange<char>{
+ .initial = "_BCD_", .index = 0, .input = "aeiou", .expected = "aeiou_BCD_"};
+template <>
+constexpr TestCase<int> FullContainer_Begin_MidRange<bool>{
+ .initial = {0, 0, 1, 0, 1}, .index = 0, .input = {1, 1, 0, 1, 1}, .expected = {1, 1, 0, 1, 1, 0, 0, 1, 0, 1}};
+
+template <class T>
+constexpr TestCase<T> FullContainer_Mid_MidRange;
+template <>
+constexpr TestCase<int> FullContainer_Mid_MidRange<int>{
+ .initial = {11, 29, 35, 14, 84},
+ .index = 2,
+ .input = {-5, -3, -1, -7, -9},
+ .expected = {11, 29, -5, -3, -1, -7, -9, 35, 14, 84}};
+template <>
+constexpr TestCase<char> FullContainer_Mid_MidRange<char>{
+ .initial = "_BCD_", .index = 2, .input = "aeiou", .expected = "_BaeiouCD_"};
+template <>
+constexpr TestCase<int> FullContainer_Mid_MidRange<bool>{
+ .initial = {0, 0, 1, 0, 1}, .index = 2, .input = {1, 1, 0, 1, 1}, .expected = {0, 0, 1, 1, 0, 1, 1, 1, 0, 1}};
+
+template <class T>
+constexpr TestCase<T> FullContainer_End_MidRange;
+template <>
+constexpr TestCase<int> FullContainer_End_MidRange<int>{
+ .initial = {11, 29, 35, 14, 84},
+ .index = 5,
+ .input = {-5, -3, -1, -7, -9},
+ .expected = {11, 29, 35, 14, 84, -5, -3, -1, -7, -9}};
+template <>
+constexpr TestCase<char> FullContainer_End_MidRange<char>{
+ .initial = "_BCD_", .index = 5, .input = "aeiou", .expected = "_BCD_aeiou"};
+template <>
+constexpr TestCase<int> FullContainer_End_MidRange<bool>{
+ .initial = {0, 0, 1, 0, 1}, .index = 5, .input = {1, 1, 0, 1, 1}, .expected = {0, 0, 1, 0, 1, 1, 1, 0, 1, 1}};
// Full container / long range.
-template <class T> constexpr TestCase<T> FullContainer_Begin_LongRange;
-template <> constexpr TestCase<int> FullContainer_Begin_LongRange<int> {
- .initial = {11, 29, 35, 14, 84},
- .index = 0,
- .input = {-5, -3, -1, -7, -9, -19, -48, -56, -13, -14, -29, -88, -17, -1, -5, -11, -89, -21, -33, -48},
- .expected = {
- -5, -3, -1, -7, -9, -19, -48, -56, -13, -14, -29, -88, -17, -1, -5, -11, -89, -21, -33, -48, 11, 29, 35, 14, 84
- }
-};
-template <> constexpr TestCase<char> FullContainer_Begin_LongRange<char> {
- .initial = "_BCD_",
- .index = 0,
- .input = "aeiouqwxyz5781964203",
- .expected = "aeiouqwxyz5781964203_BCD_"
-};
-template <> constexpr TestCase<int> FullContainer_Begin_LongRange<bool> {
- .initial = {0, 0, 1, 0, 0},
- .index = 0,
- .input = {1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0},
- .expected = {
- 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0
- }
-};
-
-template <class T> constexpr TestCase<T> FullContainer_Mid_LongRange;
-template <> constexpr TestCase<int> FullContainer_Mid_LongRange<int> {
- .initial = {11, 29, 35, 14, 84},
- .index = 2,
- .input = {-5, -3, -1, -7, -9, -19, -48, -56, -13, -14, -29, -88, -17, -1, -5, -11, -89, -21, -33, -48},
- .expected = {
- 11, 29, -5, -3, -1, -7, -9, -19, -48, -56, -13, -14, -29, -88, -17, -1, -5, -11, -89, -21, -33, -48, 35, 14, 84
- }
-};
-template <> constexpr TestCase<char> FullContainer_Mid_LongRange<char> {
- .initial = "_BCD_",
- .index = 2,
- .input = "aeiouqwxyz5781964203",
- .expected = "_Baeiouqwxyz5781964203CD_"
-};
-template <> constexpr TestCase<int> FullContainer_Mid_LongRange<bool> {
- .initial = {0, 0, 1, 0, 0},
- .index = 2,
- .input = {1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0},
- .expected = {
- 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0
- }
-};
-
-template <class T> constexpr TestCase<T> FullContainer_End_LongRange;
-template <> constexpr TestCase<int> FullContainer_End_LongRange<int> {
- .initial = {11, 29, 35, 14, 84},
- .index = 5,
- .input = {-5, -3, -1, -7, -9, -19, -48, -56, -13, -14, -29, -88, -17, -1, -5, -11, -89, -21, -33, -48},
- .expected = {
- 11, 29, 35, 14, 84, -5, -3, -1, -7, -9, -19, -48, -56, -13, -14, -29, -88, -17, -1, -5, -11, -89, -21, -33, -48
- }
-};
-template <> constexpr TestCase<char> FullContainer_End_LongRange<char> {
- .initial = "_BCD_",
- .index = 5,
- .input = "aeiouqwxyz5781964203",
- .expected = "_BCD_aeiouqwxyz5781964203"
-};
-template <> constexpr TestCase<int> FullContainer_End_LongRange<bool> {
- .initial = {0, 0, 1, 0, 1},
- .index = 5,
- .input = {1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0},
- .expected = {
- 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0
- }
-};
+template <class T>
+constexpr TestCase<T> FullContainer_Begin_LongRange;
+template <>
+constexpr TestCase<int> FullContainer_Begin_LongRange<int>{
+ .initial = {11, 29, 35, 14, 84},
+ .index = 0,
+ .input = {-5, -3, -1, -7, -9, -19, -48, -56, -13, -14, -29, -88, -17, -1, -5, -11, -89, -21, -33, -48},
+ .expected = {-5, -3, -1, -7, -9, -19, -48, -56, -13, -14, -29, -88, -17,
+ -1, -5, -11, -89, -21, -33, -48, 11, 29, 35, 14, 84}};
+template <>
+constexpr TestCase<char> FullContainer_Begin_LongRange<char>{
+ .initial = "_BCD_", .index = 0, .input = "aeiouqwxyz5781964203", .expected = "aeiouqwxyz5781964203_BCD_"};
+template <>
+constexpr TestCase<int> FullContainer_Begin_LongRange<bool>{
+ .initial = {0, 0, 1, 0, 0},
+ .index = 0,
+ .input = {1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0},
+ .expected = {1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0}};
+
+template <class T>
+constexpr TestCase<T> FullContainer_Mid_LongRange;
+template <>
+constexpr TestCase<int> FullContainer_Mid_LongRange<int>{
+ .initial = {11, 29, 35, 14, 84},
+ .index = 2,
+ .input = {-5, -3, -1, -7, -9, -19, -48, -56, -13, -14, -29, -88, -17, -1, -5, -11, -89, -21, -33, -48},
+ .expected = {11, 29, -5, -3, -1, -7, -9, -19, -48, -56, -13, -14, -29,
+ -88, -17, -1, -5, -11, -89, -21, -33, -48, 35, 14, 84}};
+template <>
+constexpr TestCase<char> FullContainer_Mid_LongRange<char>{
+ .initial = "_BCD_", .index = 2, .input = "aeiouqwxyz5781964203", .expected = "_Baeiouqwxyz5781964203CD_"};
+template <>
+constexpr TestCase<int> FullContainer_Mid_LongRange<bool>{
+ .initial = {0, 0, 1, 0, 0},
+ .index = 2,
+ .input = {1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0},
+ .expected = {0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0}};
+
+template <class T>
+constexpr TestCase<T> FullContainer_End_LongRange;
+template <>
+constexpr TestCase<int> FullContainer_End_LongRange<int>{
+ .initial = {11, 29, 35, 14, 84},
+ .index = 5,
+ .input = {-5, -3, -1, -7, -9, -19, -48, -56, -13, -14, -29, -88, -17, -1, -5, -11, -89, -21, -33, -48},
+ .expected = {11, 29, 35, 14, 84, -5, -3, -1, -7, -9, -19, -48, -56,
+ -13, -14, -29, -88, -17, -1, -5, -11, -89, -21, -33, -48}};
+template <>
+constexpr TestCase<char> FullContainer_End_LongRange<char>{
+ .initial = "_BCD_", .index = 5, .input = "aeiouqwxyz5781964203", .expected = "_BCD_aeiouqwxyz5781964203"};
+template <>
+constexpr TestCase<int> FullContainer_End_LongRange<bool>{
+ .initial = {0, 0, 1, 0, 1},
+ .index = 5,
+ .input = {1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0},
+ .expected = {0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0}};
// Sequence containers tests.
template <class Container, class Iter, class Sent, class Validate>
constexpr void test_sequence_insert_range(Validate validate) {
- using T = typename Container::value_type;
+ using T = typename Container::value_type;
using D = typename Container::
diff erence_type;
auto get_pos = [](auto& c, auto& test_case) { return std::ranges::next(c.begin(), static_cast<D>(test_case.index)); };
auto test = [&](auto& test_case) {
Container c(test_case.initial.begin(), test_case.initial.end());
- auto in = wrap_input<Iter, Sent>(test_case.input);
+ auto in = wrap_input<Iter, Sent>(test_case.input);
auto pos = get_pos(c, test_case);
auto result = c.insert_range(pos, in);
@@ -583,13 +554,13 @@ template <class Container, class Iter, class Sent, class Validate>
constexpr void test_sequence_assign_range(Validate validate) {
using T = typename Container::value_type;
- auto& initial_empty = EmptyContainer_EmptyRange<T>.initial;
+ auto& initial_empty = EmptyContainer_EmptyRange<T>.initial;
auto& initial_one_element = OneElementContainer_Begin_EmptyRange<T>.initial;
- auto& initial_full = FullContainer_Begin_EmptyRange<T>.initial;
- auto& input_empty = FullContainer_Begin_EmptyRange<T>.input;
- auto& input_one_element = FullContainer_Begin_OneElementRange<T>.input;
- auto& input_mid_range = FullContainer_Begin_MidRange<T>.input;
- auto& input_long_range = FullContainer_Begin_LongRange<T>.input;
+ auto& initial_full = FullContainer_Begin_EmptyRange<T>.initial;
+ auto& input_empty = FullContainer_Begin_EmptyRange<T>.input;
+ auto& input_one_element = FullContainer_Begin_OneElementRange<T>.input;
+ auto& input_mid_range = FullContainer_Begin_MidRange<T>.input;
+ auto& input_long_range = FullContainer_Begin_LongRange<T>.input;
auto test = [&](auto& initial, auto& input) {
Container c(initial.begin(), initial.end());
@@ -636,7 +607,7 @@ constexpr void test_sequence_assign_range(Validate validate) {
// Move-only types.
-template <template <class ...> class Container>
+template <template <class...> class Container>
constexpr void test_sequence_insert_range_move_only() {
MoveOnly input[5];
std::ranges::subrange in(std::move_iterator{input}, std::move_iterator{input + 5});
@@ -645,7 +616,7 @@ constexpr void test_sequence_insert_range_move_only() {
c.insert_range(c.end(), in);
}
-template <template <class ...> class Container>
+template <template <class...> class Container>
constexpr void test_sequence_prepend_range_move_only() {
MoveOnly input[5];
std::ranges::subrange in(std::move_iterator{input}, std::move_iterator{input + 5});
@@ -654,7 +625,7 @@ constexpr void test_sequence_prepend_range_move_only() {
c.prepend_range(in);
}
-template <template <class ...> class Container>
+template <template <class...> class Container>
constexpr void test_sequence_append_range_move_only() {
MoveOnly input[5];
std::ranges::subrange in(std::move_iterator{input}, std::move_iterator{input + 5});
@@ -663,7 +634,7 @@ constexpr void test_sequence_append_range_move_only() {
c.append_range(in);
}
-template <template <class ...> class Container>
+template <template <class...> class Container>
constexpr void test_sequence_assign_range_move_only() {
MoveOnly input[5];
std::ranges::subrange in(std::move_iterator{input}, std::move_iterator{input + 5});
@@ -674,11 +645,11 @@ constexpr void test_sequence_assign_range_move_only() {
// Exception safety.
-template <template <class ...> class Container>
+template <template <class...> class Container>
void test_insert_range_exception_safety_throwing_copy() {
#if !defined(TEST_HAS_NO_EXCEPTIONS)
constexpr int ThrowOn = 3;
- using T = ThrowingCopy<ThrowOn>;
+ using T = ThrowingCopy<ThrowOn>;
test_exception_safety_throwing_copy<ThrowOn, /*Size=*/5>([](T* from, T* to) {
Container<T> c;
c.insert_range(c.end(), std::ranges::subrange(from, to));
@@ -686,7 +657,7 @@ void test_insert_range_exception_safety_throwing_copy() {
#endif
}
-template <template <class ...> class Container, class T>
+template <template <class...> class Container, class T>
void test_insert_range_exception_safety_throwing_allocator() {
#if !defined(TEST_HAS_NO_EXCEPTIONS)
T in[] = {0, 1};
@@ -705,11 +676,11 @@ void test_insert_range_exception_safety_throwing_allocator() {
#endif
}
-template <template <class ...> class Container>
+template <template <class...> class Container>
void test_prepend_range_exception_safety_throwing_copy() {
#if !defined(TEST_HAS_NO_EXCEPTIONS)
constexpr int ThrowOn = 3;
- using T = ThrowingCopy<ThrowOn>;
+ using T = ThrowingCopy<ThrowOn>;
test_exception_safety_throwing_copy<ThrowOn, /*Size=*/5>([](T* from, T* to) {
Container<T> c;
c.prepend_range(std::ranges::subrange(from, to));
@@ -717,7 +688,7 @@ void test_prepend_range_exception_safety_throwing_copy() {
#endif
}
-template <template <class ...> class Container, class T>
+template <template <class...> class Container, class T>
void test_prepend_range_exception_safety_throwing_allocator() {
#if !defined(TEST_HAS_NO_EXCEPTIONS)
T in[] = {0, 1};
@@ -736,11 +707,11 @@ void test_prepend_range_exception_safety_throwing_allocator() {
#endif
}
-template <template <class ...> class Container>
+template <template <class...> class Container>
void test_append_range_exception_safety_throwing_copy() {
#if !defined(TEST_HAS_NO_EXCEPTIONS)
constexpr int ThrowOn = 3;
- using T = ThrowingCopy<ThrowOn>;
+ using T = ThrowingCopy<ThrowOn>;
test_exception_safety_throwing_copy<ThrowOn, /*Size=*/5>([](T* from, T* to) {
Container<T> c;
c.append_range(std::ranges::subrange(from, to));
@@ -748,7 +719,7 @@ void test_append_range_exception_safety_throwing_copy() {
#endif
}
-template <template <class ...> class Container, class T>
+template <template <class...> class Container, class T>
void test_append_range_exception_safety_throwing_allocator() {
#if !defined(TEST_HAS_NO_EXCEPTIONS)
T in[] = {0, 1};
@@ -767,11 +738,11 @@ void test_append_range_exception_safety_throwing_allocator() {
#endif
}
-template <template <class ...> class Container>
+template <template <class...> class Container>
void test_assign_range_exception_safety_throwing_copy() {
#if !defined(TEST_HAS_NO_EXCEPTIONS)
constexpr int ThrowOn = 3;
- using T = ThrowingCopy<ThrowOn>;
+ using T = ThrowingCopy<ThrowOn>;
test_exception_safety_throwing_copy<ThrowOn, /*Size=*/5>([](T* from, T* to) {
Container<T> c;
c.assign_range(std::ranges::subrange(from, to));
@@ -779,7 +750,7 @@ void test_assign_range_exception_safety_throwing_copy() {
#endif
}
-template <template <class ...> class Container, class T>
+template <template <class...> class Container, class T>
void test_assign_range_exception_safety_throwing_allocator() {
#if !defined(TEST_HAS_NO_EXCEPTIONS)
T in[] = {0, 1};
diff --git a/libcxx/test/std/containers/sequences/list/allocator_mismatch.verify.cpp b/libcxx/test/std/containers/sequences/list/allocator_mismatch.verify.cpp
index 981e2face7ede66..ff67c032610026e 100644
--- a/libcxx/test/std/containers/sequences/list/allocator_mismatch.verify.cpp
+++ b/libcxx/test/std/containers/sequences/list/allocator_mismatch.verify.cpp
@@ -12,4 +12,4 @@
#include <list>
std::list<int, std::allocator<long> > l;
- // expected-error-re@*:* {{static assertion failed{{.*}}Allocator::value_type must be same type as value_type}}
+// expected-error-re@*:* {{static assertion failed{{.*}}Allocator::value_type must be same type as value_type}}
diff --git a/libcxx/test/std/containers/sequences/list/compare.pass.cpp b/libcxx/test/std/containers/sequences/list/compare.pass.cpp
index 1d6dd80745447f9..ce00f57733bf9d2 100644
--- a/libcxx/test/std/containers/sequences/list/compare.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/compare.pass.cpp
@@ -38,80 +38,80 @@
#include "test_comparisons.h"
int main(int, char**) {
- {
- const std::list<int> l1, l2;
- assert(testComparisons(l1, l2, true, false));
- }
- {
- const std::list<int> l1(1, 1), l2(1, 1);
- assert(testComparisons(l1, l2, true, false));
- }
- {
- int items[3] = {1, 2, 3};
- const std::list<int> l1(items, items + 3);
- const std::list<int> l2(items, items + 3);
- assert(testComparisons(l1, l2, true, false));
- }
- {
- const std::list<int> l1(1, 1), l2;
- assert(testComparisons(l1, l2, false, false));
- }
- {
- const std::list<int> l1(1, 1), l2(1, 2);
- assert(testComparisons(l1, l2, false, true));
- }
- {
- int items1[2] = {1, 2};
- int items2[2] = {1, 3};
- const std::list<int> l1(items1, items1 + 2);
- const std::list<int> l2(items2, items2 + 2);
- assert(testComparisons(l1, l2, false, true));
- }
- {
- int items1[2] = {2, 2};
- int items2[2] = {1, 3};
- const std::list<int> l1(items1, items1 + 2);
- const std::list<int> l2(items2, items2 + 2);
- assert(testComparisons(l1, l2, false, false));
- }
- {
- const std::list<LessAndEqComp> l1, l2;
- assert(testComparisons(l1, l2, true, false));
- }
- {
- const std::list<LessAndEqComp> l1(1, LessAndEqComp(1));
- const std::list<LessAndEqComp> l2(1, LessAndEqComp(1));
- assert(testComparisons(l1, l2, true, false));
- }
- {
- LessAndEqComp items[3] = {LessAndEqComp(1), LessAndEqComp(2), LessAndEqComp(3)};
- const std::list<LessAndEqComp> l1(items, items + 3);
- const std::list<LessAndEqComp> l2(items, items + 3);
- assert(testComparisons(l1, l2, true, false));
- }
- {
- const std::list<LessAndEqComp> l1(1, LessAndEqComp(1));
- const std::list<LessAndEqComp> l2;
- assert(testComparisons(l1, l2, false, false));
- }
- {
- const std::list<LessAndEqComp> l1(1, LessAndEqComp(1));
- const std::list<LessAndEqComp> l2(1, LessAndEqComp(2));
- assert(testComparisons(l1, l2, false, true));
- }
- {
- LessAndEqComp items1[2] = {LessAndEqComp(1), LessAndEqComp(2)};
- LessAndEqComp items2[2] = {LessAndEqComp(1), LessAndEqComp(3)};
- const std::list<LessAndEqComp> l1(items1, items1 + 2);
- const std::list<LessAndEqComp> l2(items2, items2 + 2);
- assert(testComparisons(l1, l2, false, true));
- }
- {
- LessAndEqComp items1[2] = {LessAndEqComp(2), LessAndEqComp(2)};
- LessAndEqComp items2[2] = {LessAndEqComp(1), LessAndEqComp(3)};
- const std::list<LessAndEqComp> l1(items1, items1 + 2);
- const std::list<LessAndEqComp> l2(items2, items2 + 2);
- assert(testComparisons(l1, l2, false, false));
- }
- return 0;
+ {
+ const std::list<int> l1, l2;
+ assert(testComparisons(l1, l2, true, false));
+ }
+ {
+ const std::list<int> l1(1, 1), l2(1, 1);
+ assert(testComparisons(l1, l2, true, false));
+ }
+ {
+ int items[3] = {1, 2, 3};
+ const std::list<int> l1(items, items + 3);
+ const std::list<int> l2(items, items + 3);
+ assert(testComparisons(l1, l2, true, false));
+ }
+ {
+ const std::list<int> l1(1, 1), l2;
+ assert(testComparisons(l1, l2, false, false));
+ }
+ {
+ const std::list<int> l1(1, 1), l2(1, 2);
+ assert(testComparisons(l1, l2, false, true));
+ }
+ {
+ int items1[2] = {1, 2};
+ int items2[2] = {1, 3};
+ const std::list<int> l1(items1, items1 + 2);
+ const std::list<int> l2(items2, items2 + 2);
+ assert(testComparisons(l1, l2, false, true));
+ }
+ {
+ int items1[2] = {2, 2};
+ int items2[2] = {1, 3};
+ const std::list<int> l1(items1, items1 + 2);
+ const std::list<int> l2(items2, items2 + 2);
+ assert(testComparisons(l1, l2, false, false));
+ }
+ {
+ const std::list<LessAndEqComp> l1, l2;
+ assert(testComparisons(l1, l2, true, false));
+ }
+ {
+ const std::list<LessAndEqComp> l1(1, LessAndEqComp(1));
+ const std::list<LessAndEqComp> l2(1, LessAndEqComp(1));
+ assert(testComparisons(l1, l2, true, false));
+ }
+ {
+ LessAndEqComp items[3] = {LessAndEqComp(1), LessAndEqComp(2), LessAndEqComp(3)};
+ const std::list<LessAndEqComp> l1(items, items + 3);
+ const std::list<LessAndEqComp> l2(items, items + 3);
+ assert(testComparisons(l1, l2, true, false));
+ }
+ {
+ const std::list<LessAndEqComp> l1(1, LessAndEqComp(1));
+ const std::list<LessAndEqComp> l2;
+ assert(testComparisons(l1, l2, false, false));
+ }
+ {
+ const std::list<LessAndEqComp> l1(1, LessAndEqComp(1));
+ const std::list<LessAndEqComp> l2(1, LessAndEqComp(2));
+ assert(testComparisons(l1, l2, false, true));
+ }
+ {
+ LessAndEqComp items1[2] = {LessAndEqComp(1), LessAndEqComp(2)};
+ LessAndEqComp items2[2] = {LessAndEqComp(1), LessAndEqComp(3)};
+ const std::list<LessAndEqComp> l1(items1, items1 + 2);
+ const std::list<LessAndEqComp> l2(items2, items2 + 2);
+ assert(testComparisons(l1, l2, false, true));
+ }
+ {
+ LessAndEqComp items1[2] = {LessAndEqComp(2), LessAndEqComp(2)};
+ LessAndEqComp items2[2] = {LessAndEqComp(1), LessAndEqComp(3)};
+ const std::list<LessAndEqComp> l1(items1, items1 + 2);
+ const std::list<LessAndEqComp> l2(items2, items2 + 2);
+ assert(testComparisons(l1, l2, false, false));
+ }
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/list/exception_safety.pass.cpp b/libcxx/test/std/containers/sequences/list/exception_safety.pass.cpp
index c734d18f2bb2fc0..9820792f748c2c0 100644
--- a/libcxx/test/std/containers/sequences/list/exception_safety.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/exception_safety.pass.cpp
@@ -58,29 +58,29 @@
#include "test_macros.h"
#if TEST_STD_VER >= 23
-#include <ranges>
+# include <ranges>
#endif
int main(int, char**) {
{
constexpr int ThrowOn = 1;
- constexpr int Size = 1;
- using T = ThrowingCopy<ThrowOn>;
+ constexpr int Size = 1;
+ using T = ThrowingCopy<ThrowOn>;
// void push_front(const value_type& v);
- test_exception_safety_throwing_copy<ThrowOn, Size>([](T* from, T*){
+ test_exception_safety_throwing_copy<ThrowOn, Size>([](T* from, T*) {
std::list<T> c;
c.push_front(*from);
});
// void push_back(const value_type& v);
- test_exception_safety_throwing_copy<ThrowOn, Size>([](T* from, T*){
+ test_exception_safety_throwing_copy<ThrowOn, Size>([](T* from, T*) {
std::list<T> c;
c.push_back(*from);
});
// iterator insert(const_iterator p, const value_type& v);
- test_exception_safety_throwing_copy</*ThrowOn=*/1, Size>([](T* from, T*){
+ test_exception_safety_throwing_copy</*ThrowOn=*/1, Size>([](T* from, T*) {
std::list<T> c;
c.insert(c.end(), *from);
});
@@ -88,33 +88,33 @@ int main(int, char**) {
{
constexpr int ThrowOn = 3;
- constexpr int Size = 5;
- using T = ThrowingCopy<ThrowOn>;
- using C = std::list<T>;
- using Alloc = std::allocator<T>;
+ constexpr int Size = 5;
+ using T = ThrowingCopy<ThrowOn>;
+ using C = std::list<T>;
+ using Alloc = std::allocator<T>;
// list(size_type n, const value_type& v);
- test_exception_safety_throwing_copy<ThrowOn, Size>([](T* from, T*){
+ test_exception_safety_throwing_copy<ThrowOn, Size>([](T* from, T*) {
std::list<T> c(Size, *from);
(void)c;
});
// list(size_type n, const value_type& v, const allocator_type& a);
- test_exception_safety_throwing_copy<ThrowOn, Size>([](T* from, T*){
+ test_exception_safety_throwing_copy<ThrowOn, Size>([](T* from, T*) {
std::list<T> c(Size, *from, Alloc());
(void)c;
});
// template <class InputIterator>
// list(InputIterator first, InputIterator last);
- test_exception_safety_throwing_copy<ThrowOn, Size>([](T* from, T* to){
+ test_exception_safety_throwing_copy<ThrowOn, Size>([](T* from, T* to) {
std::list<T> c(from, to);
(void)c;
});
// template <class InputIterator>
// list(InputIterator first, InputIterator last, const allocator_type& a);
- test_exception_safety_throwing_copy<ThrowOn, Size>([](T* from, T* to){
+ test_exception_safety_throwing_copy<ThrowOn, Size>([](T* from, T* to) {
std::list<T> c(from, to, Alloc());
(void)c;
});
@@ -122,7 +122,7 @@ int main(int, char**) {
#if TEST_STD_VER >= 23
// template<container-compatible-range<T> R>
// list(from_range_t, R&& rg, const Allocator& = Allocator()); // C++23
- test_exception_safety_throwing_copy<ThrowOn, Size>([](T* from, T* to){
+ test_exception_safety_throwing_copy<ThrowOn, Size>([](T* from, T* to) {
{
std::list<T> c(std::from_range, std::ranges::subrange(from, to));
(void)c;
diff --git a/libcxx/test/std/containers/sequences/list/get_allocator.pass.cpp b/libcxx/test/std/containers/sequences/list/get_allocator.pass.cpp
index 895fc219086a899..f1002f2ca81131c 100644
--- a/libcxx/test/std/containers/sequences/list/get_allocator.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/get_allocator.pass.cpp
@@ -19,16 +19,16 @@
#include "test_macros.h"
int main(int, char**) {
- {
- std::allocator<int> alloc;
- const std::list<int> l(alloc);
- assert(l.get_allocator() == alloc);
- }
- {
- other_allocator<int> alloc(1);
- const std::list<int, other_allocator<int> > l(alloc);
- assert(l.get_allocator() == alloc);
- }
+ {
+ std::allocator<int> alloc;
+ const std::list<int> l(alloc);
+ assert(l.get_allocator() == alloc);
+ }
+ {
+ other_allocator<int> alloc(1);
+ const std::list<int, other_allocator<int> > l(alloc);
+ assert(l.get_allocator() == alloc);
+ }
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/list/incomplete_type.pass.cpp b/libcxx/test/std/containers/sequences/list/incomplete_type.pass.cpp
index 103117fb40fd3c7..1802e53ecf387c2 100644
--- a/libcxx/test/std/containers/sequences/list/incomplete_type.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/incomplete_type.pass.cpp
@@ -16,15 +16,15 @@
#include "test_macros.h"
struct A {
- std::list<A> l;
- std::list<A>::iterator it;
- std::list<A>::const_iterator cit;
- std::list<A>::reverse_iterator rit;
- std::list<A>::const_reverse_iterator crit;
+ std::list<A> l;
+ std::list<A>::iterator it;
+ std::list<A>::const_iterator cit;
+ std::list<A>::reverse_iterator rit;
+ std::list<A>::const_reverse_iterator crit;
};
int main(int, char**) {
- A a;
+ A a;
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/list/iterator_concept_conformance.compile.pass.cpp b/libcxx/test/std/containers/sequences/list/iterator_concept_conformance.compile.pass.cpp
index bfa31feb416df25..102c7ef7f33d8c6 100644
--- a/libcxx/test/std/containers/sequences/list/iterator_concept_conformance.compile.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/iterator_concept_conformance.compile.pass.cpp
@@ -14,11 +14,11 @@
#include <iterator>
-using iterator = std::list<int>::iterator;
-using const_iterator = std::list<int>::const_iterator;
-using reverse_iterator = std::list<int>::reverse_iterator;
+using iterator = std::list<int>::iterator;
+using const_iterator = std::list<int>::const_iterator;
+using reverse_iterator = std::list<int>::reverse_iterator;
using const_reverse_iterator = std::list<int>::const_reverse_iterator;
-using value_type = int;
+using value_type = int;
static_assert(std::bidirectional_iterator<iterator>);
static_assert(!std::random_access_iterator<iterator>);
@@ -31,20 +31,20 @@ static_assert(!std::sized_sentinel_for<iterator, iterator>);
static_assert(!std::sized_sentinel_for<iterator, const_iterator>);
static_assert(!std::sized_sentinel_for<iterator, reverse_iterator>);
static_assert(!std::sized_sentinel_for<iterator, const_reverse_iterator>);
-static_assert( std::indirectly_movable<iterator, iterator>);
-static_assert( std::indirectly_movable_storable<iterator, iterator>);
+static_assert(std::indirectly_movable<iterator, iterator>);
+static_assert(std::indirectly_movable_storable<iterator, iterator>);
static_assert(!std::indirectly_movable<iterator, const_iterator>);
static_assert(!std::indirectly_movable_storable<iterator, const_iterator>);
-static_assert( std::indirectly_movable<iterator, reverse_iterator>);
-static_assert( std::indirectly_movable_storable<iterator, reverse_iterator>);
+static_assert(std::indirectly_movable<iterator, reverse_iterator>);
+static_assert(std::indirectly_movable_storable<iterator, reverse_iterator>);
static_assert(!std::indirectly_movable<iterator, const_reverse_iterator>);
static_assert(!std::indirectly_movable_storable<iterator, const_reverse_iterator>);
-static_assert( std::indirectly_copyable<iterator, iterator>);
-static_assert( std::indirectly_copyable_storable<iterator, iterator>);
+static_assert(std::indirectly_copyable<iterator, iterator>);
+static_assert(std::indirectly_copyable_storable<iterator, iterator>);
static_assert(!std::indirectly_copyable<iterator, const_iterator>);
static_assert(!std::indirectly_copyable_storable<iterator, const_iterator>);
-static_assert( std::indirectly_copyable<iterator, reverse_iterator>);
-static_assert( std::indirectly_copyable_storable<iterator, reverse_iterator>);
+static_assert(std::indirectly_copyable<iterator, reverse_iterator>);
+static_assert(std::indirectly_copyable_storable<iterator, reverse_iterator>);
static_assert(!std::indirectly_copyable<iterator, const_reverse_iterator>);
static_assert(!std::indirectly_copyable_storable<iterator, const_reverse_iterator>);
static_assert(std::indirectly_swappable<iterator, iterator>);
@@ -60,20 +60,20 @@ static_assert(!std::sized_sentinel_for<const_iterator, iterator>);
static_assert(!std::sized_sentinel_for<const_iterator, const_iterator>);
static_assert(!std::sized_sentinel_for<const_iterator, reverse_iterator>);
static_assert(!std::sized_sentinel_for<const_iterator, const_reverse_iterator>);
-static_assert( std::indirectly_movable<const_iterator, iterator>);
-static_assert( std::indirectly_movable_storable<const_iterator, iterator>);
+static_assert(std::indirectly_movable<const_iterator, iterator>);
+static_assert(std::indirectly_movable_storable<const_iterator, iterator>);
static_assert(!std::indirectly_movable<const_iterator, const_iterator>);
static_assert(!std::indirectly_movable_storable<const_iterator, const_iterator>);
-static_assert( std::indirectly_movable<const_iterator, reverse_iterator>);
-static_assert( std::indirectly_movable_storable<const_iterator, reverse_iterator>);
+static_assert(std::indirectly_movable<const_iterator, reverse_iterator>);
+static_assert(std::indirectly_movable_storable<const_iterator, reverse_iterator>);
static_assert(!std::indirectly_movable<const_iterator, const_reverse_iterator>);
static_assert(!std::indirectly_movable_storable<const_iterator, const_reverse_iterator>);
-static_assert( std::indirectly_copyable<const_iterator, iterator>);
-static_assert( std::indirectly_copyable_storable<const_iterator, iterator>);
+static_assert(std::indirectly_copyable<const_iterator, iterator>);
+static_assert(std::indirectly_copyable_storable<const_iterator, iterator>);
static_assert(!std::indirectly_copyable<const_iterator, const_iterator>);
static_assert(!std::indirectly_copyable_storable<const_iterator, const_iterator>);
-static_assert( std::indirectly_copyable<const_iterator, reverse_iterator>);
-static_assert( std::indirectly_copyable_storable<const_iterator, reverse_iterator>);
+static_assert(std::indirectly_copyable<const_iterator, reverse_iterator>);
+static_assert(std::indirectly_copyable_storable<const_iterator, reverse_iterator>);
static_assert(!std::indirectly_copyable<const_iterator, const_reverse_iterator>);
static_assert(!std::indirectly_copyable_storable<const_iterator, const_reverse_iterator>);
static_assert(!std::indirectly_swappable<const_iterator, const_iterator>);
diff --git a/libcxx/test/std/containers/sequences/list/iterators.pass.cpp b/libcxx/test/std/containers/sequences/list/iterators.pass.cpp
index 0fe92dfba694f1e..deaae31f2d27c90 100644
--- a/libcxx/test/std/containers/sequences/list/iterators.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/iterators.pass.cpp
@@ -22,136 +22,133 @@
#include "test_macros.h"
#include "min_allocator.h"
-struct A
-{
- int first;
- int second;
+struct A {
+ int first;
+ int second;
};
-int main(int, char**)
-{
- {
- typedef int T;
- typedef std::list<T> C;
- C c;
- C::iterator i = c.begin();
- C::iterator j = c.end();
- assert(std::distance(i, j) == 0);
- assert(i == j);
- }
- {
- typedef int T;
- typedef std::list<T> C;
- const C c;
- C::const_iterator i = c.begin();
- C::const_iterator j = c.end();
- assert(std::distance(i, j) == 0);
- assert(i == j);
- }
- {
- typedef int T;
- typedef std::list<T> C;
- C c;
- C::const_iterator i = c.cbegin();
- C::const_iterator j = c.cend();
- assert(std::distance(i, j) == 0);
- assert(i == j);
- assert(i == c.end());
- }
- {
- typedef int T;
- typedef std::list<T> C;
- const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- C c(std::begin(t), std::end(t));
- C::iterator i = c.begin();
- assert(*i == 0);
- ++i;
- assert(*i == 1);
- *i = 10;
- assert(*i == 10);
- assert(std::distance(c.begin(), c.end()) == 10);
- }
- {
- typedef int T;
- typedef std::list<T> C;
- C::iterator i;
- C::const_iterator j;
- }
+int main(int, char**) {
+ {
+ typedef int T;
+ typedef std::list<T> C;
+ C c;
+ C::iterator i = c.begin();
+ C::iterator j = c.end();
+ assert(std::distance(i, j) == 0);
+ assert(i == j);
+ }
+ {
+ typedef int T;
+ typedef std::list<T> C;
+ const C c;
+ C::const_iterator i = c.begin();
+ C::const_iterator j = c.end();
+ assert(std::distance(i, j) == 0);
+ assert(i == j);
+ }
+ {
+ typedef int T;
+ typedef std::list<T> C;
+ C c;
+ C::const_iterator i = c.cbegin();
+ C::const_iterator j = c.cend();
+ assert(std::distance(i, j) == 0);
+ assert(i == j);
+ assert(i == c.end());
+ }
+ {
+ typedef int T;
+ typedef std::list<T> C;
+ const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ C c(std::begin(t), std::end(t));
+ C::iterator i = c.begin();
+ assert(*i == 0);
+ ++i;
+ assert(*i == 1);
+ *i = 10;
+ assert(*i == 10);
+ assert(std::distance(c.begin(), c.end()) == 10);
+ }
+ {
+ typedef int T;
+ typedef std::list<T> C;
+ C::iterator i;
+ C::const_iterator j;
+ }
#if TEST_STD_VER >= 11
- {
- typedef int T;
- typedef std::list<T, min_allocator<T>> C;
- C c;
- C::iterator i = c.begin();
- C::iterator j = c.end();
- assert(std::distance(i, j) == 0);
- assert(i == j);
- }
- {
- typedef int T;
- typedef std::list<T, min_allocator<T>> C;
- const C c;
- C::const_iterator i = c.begin();
- C::const_iterator j = c.end();
- assert(std::distance(i, j) == 0);
- assert(i == j);
- }
- {
- typedef int T;
- typedef std::list<T, min_allocator<T>> C;
- C c;
- C::const_iterator i = c.cbegin();
- C::const_iterator j = c.cend();
- assert(std::distance(i, j) == 0);
- assert(i == j);
- assert(i == c.end());
- }
- {
- typedef int T;
- typedef std::list<T, min_allocator<T>> C;
- const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- C c(std::begin(t), std::end(t));
- C::iterator i = c.begin();
- assert(*i == 0);
- ++i;
- assert(*i == 1);
- *i = 10;
- assert(*i == 10);
- assert(std::distance(c.begin(), c.end()) == 10);
- }
- {
- typedef int T;
- typedef std::list<T, min_allocator<T>> C;
- C::iterator i;
- C::const_iterator j;
- }
- {
- typedef A T;
- typedef std::list<T, min_allocator<T>> C;
- C c = {A{1, 2}};
- C::iterator i = c.begin();
- i->first = 3;
- C::const_iterator j = i;
- assert(j->first == 3);
- }
+ {
+ typedef int T;
+ typedef std::list<T, min_allocator<T>> C;
+ C c;
+ C::iterator i = c.begin();
+ C::iterator j = c.end();
+ assert(std::distance(i, j) == 0);
+ assert(i == j);
+ }
+ {
+ typedef int T;
+ typedef std::list<T, min_allocator<T>> C;
+ const C c;
+ C::const_iterator i = c.begin();
+ C::const_iterator j = c.end();
+ assert(std::distance(i, j) == 0);
+ assert(i == j);
+ }
+ {
+ typedef int T;
+ typedef std::list<T, min_allocator<T>> C;
+ C c;
+ C::const_iterator i = c.cbegin();
+ C::const_iterator j = c.cend();
+ assert(std::distance(i, j) == 0);
+ assert(i == j);
+ assert(i == c.end());
+ }
+ {
+ typedef int T;
+ typedef std::list<T, min_allocator<T>> C;
+ const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ C c(std::begin(t), std::end(t));
+ C::iterator i = c.begin();
+ assert(*i == 0);
+ ++i;
+ assert(*i == 1);
+ *i = 10;
+ assert(*i == 10);
+ assert(std::distance(c.begin(), c.end()) == 10);
+ }
+ {
+ typedef int T;
+ typedef std::list<T, min_allocator<T>> C;
+ C::iterator i;
+ C::const_iterator j;
+ }
+ {
+ typedef A T;
+ typedef std::list<T, min_allocator<T>> C;
+ C c = {A{1, 2}};
+ C::iterator i = c.begin();
+ i->first = 3;
+ C::const_iterator j = i;
+ assert(j->first == 3);
+ }
#endif
#if TEST_STD_VER > 11
- {
- std::list<int>::iterator ii1{}, ii2{};
- std::list<int>::iterator ii4 = ii1;
- std::list<int>::const_iterator cii{};
- assert ( ii1 == ii2 );
- assert ( ii1 == ii4 );
+ {
+ std::list<int>::iterator ii1{}, ii2{};
+ std::list<int>::iterator ii4 = ii1;
+ std::list<int>::const_iterator cii{};
+ assert(ii1 == ii2);
+ assert(ii1 == ii4);
- assert (!(ii1 != ii2 ));
+ assert(!(ii1 != ii2));
- assert ( (ii1 == cii ));
- assert ( (cii == ii1 ));
- assert (!(ii1 != cii ));
- assert (!(cii != ii1 ));
- }
+ assert((ii1 == cii));
+ assert((cii == ii1));
+ assert(!(ii1 != cii));
+ assert(!(cii != ii1));
+ }
#endif
-
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/list/list.capacity/empty.pass.cpp b/libcxx/test/std/containers/sequences/list/list.capacity/empty.pass.cpp
index 7619ec50853ad93..50ca23ff9c56c64 100644
--- a/libcxx/test/std/containers/sequences/list/list.capacity/empty.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.capacity/empty.pass.cpp
@@ -18,9 +18,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::list<int> C;
C c;
ASSERT_NOEXCEPT(c.empty());
@@ -29,9 +28,9 @@ int main(int, char**)
assert(!c.empty());
c.clear();
assert(c.empty());
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::list<int, min_allocator<int>> C;
C c;
ASSERT_NOEXCEPT(c.empty());
@@ -40,7 +39,7 @@ int main(int, char**)
assert(!c.empty());
c.clear();
assert(c.empty());
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/list/list.capacity/empty.verify.cpp b/libcxx/test/std/containers/sequences/list/list.capacity/empty.verify.cpp
index 77d4e5ab21387c5..4ecb4cff6853c74 100644
--- a/libcxx/test/std/containers/sequences/list/list.capacity/empty.verify.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.capacity/empty.verify.cpp
@@ -17,6 +17,6 @@
#include <list>
void f() {
- std::list<int> c;
- c.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::list<int> c;
+ c.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}
diff --git a/libcxx/test/std/containers/sequences/list/list.capacity/max_size.pass.cpp b/libcxx/test/std/containers/sequences/list/list.capacity/max_size.pass.cpp
index c39fefe1cb11f4c..74c2ccfb144214a 100644
--- a/libcxx/test/std/containers/sequences/list/list.capacity/max_size.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.capacity/max_size.pass.cpp
@@ -29,16 +29,14 @@ int main(int, char**) {
{
typedef limited_allocator<int, (std::size_t)-1> A;
typedef std::list<int, A> C;
- const C::size_type max_dist =
- static_cast<C::size_type>(std::numeric_limits<C::
diff erence_type>::max());
+ const C::size_type max_dist = static_cast<C::size_type>(std::numeric_limits<C::
diff erence_type>::max());
C c;
assert(c.max_size() <= max_dist);
LIBCPP_ASSERT(c.max_size() == max_dist);
}
{
typedef std::list<char> C;
- const C::size_type max_dist =
- static_cast<C::size_type>(std::numeric_limits<C::
diff erence_type>::max());
+ const C::size_type max_dist = static_cast<C::size_type>(std::numeric_limits<C::
diff erence_type>::max());
C c;
assert(c.max_size() <= max_dist);
assert(c.max_size() <= alloc_max_size(c.get_allocator()));
diff --git a/libcxx/test/std/containers/sequences/list/list.capacity/resize_size.pass.cpp b/libcxx/test/std/containers/sequences/list/list.capacity/resize_size.pass.cpp
index b27b9a3f5ace9e7..754d931646cc61f 100644
--- a/libcxx/test/std/containers/sequences/list/list.capacity/resize_size.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.capacity/resize_size.pass.cpp
@@ -16,64 +16,63 @@
#include "DefaultOnly.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- std::list<int> l(5, 2);
- l.resize(2);
- assert(l.size() == 2);
- assert(std::distance(l.begin(), l.end()) == 2);
- assert(l == std::list<int>(2, 2));
- }
- {
- std::list<int> l(5, 2);
- l.resize(10);
- assert(l.size() == 10);
- assert(std::distance(l.begin(), l.end()) == 10);
- assert(l.front() == 2);
- assert(l.back() == 0);
- }
+int main(int, char**) {
+ {
+ std::list<int> l(5, 2);
+ l.resize(2);
+ assert(l.size() == 2);
+ assert(std::distance(l.begin(), l.end()) == 2);
+ assert(l == std::list<int>(2, 2));
+ }
+ {
+ std::list<int> l(5, 2);
+ l.resize(10);
+ assert(l.size() == 10);
+ assert(std::distance(l.begin(), l.end()) == 10);
+ assert(l.front() == 2);
+ assert(l.back() == 0);
+ }
#if TEST_STD_VER >= 11
- {
- std::list<DefaultOnly> l(10);
- l.resize(5);
- assert(l.size() == 5);
- assert(std::distance(l.begin(), l.end()) == 5);
- }
- {
- std::list<DefaultOnly> l(10);
- l.resize(20);
- assert(l.size() == 20);
- assert(std::distance(l.begin(), l.end()) == 20);
- }
- {
- std::list<int, min_allocator<int>> l(5, 2);
- l.resize(2);
- assert(l.size() == 2);
- assert(std::distance(l.begin(), l.end()) == 2);
- assert((l == std::list<int, min_allocator<int>>(2, 2)));
- }
- {
- std::list<int, min_allocator<int>> l(5, 2);
- l.resize(10);
- assert(l.size() == 10);
- assert(std::distance(l.begin(), l.end()) == 10);
- assert(l.front() == 2);
- assert(l.back() == 0);
- }
- {
- std::list<DefaultOnly, min_allocator<DefaultOnly>> l(10);
- l.resize(5);
- assert(l.size() == 5);
- assert(std::distance(l.begin(), l.end()) == 5);
- }
- {
- std::list<DefaultOnly, min_allocator<DefaultOnly>> l(10);
- l.resize(20);
- assert(l.size() == 20);
- assert(std::distance(l.begin(), l.end()) == 20);
- }
+ {
+ std::list<DefaultOnly> l(10);
+ l.resize(5);
+ assert(l.size() == 5);
+ assert(std::distance(l.begin(), l.end()) == 5);
+ }
+ {
+ std::list<DefaultOnly> l(10);
+ l.resize(20);
+ assert(l.size() == 20);
+ assert(std::distance(l.begin(), l.end()) == 20);
+ }
+ {
+ std::list<int, min_allocator<int>> l(5, 2);
+ l.resize(2);
+ assert(l.size() == 2);
+ assert(std::distance(l.begin(), l.end()) == 2);
+ assert((l == std::list<int, min_allocator<int>>(2, 2)));
+ }
+ {
+ std::list<int, min_allocator<int>> l(5, 2);
+ l.resize(10);
+ assert(l.size() == 10);
+ assert(std::distance(l.begin(), l.end()) == 10);
+ assert(l.front() == 2);
+ assert(l.back() == 0);
+ }
+ {
+ std::list<DefaultOnly, min_allocator<DefaultOnly>> l(10);
+ l.resize(5);
+ assert(l.size() == 5);
+ assert(std::distance(l.begin(), l.end()) == 5);
+ }
+ {
+ std::list<DefaultOnly, min_allocator<DefaultOnly>> l(10);
+ l.resize(20);
+ assert(l.size() == 20);
+ assert(std::distance(l.begin(), l.end()) == 20);
+ }
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/list/list.capacity/resize_size_value.pass.cpp b/libcxx/test/std/containers/sequences/list/list.capacity/resize_size_value.pass.cpp
index 112287a550b3d8f..95fccddeca540d3 100644
--- a/libcxx/test/std/containers/sequences/list/list.capacity/resize_size_value.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.capacity/resize_size_value.pass.cpp
@@ -16,39 +16,38 @@
#include "DefaultOnly.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- std::list<double> l(5, 2);
- l.resize(2, 3.5);
- assert(l.size() == 2);
- assert(std::distance(l.begin(), l.end()) == 2);
- assert(l == std::list<double>(2, 2));
- }
- {
- std::list<double> l(5, 2);
- l.resize(10, 3.5);
- assert(l.size() == 10);
- assert(std::distance(l.begin(), l.end()) == 10);
- assert(l.front() == 2);
- assert(l.back() == 3.5);
- }
+int main(int, char**) {
+ {
+ std::list<double> l(5, 2);
+ l.resize(2, 3.5);
+ assert(l.size() == 2);
+ assert(std::distance(l.begin(), l.end()) == 2);
+ assert(l == std::list<double>(2, 2));
+ }
+ {
+ std::list<double> l(5, 2);
+ l.resize(10, 3.5);
+ assert(l.size() == 10);
+ assert(std::distance(l.begin(), l.end()) == 10);
+ assert(l.front() == 2);
+ assert(l.back() == 3.5);
+ }
#if TEST_STD_VER >= 11
- {
- std::list<double, min_allocator<double>> l(5, 2);
- l.resize(2, 3.5);
- assert(l.size() == 2);
- assert(std::distance(l.begin(), l.end()) == 2);
- assert((l == std::list<double, min_allocator<double>>(2, 2)));
- }
- {
- std::list<double, min_allocator<double>> l(5, 2);
- l.resize(10, 3.5);
- assert(l.size() == 10);
- assert(std::distance(l.begin(), l.end()) == 10);
- assert(l.front() == 2);
- assert(l.back() == 3.5);
- }
+ {
+ std::list<double, min_allocator<double>> l(5, 2);
+ l.resize(2, 3.5);
+ assert(l.size() == 2);
+ assert(std::distance(l.begin(), l.end()) == 2);
+ assert((l == std::list<double, min_allocator<double>>(2, 2)));
+ }
+ {
+ std::list<double, min_allocator<double>> l(5, 2);
+ l.resize(10, 3.5);
+ assert(l.size() == 10);
+ assert(std::distance(l.begin(), l.end()) == 10);
+ assert(l.front() == 2);
+ assert(l.back() == 3.5);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/list/list.capacity/size.pass.cpp b/libcxx/test/std/containers/sequences/list/list.capacity/size.pass.cpp
index d4801e76c225556..930331205a9a5bf 100644
--- a/libcxx/test/std/containers/sequences/list/list.capacity/size.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.capacity/size.pass.cpp
@@ -18,9 +18,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::list<int> C;
C c;
ASSERT_NOEXCEPT(c.size());
@@ -37,9 +36,9 @@ int main(int, char**)
assert(c.size() == 1);
c.erase(c.begin());
assert(c.size() == 0);
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::list<int, min_allocator<int>> C;
C c;
ASSERT_NOEXCEPT(c.size());
@@ -56,7 +55,7 @@ int main(int, char**)
assert(c.size() == 1);
c.erase(c.begin());
assert(c.size() == 0);
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/list/list.cons/assign_copy.pass.cpp b/libcxx/test/std/containers/sequences/list/list.cons/assign_copy.pass.cpp
index 39369d4f8295c5e..ca468d870998e94 100644
--- a/libcxx/test/std/containers/sequences/list/list.cons/assign_copy.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.cons/assign_copy.pass.cpp
@@ -16,30 +16,29 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- std::list<int, test_allocator<int> > l(3, 2, test_allocator<int>(5));
- std::list<int, test_allocator<int> > l2(l, test_allocator<int>(3));
- l2 = l;
- assert(l2 == l);
- assert(l2.get_allocator() == test_allocator<int>(3));
- }
- {
- std::list<int, other_allocator<int> > l(3, 2, other_allocator<int>(5));
- std::list<int, other_allocator<int> > l2(l, other_allocator<int>(3));
- l2 = l;
- assert(l2 == l);
- assert(l2.get_allocator() == other_allocator<int>(5));
- }
+int main(int, char**) {
+ {
+ std::list<int, test_allocator<int> > l(3, 2, test_allocator<int>(5));
+ std::list<int, test_allocator<int> > l2(l, test_allocator<int>(3));
+ l2 = l;
+ assert(l2 == l);
+ assert(l2.get_allocator() == test_allocator<int>(3));
+ }
+ {
+ std::list<int, other_allocator<int> > l(3, 2, other_allocator<int>(5));
+ std::list<int, other_allocator<int> > l2(l, other_allocator<int>(3));
+ l2 = l;
+ assert(l2 == l);
+ assert(l2.get_allocator() == other_allocator<int>(5));
+ }
#if TEST_STD_VER >= 11
- {
- std::list<int, min_allocator<int> > l(3, 2, min_allocator<int>());
- std::list<int, min_allocator<int> > l2(l, min_allocator<int>());
- l2 = l;
- assert(l2 == l);
- assert(l2.get_allocator() == min_allocator<int>());
- }
+ {
+ std::list<int, min_allocator<int> > l(3, 2, min_allocator<int>());
+ std::list<int, min_allocator<int> > l2(l, min_allocator<int>());
+ l2 = l;
+ assert(l2 == l);
+ assert(l2.get_allocator() == min_allocator<int>());
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/list/list.cons/assign_initializer_list.pass.cpp b/libcxx/test/std/containers/sequences/list/list.cons/assign_initializer_list.pass.cpp
index 6aeec2b165efc2d..d4c1120df622625 100644
--- a/libcxx/test/std/containers/sequences/list/list.cons/assign_initializer_list.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.cons/assign_initializer_list.pass.cpp
@@ -18,9 +18,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
std::list<int> d;
d.assign({3, 4, 5, 6});
assert(d.size() == 4);
@@ -29,8 +28,8 @@ int main(int, char**)
assert(*i++ == 4);
assert(*i++ == 5);
assert(*i++ == 6);
- }
- {
+ }
+ {
std::list<int, min_allocator<int>> d;
d.assign({3, 4, 5, 6});
assert(d.size() == 4);
@@ -39,7 +38,7 @@ int main(int, char**)
assert(*i++ == 4);
assert(*i++ == 5);
assert(*i++ == 6);
- }
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/list/list.cons/assign_move.pass.cpp b/libcxx/test/std/containers/sequences/list/list.cons/assign_move.pass.cpp
index 1e459a2bdca8d91..87faaaac2b21009 100644
--- a/libcxx/test/std/containers/sequences/list/list.cons/assign_move.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.cons/assign_move.pass.cpp
@@ -19,70 +19,65 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- std::list<MoveOnly, test_allocator<MoveOnly> > l(test_allocator<MoveOnly>(5));
- std::list<MoveOnly, test_allocator<MoveOnly> > lo(test_allocator<MoveOnly>(5));
- for (int i = 1; i <= 3; ++i)
- {
- l.push_back(i);
- lo.push_back(i);
- }
- std::list<MoveOnly, test_allocator<MoveOnly> > l2(test_allocator<MoveOnly>(5));
- std::list<MoveOnly, test_allocator<MoveOnly> >::iterator it = l.begin();
- l2 = std::move(l);
- assert(l2 == lo);
- assert(l.empty());
- assert(l2.get_allocator() == lo.get_allocator());
- assert(it == l2.begin()); // Iterators remain valid
+int main(int, char**) {
+ {
+ std::list<MoveOnly, test_allocator<MoveOnly> > l(test_allocator<MoveOnly>(5));
+ std::list<MoveOnly, test_allocator<MoveOnly> > lo(test_allocator<MoveOnly>(5));
+ for (int i = 1; i <= 3; ++i) {
+ l.push_back(i);
+ lo.push_back(i);
}
- {
- std::list<MoveOnly, test_allocator<MoveOnly> > l(test_allocator<MoveOnly>(5));
- std::list<MoveOnly, test_allocator<MoveOnly> > lo(test_allocator<MoveOnly>(5));
- for (int i = 1; i <= 3; ++i)
- {
- l.push_back(i);
- lo.push_back(i);
- }
- std::list<MoveOnly, test_allocator<MoveOnly> > l2(test_allocator<MoveOnly>(6));
- l2 = std::move(l);
- assert(l2 == lo);
- assert(!l.empty());
- assert(l2.get_allocator() == test_allocator<MoveOnly>(6));
+ std::list<MoveOnly, test_allocator<MoveOnly> > l2(test_allocator<MoveOnly>(5));
+ std::list<MoveOnly, test_allocator<MoveOnly> >::iterator it = l.begin();
+ l2 = std::move(l);
+ assert(l2 == lo);
+ assert(l.empty());
+ assert(l2.get_allocator() == lo.get_allocator());
+ assert(it == l2.begin()); // Iterators remain valid
+ }
+ {
+ std::list<MoveOnly, test_allocator<MoveOnly> > l(test_allocator<MoveOnly>(5));
+ std::list<MoveOnly, test_allocator<MoveOnly> > lo(test_allocator<MoveOnly>(5));
+ for (int i = 1; i <= 3; ++i) {
+ l.push_back(i);
+ lo.push_back(i);
}
- {
- std::list<MoveOnly, other_allocator<MoveOnly> > l(other_allocator<MoveOnly>(5));
- std::list<MoveOnly, other_allocator<MoveOnly> > lo(other_allocator<MoveOnly>(5));
- for (int i = 1; i <= 3; ++i)
- {
- l.push_back(i);
- lo.push_back(i);
- }
- std::list<MoveOnly, other_allocator<MoveOnly> > l2(other_allocator<MoveOnly>(6));
- std::list<MoveOnly, other_allocator<MoveOnly> >::iterator it = l.begin();
- l2 = std::move(l);
- assert(l2 == lo);
- assert(l.empty());
- assert(l2.get_allocator() == lo.get_allocator());
- assert(it == l2.begin()); // Iterators remain valid
+ std::list<MoveOnly, test_allocator<MoveOnly> > l2(test_allocator<MoveOnly>(6));
+ l2 = std::move(l);
+ assert(l2 == lo);
+ assert(!l.empty());
+ assert(l2.get_allocator() == test_allocator<MoveOnly>(6));
+ }
+ {
+ std::list<MoveOnly, other_allocator<MoveOnly> > l(other_allocator<MoveOnly>(5));
+ std::list<MoveOnly, other_allocator<MoveOnly> > lo(other_allocator<MoveOnly>(5));
+ for (int i = 1; i <= 3; ++i) {
+ l.push_back(i);
+ lo.push_back(i);
}
- {
- std::list<MoveOnly, min_allocator<MoveOnly> > l(min_allocator<MoveOnly>{});
- std::list<MoveOnly, min_allocator<MoveOnly> > lo(min_allocator<MoveOnly>{});
- for (int i = 1; i <= 3; ++i)
- {
- l.push_back(i);
- lo.push_back(i);
- }
- std::list<MoveOnly, min_allocator<MoveOnly> > l2(min_allocator<MoveOnly>{});
- std::list<MoveOnly, min_allocator<MoveOnly> >::iterator it = l.begin();
- l2 = std::move(l);
- assert(l2 == lo);
- assert(l.empty());
- assert(l2.get_allocator() == lo.get_allocator());
- assert(it == l2.begin()); // Iterators remain valid
+ std::list<MoveOnly, other_allocator<MoveOnly> > l2(other_allocator<MoveOnly>(6));
+ std::list<MoveOnly, other_allocator<MoveOnly> >::iterator it = l.begin();
+ l2 = std::move(l);
+ assert(l2 == lo);
+ assert(l.empty());
+ assert(l2.get_allocator() == lo.get_allocator());
+ assert(it == l2.begin()); // Iterators remain valid
+ }
+ {
+ std::list<MoveOnly, min_allocator<MoveOnly> > l(min_allocator<MoveOnly>{});
+ std::list<MoveOnly, min_allocator<MoveOnly> > lo(min_allocator<MoveOnly>{});
+ for (int i = 1; i <= 3; ++i) {
+ l.push_back(i);
+ lo.push_back(i);
}
+ std::list<MoveOnly, min_allocator<MoveOnly> > l2(min_allocator<MoveOnly>{});
+ std::list<MoveOnly, min_allocator<MoveOnly> >::iterator it = l.begin();
+ l2 = std::move(l);
+ assert(l2 == lo);
+ assert(l.empty());
+ assert(l2.get_allocator() == lo.get_allocator());
+ assert(it == l2.begin()); // Iterators remain valid
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/list/list.cons/copy.pass.cpp b/libcxx/test/std/containers/sequences/list/list.cons/copy.pass.cpp
index 153cd2dbc96b605..de52da0fefabfb9 100644
--- a/libcxx/test/std/containers/sequences/list/list.cons/copy.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.cons/copy.pass.cpp
@@ -18,37 +18,36 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- std::list<int> l(3, 2);
- std::list<int> l2 = l;
- assert(l2 == l);
- }
- {
- std::list<int, test_allocator<int> > l(3, 2, test_allocator<int>(5));
- std::list<int, test_allocator<int> > l2 = l;
- assert(l2 == l);
- assert(l2.get_allocator() == l.get_allocator());
- }
+int main(int, char**) {
+ {
+ std::list<int> l(3, 2);
+ std::list<int> l2 = l;
+ assert(l2 == l);
+ }
+ {
+ std::list<int, test_allocator<int> > l(3, 2, test_allocator<int>(5));
+ std::list<int, test_allocator<int> > l2 = l;
+ assert(l2 == l);
+ assert(l2.get_allocator() == l.get_allocator());
+ }
#if TEST_STD_VER >= 11
- {
- std::list<int, other_allocator<int> > l(3, 2, other_allocator<int>(5));
- std::list<int, other_allocator<int> > l2 = l;
- assert(l2 == l);
- assert(l2.get_allocator() == other_allocator<int>(-2));
- }
- {
- std::list<int, min_allocator<int>> l(3, 2);
- std::list<int, min_allocator<int>> l2 = l;
- assert(l2 == l);
- }
- {
- std::list<int, min_allocator<int> > l(3, 2, min_allocator<int>());
- std::list<int, min_allocator<int> > l2 = l;
- assert(l2 == l);
- assert(l2.get_allocator() == l.get_allocator());
- }
+ {
+ std::list<int, other_allocator<int> > l(3, 2, other_allocator<int>(5));
+ std::list<int, other_allocator<int> > l2 = l;
+ assert(l2 == l);
+ assert(l2.get_allocator() == other_allocator<int>(-2));
+ }
+ {
+ std::list<int, min_allocator<int>> l(3, 2);
+ std::list<int, min_allocator<int>> l2 = l;
+ assert(l2 == l);
+ }
+ {
+ std::list<int, min_allocator<int> > l(3, 2, min_allocator<int>());
+ std::list<int, min_allocator<int> > l2 = l;
+ assert(l2 == l);
+ assert(l2.get_allocator() == l.get_allocator());
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/list/list.cons/copy_alloc.pass.cpp b/libcxx/test/std/containers/sequences/list/list.cons/copy_alloc.pass.cpp
index 99d7879de15c92d..0d6c6f431f09df7 100644
--- a/libcxx/test/std/containers/sequences/list/list.cons/copy_alloc.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.cons/copy_alloc.pass.cpp
@@ -17,27 +17,26 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- std::list<int, test_allocator<int> > l(3, 2, test_allocator<int>(5));
- std::list<int, test_allocator<int> > l2(l, test_allocator<int>(3));
- assert(l2 == l);
- assert(l2.get_allocator() == test_allocator<int>(3));
- }
- {
- std::list<int, other_allocator<int> > l(3, 2, other_allocator<int>(5));
- std::list<int, other_allocator<int> > l2(l, other_allocator<int>(3));
- assert(l2 == l);
- assert(l2.get_allocator() == other_allocator<int>(3));
- }
+int main(int, char**) {
+ {
+ std::list<int, test_allocator<int> > l(3, 2, test_allocator<int>(5));
+ std::list<int, test_allocator<int> > l2(l, test_allocator<int>(3));
+ assert(l2 == l);
+ assert(l2.get_allocator() == test_allocator<int>(3));
+ }
+ {
+ std::list<int, other_allocator<int> > l(3, 2, other_allocator<int>(5));
+ std::list<int, other_allocator<int> > l2(l, other_allocator<int>(3));
+ assert(l2 == l);
+ assert(l2.get_allocator() == other_allocator<int>(3));
+ }
#if TEST_STD_VER >= 11
- {
- std::list<int, min_allocator<int> > l(3, 2, min_allocator<int>());
- std::list<int, min_allocator<int> > l2(l, min_allocator<int>());
- assert(l2 == l);
- assert(l2.get_allocator() == min_allocator<int>());
- }
+ {
+ std::list<int, min_allocator<int> > l(3, 2, min_allocator<int>());
+ std::list<int, min_allocator<int> > l2(l, min_allocator<int>());
+ assert(l2 == l);
+ assert(l2.get_allocator() == min_allocator<int>());
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/list/list.cons/deduct.pass.cpp b/libcxx/test/std/containers/sequences/list/list.cons/deduct.pass.cpp
index 2210a9ea6e699ba..836c140d2e52cb1 100644
--- a/libcxx/test/std/containers/sequences/list/list.cons/deduct.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.cons/deduct.pass.cpp
@@ -31,20 +31,18 @@
struct A {};
-int main(int, char**)
-{
-
-// Test the explicit deduction guides
- {
- const int arr[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
+int main(int, char**) {
+ // Test the explicit deduction guides
+ {
+ const int arr[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
std::list lst(std::begin(arr), std::end(arr));
static_assert(std::is_same_v<decltype(lst), std::list<int>>, "");
assert(std::equal(lst.begin(), lst.end(), std::begin(arr), std::end(arr)));
- }
+ }
- {
- const long arr[] = {INT_MAX, 1L, 2L, 3L };
+ {
+ const long arr[] = {INT_MAX, 1L, 2L, 3L};
std::list lst(std::begin(arr), std::end(arr), std::allocator<long>());
static_assert(std::is_same_v<decltype(lst)::value_type, long>, "");
assert(lst.size() == 4);
@@ -52,39 +50,39 @@ int main(int, char**)
assert(*it++ == INT_MAX);
assert(*it++ == 1L);
assert(*it++ == 2L);
- }
+ }
-// Test the implicit deduction guides
+ // Test the implicit deduction guides
- {
-// We don't expect this one to work.
-// std::list lst(std::allocator<int>()); // list (allocator &)
- }
+ {
+ // We don't expect this one to work.
+ // std::list lst(std::allocator<int>()); // list (allocator &)
+ }
- {
+ {
std::list lst(1, A{}); // list (size_type, T)
static_assert(std::is_same_v<decltype(lst)::value_type, A>, "");
static_assert(std::is_same_v<decltype(lst)::allocator_type, std::allocator<A>>, "");
assert(lst.size() == 1);
- }
+ }
- {
+ {
std::list lst(1, A{}, test_allocator<A>()); // list (size_type, T, allocator)
static_assert(std::is_same_v<decltype(lst)::value_type, A>, "");
static_assert(std::is_same_v<decltype(lst)::allocator_type, test_allocator<A>>, "");
assert(lst.size() == 1);
- }
+ }
- {
+ {
std::list lst{1U, 2U, 3U, 4U, 5U}; // list(initializer-list)
static_assert(std::is_same_v<decltype(lst)::value_type, unsigned>, "");
assert(lst.size() == 5);
auto it = lst.begin();
std::advance(it, 2);
assert(*it == 3U);
- }
+ }
- {
+ {
std::list lst({1.0, 2.0, 3.0, 4.0}, test_allocator<double>()); // list(initializer-list, allocator)
static_assert(std::is_same_v<decltype(lst)::value_type, double>, "");
static_assert(std::is_same_v<decltype(lst)::allocator_type, test_allocator<double>>, "");
@@ -92,61 +90,61 @@ int main(int, char**)
auto it = lst.begin();
std::advance(it, 3);
assert(*it == 4.0);
- }
+ }
- {
+ {
std::list<long double> source;
std::list lst(source); // list(list &)
static_assert(std::is_same_v<decltype(lst)::value_type, long double>, "");
static_assert(std::is_same_v<decltype(lst)::allocator_type, std::allocator<long double>>, "");
assert(lst.size() == 0);
+ }
+
+ {
+ typedef test_allocator<short> Alloc;
+ typedef test_allocator<int> ConvertibleToAlloc;
+
+ {
+ std::list<short, Alloc> source;
+ std::list lst(source, Alloc(2));
+ static_assert(std::is_same_v<decltype(lst), decltype(source)>);
+ }
+
+ {
+ std::list<short, Alloc> source;
+ std::list lst(source, ConvertibleToAlloc(2));
+ static_assert(std::is_same_v<decltype(lst), decltype(source)>);
+ }
+
+ {
+ std::list<short, Alloc> source;
+ std::list lst(std::move(source), Alloc(2));
+ static_assert(std::is_same_v<decltype(lst), decltype(source)>);
}
{
- typedef test_allocator<short> Alloc;
- typedef test_allocator<int> ConvertibleToAlloc;
-
- {
- std::list<short, Alloc> source;
- std::list lst(source, Alloc(2));
- static_assert(std::is_same_v<decltype(lst), decltype(source)>);
- }
-
- {
- std::list<short, Alloc> source;
- std::list lst(source, ConvertibleToAlloc(2));
- static_assert(std::is_same_v<decltype(lst), decltype(source)>);
- }
-
- {
- std::list<short, Alloc> source;
- std::list lst(std::move(source), Alloc(2));
- static_assert(std::is_same_v<decltype(lst), decltype(source)>);
- }
-
- {
- std::list<short, Alloc> source;
- std::list lst(std::move(source), ConvertibleToAlloc(2));
- static_assert(std::is_same_v<decltype(lst), decltype(source)>);
- }
+ std::list<short, Alloc> source;
+ std::list lst(std::move(source), ConvertibleToAlloc(2));
+ static_assert(std::is_same_v<decltype(lst), decltype(source)>);
}
+ }
#if TEST_STD_VER >= 23
+ {
+ {
+ std::list c(std::from_range, std::array<int, 0>());
+ static_assert(std::is_same_v<decltype(c), std::list<int>>);
+ }
+
{
- {
- std::list c(std::from_range, std::array<int, 0>());
- static_assert(std::is_same_v<decltype(c), std::list<int>>);
- }
-
- {
- using Alloc = test_allocator<int>;
- std::list c(std::from_range, std::array<int, 0>(), Alloc());
- static_assert(std::is_same_v<decltype(c), std::list<int, Alloc>>);
- }
+ using Alloc = test_allocator<int>;
+ std::list c(std::from_range, std::array<int, 0>(), Alloc());
+ static_assert(std::is_same_v<decltype(c), std::list<int, Alloc>>);
}
+ }
#endif
- SequenceContainerDeductionGuidesSfinaeAway<std::list, std::list<int>>();
+ SequenceContainerDeductionGuidesSfinaeAway<std::list, std::list<int>>();
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/list/list.cons/deduct.verify.cpp b/libcxx/test/std/containers/sequences/list/list.cons/deduct.verify.cpp
index 370cd38612ab0b1..1b15ed14fe9a081 100644
--- a/libcxx/test/std/containers/sequences/list/list.cons/deduct.verify.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.cons/deduct.verify.cpp
@@ -22,19 +22,18 @@
struct A {};
-int main(int, char**)
-{
-// Test the explicit deduction guides
-
-// Test the implicit deduction guides
- {
-// list (allocator &)
- std::list lst((std::allocator<int>())); // expected-error-re {{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}list'}}
-// Note: The extra parens are necessary, since otherwise clang decides it is a function declaration.
-// Also, we can't use {} instead of parens, because that constructs a
-// deque<allocator<int>, allocator<allocator<int>>>
- }
-
+int main(int, char**) {
+ // Test the explicit deduction guides
+
+ // Test the implicit deduction guides
+ {
+ // list (allocator &)
+ std::list lst((std::allocator< int>()));
+ // expected-error-re at -1 {{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}list'}}
+ // Note: The extra parens are necessary, since otherwise clang decides it is a function declaration.
+ // Also, we can't use {} instead of parens, because that constructs a
+ // deque<allocator<int>, allocator<allocator<int>>>
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/list/list.cons/default.pass.cpp b/libcxx/test/std/containers/sequences/list/list.cons/default.pass.cpp
index 32f2729b709600c..0cfd8f1e9c59470 100644
--- a/libcxx/test/std/containers/sequences/list/list.cons/default.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.cons/default.pass.cpp
@@ -16,54 +16,53 @@
#include "DefaultOnly.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- std::list<int> l;
- assert(l.size() == 0);
- assert(std::distance(l.begin(), l.end()) == 0);
- }
- {
- std::list<DefaultOnly> l;
- assert(l.size() == 0);
- assert(std::distance(l.begin(), l.end()) == 0);
- }
- {
- std::list<int> l((std::allocator<int>()));
- assert(l.size() == 0);
- assert(std::distance(l.begin(), l.end()) == 0);
- }
+int main(int, char**) {
+ {
+ std::list<int> l;
+ assert(l.size() == 0);
+ assert(std::distance(l.begin(), l.end()) == 0);
+ }
+ {
+ std::list<DefaultOnly> l;
+ assert(l.size() == 0);
+ assert(std::distance(l.begin(), l.end()) == 0);
+ }
+ {
+ std::list<int> l((std::allocator<int>()));
+ assert(l.size() == 0);
+ assert(std::distance(l.begin(), l.end()) == 0);
+ }
#if TEST_STD_VER >= 11
- {
- std::list<int, min_allocator<int>> l;
- assert(l.size() == 0);
- assert(std::distance(l.begin(), l.end()) == 0);
- }
- {
- std::list<DefaultOnly, min_allocator<DefaultOnly>> l;
- assert(l.size() == 0);
- assert(std::distance(l.begin(), l.end()) == 0);
- }
- {
- std::list<int, min_allocator<int>> l((min_allocator<int>()));
- assert(l.size() == 0);
- assert(std::distance(l.begin(), l.end()) == 0);
- }
- {
- std::list<int> l = {};
- assert(l.size() == 0);
- assert(std::distance(l.begin(), l.end()) == 0);
- }
- {
- std::list<int, explicit_allocator<int>> l;
- assert(l.size() == 0);
- assert(std::distance(l.begin(), l.end()) == 0);
- }
- {
- std::list<int, explicit_allocator<int>> l((explicit_allocator<int>()));
- assert(l.size() == 0);
- assert(std::distance(l.begin(), l.end()) == 0);
- }
+ {
+ std::list<int, min_allocator<int>> l;
+ assert(l.size() == 0);
+ assert(std::distance(l.begin(), l.end()) == 0);
+ }
+ {
+ std::list<DefaultOnly, min_allocator<DefaultOnly>> l;
+ assert(l.size() == 0);
+ assert(std::distance(l.begin(), l.end()) == 0);
+ }
+ {
+ std::list<int, min_allocator<int>> l((min_allocator<int>()));
+ assert(l.size() == 0);
+ assert(std::distance(l.begin(), l.end()) == 0);
+ }
+ {
+ std::list<int> l = {};
+ assert(l.size() == 0);
+ assert(std::distance(l.begin(), l.end()) == 0);
+ }
+ {
+ std::list<int, explicit_allocator<int>> l;
+ assert(l.size() == 0);
+ assert(std::distance(l.begin(), l.end()) == 0);
+ }
+ {
+ std::list<int, explicit_allocator<int>> l((explicit_allocator<int>()));
+ assert(l.size() == 0);
+ assert(std::distance(l.begin(), l.end()) == 0);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/list/list.cons/default_noexcept.pass.cpp b/libcxx/test/std/containers/sequences/list/list.cons/default_noexcept.pass.cpp
index f21225777af5edf..b5e6f3c4d617bda 100644
--- a/libcxx/test/std/containers/sequences/list/list.cons/default_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.cons/default_noexcept.pass.cpp
@@ -23,33 +23,31 @@
#include "test_allocator.h"
template <class T>
-struct some_alloc
-{
- typedef T value_type;
- some_alloc(const some_alloc&);
- void allocate(std::size_t);
+struct some_alloc {
+ typedef T value_type;
+ some_alloc(const some_alloc&);
+ void allocate(std::size_t);
};
-int main(int, char**)
-{
+int main(int, char**) {
#if defined(_LIBCPP_VERSION)
- {
- typedef std::list<MoveOnly> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
- }
- {
- typedef std::list<MoveOnly, test_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
- }
+ {
+ typedef std::list<MoveOnly> C;
+ static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ }
+ {
+ typedef std::list<MoveOnly, test_allocator<MoveOnly>> C;
+ static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ }
#endif // _LIBCPP_VERSION
- {
- typedef std::list<MoveOnly, other_allocator<MoveOnly>> C;
- static_assert(!std::is_nothrow_default_constructible<C>::value, "");
- }
- {
- typedef std::list<MoveOnly, some_alloc<MoveOnly>> C;
- static_assert(!std::is_nothrow_default_constructible<C>::value, "");
- }
+ {
+ typedef std::list<MoveOnly, other_allocator<MoveOnly>> C;
+ static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+ }
+ {
+ typedef std::list<MoveOnly, some_alloc<MoveOnly>> C;
+ static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/list/list.cons/default_stack_alloc.pass.cpp b/libcxx/test/std/containers/sequences/list/list.cons/default_stack_alloc.pass.cpp
index 67c886b4ee7bc25..e31a58d7b9a5c08 100644
--- a/libcxx/test/std/containers/sequences/list/list.cons/default_stack_alloc.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.cons/default_stack_alloc.pass.cpp
@@ -16,34 +16,33 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- std::list<int> l;
- assert(l.size() == 0);
- assert(std::distance(l.begin(), l.end()) == 0);
- }
- {
- std::list<int> l((std::allocator<int>()));
- assert(l.size() == 0);
- assert(std::distance(l.begin(), l.end()) == 0);
- }
- {
- std::list<int, limited_allocator<int, 4> > l;
- assert(l.size() == 0);
- assert(std::distance(l.begin(), l.end()) == 0);
- }
+int main(int, char**) {
+ {
+ std::list<int> l;
+ assert(l.size() == 0);
+ assert(std::distance(l.begin(), l.end()) == 0);
+ }
+ {
+ std::list<int> l((std::allocator<int>()));
+ assert(l.size() == 0);
+ assert(std::distance(l.begin(), l.end()) == 0);
+ }
+ {
+ std::list<int, limited_allocator<int, 4> > l;
+ assert(l.size() == 0);
+ assert(std::distance(l.begin(), l.end()) == 0);
+ }
#if TEST_STD_VER >= 11
- {
- std::list<int, min_allocator<int>> l;
- assert(l.size() == 0);
- assert(std::distance(l.begin(), l.end()) == 0);
- }
- {
- std::list<int, min_allocator<int>> l((min_allocator<int>()));
- assert(l.size() == 0);
- assert(std::distance(l.begin(), l.end()) == 0);
- }
+ {
+ std::list<int, min_allocator<int>> l;
+ assert(l.size() == 0);
+ assert(std::distance(l.begin(), l.end()) == 0);
+ }
+ {
+ std::list<int, min_allocator<int>> l((min_allocator<int>()));
+ assert(l.size() == 0);
+ assert(std::distance(l.begin(), l.end()) == 0);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/list/list.cons/dtor.pass.cpp b/libcxx/test/std/containers/sequences/list/list.cons/dtor.pass.cpp
index 8d04a0938a1b268..5dedb547690463e 100644
--- a/libcxx/test/std/containers/sequences/list/list.cons/dtor.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.cons/dtor.pass.cpp
@@ -19,27 +19,25 @@
#include "test_macros.h"
-
std::set<int> destroyed;
struct Foo {
- explicit Foo(int i) : value(i) { }
- ~Foo() { destroyed.insert(value); }
- int value;
+ explicit Foo(int i) : value(i) {}
+ ~Foo() { destroyed.insert(value); }
+ int value;
};
-int main(int, char**)
-{
- {
- std::list<Foo> list;
- list.emplace_back(1);
- list.emplace_back(2);
- list.emplace_back(3);
- assert(destroyed.empty());
- }
- assert(destroyed.count(1) == 1);
- assert(destroyed.count(2) == 1);
- assert(destroyed.count(3) == 1);
-
- return 0;
+int main(int, char**) {
+ {
+ std::list<Foo> list;
+ list.emplace_back(1);
+ list.emplace_back(2);
+ list.emplace_back(3);
+ assert(destroyed.empty());
+ }
+ assert(destroyed.count(1) == 1);
+ assert(destroyed.count(2) == 1);
+ assert(destroyed.count(3) == 1);
+
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/list/list.cons/dtor_noexcept.pass.cpp b/libcxx/test/std/containers/sequences/list/list.cons/dtor_noexcept.pass.cpp
index ae7e264c64a3aa6..44e6ddd722a7071 100644
--- a/libcxx/test/std/containers/sequences/list/list.cons/dtor_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.cons/dtor_noexcept.pass.cpp
@@ -20,33 +20,31 @@
#include "test_allocator.h"
template <class T>
-struct some_alloc
-{
- typedef T value_type;
- some_alloc(const some_alloc&);
- ~some_alloc() noexcept(false);
- void allocate(std::size_t);
+struct some_alloc {
+ typedef T value_type;
+ some_alloc(const some_alloc&);
+ ~some_alloc() noexcept(false);
+ void allocate(std::size_t);
};
-int main(int, char**)
-{
- {
- typedef std::list<MoveOnly> C;
- static_assert(std::is_nothrow_destructible<C>::value, "");
- }
- {
- typedef std::list<MoveOnly, test_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_destructible<C>::value, "");
- }
- {
- typedef std::list<MoveOnly, other_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_destructible<C>::value, "");
- }
+int main(int, char**) {
+ {
+ typedef std::list<MoveOnly> C;
+ static_assert(std::is_nothrow_destructible<C>::value, "");
+ }
+ {
+ typedef std::list<MoveOnly, test_allocator<MoveOnly>> C;
+ static_assert(std::is_nothrow_destructible<C>::value, "");
+ }
+ {
+ typedef std::list<MoveOnly, other_allocator<MoveOnly>> C;
+ static_assert(std::is_nothrow_destructible<C>::value, "");
+ }
#if defined(_LIBCPP_VERSION)
- {
- typedef std::list<MoveOnly, some_alloc<MoveOnly>> C;
- static_assert(!std::is_nothrow_destructible<C>::value, "");
- }
+ {
+ typedef std::list<MoveOnly, some_alloc<MoveOnly>> C;
+ static_assert(!std::is_nothrow_destructible<C>::value, "");
+ }
#endif // _LIBCPP_VERSION
return 0;
diff --git a/libcxx/test/std/containers/sequences/list/list.cons/from_range.pass.cpp b/libcxx/test/std/containers/sequences/list/list.cons/from_range.pass.cpp
index 42b7475c00784b1..cc5ed5729b57bea 100644
--- a/libcxx/test/std/containers/sequences/list/list.cons/from_range.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.cons/from_range.pass.cpp
@@ -31,4 +31,3 @@ int main(int, char**) {
return 0;
}
-
diff --git a/libcxx/test/std/containers/sequences/list/list.cons/initializer_list.pass.cpp b/libcxx/test/std/containers/sequences/list/list.cons/initializer_list.pass.cpp
index 8583d67dd2f3f69..3ba90d1337e94c8 100644
--- a/libcxx/test/std/containers/sequences/list/list.cons/initializer_list.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.cons/initializer_list.pass.cpp
@@ -18,9 +18,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
std::list<int> d = {3, 4, 5, 6};
assert(d.size() == 4);
std::list<int>::iterator i = d.begin();
@@ -28,8 +27,8 @@ int main(int, char**)
assert(*i++ == 4);
assert(*i++ == 5);
assert(*i++ == 6);
- }
- {
+ }
+ {
std::list<int, min_allocator<int>> d = {3, 4, 5, 6};
assert(d.size() == 4);
std::list<int, min_allocator<int>>::iterator i = d.begin();
@@ -37,7 +36,7 @@ int main(int, char**)
assert(*i++ == 4);
assert(*i++ == 5);
assert(*i++ == 6);
- }
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/list/list.cons/initializer_list_alloc.pass.cpp b/libcxx/test/std/containers/sequences/list/list.cons/initializer_list_alloc.pass.cpp
index 0e12793ec2834b3..e4779eb5a640195 100644
--- a/libcxx/test/std/containers/sequences/list/list.cons/initializer_list_alloc.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.cons/initializer_list_alloc.pass.cpp
@@ -19,9 +19,8 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
std::list<int, test_allocator<int>> d({3, 4, 5, 6}, test_allocator<int>(3));
assert(d.get_allocator() == test_allocator<int>(3));
assert(d.size() == 4);
@@ -30,8 +29,8 @@ int main(int, char**)
assert(*i++ == 4);
assert(*i++ == 5);
assert(*i++ == 6);
- }
- {
+ }
+ {
std::list<int, min_allocator<int>> d({3, 4, 5, 6}, min_allocator<int>());
assert(d.get_allocator() == min_allocator<int>());
assert(d.size() == 4);
@@ -40,7 +39,7 @@ int main(int, char**)
assert(*i++ == 4);
assert(*i++ == 5);
assert(*i++ == 6);
- }
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/list/list.cons/input_iterator.pass.cpp b/libcxx/test/std/containers/sequences/list/list.cons/input_iterator.pass.cpp
index d13696f1d0ac40f..c99069f92f51dd2 100644
--- a/libcxx/test/std/containers/sequences/list/list.cons/input_iterator.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.cons/input_iterator.pass.cpp
@@ -18,77 +18,75 @@
#include "test_allocator.h"
#include "min_allocator.h"
#if TEST_STD_VER >= 11
-#include "emplace_constructible.h"
-#include "container_test_types.h"
+# include "emplace_constructible.h"
+# include "container_test_types.h"
#endif
-void basic_test()
-{
- {
- int a[] = {0, 1, 2, 3};
- std::list<int> l(cpp17_input_iterator<const int*>(a),
- cpp17_input_iterator<const int*>(a + sizeof(a)/sizeof(a[0])));
- assert(l.size() == sizeof(a)/sizeof(a[0]));
- assert(std::distance(l.begin(), l.end()) == sizeof(a)/sizeof(a[0]));
- int j = 0;
- for (std::list<int>::const_iterator i = l.begin(), e = l.end(); i != e; ++i, ++j)
- assert(*i == j);
- }
- {
- int a[] = {0, 1, 2, 3};
- std::list<int> l(cpp17_input_iterator<const int*>(a),
- cpp17_input_iterator<const int*>(a + sizeof(a)/sizeof(a[0])),
- std::allocator<int>());
- assert(l.size() == sizeof(a)/sizeof(a[0]));
- assert(std::distance(l.begin(), l.end()) == sizeof(a)/sizeof(a[0]));
- int j = 0;
- for (std::list<int>::const_iterator i = l.begin(), e = l.end(); i != e; ++i, ++j)
- assert(*i == j);
- }
- {
- int a[] = {0, 1, 2, 3};
- // Add 2 for implementations that dynamically allocate a sentinel node and container proxy.
- std::list<int, limited_allocator<int, sizeof(a)/sizeof(a[0]) + 2> > l(cpp17_input_iterator<const int*>(a),
- cpp17_input_iterator<const int*>(a + sizeof(a)/sizeof(a[0])));
- assert(l.size() == sizeof(a)/sizeof(a[0]));
- assert(std::distance(l.begin(), l.end()) == sizeof(a)/sizeof(a[0]));
- int j = 0;
- for (std::list<int>::const_iterator i = l.begin(), e = l.end(); i != e; ++i, ++j)
- assert(*i == j);
- }
+void basic_test() {
+ {
+ int a[] = {0, 1, 2, 3};
+ std::list<int> l(
+ cpp17_input_iterator<const int*>(a), cpp17_input_iterator<const int*>(a + sizeof(a) / sizeof(a[0])));
+ assert(l.size() == sizeof(a) / sizeof(a[0]));
+ assert(std::distance(l.begin(), l.end()) == sizeof(a) / sizeof(a[0]));
+ int j = 0;
+ for (std::list<int>::const_iterator i = l.begin(), e = l.end(); i != e; ++i, ++j)
+ assert(*i == j);
+ }
+ {
+ int a[] = {0, 1, 2, 3};
+ std::list<int> l(cpp17_input_iterator<const int*>(a),
+ cpp17_input_iterator<const int*>(a + sizeof(a) / sizeof(a[0])),
+ std::allocator<int>());
+ assert(l.size() == sizeof(a) / sizeof(a[0]));
+ assert(std::distance(l.begin(), l.end()) == sizeof(a) / sizeof(a[0]));
+ int j = 0;
+ for (std::list<int>::const_iterator i = l.begin(), e = l.end(); i != e; ++i, ++j)
+ assert(*i == j);
+ }
+ {
+ int a[] = {0, 1, 2, 3};
+ // Add 2 for implementations that dynamically allocate a sentinel node and container proxy.
+ std::list<int, limited_allocator<int, sizeof(a) / sizeof(a[0]) + 2> > l(
+ cpp17_input_iterator<const int*>(a), cpp17_input_iterator<const int*>(a + sizeof(a) / sizeof(a[0])));
+ assert(l.size() == sizeof(a) / sizeof(a[0]));
+ assert(std::distance(l.begin(), l.end()) == sizeof(a) / sizeof(a[0]));
+ int j = 0;
+ for (std::list<int>::const_iterator i = l.begin(), e = l.end(); i != e; ++i, ++j)
+ assert(*i == j);
+ }
#if TEST_STD_VER >= 11
- {
- int a[] = {0, 1, 2, 3};
- std::list<int, min_allocator<int>> l(cpp17_input_iterator<const int*>(a),
- cpp17_input_iterator<const int*>(a + sizeof(a)/sizeof(a[0])));
- assert(l.size() == sizeof(a)/sizeof(a[0]));
- assert(std::distance(l.begin(), l.end()) == sizeof(a)/sizeof(a[0]));
- int j = 0;
- for (std::list<int, min_allocator<int>>::const_iterator i = l.begin(), e = l.end(); i != e; ++i, ++j)
- assert(*i == j);
- }
- {
- int a[] = {0, 1, 2, 3};
- std::list<int, min_allocator<int>> l(cpp17_input_iterator<const int*>(a),
- cpp17_input_iterator<const int*>(a + sizeof(a)/sizeof(a[0])),
- min_allocator<int>());
- assert(l.size() == sizeof(a)/sizeof(a[0]));
- assert(std::distance(l.begin(), l.end()) == sizeof(a)/sizeof(a[0]));
- int j = 0;
- for (std::list<int, min_allocator<int>>::const_iterator i = l.begin(), e = l.end(); i != e; ++i, ++j)
- assert(*i == j);
- }
+ {
+ int a[] = {0, 1, 2, 3};
+ std::list<int, min_allocator<int>> l(
+ cpp17_input_iterator<const int*>(a), cpp17_input_iterator<const int*>(a + sizeof(a) / sizeof(a[0])));
+ assert(l.size() == sizeof(a) / sizeof(a[0]));
+ assert(std::distance(l.begin(), l.end()) == sizeof(a) / sizeof(a[0]));
+ int j = 0;
+ for (std::list<int, min_allocator<int>>::const_iterator i = l.begin(), e = l.end(); i != e; ++i, ++j)
+ assert(*i == j);
+ }
+ {
+ int a[] = {0, 1, 2, 3};
+ std::list<int, min_allocator<int>> l(
+ cpp17_input_iterator<const int*>(a),
+ cpp17_input_iterator<const int*>(a + sizeof(a) / sizeof(a[0])),
+ min_allocator<int>());
+ assert(l.size() == sizeof(a) / sizeof(a[0]));
+ assert(std::distance(l.begin(), l.end()) == sizeof(a) / sizeof(a[0]));
+ int j = 0;
+ for (std::list<int, min_allocator<int>>::const_iterator i = l.begin(), e = l.end(); i != e; ++i, ++j)
+ assert(*i == j);
+ }
#endif
}
-
-
void test_emplacable_concept() {
#if TEST_STD_VER >= 11
int arr1[] = {42};
int arr2[] = {1, 101, 42};
{
- using T = EmplaceConstructible<int>;
+ using T = EmplaceConstructible<int>;
using It = random_access_iterator<int*>;
{
std::list<T> v(It(arr1), It(std::end(arr1)));
@@ -106,7 +104,7 @@ void test_emplacable_concept() {
}
}
{
- using T = EmplaceConstructible<int>;
+ using T = EmplaceConstructible<int>;
using It = cpp17_input_iterator<int*>;
{
std::list<T> v(It(arr1), It(std::end(arr1)));
@@ -128,14 +126,12 @@ void test_emplacable_concept() {
#endif
}
-
-
void test_emplacable_concept_with_alloc() {
#if TEST_STD_VER >= 11
int arr1[] = {42};
int arr2[] = {1, 101, 42};
{
- using T = EmplaceConstructible<int>;
+ using T = EmplaceConstructible<int>;
using It = random_access_iterator<int*>;
std::allocator<T> a;
{
@@ -154,7 +150,7 @@ void test_emplacable_concept_with_alloc() {
}
}
{
- using T = EmplaceConstructible<int>;
+ using T = EmplaceConstructible<int>;
using It = cpp17_input_iterator<int*>;
std::allocator<T> a;
{
@@ -182,7 +178,7 @@ void test_ctor_under_alloc() {
int arr1[] = {42};
int arr2[] = {1, 101, 42};
{
- using C = TCT::list<>;
+ using C = TCT::list<>;
using It = forward_iterator<int*>;
{
ExpectConstructGuard<int&> G(1);
@@ -194,7 +190,7 @@ void test_ctor_under_alloc() {
}
}
{
- using C = TCT::list<>;
+ using C = TCT::list<>;
using It = cpp17_input_iterator<int*>;
{
ExpectConstructGuard<int&> G(1);
@@ -213,8 +209,8 @@ void test_ctor_under_alloc_with_alloc() {
int arr1[] = {42};
int arr2[] = {1, 101, 42};
{
- using C = TCT::list<>;
- using It = forward_iterator<int*>;
+ using C = TCT::list<>;
+ using It = forward_iterator<int*>;
using Alloc = typename C::allocator_type;
Alloc a;
{
@@ -227,8 +223,8 @@ void test_ctor_under_alloc_with_alloc() {
}
}
{
- using C = TCT::list<>;
- using It = cpp17_input_iterator<int*>;
+ using C = TCT::list<>;
+ using It = cpp17_input_iterator<int*>;
using Alloc = typename C::allocator_type;
Alloc a;
{
@@ -243,8 +239,6 @@ void test_ctor_under_alloc_with_alloc() {
#endif
}
-
-
int main(int, char**) {
basic_test();
test_emplacable_concept();
diff --git a/libcxx/test/std/containers/sequences/list/list.cons/move.pass.cpp b/libcxx/test/std/containers/sequences/list/list.cons/move.pass.cpp
index d5e09ca902fee30..6703390f10b944a 100644
--- a/libcxx/test/std/containers/sequences/list/list.cons/move.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.cons/move.pass.cpp
@@ -19,53 +19,49 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- std::list<MoveOnly, test_allocator<MoveOnly> > l(test_allocator<MoveOnly>(5));
- std::list<MoveOnly, test_allocator<MoveOnly> > lo(test_allocator<MoveOnly>(5));
- for (int i = 1; i <= 3; ++i)
- {
- l.push_back(i);
- lo.push_back(i);
- }
- std::list<MoveOnly, test_allocator<MoveOnly> >::iterator it = l.begin();
- std::list<MoveOnly, test_allocator<MoveOnly> > l2 = std::move(l);
- assert(l2 == lo);
- assert(l.empty());
- assert(l2.get_allocator() == lo.get_allocator());
- assert(it == l2.begin()); // Iterators remain valid
+int main(int, char**) {
+ {
+ std::list<MoveOnly, test_allocator<MoveOnly> > l(test_allocator<MoveOnly>(5));
+ std::list<MoveOnly, test_allocator<MoveOnly> > lo(test_allocator<MoveOnly>(5));
+ for (int i = 1; i <= 3; ++i) {
+ l.push_back(i);
+ lo.push_back(i);
}
- {
- std::list<MoveOnly, other_allocator<MoveOnly> > l(other_allocator<MoveOnly>(5));
- std::list<MoveOnly, other_allocator<MoveOnly> > lo(other_allocator<MoveOnly>(5));
- for (int i = 1; i <= 3; ++i)
- {
- l.push_back(i);
- lo.push_back(i);
- }
- std::list<MoveOnly, other_allocator<MoveOnly> >::iterator it = l.begin();
- std::list<MoveOnly, other_allocator<MoveOnly> > l2 = std::move(l);
- assert(l2 == lo);
- assert(l.empty());
- assert(l2.get_allocator() == lo.get_allocator());
- assert(it == l2.begin()); // Iterators remain valid
+ std::list<MoveOnly, test_allocator<MoveOnly> >::iterator it = l.begin();
+ std::list<MoveOnly, test_allocator<MoveOnly> > l2 = std::move(l);
+ assert(l2 == lo);
+ assert(l.empty());
+ assert(l2.get_allocator() == lo.get_allocator());
+ assert(it == l2.begin()); // Iterators remain valid
+ }
+ {
+ std::list<MoveOnly, other_allocator<MoveOnly> > l(other_allocator<MoveOnly>(5));
+ std::list<MoveOnly, other_allocator<MoveOnly> > lo(other_allocator<MoveOnly>(5));
+ for (int i = 1; i <= 3; ++i) {
+ l.push_back(i);
+ lo.push_back(i);
}
- {
- std::list<MoveOnly, min_allocator<MoveOnly> > l(min_allocator<MoveOnly>{});
- std::list<MoveOnly, min_allocator<MoveOnly> > lo(min_allocator<MoveOnly>{});
- for (int i = 1; i <= 3; ++i)
- {
- l.push_back(i);
- lo.push_back(i);
- }
- std::list<MoveOnly, min_allocator<MoveOnly> >::iterator it = l.begin();
- std::list<MoveOnly, min_allocator<MoveOnly> > l2 = std::move(l);
- assert(l2 == lo);
- assert(l.empty());
- assert(l2.get_allocator() == lo.get_allocator());
- assert(it == l2.begin()); // Iterators remain valid
+ std::list<MoveOnly, other_allocator<MoveOnly> >::iterator it = l.begin();
+ std::list<MoveOnly, other_allocator<MoveOnly> > l2 = std::move(l);
+ assert(l2 == lo);
+ assert(l.empty());
+ assert(l2.get_allocator() == lo.get_allocator());
+ assert(it == l2.begin()); // Iterators remain valid
+ }
+ {
+ std::list<MoveOnly, min_allocator<MoveOnly> > l(min_allocator<MoveOnly>{});
+ std::list<MoveOnly, min_allocator<MoveOnly> > lo(min_allocator<MoveOnly>{});
+ for (int i = 1; i <= 3; ++i) {
+ l.push_back(i);
+ lo.push_back(i);
}
+ std::list<MoveOnly, min_allocator<MoveOnly> >::iterator it = l.begin();
+ std::list<MoveOnly, min_allocator<MoveOnly> > l2 = std::move(l);
+ assert(l2 == lo);
+ assert(l.empty());
+ assert(l2.get_allocator() == lo.get_allocator());
+ assert(it == l2.begin()); // Iterators remain valid
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/list/list.cons/move_alloc.pass.cpp b/libcxx/test/std/containers/sequences/list/list.cons/move_alloc.pass.cpp
index 694fccdf038dd86..f6a1f2c33a63a1a 100644
--- a/libcxx/test/std/containers/sequences/list/list.cons/move_alloc.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.cons/move_alloc.pass.cpp
@@ -19,60 +19,55 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- std::list<MoveOnly, test_allocator<MoveOnly> > l(test_allocator<MoveOnly>(5));
- std::list<MoveOnly, test_allocator<MoveOnly> > lo(test_allocator<MoveOnly>(5));
- for (int i = 1; i <= 3; ++i)
- {
- l.push_back(i);
- lo.push_back(i);
- }
- std::list<MoveOnly, test_allocator<MoveOnly> > l2(std::move(l), test_allocator<MoveOnly>(6));
- assert(l2 == lo);
- assert(!l.empty());
- assert(l2.get_allocator() == test_allocator<MoveOnly>(6));
+int main(int, char**) {
+ {
+ std::list<MoveOnly, test_allocator<MoveOnly> > l(test_allocator<MoveOnly>(5));
+ std::list<MoveOnly, test_allocator<MoveOnly> > lo(test_allocator<MoveOnly>(5));
+ for (int i = 1; i <= 3; ++i) {
+ l.push_back(i);
+ lo.push_back(i);
}
- {
- std::list<MoveOnly, test_allocator<MoveOnly> > l(test_allocator<MoveOnly>(5));
- std::list<MoveOnly, test_allocator<MoveOnly> > lo(test_allocator<MoveOnly>(5));
- for (int i = 1; i <= 3; ++i)
- {
- l.push_back(i);
- lo.push_back(i);
- }
- std::list<MoveOnly, test_allocator<MoveOnly> > l2(std::move(l), test_allocator<MoveOnly>(5));
- assert(l2 == lo);
- assert(l.empty());
- assert(l2.get_allocator() == test_allocator<MoveOnly>(5));
+ std::list<MoveOnly, test_allocator<MoveOnly> > l2(std::move(l), test_allocator<MoveOnly>(6));
+ assert(l2 == lo);
+ assert(!l.empty());
+ assert(l2.get_allocator() == test_allocator<MoveOnly>(6));
+ }
+ {
+ std::list<MoveOnly, test_allocator<MoveOnly> > l(test_allocator<MoveOnly>(5));
+ std::list<MoveOnly, test_allocator<MoveOnly> > lo(test_allocator<MoveOnly>(5));
+ for (int i = 1; i <= 3; ++i) {
+ l.push_back(i);
+ lo.push_back(i);
}
- {
- std::list<MoveOnly, other_allocator<MoveOnly> > l(other_allocator<MoveOnly>(5));
- std::list<MoveOnly, other_allocator<MoveOnly> > lo(other_allocator<MoveOnly>(5));
- for (int i = 1; i <= 3; ++i)
- {
- l.push_back(i);
- lo.push_back(i);
- }
- std::list<MoveOnly, other_allocator<MoveOnly> > l2(std::move(l), other_allocator<MoveOnly>(4));
- assert(l2 == lo);
- assert(!l.empty());
- assert(l2.get_allocator() == other_allocator<MoveOnly>(4));
+ std::list<MoveOnly, test_allocator<MoveOnly> > l2(std::move(l), test_allocator<MoveOnly>(5));
+ assert(l2 == lo);
+ assert(l.empty());
+ assert(l2.get_allocator() == test_allocator<MoveOnly>(5));
+ }
+ {
+ std::list<MoveOnly, other_allocator<MoveOnly> > l(other_allocator<MoveOnly>(5));
+ std::list<MoveOnly, other_allocator<MoveOnly> > lo(other_allocator<MoveOnly>(5));
+ for (int i = 1; i <= 3; ++i) {
+ l.push_back(i);
+ lo.push_back(i);
}
- {
- std::list<MoveOnly, min_allocator<MoveOnly> > l(min_allocator<MoveOnly>{});
- std::list<MoveOnly, min_allocator<MoveOnly> > lo(min_allocator<MoveOnly>{});
- for (int i = 1; i <= 3; ++i)
- {
- l.push_back(i);
- lo.push_back(i);
- }
- std::list<MoveOnly, min_allocator<MoveOnly> > l2(std::move(l), min_allocator<MoveOnly>());
- assert(l2 == lo);
- assert(l.empty());
- assert(l2.get_allocator() == min_allocator<MoveOnly>());
+ std::list<MoveOnly, other_allocator<MoveOnly> > l2(std::move(l), other_allocator<MoveOnly>(4));
+ assert(l2 == lo);
+ assert(!l.empty());
+ assert(l2.get_allocator() == other_allocator<MoveOnly>(4));
+ }
+ {
+ std::list<MoveOnly, min_allocator<MoveOnly> > l(min_allocator<MoveOnly>{});
+ std::list<MoveOnly, min_allocator<MoveOnly> > lo(min_allocator<MoveOnly>{});
+ for (int i = 1; i <= 3; ++i) {
+ l.push_back(i);
+ lo.push_back(i);
}
+ std::list<MoveOnly, min_allocator<MoveOnly> > l2(std::move(l), min_allocator<MoveOnly>());
+ assert(l2 == lo);
+ assert(l.empty());
+ assert(l2.get_allocator() == min_allocator<MoveOnly>());
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/list/list.cons/move_noexcept.pass.cpp b/libcxx/test/std/containers/sequences/list/list.cons/move_noexcept.pass.cpp
index 5c0b4c2b36d258d..c33ef906be40073 100644
--- a/libcxx/test/std/containers/sequences/list/list.cons/move_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.cons/move_noexcept.pass.cpp
@@ -23,33 +23,31 @@
#include "test_allocator.h"
template <class T>
-struct some_alloc
-{
- typedef T value_type;
- some_alloc(const some_alloc&);
- void allocate(std::size_t);
+struct some_alloc {
+ typedef T value_type;
+ some_alloc(const some_alloc&);
+ void allocate(std::size_t);
};
-int main(int, char**)
-{
+int main(int, char**) {
#if defined(_LIBCPP_VERSION)
- {
- typedef std::list<MoveOnly> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
- }
- {
- typedef std::list<MoveOnly, test_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
- }
- {
- typedef std::list<MoveOnly, other_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
- }
+ {
+ typedef std::list<MoveOnly> C;
+ static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ }
+ {
+ typedef std::list<MoveOnly, test_allocator<MoveOnly>> C;
+ static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ }
+ {
+ typedef std::list<MoveOnly, other_allocator<MoveOnly>> C;
+ static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ }
#endif // _LIBCPP_VERSION
- {
- typedef std::list<MoveOnly, some_alloc<MoveOnly>> C;
- static_assert(!std::is_nothrow_move_constructible<C>::value, "");
- }
+ {
+ typedef std::list<MoveOnly, some_alloc<MoveOnly>> C;
+ static_assert(!std::is_nothrow_move_constructible<C>::value, "");
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/list/list.cons/op_equal_initializer_list.pass.cpp b/libcxx/test/std/containers/sequences/list/list.cons/op_equal_initializer_list.pass.cpp
index 08cbf2acbae2652..a9ab30b82640c92 100644
--- a/libcxx/test/std/containers/sequences/list/list.cons/op_equal_initializer_list.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.cons/op_equal_initializer_list.pass.cpp
@@ -17,9 +17,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
std::list<int> d;
d = {3, 4, 5, 6};
assert(d.size() == 4);
@@ -28,8 +27,8 @@ int main(int, char**)
assert(*i++ == 4);
assert(*i++ == 5);
assert(*i++ == 6);
- }
- {
+ }
+ {
std::list<int, min_allocator<int>> d;
d = {3, 4, 5, 6};
assert(d.size() == 4);
@@ -38,7 +37,7 @@ int main(int, char**)
assert(*i++ == 4);
assert(*i++ == 5);
assert(*i++ == 6);
- }
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/list/list.cons/size_type.pass.cpp b/libcxx/test/std/containers/sequences/list/list.cons/size_type.pass.cpp
index ef365d09fd435e6..937a86a27e05860 100644
--- a/libcxx/test/std/containers/sequences/list/list.cons/size_type.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.cons/size_type.pass.cpp
@@ -19,86 +19,82 @@
#include "min_allocator.h"
template <class T, class Allocator>
-void
-test3(unsigned n, Allocator const &alloc = Allocator())
-{
+void test3(unsigned n, Allocator const& alloc = Allocator()) {
#if TEST_STD_VER > 11
- typedef std::list<T, Allocator> C;
- {
+ typedef std::list<T, Allocator> C;
+ {
C d(n, alloc);
assert(d.size() == n);
assert(static_cast<std::size_t>(std::distance(d.begin(), d.end())) == n);
assert(d.get_allocator() == alloc);
- }
+ }
#else
- ((void)n);
- ((void)alloc);
+ ((void)n);
+ ((void)alloc);
#endif
}
-
-int main(int, char**)
-{
- {
- std::list<int> l(3);
- assert(l.size() == 3);
- assert(std::distance(l.begin(), l.end()) == 3);
- std::list<int>::const_iterator i = l.begin();
- assert(*i == 0);
- ++i;
- assert(*i == 0);
- ++i;
- assert(*i == 0);
- }
- {
- // Add 2 for implementations that dynamically allocate a sentinel node and container proxy.
- std::list<int, limited_allocator<int, 3 + 2> > l(3);
- assert(l.size() == 3);
- assert(std::distance(l.begin(), l.end()) == 3);
- std::list<int>::const_iterator i = l.begin();
- assert(*i == 0);
- ++i;
- assert(*i == 0);
- ++i;
- assert(*i == 0);
- }
+int main(int, char**) {
+ {
+ std::list<int> l(3);
+ assert(l.size() == 3);
+ assert(std::distance(l.begin(), l.end()) == 3);
+ std::list<int>::const_iterator i = l.begin();
+ assert(*i == 0);
+ ++i;
+ assert(*i == 0);
+ ++i;
+ assert(*i == 0);
+ }
+ {
+ // Add 2 for implementations that dynamically allocate a sentinel node and container proxy.
+ std::list<int, limited_allocator<int, 3 + 2> > l(3);
+ assert(l.size() == 3);
+ assert(std::distance(l.begin(), l.end()) == 3);
+ std::list<int>::const_iterator i = l.begin();
+ assert(*i == 0);
+ ++i;
+ assert(*i == 0);
+ ++i;
+ assert(*i == 0);
+ }
#if TEST_STD_VER > 11
- {
- typedef std::list<int, min_allocator<int> > C;
- C l(3, min_allocator<int> ());
- assert(l.size() == 3);
- assert(std::distance(l.begin(), l.end()) == 3);
- C::const_iterator i = l.begin();
- assert(*i == 0);
- ++i;
- assert(*i == 0);
- ++i;
- assert(*i == 0);
- test3<int, min_allocator<int>> (3);
- }
+ {
+ typedef std::list<int, min_allocator<int> > C;
+ C l(3, min_allocator<int>());
+ assert(l.size() == 3);
+ assert(std::distance(l.begin(), l.end()) == 3);
+ C::const_iterator i = l.begin();
+ assert(*i == 0);
+ ++i;
+ assert(*i == 0);
+ ++i;
+ assert(*i == 0);
+ test3<int, min_allocator<int>>(3);
+ }
#endif
#if TEST_STD_VER >= 11
- {
- std::list<DefaultOnly> l(3);
- assert(l.size() == 3);
- assert(std::distance(l.begin(), l.end()) == 3);
- }
- {
- std::list<int, min_allocator<int>> l(3);
- assert(l.size() == 3);
- assert(std::distance(l.begin(), l.end()) == 3);
- std::list<int, min_allocator<int>>::const_iterator i = l.begin();
- assert(*i == 0);
- ++i;
- assert(*i == 0);
- ++i;
- assert(*i == 0);
- }
- {
- std::list<DefaultOnly, min_allocator<DefaultOnly>> l(3);
- assert(l.size() == 3);
- assert(std::distance(l.begin(), l.end()) == 3);
- }
+ {
+ std::list<DefaultOnly> l(3);
+ assert(l.size() == 3);
+ assert(std::distance(l.begin(), l.end()) == 3);
+ }
+ {
+ std::list<int, min_allocator<int>> l(3);
+ assert(l.size() == 3);
+ assert(std::distance(l.begin(), l.end()) == 3);
+ std::list<int, min_allocator<int>>::const_iterator i = l.begin();
+ assert(*i == 0);
+ ++i;
+ assert(*i == 0);
+ ++i;
+ assert(*i == 0);
+ }
+ {
+ std::list<DefaultOnly, min_allocator<DefaultOnly>> l(3);
+ assert(l.size() == 3);
+ assert(std::distance(l.begin(), l.end()) == 3);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/list/list.cons/size_value_alloc.pass.cpp b/libcxx/test/std/containers/sequences/list/list.cons/size_value_alloc.pass.cpp
index bced58d0208bac5..ff7982ce147d5ef 100644
--- a/libcxx/test/std/containers/sequences/list/list.cons/size_value_alloc.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.cons/size_value_alloc.pass.cpp
@@ -17,65 +17,64 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- std::list<int> l(3, 2);
- assert(l.size() == 3);
- assert(std::distance(l.begin(), l.end()) == 3);
- std::list<int>::const_iterator i = l.begin();
- assert(*i == 2);
- ++i;
- assert(*i == 2);
- ++i;
- assert(*i == 2);
- }
- {
- std::list<int> l(3, 2, std::allocator<int>());
- assert(l.size() == 3);
- assert(std::distance(l.begin(), l.end()) == 3);
- std::list<int>::const_iterator i = l.begin();
- assert(*i == 2);
- ++i;
- assert(*i == 2);
- ++i;
- assert(*i == 2);
- }
- {
- // Add 2 for implementations that dynamically allocate a sentinel node and container proxy.
- std::list<int, limited_allocator<int, 3 + 2> > l(3, 2);
- assert(l.size() == 3);
- assert(std::distance(l.begin(), l.end()) == 3);
- std::list<int>::const_iterator i = l.begin();
- assert(*i == 2);
- ++i;
- assert(*i == 2);
- ++i;
- assert(*i == 2);
- }
+int main(int, char**) {
+ {
+ std::list<int> l(3, 2);
+ assert(l.size() == 3);
+ assert(std::distance(l.begin(), l.end()) == 3);
+ std::list<int>::const_iterator i = l.begin();
+ assert(*i == 2);
+ ++i;
+ assert(*i == 2);
+ ++i;
+ assert(*i == 2);
+ }
+ {
+ std::list<int> l(3, 2, std::allocator<int>());
+ assert(l.size() == 3);
+ assert(std::distance(l.begin(), l.end()) == 3);
+ std::list<int>::const_iterator i = l.begin();
+ assert(*i == 2);
+ ++i;
+ assert(*i == 2);
+ ++i;
+ assert(*i == 2);
+ }
+ {
+ // Add 2 for implementations that dynamically allocate a sentinel node and container proxy.
+ std::list<int, limited_allocator<int, 3 + 2> > l(3, 2);
+ assert(l.size() == 3);
+ assert(std::distance(l.begin(), l.end()) == 3);
+ std::list<int>::const_iterator i = l.begin();
+ assert(*i == 2);
+ ++i;
+ assert(*i == 2);
+ ++i;
+ assert(*i == 2);
+ }
#if TEST_STD_VER >= 11
- {
- std::list<int, min_allocator<int>> l(3, 2);
- assert(l.size() == 3);
- assert(std::distance(l.begin(), l.end()) == 3);
- std::list<int, min_allocator<int>>::const_iterator i = l.begin();
- assert(*i == 2);
- ++i;
- assert(*i == 2);
- ++i;
- assert(*i == 2);
- }
- {
- std::list<int, min_allocator<int>> l(3, 2, min_allocator<int>());
- assert(l.size() == 3);
- assert(std::distance(l.begin(), l.end()) == 3);
- std::list<int, min_allocator<int>>::const_iterator i = l.begin();
- assert(*i == 2);
- ++i;
- assert(*i == 2);
- ++i;
- assert(*i == 2);
- }
+ {
+ std::list<int, min_allocator<int>> l(3, 2);
+ assert(l.size() == 3);
+ assert(std::distance(l.begin(), l.end()) == 3);
+ std::list<int, min_allocator<int>>::const_iterator i = l.begin();
+ assert(*i == 2);
+ ++i;
+ assert(*i == 2);
+ ++i;
+ assert(*i == 2);
+ }
+ {
+ std::list<int, min_allocator<int>> l(3, 2, min_allocator<int>());
+ assert(l.size() == 3);
+ assert(std::distance(l.begin(), l.end()) == 3);
+ std::list<int, min_allocator<int>>::const_iterator i = l.begin();
+ assert(*i == 2);
+ ++i;
+ assert(*i == 2);
+ ++i;
+ assert(*i == 2);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/list/list.erasure/erase.pass.cpp b/libcxx/test/std/containers/sequences/list/list.erasure/erase.pass.cpp
index 977cf24d1e11ab3..77f9f8956037554 100644
--- a/libcxx/test/std/containers/sequences/list/list.erasure/erase.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.erasure/erase.pass.cpp
@@ -28,8 +28,7 @@ void test0(S s, U val, S expected, std::size_t expected_erased_count) {
}
template <class S>
-void test()
-{
+void test() {
test0(S(), 1, S(), 0);
test0(S({1}), 1, S(), 1);
@@ -63,14 +62,13 @@ void test()
test0(S({1, 2, 1}), opt(3), S({1, 2, 1}), 0);
}
-int main(int, char**)
-{
- test<std::list<int>>();
- test<std::list<int, min_allocator<int>>> ();
- test<std::list<int, test_allocator<int>>> ();
+int main(int, char**) {
+ test<std::list<int>>();
+ test<std::list<int, min_allocator<int>>>();
+ test<std::list<int, test_allocator<int>>>();
- test<std::list<long>>();
- test<std::list<double>>();
+ test<std::list<long>>();
+ test<std::list<double>>();
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/list/list.erasure/erase_if.pass.cpp b/libcxx/test/std/containers/sequences/list/list.erasure/erase_if.pass.cpp
index db8fd8b21189bbd..5352a2f454f808a 100644
--- a/libcxx/test/std/containers/sequences/list/list.erasure/erase_if.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.erasure/erase_if.pass.cpp
@@ -27,52 +27,50 @@ void test0(S s, Pred p, S expected, std::size_t expected_erased_count) {
}
template <typename S>
-void test()
-{
- auto is1 = [](auto v) { return v == 1;};
- auto is2 = [](auto v) { return v == 2;};
- auto is3 = [](auto v) { return v == 3;};
- auto is4 = [](auto v) { return v == 4;};
- auto True = [](auto) { return true; };
- auto False = [](auto) { return false; };
+void test() {
+ auto is1 = [](auto v) { return v == 1; };
+ auto is2 = [](auto v) { return v == 2; };
+ auto is3 = [](auto v) { return v == 3; };
+ auto is4 = [](auto v) { return v == 4; };
+ auto True = [](auto) { return true; };
+ auto False = [](auto) { return false; };
- test0(S(), is1, S(), 0);
+ test0(S(), is1, S(), 0);
- test0(S({1}), is1, S(), 1);
- test0(S({1}), is2, S({1}), 0);
+ test0(S({1}), is1, S(), 1);
+ test0(S({1}), is2, S({1}), 0);
- test0(S({1, 2}), is1, S({2}), 1);
- test0(S({1, 2}), is2, S({1}), 1);
- test0(S({1, 2}), is3, S({1, 2}), 0);
- test0(S({1, 1}), is1, S(), 2);
- test0(S({1, 1}), is3, S({1, 1}), 0);
+ test0(S({1, 2}), is1, S({2}), 1);
+ test0(S({1, 2}), is2, S({1}), 1);
+ test0(S({1, 2}), is3, S({1, 2}), 0);
+ test0(S({1, 1}), is1, S(), 2);
+ test0(S({1, 1}), is3, S({1, 1}), 0);
- test0(S({1, 2, 3}), is1, S({2, 3}), 1);
- test0(S({1, 2, 3}), is2, S({1, 3}), 1);
- test0(S({1, 2, 3}), is3, S({1, 2}), 1);
- test0(S({1, 2, 3}), is4, S({1, 2, 3}), 0);
+ test0(S({1, 2, 3}), is1, S({2, 3}), 1);
+ test0(S({1, 2, 3}), is2, S({1, 3}), 1);
+ test0(S({1, 2, 3}), is3, S({1, 2}), 1);
+ test0(S({1, 2, 3}), is4, S({1, 2, 3}), 0);
- test0(S({1, 1, 1}), is1, S(), 3);
- test0(S({1, 1, 1}), is2, S({1, 1, 1}), 0);
- test0(S({1, 1, 2}), is1, S({2}), 2);
- test0(S({1, 1, 2}), is2, S({1, 1}), 1);
- test0(S({1, 1, 2}), is3, S({1, 1, 2}), 0);
- test0(S({1, 2, 2}), is1, S({2, 2}), 1);
- test0(S({1, 2, 2}), is2, S({1}), 2);
- test0(S({1, 2, 2}), is3, S({1, 2, 2}), 0);
+ test0(S({1, 1, 1}), is1, S(), 3);
+ test0(S({1, 1, 1}), is2, S({1, 1, 1}), 0);
+ test0(S({1, 1, 2}), is1, S({2}), 2);
+ test0(S({1, 1, 2}), is2, S({1, 1}), 1);
+ test0(S({1, 1, 2}), is3, S({1, 1, 2}), 0);
+ test0(S({1, 2, 2}), is1, S({2, 2}), 1);
+ test0(S({1, 2, 2}), is2, S({1}), 2);
+ test0(S({1, 2, 2}), is3, S({1, 2, 2}), 0);
- test0(S({1, 2, 3}), True, S(), 3);
- test0(S({1, 2, 3}), False, S({1, 2, 3}), 0);
+ test0(S({1, 2, 3}), True, S(), 3);
+ test0(S({1, 2, 3}), False, S({1, 2, 3}), 0);
}
-int main(int, char**)
-{
- test<std::list<int>>();
- test<std::list<int, min_allocator<int>>> ();
- test<std::list<int, test_allocator<int>>> ();
+int main(int, char**) {
+ test<std::list<int>>();
+ test<std::list<int, min_allocator<int>>>();
+ test<std::list<int, test_allocator<int>>>();
- test<std::list<long>>();
- test<std::list<double>>();
+ test<std::list<long>>();
+ test<std::list<double>>();
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/list/list.modifiers/clear.pass.cpp b/libcxx/test/std/containers/sequences/list/list.modifiers/clear.pass.cpp
index 0afd0a5483512cb..5931fd62d037cdb 100644
--- a/libcxx/test/std/containers/sequences/list/list.modifiers/clear.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.modifiers/clear.pass.cpp
@@ -16,23 +16,22 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
int a[] = {1, 2, 3};
- std::list<int> c(a, a+3);
+ std::list<int> c(a, a + 3);
ASSERT_NOEXCEPT(c.clear());
c.clear();
assert(c.empty());
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
int a[] = {1, 2, 3};
- std::list<int, min_allocator<int>> c(a, a+3);
+ std::list<int, min_allocator<int>> c(a, a + 3);
ASSERT_NOEXCEPT(c.clear());
c.clear();
assert(c.empty());
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/list/list.modifiers/emplace.pass.cpp b/libcxx/test/std/containers/sequences/list/list.modifiers/emplace.pass.cpp
index 2b6e5999369ae74..2f83aa0d317b5bf 100644
--- a/libcxx/test/std/containers/sequences/list/list.modifiers/emplace.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.modifiers/emplace.pass.cpp
@@ -12,31 +12,28 @@
// template <class... Args> void emplace(const_iterator p, Args&&... args);
-
#include <list>
#include <cassert>
#include "test_macros.h"
#include "min_allocator.h"
-class A
-{
- int i_;
- double d_;
+class A {
+ int i_;
+ double d_;
+
+ A(const A&);
+ A& operator=(const A&);
- A(const A&);
- A& operator=(const A&);
public:
- A(int i, double d)
- : i_(i), d_(d) {}
+ A(int i, double d) : i_(i), d_(d) {}
- int geti() const {return i_;}
- double getd() const {return d_;}
+ int geti() const { return i_; }
+ double getd() const { return d_; }
};
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
std::list<A> c;
c.emplace(c.cbegin(), 2, 3.5);
assert(c.size() == 1);
@@ -48,8 +45,8 @@ int main(int, char**)
assert(c.front().getd() == 3.5);
assert(c.back().geti() == 3);
assert(c.back().getd() == 4.5);
- }
- {
+ }
+ {
std::list<A, min_allocator<A>> c;
c.emplace(c.cbegin(), 2, 3.5);
assert(c.size() == 1);
@@ -61,8 +58,7 @@ int main(int, char**)
assert(c.front().getd() == 3.5);
assert(c.back().geti() == 3);
assert(c.back().getd() == 4.5);
- }
-
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/list/list.modifiers/emplace_back.pass.cpp b/libcxx/test/std/containers/sequences/list/list.modifiers/emplace_back.pass.cpp
index 0d7965be64ded09..900f8b83d3e695e 100644
--- a/libcxx/test/std/containers/sequences/list/list.modifiers/emplace_back.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.modifiers/emplace_back.pass.cpp
@@ -19,24 +19,22 @@
#include "test_macros.h"
#include "min_allocator.h"
-class A
-{
- int i_;
- double d_;
+class A {
+ int i_;
+ double d_;
+
+ A(const A&);
+ A& operator=(const A&);
- A(const A&);
- A& operator=(const A&);
public:
- A(int i, double d)
- : i_(i), d_(d) {}
+ A(int i, double d) : i_(i), d_(d) {}
- int geti() const {return i_;}
- double getd() const {return d_;}
+ int geti() const { return i_; }
+ double getd() const { return d_; }
};
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
std::list<A> c;
#if TEST_STD_VER > 14
A& r1 = c.emplace_back(2, 3.5);
@@ -59,8 +57,8 @@ int main(int, char**)
assert(c.front().getd() == 3.5);
assert(c.back().geti() == 3);
assert(c.back().getd() == 4.5);
- }
- {
+ }
+ {
std::list<A, min_allocator<A>> c;
#if TEST_STD_VER > 14
A& r1 = c.emplace_back(2, 3.5);
@@ -83,7 +81,7 @@ int main(int, char**)
assert(c.front().getd() == 3.5);
assert(c.back().geti() == 3);
assert(c.back().getd() == 4.5);
- }
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/list/list.modifiers/emplace_front.pass.cpp b/libcxx/test/std/containers/sequences/list/list.modifiers/emplace_front.pass.cpp
index 7d6d18686cb5727..665f5077bd42925 100644
--- a/libcxx/test/std/containers/sequences/list/list.modifiers/emplace_front.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.modifiers/emplace_front.pass.cpp
@@ -19,24 +19,22 @@
#include "test_macros.h"
#include "min_allocator.h"
-class A
-{
- int i_;
- double d_;
+class A {
+ int i_;
+ double d_;
+
+ A(const A&);
+ A& operator=(const A&);
- A(const A&);
- A& operator=(const A&);
public:
- A(int i, double d)
- : i_(i), d_(d) {}
+ A(int i, double d) : i_(i), d_(d) {}
- int geti() const {return i_;}
- double getd() const {return d_;}
+ int geti() const { return i_; }
+ double getd() const { return d_; }
};
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
std::list<A> c;
#if TEST_STD_VER > 14
A& r1 = c.emplace_front(2, 3.5);
@@ -59,9 +57,9 @@ int main(int, char**)
assert(c.front().getd() == 4.5);
assert(c.back().geti() == 2);
assert(c.back().getd() == 3.5);
- }
+ }
- {
+ {
std::list<A, min_allocator<A>> c;
#if TEST_STD_VER > 14
A& r1 = c.emplace_front(2, 3.5);
@@ -84,7 +82,7 @@ int main(int, char**)
assert(c.front().getd() == 4.5);
assert(c.back().geti() == 2);
assert(c.back().getd() == 3.5);
- }
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/list/list.modifiers/erase_iter.pass.cpp b/libcxx/test/std/containers/sequences/list/list.modifiers/erase_iter.pass.cpp
index b559f8e7118fa1b..ba139b4367d73e7 100644
--- a/libcxx/test/std/containers/sequences/list/list.modifiers/erase_iter.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.modifiers/erase_iter.pass.cpp
@@ -16,11 +16,10 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
int a1[] = {1, 2, 3};
- std::list<int> l1(a1, a1+3);
+ std::list<int> l1(a1, a1 + 3);
std::list<int>::const_iterator i = l1.begin();
++i;
std::list<int>::iterator j = l1.erase(i);
@@ -38,11 +37,11 @@ int main(int, char**)
assert(j == l1.end());
assert(l1.size() == 0);
assert(std::distance(l1.begin(), l1.end()) == 0);
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
int a1[] = {1, 2, 3};
- std::list<int, min_allocator<int>> l1(a1, a1+3);
+ std::list<int, min_allocator<int>> l1(a1, a1 + 3);
std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
++i;
std::list<int, min_allocator<int>>::iterator j = l1.erase(i);
@@ -60,7 +59,7 @@ int main(int, char**)
assert(j == l1.end());
assert(l1.size() == 0);
assert(std::distance(l1.begin(), l1.end()) == 0);
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/list/list.modifiers/erase_iter_iter.pass.cpp b/libcxx/test/std/containers/sequences/list/list.modifiers/erase_iter_iter.pass.cpp
index d8ea38632d48f07..cc8d537032d0473 100644
--- a/libcxx/test/std/containers/sequences/list/list.modifiers/erase_iter_iter.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.modifiers/erase_iter_iter.pass.cpp
@@ -16,70 +16,69 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- int a1[] = {1, 2, 3};
- {
- std::list<int> l1(a1, a1+3);
- std::list<int>::iterator i = l1.erase(l1.cbegin(), l1.cbegin());
- assert(l1.size() == 3);
- assert(std::distance(l1.cbegin(), l1.cend()) == 3);
- assert(i == l1.begin());
- }
- {
- std::list<int> l1(a1, a1+3);
- std::list<int>::iterator i = l1.erase(l1.cbegin(), std::next(l1.cbegin()));
- assert(l1.size() == 2);
- assert(std::distance(l1.cbegin(), l1.cend()) == 2);
- assert(i == l1.begin());
- assert(l1 == std::list<int>(a1+1, a1+3));
- }
- {
- std::list<int> l1(a1, a1+3);
- std::list<int>::iterator i = l1.erase(l1.cbegin(), std::next(l1.cbegin(), 2));
- assert(l1.size() == 1);
- assert(std::distance(l1.cbegin(), l1.cend()) == 1);
- assert(i == l1.begin());
- assert(l1 == std::list<int>(a1+2, a1+3));
- }
- {
- std::list<int> l1(a1, a1+3);
- std::list<int>::iterator i = l1.erase(l1.cbegin(), std::next(l1.cbegin(), 3));
- assert(l1.size() == 0);
- assert(std::distance(l1.cbegin(), l1.cend()) == 0);
- assert(i == l1.begin());
- }
+int main(int, char**) {
+ int a1[] = {1, 2, 3};
+ {
+ std::list<int> l1(a1, a1 + 3);
+ std::list<int>::iterator i = l1.erase(l1.cbegin(), l1.cbegin());
+ assert(l1.size() == 3);
+ assert(std::distance(l1.cbegin(), l1.cend()) == 3);
+ assert(i == l1.begin());
+ }
+ {
+ std::list<int> l1(a1, a1 + 3);
+ std::list<int>::iterator i = l1.erase(l1.cbegin(), std::next(l1.cbegin()));
+ assert(l1.size() == 2);
+ assert(std::distance(l1.cbegin(), l1.cend()) == 2);
+ assert(i == l1.begin());
+ assert(l1 == std::list<int>(a1 + 1, a1 + 3));
+ }
+ {
+ std::list<int> l1(a1, a1 + 3);
+ std::list<int>::iterator i = l1.erase(l1.cbegin(), std::next(l1.cbegin(), 2));
+ assert(l1.size() == 1);
+ assert(std::distance(l1.cbegin(), l1.cend()) == 1);
+ assert(i == l1.begin());
+ assert(l1 == std::list<int>(a1 + 2, a1 + 3));
+ }
+ {
+ std::list<int> l1(a1, a1 + 3);
+ std::list<int>::iterator i = l1.erase(l1.cbegin(), std::next(l1.cbegin(), 3));
+ assert(l1.size() == 0);
+ assert(std::distance(l1.cbegin(), l1.cend()) == 0);
+ assert(i == l1.begin());
+ }
#if TEST_STD_VER >= 11
- {
- std::list<int, min_allocator<int>> l1(a1, a1+3);
- std::list<int, min_allocator<int>>::iterator i = l1.erase(l1.cbegin(), l1.cbegin());
- assert(l1.size() == 3);
- assert(std::distance(l1.cbegin(), l1.cend()) == 3);
- assert(i == l1.begin());
- }
- {
- std::list<int, min_allocator<int>> l1(a1, a1+3);
- std::list<int, min_allocator<int>>::iterator i = l1.erase(l1.cbegin(), std::next(l1.cbegin()));
- assert(l1.size() == 2);
- assert(std::distance(l1.cbegin(), l1.cend()) == 2);
- assert(i == l1.begin());
- assert((l1 == std::list<int, min_allocator<int>>(a1+1, a1+3)));
- }
- {
- std::list<int, min_allocator<int>> l1(a1, a1+3);
- std::list<int, min_allocator<int>>::iterator i = l1.erase(l1.cbegin(), std::next(l1.cbegin(), 2));
- assert(l1.size() == 1);
- assert(std::distance(l1.cbegin(), l1.cend()) == 1);
- assert(i == l1.begin());
- assert((l1 == std::list<int, min_allocator<int>>(a1+2, a1+3)));
- }
- {
- std::list<int, min_allocator<int>> l1(a1, a1+3);
- std::list<int, min_allocator<int>>::iterator i = l1.erase(l1.cbegin(), std::next(l1.cbegin(), 3));
- assert(l1.size() == 0);
- assert(std::distance(l1.cbegin(), l1.cend()) == 0);
- assert(i == l1.begin());
- }
+ {
+ std::list<int, min_allocator<int>> l1(a1, a1 + 3);
+ std::list<int, min_allocator<int>>::iterator i = l1.erase(l1.cbegin(), l1.cbegin());
+ assert(l1.size() == 3);
+ assert(std::distance(l1.cbegin(), l1.cend()) == 3);
+ assert(i == l1.begin());
+ }
+ {
+ std::list<int, min_allocator<int>> l1(a1, a1 + 3);
+ std::list<int, min_allocator<int>>::iterator i = l1.erase(l1.cbegin(), std::next(l1.cbegin()));
+ assert(l1.size() == 2);
+ assert(std::distance(l1.cbegin(), l1.cend()) == 2);
+ assert(i == l1.begin());
+ assert((l1 == std::list<int, min_allocator<int>>(a1 + 1, a1 + 3)));
+ }
+ {
+ std::list<int, min_allocator<int>> l1(a1, a1 + 3);
+ std::list<int, min_allocator<int>>::iterator i = l1.erase(l1.cbegin(), std::next(l1.cbegin(), 2));
+ assert(l1.size() == 1);
+ assert(std::distance(l1.cbegin(), l1.cend()) == 1);
+ assert(i == l1.begin());
+ assert((l1 == std::list<int, min_allocator<int>>(a1 + 2, a1 + 3)));
+ }
+ {
+ std::list<int, min_allocator<int>> l1(a1, a1 + 3);
+ std::list<int, min_allocator<int>>::iterator i = l1.erase(l1.cbegin(), std::next(l1.cbegin(), 3));
+ assert(l1.size() == 0);
+ assert(std::distance(l1.cbegin(), l1.cend()) == 0);
+ assert(i == l1.begin());
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/list/list.modifiers/insert_iter_initializer_list.pass.cpp b/libcxx/test/std/containers/sequences/list/list.modifiers/insert_iter_initializer_list.pass.cpp
index 32adf3a42d7c409..8bd01c940d958bd 100644
--- a/libcxx/test/std/containers/sequences/list/list.modifiers/insert_iter_initializer_list.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.modifiers/insert_iter_initializer_list.pass.cpp
@@ -18,9 +18,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
std::list<int> d(10, 1);
std::list<int>::iterator i = d.insert(std::next(d.cbegin(), 2), {3, 4, 5, 6});
assert(d.size() == 14);
@@ -40,8 +39,8 @@ int main(int, char**)
assert(*i++ == 1);
assert(*i++ == 1);
assert(*i++ == 1);
- }
- {
+ }
+ {
std::list<int, min_allocator<int>> d(10, 1);
std::list<int, min_allocator<int>>::iterator i = d.insert(std::next(d.cbegin(), 2), {3, 4, 5, 6});
assert(d.size() == 14);
@@ -61,7 +60,7 @@ int main(int, char**)
assert(*i++ == 1);
assert(*i++ == 1);
assert(*i++ == 1);
- }
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/list/list.modifiers/insert_iter_iter_iter.pass.cpp b/libcxx/test/std/containers/sequences/list/list.modifiers/insert_iter_iter_iter.pass.cpp
index d1177e94fbb7eaa..bab125ca6209495 100644
--- a/libcxx/test/std/containers/sequences/list/list.modifiers/insert_iter_iter_iter.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.modifiers/insert_iter_iter_iter.pass.cpp
@@ -22,70 +22,66 @@
template <class List>
void test() {
- int a1[] = {1, 2, 3};
- List l1;
- typename List::iterator i = l1.insert(l1.begin(), a1, a1+3);
- assert(i == l1.begin());
- assert(l1.size() == 3);
- assert(std::distance(l1.begin(), l1.end()) == 3);
- i = l1.begin();
- assert(*i == 1);
- ++i;
- assert(*i == 2);
- ++i;
- assert(*i == 3);
- int a2[] = {4, 5, 6};
- i = l1.insert(i, a2, a2+3);
- assert(*i == 4);
- assert(l1.size() == 6);
- assert(std::distance(l1.begin(), l1.end()) == 6);
- i = l1.begin();
- assert(*i == 1);
- ++i;
- assert(*i == 2);
- ++i;
- assert(*i == 4);
- ++i;
- assert(*i == 5);
- ++i;
- assert(*i == 6);
- ++i;
- assert(*i == 3);
+ int a1[] = {1, 2, 3};
+ List l1;
+ typename List::iterator i = l1.insert(l1.begin(), a1, a1 + 3);
+ assert(i == l1.begin());
+ assert(l1.size() == 3);
+ assert(std::distance(l1.begin(), l1.end()) == 3);
+ i = l1.begin();
+ assert(*i == 1);
+ ++i;
+ assert(*i == 2);
+ ++i;
+ assert(*i == 3);
+ int a2[] = {4, 5, 6};
+ i = l1.insert(i, a2, a2 + 3);
+ assert(*i == 4);
+ assert(l1.size() == 6);
+ assert(std::distance(l1.begin(), l1.end()) == 6);
+ i = l1.begin();
+ assert(*i == 1);
+ ++i;
+ assert(*i == 2);
+ ++i;
+ assert(*i == 4);
+ ++i;
+ assert(*i == 5);
+ ++i;
+ assert(*i == 6);
+ ++i;
+ assert(*i == 3);
#if !defined(TEST_HAS_NO_EXCEPTIONS) && !defined(DISABLE_NEW_COUNT)
- globalMemCounter.throw_after = 2;
- int save_count = globalMemCounter.outstanding_new;
- try
- {
- i = l1.insert(i, a2, a2+3);
- assert(false);
- }
- catch (...)
- {
- }
- assert(globalMemCounter.checkOutstandingNewEq(save_count));
- assert(l1.size() == 6);
- assert(std::distance(l1.begin(), l1.end()) == 6);
- i = l1.begin();
- assert(*i == 1);
- ++i;
- assert(*i == 2);
- ++i;
- assert(*i == 4);
- ++i;
- assert(*i == 5);
- ++i;
- assert(*i == 6);
- ++i;
- assert(*i == 3);
+ globalMemCounter.throw_after = 2;
+ int save_count = globalMemCounter.outstanding_new;
+ try {
+ i = l1.insert(i, a2, a2 + 3);
+ assert(false);
+ } catch (...) {
+ }
+ assert(globalMemCounter.checkOutstandingNewEq(save_count));
+ assert(l1.size() == 6);
+ assert(std::distance(l1.begin(), l1.end()) == 6);
+ i = l1.begin();
+ assert(*i == 1);
+ ++i;
+ assert(*i == 2);
+ ++i;
+ assert(*i == 4);
+ ++i;
+ assert(*i == 5);
+ ++i;
+ assert(*i == 6);
+ ++i;
+ assert(*i == 3);
#endif
}
-int main(int, char**)
-{
- test<std::list<int> >();
+int main(int, char**) {
+ test<std::list<int> >();
#if TEST_STD_VER >= 11
- test<std::list<int, min_allocator<int>>>();
+ test<std::list<int, min_allocator<int>>>();
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/list/list.modifiers/insert_iter_rvalue.pass.cpp b/libcxx/test/std/containers/sequences/list/list.modifiers/insert_iter_rvalue.pass.cpp
index 5a548916aef8acf..8bb513208eb7f35 100644
--- a/libcxx/test/std/containers/sequences/list/list.modifiers/insert_iter_rvalue.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.modifiers/insert_iter_rvalue.pass.cpp
@@ -19,9 +19,8 @@
#include "MoveOnly.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
std::list<MoveOnly> l1;
l1.insert(l1.cend(), MoveOnly(1));
assert(l1.size() == 1);
@@ -30,8 +29,8 @@ int main(int, char**)
assert(l1.size() == 2);
assert(l1.front() == MoveOnly(2));
assert(l1.back() == MoveOnly(1));
- }
- {
+ }
+ {
std::list<MoveOnly, min_allocator<MoveOnly>> l1;
l1.insert(l1.cend(), MoveOnly(1));
assert(l1.size() == 1);
@@ -40,7 +39,7 @@ int main(int, char**)
assert(l1.size() == 2);
assert(l1.front() == MoveOnly(2));
assert(l1.back() == MoveOnly(1));
- }
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp b/libcxx/test/std/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp
index 9fda96d016078aa..32ee7a73406dcdc 100644
--- a/libcxx/test/std/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp
@@ -22,33 +22,29 @@
template <class List>
void test() {
- int a1[] = {1, 2, 3};
- int a2[] = {1, 4, 4, 4, 4, 4, 2, 3};
- List l1(a1, a1+3);
- typename List::iterator i = l1.insert(std::next(l1.cbegin()), 5, 4);
- assert(i == std::next(l1.begin()));
- assert(l1 == List(a2, a2+8));
+ int a1[] = {1, 2, 3};
+ int a2[] = {1, 4, 4, 4, 4, 4, 2, 3};
+ List l1(a1, a1 + 3);
+ typename List::iterator i = l1.insert(std::next(l1.cbegin()), 5, 4);
+ assert(i == std::next(l1.begin()));
+ assert(l1 == List(a2, a2 + 8));
#ifndef TEST_HAS_NO_EXCEPTIONS
- globalMemCounter.throw_after = 4;
- int save_count = globalMemCounter.outstanding_new;
- try
- {
- i = l1.insert(i, 5, 5);
- assert(false);
- }
- catch (...)
- {
- }
- assert(globalMemCounter.checkOutstandingNewEq(save_count));
- assert(l1 == List(a2, a2+8));
+ globalMemCounter.throw_after = 4;
+ int save_count = globalMemCounter.outstanding_new;
+ try {
+ i = l1.insert(i, 5, 5);
+ assert(false);
+ } catch (...) {
+ }
+ assert(globalMemCounter.checkOutstandingNewEq(save_count));
+ assert(l1 == List(a2, a2 + 8));
#endif
}
-int main(int, char**)
-{
- test<std::list<int> >();
+int main(int, char**) {
+ test<std::list<int> >();
#if TEST_STD_VER >= 11
- test<std::list<int, min_allocator<int>>>();
+ test<std::list<int, min_allocator<int>>>();
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/list/list.modifiers/insert_iter_value.pass.cpp b/libcxx/test/std/containers/sequences/list/list.modifiers/insert_iter_value.pass.cpp
index 3e0edef65aaf03b..129fe05cb39d217 100644
--- a/libcxx/test/std/containers/sequences/list/list.modifiers/insert_iter_value.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.modifiers/insert_iter_value.pass.cpp
@@ -19,38 +19,33 @@
#include "count_new.h"
template <class List>
-void test()
-{
- int a1[] = {1, 2, 3};
- int a2[] = {1, 4, 2, 3};
- List l1(a1, a1+3);
- typename List::iterator i = l1.insert(std::next(l1.cbegin()), 4);
- assert(i == std::next(l1.begin()));
- assert(l1.size() == 4);
- assert(std::distance(l1.begin(), l1.end()) == 4);
- assert(l1 == List(a2, a2+4));
+void test() {
+ int a1[] = {1, 2, 3};
+ int a2[] = {1, 4, 2, 3};
+ List l1(a1, a1 + 3);
+ typename List::iterator i = l1.insert(std::next(l1.cbegin()), 4);
+ assert(i == std::next(l1.begin()));
+ assert(l1.size() == 4);
+ assert(std::distance(l1.begin(), l1.end()) == 4);
+ assert(l1 == List(a2, a2 + 4));
#if !defined(TEST_HAS_NO_EXCEPTIONS) && !defined(DISABLE_NEW_COUNT)
- globalMemCounter.throw_after = 0;
- int save_count = globalMemCounter.outstanding_new;
- try
- {
- i = l1.insert(i, 5);
- assert(false);
- }
- catch (...)
- {
- }
- assert(globalMemCounter.checkOutstandingNewEq(save_count));
- assert(l1 == List(a2, a2+4));
+ globalMemCounter.throw_after = 0;
+ int save_count = globalMemCounter.outstanding_new;
+ try {
+ i = l1.insert(i, 5);
+ assert(false);
+ } catch (...) {
+ }
+ assert(globalMemCounter.checkOutstandingNewEq(save_count));
+ assert(l1 == List(a2, a2 + 4));
#endif
}
-int main(int, char**)
-{
- test<std::list<int> >();
+int main(int, char**) {
+ test<std::list<int> >();
#if TEST_STD_VER >= 11
- test<std::list<int, min_allocator<int>>>();
+ test<std::list<int, min_allocator<int>>>();
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/list/list.modifiers/pop_back.pass.cpp b/libcxx/test/std/containers/sequences/list/list.modifiers/pop_back.pass.cpp
index c4c88d421d6089e..aaa225b14776712 100644
--- a/libcxx/test/std/containers/sequences/list/list.modifiers/pop_back.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.modifiers/pop_back.pass.cpp
@@ -16,29 +16,28 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
int a[] = {1, 2, 3};
- std::list<int> c(a, a+3);
+ std::list<int> c(a, a + 3);
c.pop_back();
- assert(c == std::list<int>(a, a+2));
+ assert(c == std::list<int>(a, a + 2));
c.pop_back();
- assert(c == std::list<int>(a, a+1));
+ assert(c == std::list<int>(a, a + 1));
c.pop_back();
assert(c.empty());
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
int a[] = {1, 2, 3};
- std::list<int, min_allocator<int>> c(a, a+3);
+ std::list<int, min_allocator<int>> c(a, a + 3);
c.pop_back();
- assert((c == std::list<int, min_allocator<int>>(a, a+2)));
+ assert((c == std::list<int, min_allocator<int>>(a, a + 2)));
c.pop_back();
- assert((c == std::list<int, min_allocator<int>>(a, a+1)));
+ assert((c == std::list<int, min_allocator<int>>(a, a + 1)));
c.pop_back();
assert(c.empty());
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/list/list.modifiers/pop_front.pass.cpp b/libcxx/test/std/containers/sequences/list/list.modifiers/pop_front.pass.cpp
index 7f20e0a4c11b64b..33b8ff35c524c50 100644
--- a/libcxx/test/std/containers/sequences/list/list.modifiers/pop_front.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.modifiers/pop_front.pass.cpp
@@ -16,29 +16,28 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
int a[] = {1, 2, 3};
- std::list<int> c(a, a+3);
+ std::list<int> c(a, a + 3);
c.pop_front();
- assert(c == std::list<int>(a+1, a+3));
+ assert(c == std::list<int>(a + 1, a + 3));
c.pop_front();
- assert(c == std::list<int>(a+2, a+3));
+ assert(c == std::list<int>(a + 2, a + 3));
c.pop_front();
assert(c.empty());
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
int a[] = {1, 2, 3};
- std::list<int, min_allocator<int>> c(a, a+3);
+ std::list<int, min_allocator<int>> c(a, a + 3);
c.pop_front();
- assert((c == std::list<int, min_allocator<int>>(a+1, a+3)));
+ assert((c == std::list<int, min_allocator<int>>(a + 1, a + 3)));
c.pop_front();
- assert((c == std::list<int, min_allocator<int>>(a+2, a+3)));
+ assert((c == std::list<int, min_allocator<int>>(a + 2, a + 3)));
c.pop_front();
assert(c.empty());
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/list/list.modifiers/push_back.pass.cpp b/libcxx/test/std/containers/sequences/list/list.modifiers/push_back.pass.cpp
index 29f22a566bf349a..582f4a200ac26ab 100644
--- a/libcxx/test/std/containers/sequences/list/list.modifiers/push_back.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.modifiers/push_back.pass.cpp
@@ -16,23 +16,22 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
std::list<int> c;
for (int i = 0; i < 5; ++i)
- c.push_back(i);
+ c.push_back(i);
int a[] = {0, 1, 2, 3, 4};
- assert(c == std::list<int>(a, a+5));
- }
+ assert(c == std::list<int>(a, a + 5));
+ }
#if TEST_STD_VER >= 11
- {
+ {
std::list<int, min_allocator<int>> c;
for (int i = 0; i < 5; ++i)
- c.push_back(i);
+ c.push_back(i);
int a[] = {0, 1, 2, 3, 4};
- assert((c == std::list<int, min_allocator<int>>(a, a+5)));
- }
+ assert((c == std::list<int, min_allocator<int>>(a, a + 5)));
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/list/list.modifiers/push_back_exception_safety.pass.cpp b/libcxx/test/std/containers/sequences/list/list.modifiers/push_back_exception_safety.pass.cpp
index 0ef4bc4676e88fe..ca53f160eea81d0 100644
--- a/libcxx/test/std/containers/sequences/list/list.modifiers/push_back_exception_safety.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.modifiers/push_back_exception_safety.pass.cpp
@@ -21,14 +21,23 @@
static bool gCopyConstructorShouldThrow = false;
class CMyClass {
- public: CMyClass();
- public: CMyClass(const CMyClass& iOther);
- public: ~CMyClass();
+public:
+ CMyClass();
- private: int fMagicValue;
+public:
+ CMyClass(const CMyClass& iOther);
- private: static int kStartedConstructionMagicValue;
- private: static int kFinishedConstructionMagicValue;
+public:
+ ~CMyClass();
+
+private:
+ int fMagicValue;
+
+private:
+ static int kStartedConstructionMagicValue;
+
+private:
+ static int kFinishedConstructionMagicValue;
};
// Value for fMagicValue when the constructor has started running, but not yet finished
@@ -36,42 +45,36 @@ int CMyClass::kStartedConstructionMagicValue = 0;
// Value for fMagicValue when the constructor has finished running
int CMyClass::kFinishedConstructionMagicValue = 12345;
-CMyClass::CMyClass() :
- fMagicValue(kStartedConstructionMagicValue)
-{
- // Signal that the constructor has finished running
- fMagicValue = kFinishedConstructionMagicValue;
+CMyClass::CMyClass() : fMagicValue(kStartedConstructionMagicValue) {
+ // Signal that the constructor has finished running
+ fMagicValue = kFinishedConstructionMagicValue;
}
-CMyClass::CMyClass(const CMyClass& /*iOther*/) :
- fMagicValue(kStartedConstructionMagicValue)
-{
- // If requested, throw an exception _before_ setting fMagicValue to kFinishedConstructionMagicValue
- if (gCopyConstructorShouldThrow) {
- throw std::exception();
- }
- // Signal that the constructor has finished running
- fMagicValue = kFinishedConstructionMagicValue;
+CMyClass::CMyClass(const CMyClass& /*iOther*/) : fMagicValue(kStartedConstructionMagicValue) {
+ // If requested, throw an exception _before_ setting fMagicValue to kFinishedConstructionMagicValue
+ if (gCopyConstructorShouldThrow) {
+ throw std::exception();
+ }
+ // Signal that the constructor has finished running
+ fMagicValue = kFinishedConstructionMagicValue;
}
CMyClass::~CMyClass() {
- // Only instances for which the constructor has finished running should be destructed
- assert(fMagicValue == kFinishedConstructionMagicValue);
+ // Only instances for which the constructor has finished running should be destructed
+ assert(fMagicValue == kFinishedConstructionMagicValue);
}
-int main(int, char**)
-{
- CMyClass instance;
- std::list<CMyClass> vec;
+int main(int, char**) {
+ CMyClass instance;
+ std::list<CMyClass> vec;
- vec.push_back(instance);
+ vec.push_back(instance);
- gCopyConstructorShouldThrow = true;
- try {
- vec.push_back(instance);
- }
- catch (...) {
- }
+ gCopyConstructorShouldThrow = true;
+ try {
+ vec.push_back(instance);
+ } catch (...) {
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/list/list.modifiers/push_back_rvalue.pass.cpp b/libcxx/test/std/containers/sequences/list/list.modifiers/push_back_rvalue.pass.cpp
index 8adeb0d44e2b0ac..6a31d81d694f386 100644
--- a/libcxx/test/std/containers/sequences/list/list.modifiers/push_back_rvalue.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.modifiers/push_back_rvalue.pass.cpp
@@ -19,9 +19,8 @@
#include "MoveOnly.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
std::list<MoveOnly> l1;
l1.push_back(MoveOnly(1));
assert(l1.size() == 1);
@@ -30,8 +29,8 @@ int main(int, char**)
assert(l1.size() == 2);
assert(l1.front() == MoveOnly(1));
assert(l1.back() == MoveOnly(2));
- }
- {
+ }
+ {
std::list<MoveOnly, min_allocator<MoveOnly>> l1;
l1.push_back(MoveOnly(1));
assert(l1.size() == 1);
@@ -40,7 +39,7 @@ int main(int, char**)
assert(l1.size() == 2);
assert(l1.front() == MoveOnly(1));
assert(l1.back() == MoveOnly(2));
- }
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/list/list.modifiers/push_front.pass.cpp b/libcxx/test/std/containers/sequences/list/list.modifiers/push_front.pass.cpp
index 2b6393179a20952..3b5f74a217a2f4e 100644
--- a/libcxx/test/std/containers/sequences/list/list.modifiers/push_front.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.modifiers/push_front.pass.cpp
@@ -16,23 +16,22 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
std::list<int> c;
for (int i = 0; i < 5; ++i)
- c.push_front(i);
+ c.push_front(i);
int a[] = {4, 3, 2, 1, 0};
- assert(c == std::list<int>(a, a+5));
- }
+ assert(c == std::list<int>(a, a + 5));
+ }
#if TEST_STD_VER >= 11
- {
+ {
std::list<int, min_allocator<int>> c;
for (int i = 0; i < 5; ++i)
- c.push_front(i);
+ c.push_front(i);
int a[] = {4, 3, 2, 1, 0};
- assert((c == std::list<int, min_allocator<int>>(a, a+5)));
- }
+ assert((c == std::list<int, min_allocator<int>>(a, a + 5)));
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/list/list.modifiers/push_front_exception_safety.pass.cpp b/libcxx/test/std/containers/sequences/list/list.modifiers/push_front_exception_safety.pass.cpp
index 054559d17774802..8922cab79d54f26 100644
--- a/libcxx/test/std/containers/sequences/list/list.modifiers/push_front_exception_safety.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.modifiers/push_front_exception_safety.pass.cpp
@@ -21,14 +21,23 @@
static bool gCopyConstructorShouldThrow = false;
class CMyClass {
- public: CMyClass();
- public: CMyClass(const CMyClass& iOther);
- public: ~CMyClass();
+public:
+ CMyClass();
- private: int fMagicValue;
+public:
+ CMyClass(const CMyClass& iOther);
- private: static int kStartedConstructionMagicValue;
- private: static int kFinishedConstructionMagicValue;
+public:
+ ~CMyClass();
+
+private:
+ int fMagicValue;
+
+private:
+ static int kStartedConstructionMagicValue;
+
+private:
+ static int kFinishedConstructionMagicValue;
};
// Value for fMagicValue when the constructor has started running, but not yet finished
@@ -36,42 +45,36 @@ int CMyClass::kStartedConstructionMagicValue = 0;
// Value for fMagicValue when the constructor has finished running
int CMyClass::kFinishedConstructionMagicValue = 12345;
-CMyClass::CMyClass() :
- fMagicValue(kStartedConstructionMagicValue)
-{
- // Signal that the constructor has finished running
- fMagicValue = kFinishedConstructionMagicValue;
+CMyClass::CMyClass() : fMagicValue(kStartedConstructionMagicValue) {
+ // Signal that the constructor has finished running
+ fMagicValue = kFinishedConstructionMagicValue;
}
-CMyClass::CMyClass(const CMyClass& /*iOther*/) :
- fMagicValue(kStartedConstructionMagicValue)
-{
- // If requested, throw an exception _before_ setting fMagicValue to kFinishedConstructionMagicValue
- if (gCopyConstructorShouldThrow) {
- throw std::exception();
- }
- // Signal that the constructor has finished running
- fMagicValue = kFinishedConstructionMagicValue;
+CMyClass::CMyClass(const CMyClass& /*iOther*/) : fMagicValue(kStartedConstructionMagicValue) {
+ // If requested, throw an exception _before_ setting fMagicValue to kFinishedConstructionMagicValue
+ if (gCopyConstructorShouldThrow) {
+ throw std::exception();
+ }
+ // Signal that the constructor has finished running
+ fMagicValue = kFinishedConstructionMagicValue;
}
CMyClass::~CMyClass() {
- // Only instances for which the constructor has finished running should be destructed
- assert(fMagicValue == kFinishedConstructionMagicValue);
+ // Only instances for which the constructor has finished running should be destructed
+ assert(fMagicValue == kFinishedConstructionMagicValue);
}
-int main(int, char**)
-{
- CMyClass instance;
- std::list<CMyClass> vec;
+int main(int, char**) {
+ CMyClass instance;
+ std::list<CMyClass> vec;
- vec.push_front(instance);
+ vec.push_front(instance);
- gCopyConstructorShouldThrow = true;
- try {
- vec.push_front(instance);
- }
- catch (...) {
- }
+ gCopyConstructorShouldThrow = true;
+ try {
+ vec.push_front(instance);
+ } catch (...) {
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/list/list.modifiers/push_front_rvalue.pass.cpp b/libcxx/test/std/containers/sequences/list/list.modifiers/push_front_rvalue.pass.cpp
index b3d0a24eaa45f91..0d41b8fd8553d57 100644
--- a/libcxx/test/std/containers/sequences/list/list.modifiers/push_front_rvalue.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.modifiers/push_front_rvalue.pass.cpp
@@ -19,9 +19,8 @@
#include "MoveOnly.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
std::list<MoveOnly> l1;
l1.push_front(MoveOnly(1));
assert(l1.size() == 1);
@@ -30,8 +29,8 @@ int main(int, char**)
assert(l1.size() == 2);
assert(l1.front() == MoveOnly(2));
assert(l1.back() == MoveOnly(1));
- }
- {
+ }
+ {
std::list<MoveOnly, min_allocator<MoveOnly>> l1;
l1.push_front(MoveOnly(1));
assert(l1.size() == 1);
@@ -40,7 +39,7 @@ int main(int, char**)
assert(l1.size() == 2);
assert(l1.front() == MoveOnly(2));
assert(l1.back() == MoveOnly(1));
- }
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/list/list.ops/merge.pass.cpp b/libcxx/test/std/containers/sequences/list/list.ops/merge.pass.cpp
index 5faa3f34a362686..7f82f65fd493bc6 100644
--- a/libcxx/test/std/containers/sequences/list/list.ops/merge.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.ops/merge.pass.cpp
@@ -17,37 +17,36 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
int a1[] = {1, 3, 7, 9, 10};
int a2[] = {0, 2, 4, 5, 6, 8, 11};
int a3[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
- std::list<int> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
- std::list<int> c2(a2, a2+sizeof(a2)/sizeof(a2[0]));
+ std::list<int> c1(a1, a1 + sizeof(a1) / sizeof(a1[0]));
+ std::list<int> c2(a2, a2 + sizeof(a2) / sizeof(a2[0]));
c1.merge(c2);
- assert(c1 == std::list<int>(a3, a3+sizeof(a3)/sizeof(a3[0])));
+ assert(c1 == std::list<int>(a3, a3 + sizeof(a3) / sizeof(a3[0])));
assert(c2.empty());
- }
+ }
- {
+ {
int a1[] = {1, 3, 7, 9, 10};
- std::list<int> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
+ std::list<int> c1(a1, a1 + sizeof(a1) / sizeof(a1[0]));
c1.merge(c1);
- assert((c1 == std::list<int>(a1, a1+sizeof(a1)/sizeof(a1[0]))));
- }
+ assert((c1 == std::list<int>(a1, a1 + sizeof(a1) / sizeof(a1[0]))));
+ }
#if TEST_STD_VER >= 11
- {
+ {
int a1[] = {1, 3, 7, 9, 10};
int a2[] = {0, 2, 4, 5, 6, 8, 11};
int a3[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
- std::list<int, min_allocator<int>> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
- std::list<int, min_allocator<int>> c2(a2, a2+sizeof(a2)/sizeof(a2[0]));
+ std::list<int, min_allocator<int>> c1(a1, a1 + sizeof(a1) / sizeof(a1[0]));
+ std::list<int, min_allocator<int>> c2(a2, a2 + sizeof(a2) / sizeof(a2[0]));
c1.merge(c2);
- assert((c1 == std::list<int, min_allocator<int>>(a3, a3+sizeof(a3)/sizeof(a3[0]))));
+ assert((c1 == std::list<int, min_allocator<int>>(a3, a3 + sizeof(a3) / sizeof(a3[0]))));
assert(c2.empty());
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/list/list.ops/merge_comp.pass.cpp b/libcxx/test/std/containers/sequences/list/list.ops/merge_comp.pass.cpp
index 3d4f8cc7fc2aa47..13241909c6e5b97 100644
--- a/libcxx/test/std/containers/sequences/list/list.ops/merge_comp.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.ops/merge_comp.pass.cpp
@@ -18,36 +18,35 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
int a1[] = {10, 9, 7, 3, 1};
int a2[] = {11, 8, 6, 5, 4, 2, 0};
int a3[] = {11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0};
- std::list<int> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
- std::list<int> c2(a2, a2+sizeof(a2)/sizeof(a2[0]));
+ std::list<int> c1(a1, a1 + sizeof(a1) / sizeof(a1[0]));
+ std::list<int> c2(a2, a2 + sizeof(a2) / sizeof(a2[0]));
c1.merge(c2, std::greater<int>());
- assert(c1 == std::list<int>(a3, a3+sizeof(a3)/sizeof(a3[0])));
+ assert(c1 == std::list<int>(a3, a3 + sizeof(a3) / sizeof(a3[0])));
assert(c2.empty());
- }
- {
+ }
+ {
int a1[] = {10, 9, 7, 3, 1};
- std::list<int> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
+ std::list<int> c1(a1, a1 + sizeof(a1) / sizeof(a1[0]));
c1.merge(c1, std::greater<int>());
- assert((c1 == std::list<int>(a1, a1+sizeof(a1)/sizeof(a1[0]))));
- }
+ assert((c1 == std::list<int>(a1, a1 + sizeof(a1) / sizeof(a1[0]))));
+ }
#if TEST_STD_VER >= 11
- {
+ {
int a1[] = {10, 9, 7, 3, 1};
int a2[] = {11, 8, 6, 5, 4, 2, 0};
int a3[] = {11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0};
- std::list<int, min_allocator<int>> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
- std::list<int, min_allocator<int>> c2(a2, a2+sizeof(a2)/sizeof(a2[0]));
+ std::list<int, min_allocator<int>> c1(a1, a1 + sizeof(a1) / sizeof(a1[0]));
+ std::list<int, min_allocator<int>> c2(a2, a2 + sizeof(a2) / sizeof(a2[0]));
c1.merge(c2, std::greater<int>());
- assert((c1 == std::list<int, min_allocator<int>>(a3, a3+sizeof(a3)/sizeof(a3[0]))));
+ assert((c1 == std::list<int, min_allocator<int>>(a3, a3 + sizeof(a3) / sizeof(a3[0]))));
assert(c2.empty());
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/list/list.ops/remove.pass.cpp b/libcxx/test/std/containers/sequences/list/list.ops/remove.pass.cpp
index 0bfcb6e89d65089..238ea9b69ea2ea6 100644
--- a/libcxx/test/std/containers/sequences/list/list.ops/remove.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.ops/remove.pass.cpp
@@ -19,8 +19,8 @@
struct S {
S(int i) : i_(new int(i)) {}
- S(const S &rhs) : i_(new int(*rhs.i_)) {}
- S &operator=(const S &rhs) {
+ S(const S& rhs) : i_(new int(*rhs.i_)) {}
+ S& operator=(const S& rhs) {
*i_ = *rhs.i_;
return *this;
}
@@ -28,9 +28,9 @@ struct S {
delete i_;
i_ = NULL;
}
- bool operator==(const S &rhs) const { return *i_ == *rhs.i_; }
+ bool operator==(const S& rhs) const { return *i_ == *rhs.i_; }
int get() const { return *i_; }
- int *i_;
+ int* i_;
};
int main(int, char**) {
@@ -43,7 +43,7 @@ int main(int, char**) {
assert(c.remove(3) == 1);
ASSERT_SAME_TYPE(L::size_type, decltype(c.remove(3)));
#else
- ASSERT_SAME_TYPE(void, decltype(c.remove(3)));
+ ASSERT_SAME_TYPE(void, decltype(c.remove(3)));
c.remove(3);
#endif
@@ -60,7 +60,7 @@ int main(int, char**) {
int a1[] = {1, 2, 1, 3, 5, 8, 11, 1};
int a2[] = {2, 3, 5, 8, 11};
std::list<S> c;
- for (int *ip = a1; ip < a1 + 8; ++ip)
+ for (int* ip = a1; ip < a1 + 8; ++ip)
c.push_back(S(*ip));
#if TEST_STD_VER > 17
assert(c.remove(c.front()) == 3);
@@ -68,7 +68,7 @@ int main(int, char**) {
c.remove(c.front());
#endif
std::list<S>::const_iterator it = c.begin();
- for (int *ip = a2; ip < a2 + 5; ++ip, ++it) {
+ for (int* ip = a2; ip < a2 + 5; ++ip, ++it) {
assert(it != c.end());
assert(*ip == it->get());
}
@@ -92,11 +92,11 @@ int main(int, char**) {
int a1[] = {1, 2, 3, 4};
int a2[] = {1, 2, 4};
std::list<int, min_allocator<int>> c(a1, a1 + 4);
-#if TEST_STD_VER > 17
+# if TEST_STD_VER > 17
assert(c.remove(3) == 1);
-#else
+# else
c.remove(3);
-#endif
+# endif
assert((c == std::list<int, min_allocator<int>>(a2, a2 + 3)));
}
#endif
diff --git a/libcxx/test/std/containers/sequences/list/list.ops/remove_if.pass.cpp b/libcxx/test/std/containers/sequences/list/list.ops/remove_if.pass.cpp
index 4050466a6c727a2..510cb361142b479 100644
--- a/libcxx/test/std/containers/sequences/list/list.ops/remove_if.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.ops/remove_if.pass.cpp
@@ -19,15 +19,9 @@
#include "min_allocator.h"
#include "counting_predicates.h"
-bool even(int i)
-{
- return i % 2 == 0;
-}
+bool even(int i) { return i % 2 == 0; }
-bool g(int i)
-{
- return i < 3;
-}
+bool g(int i) { return i < 3; }
struct PredLWG526 {
PredLWG526(int i) : i_(i) {}
@@ -38,15 +32,14 @@ struct PredLWG526 {
int i_;
};
-typedef unary_counting_predicate<bool(*)(int), int> Predicate;
+typedef unary_counting_predicate<bool (*)(int), int> Predicate;
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
int a1[] = {1, 2, 3, 4};
int a2[] = {3, 4};
typedef std::list<int> L;
- L c(a1, a1+4);
+ L c(a1, a1 + 4);
Predicate cp(g);
#if TEST_STD_VER > 17
ASSERT_SAME_TYPE(L::size_type, decltype(c.remove_if(std::ref(cp))));
@@ -55,49 +48,48 @@ int main(int, char**)
ASSERT_SAME_TYPE(void, decltype(c.remove_if(std::ref(cp))));
c.remove_if(std::ref(cp));
#endif
- assert(c == std::list<int>(a2, a2+2));
+ assert(c == std::list<int>(a2, a2 + 2));
assert(cp.count() == 4);
- }
- {
+ }
+ {
int a1[] = {1, 2, 3, 4};
int a2[] = {1, 3};
- std::list<int> c(a1, a1+4);
+ std::list<int> c(a1, a1 + 4);
Predicate cp(even);
#if TEST_STD_VER > 17
assert(c.remove_if(std::ref(cp)) == 2);
#else
c.remove_if(std::ref(cp));
#endif
- assert(c == std::list<int>(a2, a2+2));
+ assert(c == std::list<int>(a2, a2 + 2));
assert(cp.count() == 4);
- }
- { // LWG issue #526
+ }
+ { // LWG issue #526
int a1[] = {1, 2, 1, 3, 5, 8, 11};
int a2[] = {2, 3, 5, 8, 11};
std::list<PredLWG526> c(a1, a1 + 7);
c.remove_if(std::ref(c.front()));
assert(c.size() == 5);
- for (std::size_t i = 0; i < c.size(); ++i)
- {
- assert(c.front() == a2[i]);
- c.pop_front();
- }
+ for (std::size_t i = 0; i < c.size(); ++i) {
+ assert(c.front() == a2[i]);
+ c.pop_front();
}
+ }
#if TEST_STD_VER >= 11
- {
+ {
int a1[] = {1, 2, 3, 4};
int a2[] = {3, 4};
- std::list<int, min_allocator<int>> c(a1, a1+4);
+ std::list<int, min_allocator<int>> c(a1, a1 + 4);
Predicate cp(g);
-#if TEST_STD_VER > 17
+# if TEST_STD_VER > 17
assert(c.remove_if(std::ref(cp)) == 2);
-#else
+# else
c.remove_if(std::ref(cp));
-#endif
- assert((c == std::list<int, min_allocator<int>>(a2, a2+2)));
+# endif
+ assert((c == std::list<int, min_allocator<int>>(a2, a2 + 2)));
assert(cp.count() == 4);
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/list/list.ops/reverse.pass.cpp b/libcxx/test/std/containers/sequences/list/list.ops/reverse.pass.cpp
index 6ebd7f9b611f707..5b91ad0224be6ed 100644
--- a/libcxx/test/std/containers/sequences/list/list.ops/reverse.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.ops/reverse.pass.cpp
@@ -16,23 +16,22 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
int a1[] = {11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0};
int a2[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
- std::list<int> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
+ std::list<int> c1(a1, a1 + sizeof(a1) / sizeof(a1[0]));
c1.reverse();
- assert(c1 == std::list<int>(a2, a2+sizeof(a2)/sizeof(a2[0])));
- }
+ assert(c1 == std::list<int>(a2, a2 + sizeof(a2) / sizeof(a2[0])));
+ }
#if TEST_STD_VER >= 11
- {
+ {
int a1[] = {11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0};
int a2[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
- std::list<int, min_allocator<int>> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
+ std::list<int, min_allocator<int>> c1(a1, a1 + sizeof(a1) / sizeof(a1[0]));
c1.reverse();
- assert((c1 == std::list<int, min_allocator<int>>(a2, a2+sizeof(a2)/sizeof(a2[0]))));
- }
+ assert((c1 == std::list<int, min_allocator<int>>(a2, a2 + sizeof(a2) / sizeof(a2[0]))));
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/list/list.ops/sort.pass.cpp b/libcxx/test/std/containers/sequences/list/list.ops/sort.pass.cpp
index 6349a3d850671b1..892419f6ac964f9 100644
--- a/libcxx/test/std/containers/sequences/list/list.ops/sort.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.ops/sort.pass.cpp
@@ -21,68 +21,63 @@
std::mt19937 randomness;
-struct Payload
-{
- int val;
- int side;
- Payload(int v) : val(v), side(0) {}
- Payload(int v, int s) : val(v), side(s) {}
- bool operator< (const Payload &rhs) const { return val < rhs.val;}
-// bool operator==(const Payload &rhs) const { return val == rhs.val;}
+struct Payload {
+ int val;
+ int side;
+ Payload(int v) : val(v), side(0) {}
+ Payload(int v, int s) : val(v), side(s) {}
+ bool operator<(const Payload& rhs) const { return val < rhs.val; }
+ // bool operator==(const Payload &rhs) const { return val == rhs.val;}
};
-void test_stable(int N)
-{
- typedef Payload T;
- typedef std::list<T> C;
- typedef std::vector<T> V;
- V v;
- for (int i = 0; i < N; ++i)
- v.push_back(Payload(i/2));
- std::shuffle(v.begin(), v.end(), randomness);
- for (int i = 0; i < N; ++i)
- v[i].side = i;
+void test_stable(int N) {
+ typedef Payload T;
+ typedef std::list<T> C;
+ typedef std::vector<T> V;
+ V v;
+ for (int i = 0; i < N; ++i)
+ v.push_back(Payload(i / 2));
+ std::shuffle(v.begin(), v.end(), randomness);
+ for (int i = 0; i < N; ++i)
+ v[i].side = i;
- C c(v.begin(), v.end());
- c.sort();
- assert(std::distance(c.begin(), c.end()) == N);
+ C c(v.begin(), v.end());
+ c.sort();
+ assert(std::distance(c.begin(), c.end()) == N);
-// Are we sorted?
- typename C::const_iterator j = c.begin();
- for (int i = 0; i < N; ++i, ++j)
- assert(j->val == i/2);
+ // Are we sorted?
+ typename C::const_iterator j = c.begin();
+ for (int i = 0; i < N; ++i, ++j)
+ assert(j->val == i / 2);
-// Are we stable?
- for (C::const_iterator it = c.begin(); it != c.end(); ++it)
- {
- C::const_iterator next = std::next(it);
- if (next != c.end() && it->val == next->val)
- assert(it->side < next->side);
- }
+ // Are we stable?
+ for (C::const_iterator it = c.begin(); it != c.end(); ++it) {
+ C::const_iterator next = std::next(it);
+ if (next != c.end() && it->val == next->val)
+ assert(it->side < next->side);
+ }
}
-
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
int a1[] = {4, 8, 1, 0, 5, 7, 2, 3, 6, 11, 10, 9};
int a2[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
- std::list<int> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
+ std::list<int> c1(a1, a1 + sizeof(a1) / sizeof(a1[0]));
c1.sort();
- assert(c1 == std::list<int>(a2, a2+sizeof(a2)/sizeof(a2[0])));
- }
+ assert(c1 == std::list<int>(a2, a2 + sizeof(a2) / sizeof(a2[0])));
+ }
#if TEST_STD_VER >= 11
- {
+ {
int a1[] = {4, 8, 1, 0, 5, 7, 2, 3, 6, 11, 10, 9};
int a2[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
- std::list<int, min_allocator<int>> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
+ std::list<int, min_allocator<int>> c1(a1, a1 + sizeof(a1) / sizeof(a1[0]));
c1.sort();
- assert((c1 == std::list<int, min_allocator<int>>(a2, a2+sizeof(a2)/sizeof(a2[0]))));
- }
+ assert((c1 == std::list<int, min_allocator<int>>(a2, a2 + sizeof(a2) / sizeof(a2[0]))));
+ }
#endif
- for (int i = 0; i < 40; ++i)
- test_stable(i);
+ for (int i = 0; i < 40; ++i)
+ test_stable(i);
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/list/list.ops/sort_comp.pass.cpp b/libcxx/test/std/containers/sequences/list/list.ops/sort_comp.pass.cpp
index 8345823f4db9db4..499702281991918 100644
--- a/libcxx/test/std/containers/sequences/list/list.ops/sort_comp.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.ops/sort_comp.pass.cpp
@@ -12,7 +12,7 @@
#include <list>
#include <functional>
-#include <algorithm> // for is_permutation
+#include <algorithm> // for is_permutation
#include <random>
#include <vector>
#include <cassert>
@@ -25,105 +25,97 @@ std::mt19937 randomness;
#ifndef TEST_HAS_NO_EXCEPTIONS
template <typename T>
struct throwingLess {
- throwingLess() : num_(1) {}
- throwingLess(int num) : num_(num) {}
+ throwingLess() : num_(1) {}
+ throwingLess(int num) : num_(num) {}
- bool operator() (const T& lhs, const T& rhs) const
- {
- if ( --num_ == 0) throw 1;
+ bool operator()(const T& lhs, const T& rhs) const {
+ if (--num_ == 0)
+ throw 1;
return lhs < rhs;
- }
+ }
- mutable int num_;
- };
+ mutable int num_;
+};
#endif
-
-struct Payload
-{
- int val;
- int side;
- Payload(int v) : val(v), side(0) {}
- Payload(int v, int s) : val(v), side(s) {}
- bool operator< (const Payload &rhs) const { return val < rhs.val;}
+struct Payload {
+ int val;
+ int side;
+ Payload(int v) : val(v), side(0) {}
+ Payload(int v, int s) : val(v), side(s) {}
+ bool operator<(const Payload& rhs) const { return val < rhs.val; }
};
-bool greater(const Payload &lhs, const Payload &rhs) { return lhs.val > rhs.val; }
-
-void test_stable(int N)
-{
- typedef Payload T;
- typedef std::list<T> C;
- typedef std::vector<T> V;
- V v;
- for (int i = 0; i < N; ++i)
- v.push_back(Payload(i/2));
- std::shuffle(v.begin(), v.end(), randomness);
- for (int i = 0; i < N; ++i)
- v[i].side = i;
-
- C c(v.begin(), v.end());
- c.sort(greater);
- assert(std::distance(c.begin(), c.end()) == N);
-
-// Are we sorted?
- typename C::const_iterator j = c.begin();
- for (int i = 0; i < N; ++i, ++j)
- assert(j->val == (N-1-i)/2);
-
-// Are we stable?
- for (C::const_iterator it = c.begin(); it != c.end(); ++it)
- {
- C::const_iterator next = std::next(it);
- if (next != c.end() && it->val == next->val)
- assert(it->side < next->side);
- }
+bool greater(const Payload& lhs, const Payload& rhs) { return lhs.val > rhs.val; }
+
+void test_stable(int N) {
+ typedef Payload T;
+ typedef std::list<T> C;
+ typedef std::vector<T> V;
+ V v;
+ for (int i = 0; i < N; ++i)
+ v.push_back(Payload(i / 2));
+ std::shuffle(v.begin(), v.end(), randomness);
+ for (int i = 0; i < N; ++i)
+ v[i].side = i;
+
+ C c(v.begin(), v.end());
+ c.sort(greater);
+ assert(std::distance(c.begin(), c.end()) == N);
+
+ // Are we sorted?
+ typename C::const_iterator j = c.begin();
+ for (int i = 0; i < N; ++i, ++j)
+ assert(j->val == (N - 1 - i) / 2);
+
+ // Are we stable?
+ for (C::const_iterator it = c.begin(); it != c.end(); ++it) {
+ C::const_iterator next = std::next(it);
+ if (next != c.end() && it->val == next->val)
+ assert(it->side < next->side);
+ }
}
-
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
int a1[] = {4, 8, 1, 0, 5, 7, 2, 3, 6, 11, 10, 9};
int a2[] = {11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0};
- std::list<int> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
+ std::list<int> c1(a1, a1 + sizeof(a1) / sizeof(a1[0]));
c1.sort(std::greater<int>());
- assert(c1 == std::list<int>(a2, a2+sizeof(a2)/sizeof(a2[0])));
- }
+ assert(c1 == std::list<int>(a2, a2 + sizeof(a2) / sizeof(a2[0])));
+ }
// Test with throwing comparison; make sure that nothing is lost.
// This is (sort of) LWG #2824
#ifndef TEST_HAS_NO_EXCEPTIONS
- {
- int a1[] = {4, 8, 1, 0, 5, 7, 2, 3, 6, 11, 10, 9};
- const int sz = sizeof(a1)/sizeof(a1[0]);
- for (int i = 0; i < 10; ++i)
- {
- std::list<int> c1(a1, a1 + sz);
- try
- {
- throwingLess<int> comp(i);
- c1.sort(std::cref(comp));
- }
- catch (int) {}
- assert((c1.size() == sz));
- assert((std::is_permutation(c1.begin(), c1.end(), a1)));
- }
+ {
+ int a1[] = {4, 8, 1, 0, 5, 7, 2, 3, 6, 11, 10, 9};
+ const int sz = sizeof(a1) / sizeof(a1[0]);
+ for (int i = 0; i < 10; ++i) {
+ std::list<int> c1(a1, a1 + sz);
+ try {
+ throwingLess<int> comp(i);
+ c1.sort(std::cref(comp));
+ } catch (int) {
+ }
+ assert((c1.size() == sz));
+ assert((std::is_permutation(c1.begin(), c1.end(), a1)));
}
+ }
#endif
#if TEST_STD_VER >= 11
- {
+ {
int a1[] = {4, 8, 1, 0, 5, 7, 2, 3, 6, 11, 10, 9};
int a2[] = {11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0};
- std::list<int, min_allocator<int>> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
+ std::list<int, min_allocator<int>> c1(a1, a1 + sizeof(a1) / sizeof(a1[0]));
c1.sort(std::greater<int>());
- assert((c1 == std::list<int, min_allocator<int>>(a2, a2+sizeof(a2)/sizeof(a2[0]))));
- }
+ assert((c1 == std::list<int, min_allocator<int>>(a2, a2 + sizeof(a2) / sizeof(a2[0]))));
+ }
#endif
- for (int i = 0; i < 40; ++i)
- test_stable(i);
+ for (int i = 0; i < 40; ++i)
+ test_stable(i);
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/list/list.ops/splice_pos_list.pass.cpp b/libcxx/test/std/containers/sequences/list/list.ops/splice_pos_list.pass.cpp
index ff0f225e8b4acef..4b40876e3bb7de9 100644
--- a/libcxx/test/std/containers/sequences/list/list.ops/splice_pos_list.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.ops/splice_pos_list.pass.cpp
@@ -16,769 +16,768 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- int a1[] = {1, 2, 3};
- int a2[] = {4, 5, 6};
- {
- std::list<int> l1;
- std::list<int> l2;
- l1.splice(l1.end(), l2);
- assert(l1.size() == 0);
- assert(std::distance(l1.begin(), l1.end()) == 0);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- }
- {
- std::list<int> l1;
- std::list<int> l2(a2, a2+1);
- l1.splice(l1.end(), l2);
- assert(l1.size() == 1);
- assert(std::distance(l1.begin(), l1.end()) == 1);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int>::const_iterator i = l1.begin();
- assert(*i == 4);
- }
- {
- std::list<int> l1;
- std::list<int> l2(a2, a2+2);
- l1.splice(l1.end(), l2);
- assert(l1.size() == 2);
- assert(std::distance(l1.begin(), l1.end()) == 2);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int>::const_iterator i = l1.begin();
- assert(*i == 4);
- ++i;
- assert(*i == 5);
- }
- {
- std::list<int> l1;
- std::list<int> l2(a2, a2+3);
- l1.splice(l1.end(), l2);
- assert(l1.size() == 3);
- assert(std::distance(l1.begin(), l1.end()) == 3);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int>::const_iterator i = l1.begin();
- assert(*i == 4);
- ++i;
- assert(*i == 5);
- ++i;
- assert(*i == 6);
- }
- {
- std::list<int> l1(a1, a1+1);
- std::list<int> l2;
- l1.splice(l1.begin(), l2);
- assert(l1.size() == 1);
- assert(std::distance(l1.begin(), l1.end()) == 1);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int>::const_iterator i = l1.begin();
- assert(*i == 1);
- }
- {
- std::list<int> l1(a1, a1+1);
- std::list<int> l2;
- l1.splice(l1.end(), l2);
- assert(l1.size() == 1);
- assert(std::distance(l1.begin(), l1.end()) == 1);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int>::const_iterator i = l1.begin();
- assert(*i == 1);
- }
- {
- std::list<int> l1(a1, a1+1);
- std::list<int> l2(a2, a2+1);
- l1.splice(l1.begin(), l2);
- assert(l1.size() == 2);
- assert(std::distance(l1.begin(), l1.end()) == 2);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int>::const_iterator i = l1.begin();
- assert(*i == 4);
- ++i;
- assert(*i == 1);
- }
- {
- std::list<int> l1(a1, a1+1);
- std::list<int> l2(a2, a2+1);
- l1.splice(l1.end(), l2);
- assert(l1.size() == 2);
- assert(std::distance(l1.begin(), l1.end()) == 2);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int>::const_iterator i = l1.begin();
- assert(*i == 1);
- ++i;
- assert(*i == 4);
- }
- {
- std::list<int> l1(a1, a1+1);
- std::list<int> l2(a2, a2+2);
- l1.splice(l1.begin(), l2);
- assert(l1.size() == 3);
- assert(std::distance(l1.begin(), l1.end()) == 3);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int>::const_iterator i = l1.begin();
- assert(*i == 4);
- ++i;
- assert(*i == 5);
- ++i;
- assert(*i == 1);
- }
- {
- std::list<int> l1(a1, a1+1);
- std::list<int> l2(a2, a2+2);
- l1.splice(l1.end(), l2);
- assert(l1.size() == 3);
- assert(std::distance(l1.begin(), l1.end()) == 3);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int>::const_iterator i = l1.begin();
- assert(*i == 1);
- ++i;
- assert(*i == 4);
- ++i;
- assert(*i == 5);
- }
- {
- std::list<int> l1(a1, a1+1);
- std::list<int> l2(a2, a2+3);
- l1.splice(l1.begin(), l2);
- assert(l1.size() == 4);
- assert(std::distance(l1.begin(), l1.end()) == 4);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int>::const_iterator i = l1.begin();
- assert(*i == 4);
- ++i;
- assert(*i == 5);
- ++i;
- assert(*i == 6);
- ++i;
- assert(*i == 1);
- }
- {
- std::list<int> l1(a1, a1+1);
- std::list<int> l2(a2, a2+3);
- l1.splice(l1.end(), l2);
- assert(l1.size() == 4);
- assert(std::distance(l1.begin(), l1.end()) == 4);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int>::const_iterator i = l1.begin();
- assert(*i == 1);
- ++i;
- assert(*i == 4);
- ++i;
- assert(*i == 5);
- ++i;
- assert(*i == 6);
- }
- {
- std::list<int> l1(a1, a1+2);
- std::list<int> l2;
- l1.splice(l1.begin(), l2);
- assert(l1.size() == 2);
- assert(std::distance(l1.begin(), l1.end()) == 2);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int>::const_iterator i = l1.begin();
- assert(*i == 1);
- ++i;
- assert(*i == 2);
- }
- {
- std::list<int> l1(a1, a1+2);
- std::list<int> l2;
- l1.splice(std::next(l1.begin()), l2);
- assert(l1.size() == 2);
- assert(std::distance(l1.begin(), l1.end()) == 2);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int>::const_iterator i = l1.begin();
- assert(*i == 1);
- ++i;
- assert(*i == 2);
- }
- {
- std::list<int> l1(a1, a1+2);
- std::list<int> l2;
- l1.splice(std::next(l1.begin(), 2), l2);
- assert(l1.size() == 2);
- assert(std::distance(l1.begin(), l1.end()) == 2);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int>::const_iterator i = l1.begin();
- assert(*i == 1);
- ++i;
- assert(*i == 2);
- }
- {
- std::list<int> l1(a1, a1+2);
- std::list<int> l2(a2, a2+1);
- l1.splice(l1.begin(), l2);
- assert(l1.size() == 3);
- assert(std::distance(l1.begin(), l1.end()) == 3);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int>::const_iterator i = l1.begin();
- assert(*i == 4);
- ++i;
- assert(*i == 1);
- ++i;
- assert(*i == 2);
- }
- {
- std::list<int> l1(a1, a1+2);
- std::list<int> l2(a2, a2+1);
- l1.splice(std::next(l1.begin()), l2);
- assert(l1.size() == 3);
- assert(std::distance(l1.begin(), l1.end()) == 3);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int>::const_iterator i = l1.begin();
- assert(*i == 1);
- ++i;
- assert(*i == 4);
- ++i;
- assert(*i == 2);
- }
- {
- std::list<int> l1(a1, a1+2);
- std::list<int> l2(a2, a2+1);
- l1.splice(std::next(l1.begin(), 2), l2);
- assert(l1.size() == 3);
- assert(std::distance(l1.begin(), l1.end()) == 3);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int>::const_iterator i = l1.begin();
- assert(*i == 1);
- ++i;
- assert(*i == 2);
- ++i;
- assert(*i == 4);
- }
- {
- std::list<int> l1(a1, a1+2);
- std::list<int> l2(a2, a2+2);
- l1.splice(l1.begin(), l2);
- assert(l1.size() == 4);
- assert(std::distance(l1.begin(), l1.end()) == 4);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int>::const_iterator i = l1.begin();
- assert(*i == 4);
- ++i;
- assert(*i == 5);
- ++i;
- assert(*i == 1);
- ++i;
- assert(*i == 2);
- }
- {
- std::list<int> l1(a1, a1+2);
- std::list<int> l2(a2, a2+2);
- l1.splice(std::next(l1.begin()), l2);
- assert(l1.size() == 4);
- assert(std::distance(l1.begin(), l1.end()) == 4);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int>::const_iterator i = l1.begin();
- assert(*i == 1);
- ++i;
- assert(*i == 4);
- ++i;
- assert(*i == 5);
- ++i;
- assert(*i == 2);
- }
- {
- std::list<int> l1(a1, a1+2);
- std::list<int> l2(a2, a2+2);
- l1.splice(std::next(l1.begin(), 2), l2);
- assert(l1.size() == 4);
- assert(std::distance(l1.begin(), l1.end()) == 4);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int>::const_iterator i = l1.begin();
- assert(*i == 1);
- ++i;
- assert(*i == 2);
- ++i;
- assert(*i == 4);
- ++i;
- assert(*i == 5);
- }
- {
- std::list<int> l1(a1, a1+3);
- std::list<int> l2(a2, a2+3);
- l1.splice(l1.begin(), l2);
- assert(l1.size() == 6);
- assert(std::distance(l1.begin(), l1.end()) == 6);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int>::const_iterator i = l1.begin();
- assert(*i == 4);
- ++i;
- assert(*i == 5);
- ++i;
- assert(*i == 6);
- ++i;
- assert(*i == 1);
- ++i;
- assert(*i == 2);
- ++i;
- assert(*i == 3);
- }
- {
- std::list<int> l1(a1, a1+3);
- std::list<int> l2(a2, a2+3);
- l1.splice(std::next(l1.begin()), l2);
- assert(l1.size() == 6);
- assert(std::distance(l1.begin(), l1.end()) == 6);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int>::const_iterator i = l1.begin();
- assert(*i == 1);
- ++i;
- assert(*i == 4);
- ++i;
- assert(*i == 5);
- ++i;
- assert(*i == 6);
- ++i;
- assert(*i == 2);
- ++i;
- assert(*i == 3);
- }
- {
- std::list<int> l1(a1, a1+3);
- std::list<int> l2(a2, a2+3);
- l1.splice(std::next(l1.begin(), 2), l2);
- assert(l1.size() == 6);
- assert(std::distance(l1.begin(), l1.end()) == 6);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int>::const_iterator i = l1.begin();
- assert(*i == 1);
- ++i;
- assert(*i == 2);
- ++i;
- assert(*i == 4);
- ++i;
- assert(*i == 5);
- ++i;
- assert(*i == 6);
- ++i;
- assert(*i == 3);
- }
- {
- std::list<int> l1(a1, a1+3);
- std::list<int> l2(a2, a2+3);
- l1.splice(std::next(l1.begin(), 3), l2);
- assert(l1.size() == 6);
- assert(std::distance(l1.begin(), l1.end()) == 6);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int>::const_iterator i = l1.begin();
- assert(*i == 1);
- ++i;
- assert(*i == 2);
- ++i;
- assert(*i == 3);
- ++i;
- assert(*i == 4);
- ++i;
- assert(*i == 5);
- ++i;
- assert(*i == 6);
- }
+int main(int, char**) {
+ int a1[] = {1, 2, 3};
+ int a2[] = {4, 5, 6};
+ {
+ std::list<int> l1;
+ std::list<int> l2;
+ l1.splice(l1.end(), l2);
+ assert(l1.size() == 0);
+ assert(std::distance(l1.begin(), l1.end()) == 0);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ }
+ {
+ std::list<int> l1;
+ std::list<int> l2(a2, a2 + 1);
+ l1.splice(l1.end(), l2);
+ assert(l1.size() == 1);
+ assert(std::distance(l1.begin(), l1.end()) == 1);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int>::const_iterator i = l1.begin();
+ assert(*i == 4);
+ }
+ {
+ std::list<int> l1;
+ std::list<int> l2(a2, a2 + 2);
+ l1.splice(l1.end(), l2);
+ assert(l1.size() == 2);
+ assert(std::distance(l1.begin(), l1.end()) == 2);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int>::const_iterator i = l1.begin();
+ assert(*i == 4);
+ ++i;
+ assert(*i == 5);
+ }
+ {
+ std::list<int> l1;
+ std::list<int> l2(a2, a2 + 3);
+ l1.splice(l1.end(), l2);
+ assert(l1.size() == 3);
+ assert(std::distance(l1.begin(), l1.end()) == 3);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int>::const_iterator i = l1.begin();
+ assert(*i == 4);
+ ++i;
+ assert(*i == 5);
+ ++i;
+ assert(*i == 6);
+ }
+ {
+ std::list<int> l1(a1, a1 + 1);
+ std::list<int> l2;
+ l1.splice(l1.begin(), l2);
+ assert(l1.size() == 1);
+ assert(std::distance(l1.begin(), l1.end()) == 1);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int>::const_iterator i = l1.begin();
+ assert(*i == 1);
+ }
+ {
+ std::list<int> l1(a1, a1 + 1);
+ std::list<int> l2;
+ l1.splice(l1.end(), l2);
+ assert(l1.size() == 1);
+ assert(std::distance(l1.begin(), l1.end()) == 1);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int>::const_iterator i = l1.begin();
+ assert(*i == 1);
+ }
+ {
+ std::list<int> l1(a1, a1 + 1);
+ std::list<int> l2(a2, a2 + 1);
+ l1.splice(l1.begin(), l2);
+ assert(l1.size() == 2);
+ assert(std::distance(l1.begin(), l1.end()) == 2);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int>::const_iterator i = l1.begin();
+ assert(*i == 4);
+ ++i;
+ assert(*i == 1);
+ }
+ {
+ std::list<int> l1(a1, a1 + 1);
+ std::list<int> l2(a2, a2 + 1);
+ l1.splice(l1.end(), l2);
+ assert(l1.size() == 2);
+ assert(std::distance(l1.begin(), l1.end()) == 2);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int>::const_iterator i = l1.begin();
+ assert(*i == 1);
+ ++i;
+ assert(*i == 4);
+ }
+ {
+ std::list<int> l1(a1, a1 + 1);
+ std::list<int> l2(a2, a2 + 2);
+ l1.splice(l1.begin(), l2);
+ assert(l1.size() == 3);
+ assert(std::distance(l1.begin(), l1.end()) == 3);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int>::const_iterator i = l1.begin();
+ assert(*i == 4);
+ ++i;
+ assert(*i == 5);
+ ++i;
+ assert(*i == 1);
+ }
+ {
+ std::list<int> l1(a1, a1 + 1);
+ std::list<int> l2(a2, a2 + 2);
+ l1.splice(l1.end(), l2);
+ assert(l1.size() == 3);
+ assert(std::distance(l1.begin(), l1.end()) == 3);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int>::const_iterator i = l1.begin();
+ assert(*i == 1);
+ ++i;
+ assert(*i == 4);
+ ++i;
+ assert(*i == 5);
+ }
+ {
+ std::list<int> l1(a1, a1 + 1);
+ std::list<int> l2(a2, a2 + 3);
+ l1.splice(l1.begin(), l2);
+ assert(l1.size() == 4);
+ assert(std::distance(l1.begin(), l1.end()) == 4);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int>::const_iterator i = l1.begin();
+ assert(*i == 4);
+ ++i;
+ assert(*i == 5);
+ ++i;
+ assert(*i == 6);
+ ++i;
+ assert(*i == 1);
+ }
+ {
+ std::list<int> l1(a1, a1 + 1);
+ std::list<int> l2(a2, a2 + 3);
+ l1.splice(l1.end(), l2);
+ assert(l1.size() == 4);
+ assert(std::distance(l1.begin(), l1.end()) == 4);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int>::const_iterator i = l1.begin();
+ assert(*i == 1);
+ ++i;
+ assert(*i == 4);
+ ++i;
+ assert(*i == 5);
+ ++i;
+ assert(*i == 6);
+ }
+ {
+ std::list<int> l1(a1, a1 + 2);
+ std::list<int> l2;
+ l1.splice(l1.begin(), l2);
+ assert(l1.size() == 2);
+ assert(std::distance(l1.begin(), l1.end()) == 2);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int>::const_iterator i = l1.begin();
+ assert(*i == 1);
+ ++i;
+ assert(*i == 2);
+ }
+ {
+ std::list<int> l1(a1, a1 + 2);
+ std::list<int> l2;
+ l1.splice(std::next(l1.begin()), l2);
+ assert(l1.size() == 2);
+ assert(std::distance(l1.begin(), l1.end()) == 2);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int>::const_iterator i = l1.begin();
+ assert(*i == 1);
+ ++i;
+ assert(*i == 2);
+ }
+ {
+ std::list<int> l1(a1, a1 + 2);
+ std::list<int> l2;
+ l1.splice(std::next(l1.begin(), 2), l2);
+ assert(l1.size() == 2);
+ assert(std::distance(l1.begin(), l1.end()) == 2);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int>::const_iterator i = l1.begin();
+ assert(*i == 1);
+ ++i;
+ assert(*i == 2);
+ }
+ {
+ std::list<int> l1(a1, a1 + 2);
+ std::list<int> l2(a2, a2 + 1);
+ l1.splice(l1.begin(), l2);
+ assert(l1.size() == 3);
+ assert(std::distance(l1.begin(), l1.end()) == 3);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int>::const_iterator i = l1.begin();
+ assert(*i == 4);
+ ++i;
+ assert(*i == 1);
+ ++i;
+ assert(*i == 2);
+ }
+ {
+ std::list<int> l1(a1, a1 + 2);
+ std::list<int> l2(a2, a2 + 1);
+ l1.splice(std::next(l1.begin()), l2);
+ assert(l1.size() == 3);
+ assert(std::distance(l1.begin(), l1.end()) == 3);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int>::const_iterator i = l1.begin();
+ assert(*i == 1);
+ ++i;
+ assert(*i == 4);
+ ++i;
+ assert(*i == 2);
+ }
+ {
+ std::list<int> l1(a1, a1 + 2);
+ std::list<int> l2(a2, a2 + 1);
+ l1.splice(std::next(l1.begin(), 2), l2);
+ assert(l1.size() == 3);
+ assert(std::distance(l1.begin(), l1.end()) == 3);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int>::const_iterator i = l1.begin();
+ assert(*i == 1);
+ ++i;
+ assert(*i == 2);
+ ++i;
+ assert(*i == 4);
+ }
+ {
+ std::list<int> l1(a1, a1 + 2);
+ std::list<int> l2(a2, a2 + 2);
+ l1.splice(l1.begin(), l2);
+ assert(l1.size() == 4);
+ assert(std::distance(l1.begin(), l1.end()) == 4);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int>::const_iterator i = l1.begin();
+ assert(*i == 4);
+ ++i;
+ assert(*i == 5);
+ ++i;
+ assert(*i == 1);
+ ++i;
+ assert(*i == 2);
+ }
+ {
+ std::list<int> l1(a1, a1 + 2);
+ std::list<int> l2(a2, a2 + 2);
+ l1.splice(std::next(l1.begin()), l2);
+ assert(l1.size() == 4);
+ assert(std::distance(l1.begin(), l1.end()) == 4);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int>::const_iterator i = l1.begin();
+ assert(*i == 1);
+ ++i;
+ assert(*i == 4);
+ ++i;
+ assert(*i == 5);
+ ++i;
+ assert(*i == 2);
+ }
+ {
+ std::list<int> l1(a1, a1 + 2);
+ std::list<int> l2(a2, a2 + 2);
+ l1.splice(std::next(l1.begin(), 2), l2);
+ assert(l1.size() == 4);
+ assert(std::distance(l1.begin(), l1.end()) == 4);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int>::const_iterator i = l1.begin();
+ assert(*i == 1);
+ ++i;
+ assert(*i == 2);
+ ++i;
+ assert(*i == 4);
+ ++i;
+ assert(*i == 5);
+ }
+ {
+ std::list<int> l1(a1, a1 + 3);
+ std::list<int> l2(a2, a2 + 3);
+ l1.splice(l1.begin(), l2);
+ assert(l1.size() == 6);
+ assert(std::distance(l1.begin(), l1.end()) == 6);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int>::const_iterator i = l1.begin();
+ assert(*i == 4);
+ ++i;
+ assert(*i == 5);
+ ++i;
+ assert(*i == 6);
+ ++i;
+ assert(*i == 1);
+ ++i;
+ assert(*i == 2);
+ ++i;
+ assert(*i == 3);
+ }
+ {
+ std::list<int> l1(a1, a1 + 3);
+ std::list<int> l2(a2, a2 + 3);
+ l1.splice(std::next(l1.begin()), l2);
+ assert(l1.size() == 6);
+ assert(std::distance(l1.begin(), l1.end()) == 6);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int>::const_iterator i = l1.begin();
+ assert(*i == 1);
+ ++i;
+ assert(*i == 4);
+ ++i;
+ assert(*i == 5);
+ ++i;
+ assert(*i == 6);
+ ++i;
+ assert(*i == 2);
+ ++i;
+ assert(*i == 3);
+ }
+ {
+ std::list<int> l1(a1, a1 + 3);
+ std::list<int> l2(a2, a2 + 3);
+ l1.splice(std::next(l1.begin(), 2), l2);
+ assert(l1.size() == 6);
+ assert(std::distance(l1.begin(), l1.end()) == 6);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int>::const_iterator i = l1.begin();
+ assert(*i == 1);
+ ++i;
+ assert(*i == 2);
+ ++i;
+ assert(*i == 4);
+ ++i;
+ assert(*i == 5);
+ ++i;
+ assert(*i == 6);
+ ++i;
+ assert(*i == 3);
+ }
+ {
+ std::list<int> l1(a1, a1 + 3);
+ std::list<int> l2(a2, a2 + 3);
+ l1.splice(std::next(l1.begin(), 3), l2);
+ assert(l1.size() == 6);
+ assert(std::distance(l1.begin(), l1.end()) == 6);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int>::const_iterator i = l1.begin();
+ assert(*i == 1);
+ ++i;
+ assert(*i == 2);
+ ++i;
+ assert(*i == 3);
+ ++i;
+ assert(*i == 4);
+ ++i;
+ assert(*i == 5);
+ ++i;
+ assert(*i == 6);
+ }
#if TEST_STD_VER >= 11
- {
- std::list<int, min_allocator<int>> l1;
- std::list<int, min_allocator<int>> l2;
- l1.splice(l1.end(), l2);
- assert(l1.size() == 0);
- assert(std::distance(l1.begin(), l1.end()) == 0);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- }
- {
- std::list<int, min_allocator<int>> l1;
- std::list<int, min_allocator<int>> l2(a2, a2+1);
- l1.splice(l1.end(), l2);
- assert(l1.size() == 1);
- assert(std::distance(l1.begin(), l1.end()) == 1);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
- assert(*i == 4);
- }
- {
- std::list<int, min_allocator<int>> l1;
- std::list<int, min_allocator<int>> l2(a2, a2+2);
- l1.splice(l1.end(), l2);
- assert(l1.size() == 2);
- assert(std::distance(l1.begin(), l1.end()) == 2);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
- assert(*i == 4);
- ++i;
- assert(*i == 5);
- }
- {
- std::list<int, min_allocator<int>> l1;
- std::list<int, min_allocator<int>> l2(a2, a2+3);
- l1.splice(l1.end(), l2);
- assert(l1.size() == 3);
- assert(std::distance(l1.begin(), l1.end()) == 3);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
- assert(*i == 4);
- ++i;
- assert(*i == 5);
- ++i;
- assert(*i == 6);
- }
- {
- std::list<int, min_allocator<int>> l1(a1, a1+1);
- std::list<int, min_allocator<int>> l2;
- l1.splice(l1.begin(), l2);
- assert(l1.size() == 1);
- assert(std::distance(l1.begin(), l1.end()) == 1);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
- assert(*i == 1);
- }
- {
- std::list<int, min_allocator<int>> l1(a1, a1+1);
- std::list<int, min_allocator<int>> l2;
- l1.splice(l1.end(), l2);
- assert(l1.size() == 1);
- assert(std::distance(l1.begin(), l1.end()) == 1);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
- assert(*i == 1);
- }
- {
- std::list<int, min_allocator<int>> l1(a1, a1+1);
- std::list<int, min_allocator<int>> l2(a2, a2+1);
- l1.splice(l1.begin(), l2);
- assert(l1.size() == 2);
- assert(std::distance(l1.begin(), l1.end()) == 2);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
- assert(*i == 4);
- ++i;
- assert(*i == 1);
- }
- {
- std::list<int, min_allocator<int>> l1(a1, a1+1);
- std::list<int, min_allocator<int>> l2(a2, a2+1);
- l1.splice(l1.end(), l2);
- assert(l1.size() == 2);
- assert(std::distance(l1.begin(), l1.end()) == 2);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
- assert(*i == 1);
- ++i;
- assert(*i == 4);
- }
- {
- std::list<int, min_allocator<int>> l1(a1, a1+1);
- std::list<int, min_allocator<int>> l2(a2, a2+2);
- l1.splice(l1.begin(), l2);
- assert(l1.size() == 3);
- assert(std::distance(l1.begin(), l1.end()) == 3);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
- assert(*i == 4);
- ++i;
- assert(*i == 5);
- ++i;
- assert(*i == 1);
- }
- {
- std::list<int, min_allocator<int>> l1(a1, a1+1);
- std::list<int, min_allocator<int>> l2(a2, a2+2);
- l1.splice(l1.end(), l2);
- assert(l1.size() == 3);
- assert(std::distance(l1.begin(), l1.end()) == 3);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
- assert(*i == 1);
- ++i;
- assert(*i == 4);
- ++i;
- assert(*i == 5);
- }
- {
- std::list<int, min_allocator<int>> l1(a1, a1+1);
- std::list<int, min_allocator<int>> l2(a2, a2+3);
- l1.splice(l1.begin(), l2);
- assert(l1.size() == 4);
- assert(std::distance(l1.begin(), l1.end()) == 4);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
- assert(*i == 4);
- ++i;
- assert(*i == 5);
- ++i;
- assert(*i == 6);
- ++i;
- assert(*i == 1);
- }
- {
- std::list<int, min_allocator<int>> l1(a1, a1+1);
- std::list<int, min_allocator<int>> l2(a2, a2+3);
- l1.splice(l1.end(), l2);
- assert(l1.size() == 4);
- assert(std::distance(l1.begin(), l1.end()) == 4);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
- assert(*i == 1);
- ++i;
- assert(*i == 4);
- ++i;
- assert(*i == 5);
- ++i;
- assert(*i == 6);
- }
- {
- std::list<int, min_allocator<int>> l1(a1, a1+2);
- std::list<int, min_allocator<int>> l2;
- l1.splice(l1.begin(), l2);
- assert(l1.size() == 2);
- assert(std::distance(l1.begin(), l1.end()) == 2);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
- assert(*i == 1);
- ++i;
- assert(*i == 2);
- }
- {
- std::list<int, min_allocator<int>> l1(a1, a1+2);
- std::list<int, min_allocator<int>> l2;
- l1.splice(std::next(l1.begin()), l2);
- assert(l1.size() == 2);
- assert(std::distance(l1.begin(), l1.end()) == 2);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
- assert(*i == 1);
- ++i;
- assert(*i == 2);
- }
- {
- std::list<int, min_allocator<int>> l1(a1, a1+2);
- std::list<int, min_allocator<int>> l2;
- l1.splice(std::next(l1.begin(), 2), l2);
- assert(l1.size() == 2);
- assert(std::distance(l1.begin(), l1.end()) == 2);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
- assert(*i == 1);
- ++i;
- assert(*i == 2);
- }
- {
- std::list<int, min_allocator<int>> l1(a1, a1+2);
- std::list<int, min_allocator<int>> l2(a2, a2+1);
- l1.splice(l1.begin(), l2);
- assert(l1.size() == 3);
- assert(std::distance(l1.begin(), l1.end()) == 3);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
- assert(*i == 4);
- ++i;
- assert(*i == 1);
- ++i;
- assert(*i == 2);
- }
- {
- std::list<int, min_allocator<int>> l1(a1, a1+2);
- std::list<int, min_allocator<int>> l2(a2, a2+1);
- l1.splice(std::next(l1.begin()), l2);
- assert(l1.size() == 3);
- assert(std::distance(l1.begin(), l1.end()) == 3);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
- assert(*i == 1);
- ++i;
- assert(*i == 4);
- ++i;
- assert(*i == 2);
- }
- {
- std::list<int, min_allocator<int>> l1(a1, a1+2);
- std::list<int, min_allocator<int>> l2(a2, a2+1);
- l1.splice(std::next(l1.begin(), 2), l2);
- assert(l1.size() == 3);
- assert(std::distance(l1.begin(), l1.end()) == 3);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
- assert(*i == 1);
- ++i;
- assert(*i == 2);
- ++i;
- assert(*i == 4);
- }
- {
- std::list<int, min_allocator<int>> l1(a1, a1+2);
- std::list<int, min_allocator<int>> l2(a2, a2+2);
- l1.splice(l1.begin(), l2);
- assert(l1.size() == 4);
- assert(std::distance(l1.begin(), l1.end()) == 4);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
- assert(*i == 4);
- ++i;
- assert(*i == 5);
- ++i;
- assert(*i == 1);
- ++i;
- assert(*i == 2);
- }
- {
- std::list<int, min_allocator<int>> l1(a1, a1+2);
- std::list<int, min_allocator<int>> l2(a2, a2+2);
- l1.splice(std::next(l1.begin()), l2);
- assert(l1.size() == 4);
- assert(std::distance(l1.begin(), l1.end()) == 4);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
- assert(*i == 1);
- ++i;
- assert(*i == 4);
- ++i;
- assert(*i == 5);
- ++i;
- assert(*i == 2);
- }
- {
- std::list<int, min_allocator<int>> l1(a1, a1+2);
- std::list<int, min_allocator<int>> l2(a2, a2+2);
- l1.splice(std::next(l1.begin(), 2), l2);
- assert(l1.size() == 4);
- assert(std::distance(l1.begin(), l1.end()) == 4);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
- assert(*i == 1);
- ++i;
- assert(*i == 2);
- ++i;
- assert(*i == 4);
- ++i;
- assert(*i == 5);
- }
- {
- std::list<int, min_allocator<int>> l1(a1, a1+3);
- std::list<int, min_allocator<int>> l2(a2, a2+3);
- l1.splice(l1.begin(), l2);
- assert(l1.size() == 6);
- assert(std::distance(l1.begin(), l1.end()) == 6);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
- assert(*i == 4);
- ++i;
- assert(*i == 5);
- ++i;
- assert(*i == 6);
- ++i;
- assert(*i == 1);
- ++i;
- assert(*i == 2);
- ++i;
- assert(*i == 3);
- }
- {
- std::list<int, min_allocator<int>> l1(a1, a1+3);
- std::list<int, min_allocator<int>> l2(a2, a2+3);
- l1.splice(std::next(l1.begin()), l2);
- assert(l1.size() == 6);
- assert(std::distance(l1.begin(), l1.end()) == 6);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
- assert(*i == 1);
- ++i;
- assert(*i == 4);
- ++i;
- assert(*i == 5);
- ++i;
- assert(*i == 6);
- ++i;
- assert(*i == 2);
- ++i;
- assert(*i == 3);
- }
- {
- std::list<int, min_allocator<int>> l1(a1, a1+3);
- std::list<int, min_allocator<int>> l2(a2, a2+3);
- l1.splice(std::next(l1.begin(), 2), l2);
- assert(l1.size() == 6);
- assert(std::distance(l1.begin(), l1.end()) == 6);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
- assert(*i == 1);
- ++i;
- assert(*i == 2);
- ++i;
- assert(*i == 4);
- ++i;
- assert(*i == 5);
- ++i;
- assert(*i == 6);
- ++i;
- assert(*i == 3);
- }
- {
- std::list<int, min_allocator<int>> l1(a1, a1+3);
- std::list<int, min_allocator<int>> l2(a2, a2+3);
- l1.splice(std::next(l1.begin(), 3), l2);
- assert(l1.size() == 6);
- assert(std::distance(l1.begin(), l1.end()) == 6);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
- assert(*i == 1);
- ++i;
- assert(*i == 2);
- ++i;
- assert(*i == 3);
- ++i;
- assert(*i == 4);
- ++i;
- assert(*i == 5);
- ++i;
- assert(*i == 6);
- }
+ {
+ std::list<int, min_allocator<int>> l1;
+ std::list<int, min_allocator<int>> l2;
+ l1.splice(l1.end(), l2);
+ assert(l1.size() == 0);
+ assert(std::distance(l1.begin(), l1.end()) == 0);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ }
+ {
+ std::list<int, min_allocator<int>> l1;
+ std::list<int, min_allocator<int>> l2(a2, a2 + 1);
+ l1.splice(l1.end(), l2);
+ assert(l1.size() == 1);
+ assert(std::distance(l1.begin(), l1.end()) == 1);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
+ assert(*i == 4);
+ }
+ {
+ std::list<int, min_allocator<int>> l1;
+ std::list<int, min_allocator<int>> l2(a2, a2 + 2);
+ l1.splice(l1.end(), l2);
+ assert(l1.size() == 2);
+ assert(std::distance(l1.begin(), l1.end()) == 2);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
+ assert(*i == 4);
+ ++i;
+ assert(*i == 5);
+ }
+ {
+ std::list<int, min_allocator<int>> l1;
+ std::list<int, min_allocator<int>> l2(a2, a2 + 3);
+ l1.splice(l1.end(), l2);
+ assert(l1.size() == 3);
+ assert(std::distance(l1.begin(), l1.end()) == 3);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
+ assert(*i == 4);
+ ++i;
+ assert(*i == 5);
+ ++i;
+ assert(*i == 6);
+ }
+ {
+ std::list<int, min_allocator<int>> l1(a1, a1 + 1);
+ std::list<int, min_allocator<int>> l2;
+ l1.splice(l1.begin(), l2);
+ assert(l1.size() == 1);
+ assert(std::distance(l1.begin(), l1.end()) == 1);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
+ assert(*i == 1);
+ }
+ {
+ std::list<int, min_allocator<int>> l1(a1, a1 + 1);
+ std::list<int, min_allocator<int>> l2;
+ l1.splice(l1.end(), l2);
+ assert(l1.size() == 1);
+ assert(std::distance(l1.begin(), l1.end()) == 1);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
+ assert(*i == 1);
+ }
+ {
+ std::list<int, min_allocator<int>> l1(a1, a1 + 1);
+ std::list<int, min_allocator<int>> l2(a2, a2 + 1);
+ l1.splice(l1.begin(), l2);
+ assert(l1.size() == 2);
+ assert(std::distance(l1.begin(), l1.end()) == 2);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
+ assert(*i == 4);
+ ++i;
+ assert(*i == 1);
+ }
+ {
+ std::list<int, min_allocator<int>> l1(a1, a1 + 1);
+ std::list<int, min_allocator<int>> l2(a2, a2 + 1);
+ l1.splice(l1.end(), l2);
+ assert(l1.size() == 2);
+ assert(std::distance(l1.begin(), l1.end()) == 2);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
+ assert(*i == 1);
+ ++i;
+ assert(*i == 4);
+ }
+ {
+ std::list<int, min_allocator<int>> l1(a1, a1 + 1);
+ std::list<int, min_allocator<int>> l2(a2, a2 + 2);
+ l1.splice(l1.begin(), l2);
+ assert(l1.size() == 3);
+ assert(std::distance(l1.begin(), l1.end()) == 3);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
+ assert(*i == 4);
+ ++i;
+ assert(*i == 5);
+ ++i;
+ assert(*i == 1);
+ }
+ {
+ std::list<int, min_allocator<int>> l1(a1, a1 + 1);
+ std::list<int, min_allocator<int>> l2(a2, a2 + 2);
+ l1.splice(l1.end(), l2);
+ assert(l1.size() == 3);
+ assert(std::distance(l1.begin(), l1.end()) == 3);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
+ assert(*i == 1);
+ ++i;
+ assert(*i == 4);
+ ++i;
+ assert(*i == 5);
+ }
+ {
+ std::list<int, min_allocator<int>> l1(a1, a1 + 1);
+ std::list<int, min_allocator<int>> l2(a2, a2 + 3);
+ l1.splice(l1.begin(), l2);
+ assert(l1.size() == 4);
+ assert(std::distance(l1.begin(), l1.end()) == 4);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
+ assert(*i == 4);
+ ++i;
+ assert(*i == 5);
+ ++i;
+ assert(*i == 6);
+ ++i;
+ assert(*i == 1);
+ }
+ {
+ std::list<int, min_allocator<int>> l1(a1, a1 + 1);
+ std::list<int, min_allocator<int>> l2(a2, a2 + 3);
+ l1.splice(l1.end(), l2);
+ assert(l1.size() == 4);
+ assert(std::distance(l1.begin(), l1.end()) == 4);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
+ assert(*i == 1);
+ ++i;
+ assert(*i == 4);
+ ++i;
+ assert(*i == 5);
+ ++i;
+ assert(*i == 6);
+ }
+ {
+ std::list<int, min_allocator<int>> l1(a1, a1 + 2);
+ std::list<int, min_allocator<int>> l2;
+ l1.splice(l1.begin(), l2);
+ assert(l1.size() == 2);
+ assert(std::distance(l1.begin(), l1.end()) == 2);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
+ assert(*i == 1);
+ ++i;
+ assert(*i == 2);
+ }
+ {
+ std::list<int, min_allocator<int>> l1(a1, a1 + 2);
+ std::list<int, min_allocator<int>> l2;
+ l1.splice(std::next(l1.begin()), l2);
+ assert(l1.size() == 2);
+ assert(std::distance(l1.begin(), l1.end()) == 2);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
+ assert(*i == 1);
+ ++i;
+ assert(*i == 2);
+ }
+ {
+ std::list<int, min_allocator<int>> l1(a1, a1 + 2);
+ std::list<int, min_allocator<int>> l2;
+ l1.splice(std::next(l1.begin(), 2), l2);
+ assert(l1.size() == 2);
+ assert(std::distance(l1.begin(), l1.end()) == 2);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
+ assert(*i == 1);
+ ++i;
+ assert(*i == 2);
+ }
+ {
+ std::list<int, min_allocator<int>> l1(a1, a1 + 2);
+ std::list<int, min_allocator<int>> l2(a2, a2 + 1);
+ l1.splice(l1.begin(), l2);
+ assert(l1.size() == 3);
+ assert(std::distance(l1.begin(), l1.end()) == 3);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
+ assert(*i == 4);
+ ++i;
+ assert(*i == 1);
+ ++i;
+ assert(*i == 2);
+ }
+ {
+ std::list<int, min_allocator<int>> l1(a1, a1 + 2);
+ std::list<int, min_allocator<int>> l2(a2, a2 + 1);
+ l1.splice(std::next(l1.begin()), l2);
+ assert(l1.size() == 3);
+ assert(std::distance(l1.begin(), l1.end()) == 3);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
+ assert(*i == 1);
+ ++i;
+ assert(*i == 4);
+ ++i;
+ assert(*i == 2);
+ }
+ {
+ std::list<int, min_allocator<int>> l1(a1, a1 + 2);
+ std::list<int, min_allocator<int>> l2(a2, a2 + 1);
+ l1.splice(std::next(l1.begin(), 2), l2);
+ assert(l1.size() == 3);
+ assert(std::distance(l1.begin(), l1.end()) == 3);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
+ assert(*i == 1);
+ ++i;
+ assert(*i == 2);
+ ++i;
+ assert(*i == 4);
+ }
+ {
+ std::list<int, min_allocator<int>> l1(a1, a1 + 2);
+ std::list<int, min_allocator<int>> l2(a2, a2 + 2);
+ l1.splice(l1.begin(), l2);
+ assert(l1.size() == 4);
+ assert(std::distance(l1.begin(), l1.end()) == 4);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
+ assert(*i == 4);
+ ++i;
+ assert(*i == 5);
+ ++i;
+ assert(*i == 1);
+ ++i;
+ assert(*i == 2);
+ }
+ {
+ std::list<int, min_allocator<int>> l1(a1, a1 + 2);
+ std::list<int, min_allocator<int>> l2(a2, a2 + 2);
+ l1.splice(std::next(l1.begin()), l2);
+ assert(l1.size() == 4);
+ assert(std::distance(l1.begin(), l1.end()) == 4);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
+ assert(*i == 1);
+ ++i;
+ assert(*i == 4);
+ ++i;
+ assert(*i == 5);
+ ++i;
+ assert(*i == 2);
+ }
+ {
+ std::list<int, min_allocator<int>> l1(a1, a1 + 2);
+ std::list<int, min_allocator<int>> l2(a2, a2 + 2);
+ l1.splice(std::next(l1.begin(), 2), l2);
+ assert(l1.size() == 4);
+ assert(std::distance(l1.begin(), l1.end()) == 4);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
+ assert(*i == 1);
+ ++i;
+ assert(*i == 2);
+ ++i;
+ assert(*i == 4);
+ ++i;
+ assert(*i == 5);
+ }
+ {
+ std::list<int, min_allocator<int>> l1(a1, a1 + 3);
+ std::list<int, min_allocator<int>> l2(a2, a2 + 3);
+ l1.splice(l1.begin(), l2);
+ assert(l1.size() == 6);
+ assert(std::distance(l1.begin(), l1.end()) == 6);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
+ assert(*i == 4);
+ ++i;
+ assert(*i == 5);
+ ++i;
+ assert(*i == 6);
+ ++i;
+ assert(*i == 1);
+ ++i;
+ assert(*i == 2);
+ ++i;
+ assert(*i == 3);
+ }
+ {
+ std::list<int, min_allocator<int>> l1(a1, a1 + 3);
+ std::list<int, min_allocator<int>> l2(a2, a2 + 3);
+ l1.splice(std::next(l1.begin()), l2);
+ assert(l1.size() == 6);
+ assert(std::distance(l1.begin(), l1.end()) == 6);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
+ assert(*i == 1);
+ ++i;
+ assert(*i == 4);
+ ++i;
+ assert(*i == 5);
+ ++i;
+ assert(*i == 6);
+ ++i;
+ assert(*i == 2);
+ ++i;
+ assert(*i == 3);
+ }
+ {
+ std::list<int, min_allocator<int>> l1(a1, a1 + 3);
+ std::list<int, min_allocator<int>> l2(a2, a2 + 3);
+ l1.splice(std::next(l1.begin(), 2), l2);
+ assert(l1.size() == 6);
+ assert(std::distance(l1.begin(), l1.end()) == 6);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
+ assert(*i == 1);
+ ++i;
+ assert(*i == 2);
+ ++i;
+ assert(*i == 4);
+ ++i;
+ assert(*i == 5);
+ ++i;
+ assert(*i == 6);
+ ++i;
+ assert(*i == 3);
+ }
+ {
+ std::list<int, min_allocator<int>> l1(a1, a1 + 3);
+ std::list<int, min_allocator<int>> l2(a2, a2 + 3);
+ l1.splice(std::next(l1.begin(), 3), l2);
+ assert(l1.size() == 6);
+ assert(std::distance(l1.begin(), l1.end()) == 6);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
+ assert(*i == 1);
+ ++i;
+ assert(*i == 2);
+ ++i;
+ assert(*i == 3);
+ ++i;
+ assert(*i == 4);
+ ++i;
+ assert(*i == 5);
+ ++i;
+ assert(*i == 6);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/list/list.ops/splice_pos_list_iter.pass.cpp b/libcxx/test/std/containers/sequences/list/list.ops/splice_pos_list_iter.pass.cpp
index 08b78e14afa1b7d..db71fe17a06eb5e 100644
--- a/libcxx/test/std/containers/sequences/list/list.ops/splice_pos_list_iter.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.ops/splice_pos_list_iter.pass.cpp
@@ -16,323 +16,322 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- int a1[] = {1, 2, 3};
- int a2[] = {4, 5, 6};
- {
- std::list<int> l1;
- std::list<int> l2(a2, a2+1);
- l1.splice(l1.end(), l2, l2.begin());
- assert(l1.size() == 1);
- assert(std::distance(l1.begin(), l1.end()) == 1);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int>::const_iterator i = l1.begin();
- assert(*i == 4);
- }
- {
- std::list<int> l1;
- std::list<int> l2(a2, a2+2);
- l1.splice(l1.end(), l2, l2.begin());
- assert(l1.size() == 1);
- assert(std::distance(l1.begin(), l1.end()) == 1);
- assert(l2.size() == 1);
- assert(std::distance(l2.begin(), l2.end()) == 1);
- std::list<int>::const_iterator i = l1.begin();
- assert(*i == 4);
- i = l2.begin();
- assert(*i == 5);
- }
- {
- std::list<int> l1;
- std::list<int> l2(a2, a2+2);
- l1.splice(l1.end(), l2, std::next(l2.begin()));
- assert(l1.size() == 1);
- assert(std::distance(l1.begin(), l1.end()) == 1);
- assert(l2.size() == 1);
- assert(std::distance(l2.begin(), l2.end()) == 1);
- std::list<int>::const_iterator i = l1.begin();
- assert(*i == 5);
- i = l2.begin();
- assert(*i == 4);
- }
- {
- std::list<int> l1;
- std::list<int> l2(a2, a2+3);
- l1.splice(l1.end(), l2, l2.begin());
- assert(l1.size() == 1);
- assert(std::distance(l1.begin(), l1.end()) == 1);
- assert(l2.size() == 2);
- assert(std::distance(l2.begin(), l2.end()) == 2);
- std::list<int>::const_iterator i = l1.begin();
- assert(*i == 4);
- i = l2.begin();
- assert(*i == 5);
- ++i;
- assert(*i == 6);
- }
- {
- std::list<int> l1;
- std::list<int> l2(a2, a2+3);
- l1.splice(l1.end(), l2, std::next(l2.begin()));
- assert(l1.size() == 1);
- assert(std::distance(l1.begin(), l1.end()) == 1);
- assert(l2.size() == 2);
- assert(std::distance(l2.begin(), l2.end()) == 2);
- std::list<int>::const_iterator i = l1.begin();
- assert(*i == 5);
- i = l2.begin();
- assert(*i == 4);
- ++i;
- assert(*i == 6);
- }
- {
- std::list<int> l1;
- std::list<int> l2(a2, a2+3);
- l1.splice(l1.end(), l2, std::next(l2.begin(), 2));
- assert(l1.size() == 1);
- assert(std::distance(l1.begin(), l1.end()) == 1);
- assert(l2.size() == 2);
- assert(std::distance(l2.begin(), l2.end()) == 2);
- std::list<int>::const_iterator i = l1.begin();
- assert(*i == 6);
- i = l2.begin();
- assert(*i == 4);
- ++i;
- assert(*i == 5);
- }
- {
- std::list<int> l1(a1, a1+1);
- l1.splice(l1.begin(), l1, l1.begin());
- assert(l1.size() == 1);
- assert(std::distance(l1.begin(), l1.end()) == 1);
- std::list<int>::const_iterator i = l1.begin();
- assert(*i == 1);
- }
- {
- std::list<int> l1(a1, a1+1);
- std::list<int> l2(a2, a2+1);
- l1.splice(l1.begin(), l2, l2.begin());
- assert(l1.size() == 2);
- assert(std::distance(l1.begin(), l1.end()) == 2);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int>::const_iterator i = l1.begin();
- assert(*i == 4);
- ++i;
- assert(*i == 1);
- }
- {
- std::list<int> l1(a1, a1+1);
- std::list<int> l2(a2, a2+1);
- l1.splice(std::next(l1.begin()), l2, l2.begin());
- assert(l1.size() == 2);
- assert(std::distance(l1.begin(), l1.end()) == 2);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int>::const_iterator i = l1.begin();
- assert(*i == 1);
- ++i;
- assert(*i == 4);
- }
- {
- std::list<int> l1(a1, a1+2);
- l1.splice(l1.begin(), l1, l1.begin());
- assert(l1.size() == 2);
- assert(std::distance(l1.begin(), l1.end()) == 2);
- std::list<int>::const_iterator i = l1.begin();
- assert(*i == 1);
- ++i;
- assert(*i == 2);
- }
- {
- std::list<int> l1(a1, a1+2);
- l1.splice(l1.begin(), l1, std::next(l1.begin()));
- assert(l1.size() == 2);
- assert(std::distance(l1.begin(), l1.end()) == 2);
- std::list<int>::const_iterator i = l1.begin();
- assert(*i == 2);
- ++i;
- assert(*i == 1);
- }
- {
- std::list<int> l1(a1, a1+2);
- l1.splice(std::next(l1.begin()), l1, l1.begin());
- assert(l1.size() == 2);
- assert(std::distance(l1.begin(), l1.end()) == 2);
- std::list<int>::const_iterator i = l1.begin();
- assert(*i == 1);
- ++i;
- assert(*i == 2);
- }
- {
- std::list<int> l1(a1, a1+2);
- l1.splice(std::next(l1.begin()), l1, std::next(l1.begin()));
- assert(l1.size() == 2);
- assert(std::distance(l1.begin(), l1.end()) == 2);
- std::list<int>::const_iterator i = l1.begin();
- assert(*i == 1);
- ++i;
- assert(*i == 2);
- }
+int main(int, char**) {
+ int a1[] = {1, 2, 3};
+ int a2[] = {4, 5, 6};
+ {
+ std::list<int> l1;
+ std::list<int> l2(a2, a2 + 1);
+ l1.splice(l1.end(), l2, l2.begin());
+ assert(l1.size() == 1);
+ assert(std::distance(l1.begin(), l1.end()) == 1);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int>::const_iterator i = l1.begin();
+ assert(*i == 4);
+ }
+ {
+ std::list<int> l1;
+ std::list<int> l2(a2, a2 + 2);
+ l1.splice(l1.end(), l2, l2.begin());
+ assert(l1.size() == 1);
+ assert(std::distance(l1.begin(), l1.end()) == 1);
+ assert(l2.size() == 1);
+ assert(std::distance(l2.begin(), l2.end()) == 1);
+ std::list<int>::const_iterator i = l1.begin();
+ assert(*i == 4);
+ i = l2.begin();
+ assert(*i == 5);
+ }
+ {
+ std::list<int> l1;
+ std::list<int> l2(a2, a2 + 2);
+ l1.splice(l1.end(), l2, std::next(l2.begin()));
+ assert(l1.size() == 1);
+ assert(std::distance(l1.begin(), l1.end()) == 1);
+ assert(l2.size() == 1);
+ assert(std::distance(l2.begin(), l2.end()) == 1);
+ std::list<int>::const_iterator i = l1.begin();
+ assert(*i == 5);
+ i = l2.begin();
+ assert(*i == 4);
+ }
+ {
+ std::list<int> l1;
+ std::list<int> l2(a2, a2 + 3);
+ l1.splice(l1.end(), l2, l2.begin());
+ assert(l1.size() == 1);
+ assert(std::distance(l1.begin(), l1.end()) == 1);
+ assert(l2.size() == 2);
+ assert(std::distance(l2.begin(), l2.end()) == 2);
+ std::list<int>::const_iterator i = l1.begin();
+ assert(*i == 4);
+ i = l2.begin();
+ assert(*i == 5);
+ ++i;
+ assert(*i == 6);
+ }
+ {
+ std::list<int> l1;
+ std::list<int> l2(a2, a2 + 3);
+ l1.splice(l1.end(), l2, std::next(l2.begin()));
+ assert(l1.size() == 1);
+ assert(std::distance(l1.begin(), l1.end()) == 1);
+ assert(l2.size() == 2);
+ assert(std::distance(l2.begin(), l2.end()) == 2);
+ std::list<int>::const_iterator i = l1.begin();
+ assert(*i == 5);
+ i = l2.begin();
+ assert(*i == 4);
+ ++i;
+ assert(*i == 6);
+ }
+ {
+ std::list<int> l1;
+ std::list<int> l2(a2, a2 + 3);
+ l1.splice(l1.end(), l2, std::next(l2.begin(), 2));
+ assert(l1.size() == 1);
+ assert(std::distance(l1.begin(), l1.end()) == 1);
+ assert(l2.size() == 2);
+ assert(std::distance(l2.begin(), l2.end()) == 2);
+ std::list<int>::const_iterator i = l1.begin();
+ assert(*i == 6);
+ i = l2.begin();
+ assert(*i == 4);
+ ++i;
+ assert(*i == 5);
+ }
+ {
+ std::list<int> l1(a1, a1 + 1);
+ l1.splice(l1.begin(), l1, l1.begin());
+ assert(l1.size() == 1);
+ assert(std::distance(l1.begin(), l1.end()) == 1);
+ std::list<int>::const_iterator i = l1.begin();
+ assert(*i == 1);
+ }
+ {
+ std::list<int> l1(a1, a1 + 1);
+ std::list<int> l2(a2, a2 + 1);
+ l1.splice(l1.begin(), l2, l2.begin());
+ assert(l1.size() == 2);
+ assert(std::distance(l1.begin(), l1.end()) == 2);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int>::const_iterator i = l1.begin();
+ assert(*i == 4);
+ ++i;
+ assert(*i == 1);
+ }
+ {
+ std::list<int> l1(a1, a1 + 1);
+ std::list<int> l2(a2, a2 + 1);
+ l1.splice(std::next(l1.begin()), l2, l2.begin());
+ assert(l1.size() == 2);
+ assert(std::distance(l1.begin(), l1.end()) == 2);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int>::const_iterator i = l1.begin();
+ assert(*i == 1);
+ ++i;
+ assert(*i == 4);
+ }
+ {
+ std::list<int> l1(a1, a1 + 2);
+ l1.splice(l1.begin(), l1, l1.begin());
+ assert(l1.size() == 2);
+ assert(std::distance(l1.begin(), l1.end()) == 2);
+ std::list<int>::const_iterator i = l1.begin();
+ assert(*i == 1);
+ ++i;
+ assert(*i == 2);
+ }
+ {
+ std::list<int> l1(a1, a1 + 2);
+ l1.splice(l1.begin(), l1, std::next(l1.begin()));
+ assert(l1.size() == 2);
+ assert(std::distance(l1.begin(), l1.end()) == 2);
+ std::list<int>::const_iterator i = l1.begin();
+ assert(*i == 2);
+ ++i;
+ assert(*i == 1);
+ }
+ {
+ std::list<int> l1(a1, a1 + 2);
+ l1.splice(std::next(l1.begin()), l1, l1.begin());
+ assert(l1.size() == 2);
+ assert(std::distance(l1.begin(), l1.end()) == 2);
+ std::list<int>::const_iterator i = l1.begin();
+ assert(*i == 1);
+ ++i;
+ assert(*i == 2);
+ }
+ {
+ std::list<int> l1(a1, a1 + 2);
+ l1.splice(std::next(l1.begin()), l1, std::next(l1.begin()));
+ assert(l1.size() == 2);
+ assert(std::distance(l1.begin(), l1.end()) == 2);
+ std::list<int>::const_iterator i = l1.begin();
+ assert(*i == 1);
+ ++i;
+ assert(*i == 2);
+ }
#if TEST_STD_VER >= 11
- {
- std::list<int, min_allocator<int>> l1;
- std::list<int, min_allocator<int>> l2(a2, a2+1);
- l1.splice(l1.end(), l2, l2.begin());
- assert(l1.size() == 1);
- assert(std::distance(l1.begin(), l1.end()) == 1);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
- assert(*i == 4);
- }
- {
- std::list<int, min_allocator<int>> l1;
- std::list<int, min_allocator<int>> l2(a2, a2+2);
- l1.splice(l1.end(), l2, l2.begin());
- assert(l1.size() == 1);
- assert(std::distance(l1.begin(), l1.end()) == 1);
- assert(l2.size() == 1);
- assert(std::distance(l2.begin(), l2.end()) == 1);
- std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
- assert(*i == 4);
- i = l2.begin();
- assert(*i == 5);
- }
- {
- std::list<int, min_allocator<int>> l1;
- std::list<int, min_allocator<int>> l2(a2, a2+2);
- l1.splice(l1.end(), l2, std::next(l2.begin()));
- assert(l1.size() == 1);
- assert(std::distance(l1.begin(), l1.end()) == 1);
- assert(l2.size() == 1);
- assert(std::distance(l2.begin(), l2.end()) == 1);
- std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
- assert(*i == 5);
- i = l2.begin();
- assert(*i == 4);
- }
- {
- std::list<int, min_allocator<int>> l1;
- std::list<int, min_allocator<int>> l2(a2, a2+3);
- l1.splice(l1.end(), l2, l2.begin());
- assert(l1.size() == 1);
- assert(std::distance(l1.begin(), l1.end()) == 1);
- assert(l2.size() == 2);
- assert(std::distance(l2.begin(), l2.end()) == 2);
- std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
- assert(*i == 4);
- i = l2.begin();
- assert(*i == 5);
- ++i;
- assert(*i == 6);
- }
- {
- std::list<int, min_allocator<int>> l1;
- std::list<int, min_allocator<int>> l2(a2, a2+3);
- l1.splice(l1.end(), l2, std::next(l2.begin()));
- assert(l1.size() == 1);
- assert(std::distance(l1.begin(), l1.end()) == 1);
- assert(l2.size() == 2);
- assert(std::distance(l2.begin(), l2.end()) == 2);
- std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
- assert(*i == 5);
- i = l2.begin();
- assert(*i == 4);
- ++i;
- assert(*i == 6);
- }
- {
- std::list<int, min_allocator<int>> l1;
- std::list<int, min_allocator<int>> l2(a2, a2+3);
- l1.splice(l1.end(), l2, std::next(l2.begin(), 2));
- assert(l1.size() == 1);
- assert(std::distance(l1.begin(), l1.end()) == 1);
- assert(l2.size() == 2);
- assert(std::distance(l2.begin(), l2.end()) == 2);
- std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
- assert(*i == 6);
- i = l2.begin();
- assert(*i == 4);
- ++i;
- assert(*i == 5);
- }
- {
- std::list<int, min_allocator<int>> l1(a1, a1+1);
- l1.splice(l1.begin(), l1, l1.begin());
- assert(l1.size() == 1);
- assert(std::distance(l1.begin(), l1.end()) == 1);
- std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
- assert(*i == 1);
- }
- {
- std::list<int, min_allocator<int>> l1(a1, a1+1);
- std::list<int, min_allocator<int>> l2(a2, a2+1);
- l1.splice(l1.begin(), l2, l2.begin());
- assert(l1.size() == 2);
- assert(std::distance(l1.begin(), l1.end()) == 2);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
- assert(*i == 4);
- ++i;
- assert(*i == 1);
- }
- {
- std::list<int, min_allocator<int>> l1(a1, a1+1);
- std::list<int, min_allocator<int>> l2(a2, a2+1);
- l1.splice(std::next(l1.begin()), l2, l2.begin());
- assert(l1.size() == 2);
- assert(std::distance(l1.begin(), l1.end()) == 2);
- assert(l2.size() == 0);
- assert(std::distance(l2.begin(), l2.end()) == 0);
- std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
- assert(*i == 1);
- ++i;
- assert(*i == 4);
- }
- {
- std::list<int, min_allocator<int>> l1(a1, a1+2);
- l1.splice(l1.begin(), l1, l1.begin());
- assert(l1.size() == 2);
- assert(std::distance(l1.begin(), l1.end()) == 2);
- std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
- assert(*i == 1);
- ++i;
- assert(*i == 2);
- }
- {
- std::list<int, min_allocator<int>> l1(a1, a1+2);
- l1.splice(l1.begin(), l1, std::next(l1.begin()));
- assert(l1.size() == 2);
- assert(std::distance(l1.begin(), l1.end()) == 2);
- std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
- assert(*i == 2);
- ++i;
- assert(*i == 1);
- }
- {
- std::list<int, min_allocator<int>> l1(a1, a1+2);
- l1.splice(std::next(l1.begin()), l1, l1.begin());
- assert(l1.size() == 2);
- assert(std::distance(l1.begin(), l1.end()) == 2);
- std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
- assert(*i == 1);
- ++i;
- assert(*i == 2);
- }
- {
- std::list<int, min_allocator<int>> l1(a1, a1+2);
- l1.splice(std::next(l1.begin()), l1, std::next(l1.begin()));
- assert(l1.size() == 2);
- assert(std::distance(l1.begin(), l1.end()) == 2);
- std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
- assert(*i == 1);
- ++i;
- assert(*i == 2);
- }
+ {
+ std::list<int, min_allocator<int>> l1;
+ std::list<int, min_allocator<int>> l2(a2, a2 + 1);
+ l1.splice(l1.end(), l2, l2.begin());
+ assert(l1.size() == 1);
+ assert(std::distance(l1.begin(), l1.end()) == 1);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
+ assert(*i == 4);
+ }
+ {
+ std::list<int, min_allocator<int>> l1;
+ std::list<int, min_allocator<int>> l2(a2, a2 + 2);
+ l1.splice(l1.end(), l2, l2.begin());
+ assert(l1.size() == 1);
+ assert(std::distance(l1.begin(), l1.end()) == 1);
+ assert(l2.size() == 1);
+ assert(std::distance(l2.begin(), l2.end()) == 1);
+ std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
+ assert(*i == 4);
+ i = l2.begin();
+ assert(*i == 5);
+ }
+ {
+ std::list<int, min_allocator<int>> l1;
+ std::list<int, min_allocator<int>> l2(a2, a2 + 2);
+ l1.splice(l1.end(), l2, std::next(l2.begin()));
+ assert(l1.size() == 1);
+ assert(std::distance(l1.begin(), l1.end()) == 1);
+ assert(l2.size() == 1);
+ assert(std::distance(l2.begin(), l2.end()) == 1);
+ std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
+ assert(*i == 5);
+ i = l2.begin();
+ assert(*i == 4);
+ }
+ {
+ std::list<int, min_allocator<int>> l1;
+ std::list<int, min_allocator<int>> l2(a2, a2 + 3);
+ l1.splice(l1.end(), l2, l2.begin());
+ assert(l1.size() == 1);
+ assert(std::distance(l1.begin(), l1.end()) == 1);
+ assert(l2.size() == 2);
+ assert(std::distance(l2.begin(), l2.end()) == 2);
+ std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
+ assert(*i == 4);
+ i = l2.begin();
+ assert(*i == 5);
+ ++i;
+ assert(*i == 6);
+ }
+ {
+ std::list<int, min_allocator<int>> l1;
+ std::list<int, min_allocator<int>> l2(a2, a2 + 3);
+ l1.splice(l1.end(), l2, std::next(l2.begin()));
+ assert(l1.size() == 1);
+ assert(std::distance(l1.begin(), l1.end()) == 1);
+ assert(l2.size() == 2);
+ assert(std::distance(l2.begin(), l2.end()) == 2);
+ std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
+ assert(*i == 5);
+ i = l2.begin();
+ assert(*i == 4);
+ ++i;
+ assert(*i == 6);
+ }
+ {
+ std::list<int, min_allocator<int>> l1;
+ std::list<int, min_allocator<int>> l2(a2, a2 + 3);
+ l1.splice(l1.end(), l2, std::next(l2.begin(), 2));
+ assert(l1.size() == 1);
+ assert(std::distance(l1.begin(), l1.end()) == 1);
+ assert(l2.size() == 2);
+ assert(std::distance(l2.begin(), l2.end()) == 2);
+ std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
+ assert(*i == 6);
+ i = l2.begin();
+ assert(*i == 4);
+ ++i;
+ assert(*i == 5);
+ }
+ {
+ std::list<int, min_allocator<int>> l1(a1, a1 + 1);
+ l1.splice(l1.begin(), l1, l1.begin());
+ assert(l1.size() == 1);
+ assert(std::distance(l1.begin(), l1.end()) == 1);
+ std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
+ assert(*i == 1);
+ }
+ {
+ std::list<int, min_allocator<int>> l1(a1, a1 + 1);
+ std::list<int, min_allocator<int>> l2(a2, a2 + 1);
+ l1.splice(l1.begin(), l2, l2.begin());
+ assert(l1.size() == 2);
+ assert(std::distance(l1.begin(), l1.end()) == 2);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
+ assert(*i == 4);
+ ++i;
+ assert(*i == 1);
+ }
+ {
+ std::list<int, min_allocator<int>> l1(a1, a1 + 1);
+ std::list<int, min_allocator<int>> l2(a2, a2 + 1);
+ l1.splice(std::next(l1.begin()), l2, l2.begin());
+ assert(l1.size() == 2);
+ assert(std::distance(l1.begin(), l1.end()) == 2);
+ assert(l2.size() == 0);
+ assert(std::distance(l2.begin(), l2.end()) == 0);
+ std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
+ assert(*i == 1);
+ ++i;
+ assert(*i == 4);
+ }
+ {
+ std::list<int, min_allocator<int>> l1(a1, a1 + 2);
+ l1.splice(l1.begin(), l1, l1.begin());
+ assert(l1.size() == 2);
+ assert(std::distance(l1.begin(), l1.end()) == 2);
+ std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
+ assert(*i == 1);
+ ++i;
+ assert(*i == 2);
+ }
+ {
+ std::list<int, min_allocator<int>> l1(a1, a1 + 2);
+ l1.splice(l1.begin(), l1, std::next(l1.begin()));
+ assert(l1.size() == 2);
+ assert(std::distance(l1.begin(), l1.end()) == 2);
+ std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
+ assert(*i == 2);
+ ++i;
+ assert(*i == 1);
+ }
+ {
+ std::list<int, min_allocator<int>> l1(a1, a1 + 2);
+ l1.splice(std::next(l1.begin()), l1, l1.begin());
+ assert(l1.size() == 2);
+ assert(std::distance(l1.begin(), l1.end()) == 2);
+ std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
+ assert(*i == 1);
+ ++i;
+ assert(*i == 2);
+ }
+ {
+ std::list<int, min_allocator<int>> l1(a1, a1 + 2);
+ l1.splice(std::next(l1.begin()), l1, std::next(l1.begin()));
+ assert(l1.size() == 2);
+ assert(std::distance(l1.begin(), l1.end()) == 2);
+ std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
+ assert(*i == 1);
+ ++i;
+ assert(*i == 2);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/list/list.ops/splice_pos_list_iter_iter.pass.cpp b/libcxx/test/std/containers/sequences/list/list.ops/splice_pos_list_iter_iter.pass.cpp
index ebfdd50a2b545f4..b77b6a26440d563 100644
--- a/libcxx/test/std/containers/sequences/list/list.ops/splice_pos_list_iter_iter.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.ops/splice_pos_list_iter_iter.pass.cpp
@@ -16,203 +16,202 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- int a1[] = {1, 2, 3};
- int a2[] = {4, 5, 6};
- {
- std::list<int> l1(a1, a1+3);
- l1.splice(l1.begin(), l1, std::next(l1.begin()), std::next(l1.begin()));
- assert(l1.size() == 3);
- assert(std::distance(l1.begin(), l1.end()) == 3);
- std::list<int>::const_iterator i = l1.begin();
- assert(*i == 1);
- ++i;
- assert(*i == 2);
- ++i;
- assert(*i == 3);
- }
- {
- std::list<int> l1(a1, a1+3);
- l1.splice(l1.begin(), l1, std::next(l1.begin()), std::next(l1.begin(), 2));
- assert(l1.size() == 3);
- assert(std::distance(l1.begin(), l1.end()) == 3);
- std::list<int>::const_iterator i = l1.begin();
- assert(*i == 2);
- ++i;
- assert(*i == 1);
- ++i;
- assert(*i == 3);
- }
- {
- std::list<int> l1(a1, a1+3);
- l1.splice(l1.begin(), l1, std::next(l1.begin()), std::next(l1.begin(), 3));
- assert(l1.size() == 3);
- assert(std::distance(l1.begin(), l1.end()) == 3);
- std::list<int>::const_iterator i = l1.begin();
- assert(*i == 2);
- ++i;
- assert(*i == 3);
- ++i;
- assert(*i == 1);
- }
- {
- std::list<int> l1(a1, a1+3);
- std::list<int> l2(a2, a2+3);
- l1.splice(l1.begin(), l2, std::next(l2.begin()), l2.end());
- assert(l1.size() == 5);
- assert(std::distance(l1.begin(), l1.end()) == 5);
- std::list<int>::const_iterator i = l1.begin();
- assert(*i == 5);
- ++i;
- assert(*i == 6);
- ++i;
- assert(*i == 1);
- ++i;
- assert(*i == 2);
- ++i;
- assert(*i == 3);
- assert(l2.size() == 1);
- i = l2.begin();
- assert(*i == 4);
- }
- {
- std::list<int> l1(a1, a1+3);
- std::list<int> l2(a2, a2+3);
- l1.splice(std::next(l1.begin()), l2, std::next(l2.begin()), l2.end());
- assert(l1.size() == 5);
- assert(std::distance(l1.begin(), l1.end()) == 5);
- std::list<int>::const_iterator i = l1.begin();
- assert(*i == 1);
- ++i;
- assert(*i == 5);
- ++i;
- assert(*i == 6);
- ++i;
- assert(*i == 2);
- ++i;
- assert(*i == 3);
- assert(l2.size() == 1);
- i = l2.begin();
- assert(*i == 4);
- }
- {
- std::list<int> l1(a1, a1+3);
- std::list<int> l2(a2, a2+3);
- l1.splice(l1.end(), l2, std::next(l2.begin()), l2.end());
- assert(l1.size() == 5);
- assert(std::distance(l1.begin(), l1.end()) == 5);
- std::list<int>::const_iterator i = l1.begin();
- assert(*i == 1);
- ++i;
- assert(*i == 2);
- ++i;
- assert(*i == 3);
- ++i;
- assert(*i == 5);
- ++i;
- assert(*i == 6);
- assert(l2.size() == 1);
- i = l2.begin();
- assert(*i == 4);
- }
+int main(int, char**) {
+ int a1[] = {1, 2, 3};
+ int a2[] = {4, 5, 6};
+ {
+ std::list<int> l1(a1, a1 + 3);
+ l1.splice(l1.begin(), l1, std::next(l1.begin()), std::next(l1.begin()));
+ assert(l1.size() == 3);
+ assert(std::distance(l1.begin(), l1.end()) == 3);
+ std::list<int>::const_iterator i = l1.begin();
+ assert(*i == 1);
+ ++i;
+ assert(*i == 2);
+ ++i;
+ assert(*i == 3);
+ }
+ {
+ std::list<int> l1(a1, a1 + 3);
+ l1.splice(l1.begin(), l1, std::next(l1.begin()), std::next(l1.begin(), 2));
+ assert(l1.size() == 3);
+ assert(std::distance(l1.begin(), l1.end()) == 3);
+ std::list<int>::const_iterator i = l1.begin();
+ assert(*i == 2);
+ ++i;
+ assert(*i == 1);
+ ++i;
+ assert(*i == 3);
+ }
+ {
+ std::list<int> l1(a1, a1 + 3);
+ l1.splice(l1.begin(), l1, std::next(l1.begin()), std::next(l1.begin(), 3));
+ assert(l1.size() == 3);
+ assert(std::distance(l1.begin(), l1.end()) == 3);
+ std::list<int>::const_iterator i = l1.begin();
+ assert(*i == 2);
+ ++i;
+ assert(*i == 3);
+ ++i;
+ assert(*i == 1);
+ }
+ {
+ std::list<int> l1(a1, a1 + 3);
+ std::list<int> l2(a2, a2 + 3);
+ l1.splice(l1.begin(), l2, std::next(l2.begin()), l2.end());
+ assert(l1.size() == 5);
+ assert(std::distance(l1.begin(), l1.end()) == 5);
+ std::list<int>::const_iterator i = l1.begin();
+ assert(*i == 5);
+ ++i;
+ assert(*i == 6);
+ ++i;
+ assert(*i == 1);
+ ++i;
+ assert(*i == 2);
+ ++i;
+ assert(*i == 3);
+ assert(l2.size() == 1);
+ i = l2.begin();
+ assert(*i == 4);
+ }
+ {
+ std::list<int> l1(a1, a1 + 3);
+ std::list<int> l2(a2, a2 + 3);
+ l1.splice(std::next(l1.begin()), l2, std::next(l2.begin()), l2.end());
+ assert(l1.size() == 5);
+ assert(std::distance(l1.begin(), l1.end()) == 5);
+ std::list<int>::const_iterator i = l1.begin();
+ assert(*i == 1);
+ ++i;
+ assert(*i == 5);
+ ++i;
+ assert(*i == 6);
+ ++i;
+ assert(*i == 2);
+ ++i;
+ assert(*i == 3);
+ assert(l2.size() == 1);
+ i = l2.begin();
+ assert(*i == 4);
+ }
+ {
+ std::list<int> l1(a1, a1 + 3);
+ std::list<int> l2(a2, a2 + 3);
+ l1.splice(l1.end(), l2, std::next(l2.begin()), l2.end());
+ assert(l1.size() == 5);
+ assert(std::distance(l1.begin(), l1.end()) == 5);
+ std::list<int>::const_iterator i = l1.begin();
+ assert(*i == 1);
+ ++i;
+ assert(*i == 2);
+ ++i;
+ assert(*i == 3);
+ ++i;
+ assert(*i == 5);
+ ++i;
+ assert(*i == 6);
+ assert(l2.size() == 1);
+ i = l2.begin();
+ assert(*i == 4);
+ }
#if TEST_STD_VER >= 11
- {
- std::list<int, min_allocator<int>> l1(a1, a1+3);
- l1.splice(l1.begin(), l1, std::next(l1.begin()), std::next(l1.begin()));
- assert(l1.size() == 3);
- assert(std::distance(l1.begin(), l1.end()) == 3);
- std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
- assert(*i == 1);
- ++i;
- assert(*i == 2);
- ++i;
- assert(*i == 3);
- }
- {
- std::list<int, min_allocator<int>> l1(a1, a1+3);
- l1.splice(l1.begin(), l1, std::next(l1.begin()), std::next(l1.begin(), 2));
- assert(l1.size() == 3);
- assert(std::distance(l1.begin(), l1.end()) == 3);
- std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
- assert(*i == 2);
- ++i;
- assert(*i == 1);
- ++i;
- assert(*i == 3);
- }
- {
- std::list<int, min_allocator<int>> l1(a1, a1+3);
- l1.splice(l1.begin(), l1, std::next(l1.begin()), std::next(l1.begin(), 3));
- assert(l1.size() == 3);
- assert(std::distance(l1.begin(), l1.end()) == 3);
- std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
- assert(*i == 2);
- ++i;
- assert(*i == 3);
- ++i;
- assert(*i == 1);
- }
- {
- std::list<int, min_allocator<int>> l1(a1, a1+3);
- std::list<int, min_allocator<int>> l2(a2, a2+3);
- l1.splice(l1.begin(), l2, std::next(l2.begin()), l2.end());
- assert(l1.size() == 5);
- assert(std::distance(l1.begin(), l1.end()) == 5);
- std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
- assert(*i == 5);
- ++i;
- assert(*i == 6);
- ++i;
- assert(*i == 1);
- ++i;
- assert(*i == 2);
- ++i;
- assert(*i == 3);
- assert(l2.size() == 1);
- i = l2.begin();
- assert(*i == 4);
- }
- {
- std::list<int, min_allocator<int>> l1(a1, a1+3);
- std::list<int, min_allocator<int>> l2(a2, a2+3);
- l1.splice(std::next(l1.begin()), l2, std::next(l2.begin()), l2.end());
- assert(l1.size() == 5);
- assert(std::distance(l1.begin(), l1.end()) == 5);
- std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
- assert(*i == 1);
- ++i;
- assert(*i == 5);
- ++i;
- assert(*i == 6);
- ++i;
- assert(*i == 2);
- ++i;
- assert(*i == 3);
- assert(l2.size() == 1);
- i = l2.begin();
- assert(*i == 4);
- }
- {
- std::list<int, min_allocator<int>> l1(a1, a1+3);
- std::list<int, min_allocator<int>> l2(a2, a2+3);
- l1.splice(l1.end(), l2, std::next(l2.begin()), l2.end());
- assert(l1.size() == 5);
- assert(std::distance(l1.begin(), l1.end()) == 5);
- std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
- assert(*i == 1);
- ++i;
- assert(*i == 2);
- ++i;
- assert(*i == 3);
- ++i;
- assert(*i == 5);
- ++i;
- assert(*i == 6);
- assert(l2.size() == 1);
- i = l2.begin();
- assert(*i == 4);
- }
+ {
+ std::list<int, min_allocator<int>> l1(a1, a1 + 3);
+ l1.splice(l1.begin(), l1, std::next(l1.begin()), std::next(l1.begin()));
+ assert(l1.size() == 3);
+ assert(std::distance(l1.begin(), l1.end()) == 3);
+ std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
+ assert(*i == 1);
+ ++i;
+ assert(*i == 2);
+ ++i;
+ assert(*i == 3);
+ }
+ {
+ std::list<int, min_allocator<int>> l1(a1, a1 + 3);
+ l1.splice(l1.begin(), l1, std::next(l1.begin()), std::next(l1.begin(), 2));
+ assert(l1.size() == 3);
+ assert(std::distance(l1.begin(), l1.end()) == 3);
+ std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
+ assert(*i == 2);
+ ++i;
+ assert(*i == 1);
+ ++i;
+ assert(*i == 3);
+ }
+ {
+ std::list<int, min_allocator<int>> l1(a1, a1 + 3);
+ l1.splice(l1.begin(), l1, std::next(l1.begin()), std::next(l1.begin(), 3));
+ assert(l1.size() == 3);
+ assert(std::distance(l1.begin(), l1.end()) == 3);
+ std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
+ assert(*i == 2);
+ ++i;
+ assert(*i == 3);
+ ++i;
+ assert(*i == 1);
+ }
+ {
+ std::list<int, min_allocator<int>> l1(a1, a1 + 3);
+ std::list<int, min_allocator<int>> l2(a2, a2 + 3);
+ l1.splice(l1.begin(), l2, std::next(l2.begin()), l2.end());
+ assert(l1.size() == 5);
+ assert(std::distance(l1.begin(), l1.end()) == 5);
+ std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
+ assert(*i == 5);
+ ++i;
+ assert(*i == 6);
+ ++i;
+ assert(*i == 1);
+ ++i;
+ assert(*i == 2);
+ ++i;
+ assert(*i == 3);
+ assert(l2.size() == 1);
+ i = l2.begin();
+ assert(*i == 4);
+ }
+ {
+ std::list<int, min_allocator<int>> l1(a1, a1 + 3);
+ std::list<int, min_allocator<int>> l2(a2, a2 + 3);
+ l1.splice(std::next(l1.begin()), l2, std::next(l2.begin()), l2.end());
+ assert(l1.size() == 5);
+ assert(std::distance(l1.begin(), l1.end()) == 5);
+ std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
+ assert(*i == 1);
+ ++i;
+ assert(*i == 5);
+ ++i;
+ assert(*i == 6);
+ ++i;
+ assert(*i == 2);
+ ++i;
+ assert(*i == 3);
+ assert(l2.size() == 1);
+ i = l2.begin();
+ assert(*i == 4);
+ }
+ {
+ std::list<int, min_allocator<int>> l1(a1, a1 + 3);
+ std::list<int, min_allocator<int>> l2(a2, a2 + 3);
+ l1.splice(l1.end(), l2, std::next(l2.begin()), l2.end());
+ assert(l1.size() == 5);
+ assert(std::distance(l1.begin(), l1.end()) == 5);
+ std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
+ assert(*i == 1);
+ ++i;
+ assert(*i == 2);
+ ++i;
+ assert(*i == 3);
+ ++i;
+ assert(*i == 5);
+ ++i;
+ assert(*i == 6);
+ assert(l2.size() == 1);
+ i = l2.begin();
+ assert(*i == 4);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/list/list.ops/unique.pass.cpp b/libcxx/test/std/containers/sequences/list/list.ops/unique.pass.cpp
index f78f6f152ae91a2..c08e348218f95a9 100644
--- a/libcxx/test/std/containers/sequences/list/list.ops/unique.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.ops/unique.pass.cpp
@@ -17,34 +17,33 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
int a1[] = {2, 1, 1, 4, 4, 4, 4, 3, 3};
int a2[] = {2, 1, 4, 3};
typedef std::list<int> L;
- L c(a1, a1+sizeof(a1)/sizeof(a1[0]));
+ L c(a1, a1 + sizeof(a1) / sizeof(a1[0]));
#if TEST_STD_VER > 17
ASSERT_SAME_TYPE(L::size_type, decltype(c.unique()));
assert(c.unique() == 5);
#else
- ASSERT_SAME_TYPE(void, decltype(c.unique()));
+ ASSERT_SAME_TYPE(void, decltype(c.unique()));
c.unique();
#endif
- assert(c == std::list<int>(a2, a2+4));
- }
+ assert(c == std::list<int>(a2, a2 + 4));
+ }
#if TEST_STD_VER >= 11
- {
+ {
int a1[] = {2, 1, 1, 4, 4, 4, 4, 3, 3};
int a2[] = {2, 1, 4, 3};
- std::list<int, min_allocator<int>> c(a1, a1+sizeof(a1)/sizeof(a1[0]));
-#if TEST_STD_VER > 17
+ std::list<int, min_allocator<int>> c(a1, a1 + sizeof(a1) / sizeof(a1[0]));
+# if TEST_STD_VER > 17
assert(c.unique() == 5);
-#else
+# else
c.unique();
-#endif
- assert((c == std::list<int, min_allocator<int>>(a2, a2+4)));
- }
+# endif
+ assert((c == std::list<int, min_allocator<int>>(a2, a2 + 4)));
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/list/list.ops/unique_pred.pass.cpp b/libcxx/test/std/containers/sequences/list/list.ops/unique_pred.pass.cpp
index 316b7c1b44d8d31..1d3a8e0c426aa00 100644
--- a/libcxx/test/std/containers/sequences/list/list.ops/unique_pred.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.ops/unique_pred.pass.cpp
@@ -18,10 +18,7 @@
#include "test_macros.h"
#include "min_allocator.h"
-bool g(int x, int y)
-{
- return x == y;
-}
+bool g(int x, int y) { return x == y; }
struct PredLWG526 {
PredLWG526(int i) : i_(i) {}
@@ -32,26 +29,25 @@ struct PredLWG526 {
int i_;
};
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
int a1[] = {2, 1, 1, 4, 4, 4, 4, 3, 3};
int a2[] = {2, 1, 4, 3};
typedef std::list<int> L;
- L c(a1, a1+sizeof(a1)/sizeof(a1[0]));
+ L c(a1, a1 + sizeof(a1) / sizeof(a1[0]));
#if TEST_STD_VER > 17
ASSERT_SAME_TYPE(L::size_type, decltype(c.unique(g)));
assert(c.unique(g) == 5);
#else
- ASSERT_SAME_TYPE(void, decltype(c.unique(g)));
+ ASSERT_SAME_TYPE(void, decltype(c.unique(g)));
c.unique(g);
#endif
- assert(c == std::list<int>(a2, a2+4));
- }
+ assert(c == std::list<int>(a2, a2 + 4));
+ }
- { // LWG issue #526
+ { // LWG issue #526
int a1[] = {1, 1, 1, 2, 3, 5, 5, 2, 11};
- int a2[] = {1, 2, 3, 5, 2, 11};
+ int a2[] = {1, 2, 3, 5, 2, 11};
std::list<PredLWG526> c(a1, a1 + 9);
#if TEST_STD_VER > 17
assert(c.unique(std::ref(c.front())) == 3);
@@ -59,25 +55,24 @@ int main(int, char**)
c.unique(std::ref(c.front()));
#endif
assert(c.size() == 6);
- for (std::size_t i = 0; i < c.size(); ++i)
- {
- assert(c.front() == a2[i]);
- c.pop_front();
- }
+ for (std::size_t i = 0; i < c.size(); ++i) {
+ assert(c.front() == a2[i]);
+ c.pop_front();
}
+ }
#if TEST_STD_VER >= 11
- {
+ {
int a1[] = {2, 1, 1, 4, 4, 4, 4, 3, 3};
int a2[] = {2, 1, 4, 3};
- std::list<int, min_allocator<int>> c(a1, a1+sizeof(a1)/sizeof(a1[0]));
-#if TEST_STD_VER > 17
+ std::list<int, min_allocator<int>> c(a1, a1 + sizeof(a1) / sizeof(a1[0]));
+# if TEST_STD_VER > 17
assert(c.unique(g) == 5);
-#else
+# else
c.unique(g);
-#endif
- assert((c == std::list<int, min_allocator<int>>(a2, a2+4)));
- }
+# endif
+ assert((c == std::list<int, min_allocator<int>>(a2, a2 + 4)));
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/list/list.special/swap.pass.cpp b/libcxx/test/std/containers/sequences/list/list.special/swap.pass.cpp
index 6e6eb21246eeb4b..1e9c71131d80a89 100644
--- a/libcxx/test/std/containers/sequences/list/list.special/swap.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.special/swap.pass.cpp
@@ -17,122 +17,121 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- int a1[] = {1, 3, 7, 9, 10};
- int a2[] = {0, 2, 4, 5, 6, 8, 11};
- std::list<int> c1(a1, a1 + 5);
- std::list<int> c2(a2, a2 + 7);
- std::list<int>::iterator it1 = c1.begin();
- std::list<int>::const_iterator it2 = c2.begin();
- swap(c1, c2);
- assert(c1 == std::list<int>(a2, a2 + 7));
- assert(c2 == std::list<int>(a1, a1 + 5));
- assert(it1 == c2.begin()); // Iterators remain valid
- assert(it2 == c1.begin()); // Iterators remain valid
- }
- {
- int a2[] = {0, 2, 4, 5, 6, 8, 11};
- std::list<int> c1;
- std::list<int> c2(a2, a2 + 7);
- swap(c1, c2);
- assert(c1 == std::list<int>(a2, a2 + 7));
- assert(c2.empty());
- assert(std::distance(c2.begin(), c2.end()) == 0);
- }
- {
- int a1[] = {1, 3, 7, 9, 10};
- std::list<int> c1(a1, a1 + 5);
- std::list<int> c2;
- swap(c1, c2);
- assert(c1.empty());
- assert(std::distance(c1.begin(), c1.end()) == 0);
- assert(c2 == std::list<int>(a1, a1 + 5));
- }
- {
- std::list<int> c1;
- std::list<int> c2;
- swap(c1, c2);
- assert(c1.empty());
- assert(std::distance(c1.begin(), c1.end()) == 0);
- assert(c2.empty());
- assert(std::distance(c2.begin(), c2.end()) == 0);
- }
- {
- int a1[] = {1, 3, 7, 9, 10};
- int a2[] = {0, 2, 4, 5, 6, 8, 11};
- typedef test_allocator<int> A;
- std::list<int, A> c1(a1, a1 + 5, A(1));
- std::list<int, A> c2(a2, a2 + 7, A(1));
- swap(c1, c2);
- assert((c1 == std::list<int, A>(a2, a2 + 7)));
- assert(c1.get_allocator() == A(1));
- assert((c2 == std::list<int, A>(a1, a1 + 5)));
- assert(c2.get_allocator() == A(1));
- }
- {
- int a1[] = {1, 3, 7, 9, 10};
- int a2[] = {0, 2, 4, 5, 6, 8, 11};
- typedef other_allocator<int> A;
- std::list<int, A> c1(a1, a1 + 5, A(1));
- std::list<int, A> c2(a2, a2 + 7, A(2));
- swap(c1, c2);
- assert((c1 == std::list<int, A>(a2, a2 + 7)));
- assert(c1.get_allocator() == A(2));
- assert((c2 == std::list<int, A>(a1, a1 + 5)));
- assert(c2.get_allocator() == A(1));
- }
+int main(int, char**) {
+ {
+ int a1[] = {1, 3, 7, 9, 10};
+ int a2[] = {0, 2, 4, 5, 6, 8, 11};
+ std::list<int> c1(a1, a1 + 5);
+ std::list<int> c2(a2, a2 + 7);
+ std::list<int>::iterator it1 = c1.begin();
+ std::list<int>::const_iterator it2 = c2.begin();
+ swap(c1, c2);
+ assert(c1 == std::list<int>(a2, a2 + 7));
+ assert(c2 == std::list<int>(a1, a1 + 5));
+ assert(it1 == c2.begin()); // Iterators remain valid
+ assert(it2 == c1.begin()); // Iterators remain valid
+ }
+ {
+ int a2[] = {0, 2, 4, 5, 6, 8, 11};
+ std::list<int> c1;
+ std::list<int> c2(a2, a2 + 7);
+ swap(c1, c2);
+ assert(c1 == std::list<int>(a2, a2 + 7));
+ assert(c2.empty());
+ assert(std::distance(c2.begin(), c2.end()) == 0);
+ }
+ {
+ int a1[] = {1, 3, 7, 9, 10};
+ std::list<int> c1(a1, a1 + 5);
+ std::list<int> c2;
+ swap(c1, c2);
+ assert(c1.empty());
+ assert(std::distance(c1.begin(), c1.end()) == 0);
+ assert(c2 == std::list<int>(a1, a1 + 5));
+ }
+ {
+ std::list<int> c1;
+ std::list<int> c2;
+ swap(c1, c2);
+ assert(c1.empty());
+ assert(std::distance(c1.begin(), c1.end()) == 0);
+ assert(c2.empty());
+ assert(std::distance(c2.begin(), c2.end()) == 0);
+ }
+ {
+ int a1[] = {1, 3, 7, 9, 10};
+ int a2[] = {0, 2, 4, 5, 6, 8, 11};
+ typedef test_allocator<int> A;
+ std::list<int, A> c1(a1, a1 + 5, A(1));
+ std::list<int, A> c2(a2, a2 + 7, A(1));
+ swap(c1, c2);
+ assert((c1 == std::list<int, A>(a2, a2 + 7)));
+ assert(c1.get_allocator() == A(1));
+ assert((c2 == std::list<int, A>(a1, a1 + 5)));
+ assert(c2.get_allocator() == A(1));
+ }
+ {
+ int a1[] = {1, 3, 7, 9, 10};
+ int a2[] = {0, 2, 4, 5, 6, 8, 11};
+ typedef other_allocator<int> A;
+ std::list<int, A> c1(a1, a1 + 5, A(1));
+ std::list<int, A> c2(a2, a2 + 7, A(2));
+ swap(c1, c2);
+ assert((c1 == std::list<int, A>(a2, a2 + 7)));
+ assert(c1.get_allocator() == A(2));
+ assert((c2 == std::list<int, A>(a1, a1 + 5)));
+ assert(c2.get_allocator() == A(1));
+ }
#if TEST_STD_VER >= 11
- {
- int a1[] = {1, 3, 7, 9, 10};
- int a2[] = {0, 2, 4, 5, 6, 8, 11};
- std::list<int, min_allocator<int>> c1(a1, a1 + 5);
- std::list<int, min_allocator<int>> c2(a2, a2 + 7);
- swap(c1, c2);
- assert((c1 == std::list<int, min_allocator<int>>(a2, a2 + 7)));
- assert((c2 == std::list<int, min_allocator<int>>(a1, a1 + 5)));
- }
- {
- int a2[] = {0, 2, 4, 5, 6, 8, 11};
- std::list<int, min_allocator<int>> c1;
- std::list<int, min_allocator<int>> c2(a2, a2 + 7);
- swap(c1, c2);
- assert((c1 == std::list<int, min_allocator<int>>(a2, a2 + 7)));
- assert(c2.empty());
- assert(std::distance(c2.begin(), c2.end()) == 0);
- }
- {
- int a1[] = {1, 3, 7, 9, 10};
- std::list<int, min_allocator<int>> c1(a1, a1 + 5);
- std::list<int, min_allocator<int>> c2;
- swap(c1, c2);
- assert(c1.empty());
- assert(std::distance(c1.begin(), c1.end()) == 0);
- assert((c2 == std::list<int, min_allocator<int>>(a1, a1 + 5)));
- }
- {
- std::list<int, min_allocator<int>> c1;
- std::list<int, min_allocator<int>> c2;
- swap(c1, c2);
- assert(c1.empty());
- assert(std::distance(c1.begin(), c1.end()) == 0);
- assert(c2.empty());
- assert(std::distance(c2.begin(), c2.end()) == 0);
- }
- {
- int a1[] = {1, 3, 7, 9, 10};
- int a2[] = {0, 2, 4, 5, 6, 8, 11};
- typedef min_allocator<int> A;
- std::list<int, A> c1(a1, a1 + 5, A());
- std::list<int, A> c2(a2, a2 + 7, A());
- swap(c1, c2);
- assert((c1 == std::list<int, A>(a2, a2 + 7)));
- assert(c1.get_allocator() == A());
- assert((c2 == std::list<int, A>(a1, a1 + 5)));
- assert(c2.get_allocator() == A());
- }
+ {
+ int a1[] = {1, 3, 7, 9, 10};
+ int a2[] = {0, 2, 4, 5, 6, 8, 11};
+ std::list<int, min_allocator<int>> c1(a1, a1 + 5);
+ std::list<int, min_allocator<int>> c2(a2, a2 + 7);
+ swap(c1, c2);
+ assert((c1 == std::list<int, min_allocator<int>>(a2, a2 + 7)));
+ assert((c2 == std::list<int, min_allocator<int>>(a1, a1 + 5)));
+ }
+ {
+ int a2[] = {0, 2, 4, 5, 6, 8, 11};
+ std::list<int, min_allocator<int>> c1;
+ std::list<int, min_allocator<int>> c2(a2, a2 + 7);
+ swap(c1, c2);
+ assert((c1 == std::list<int, min_allocator<int>>(a2, a2 + 7)));
+ assert(c2.empty());
+ assert(std::distance(c2.begin(), c2.end()) == 0);
+ }
+ {
+ int a1[] = {1, 3, 7, 9, 10};
+ std::list<int, min_allocator<int>> c1(a1, a1 + 5);
+ std::list<int, min_allocator<int>> c2;
+ swap(c1, c2);
+ assert(c1.empty());
+ assert(std::distance(c1.begin(), c1.end()) == 0);
+ assert((c2 == std::list<int, min_allocator<int>>(a1, a1 + 5)));
+ }
+ {
+ std::list<int, min_allocator<int>> c1;
+ std::list<int, min_allocator<int>> c2;
+ swap(c1, c2);
+ assert(c1.empty());
+ assert(std::distance(c1.begin(), c1.end()) == 0);
+ assert(c2.empty());
+ assert(std::distance(c2.begin(), c2.end()) == 0);
+ }
+ {
+ int a1[] = {1, 3, 7, 9, 10};
+ int a2[] = {0, 2, 4, 5, 6, 8, 11};
+ typedef min_allocator<int> A;
+ std::list<int, A> c1(a1, a1 + 5, A());
+ std::list<int, A> c2(a2, a2 + 7, A());
+ swap(c1, c2);
+ assert((c1 == std::list<int, A>(a2, a2 + 7)));
+ assert(c1.get_allocator() == A());
+ assert((c2 == std::list<int, A>(a1, a1 + 5)));
+ assert(c2.get_allocator() == A());
+ }
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/list/list.special/swap_noexcept.pass.cpp b/libcxx/test/std/containers/sequences/list/list.special/swap_noexcept.pass.cpp
index ae76236c5d5cc69..a4b1622a04bee4a 100644
--- a/libcxx/test/std/containers/sequences/list/list.special/swap_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/list.special/swap_noexcept.pass.cpp
@@ -28,65 +28,61 @@
#include "test_allocator.h"
template <class T>
-struct some_alloc
-{
- typedef T value_type;
+struct some_alloc {
+ typedef T value_type;
- some_alloc() {}
- some_alloc(const some_alloc&);
- void allocate(std::size_t);
- void deallocate(void*, unsigned) {}
+ some_alloc() {}
+ some_alloc(const some_alloc&);
+ void allocate(std::size_t);
+ void deallocate(void*, unsigned) {}
- typedef std::true_type propagate_on_container_swap;
+ typedef std::true_type propagate_on_container_swap;
};
template <class T>
-struct some_alloc2
-{
- typedef T value_type;
+struct some_alloc2 {
+ typedef T value_type;
- some_alloc2() {}
- some_alloc2(const some_alloc2&);
- void allocate(std::size_t);
- void deallocate(void*, unsigned) {}
+ some_alloc2() {}
+ some_alloc2(const some_alloc2&);
+ void allocate(std::size_t);
+ void deallocate(void*, unsigned) {}
- typedef std::false_type propagate_on_container_swap;
- typedef std::true_type is_always_equal;
+ typedef std::false_type propagate_on_container_swap;
+ typedef std::true_type is_always_equal;
};
-int main(int, char**)
-{
- {
- typedef std::list<MoveOnly> C;
- static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
+int main(int, char**) {
+ {
+ typedef std::list<MoveOnly> C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
#if defined(_LIBCPP_VERSION)
- {
- typedef std::list<MoveOnly, test_allocator<MoveOnly>> C;
- static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- {
- typedef std::list<MoveOnly, other_allocator<MoveOnly>> C;
- static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
+ {
+ typedef std::list<MoveOnly, test_allocator<MoveOnly>> C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
+ {
+ typedef std::list<MoveOnly, other_allocator<MoveOnly>> C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
#endif // _LIBCPP_VERSION
- {
- typedef std::list<MoveOnly, some_alloc<MoveOnly>> C;
+ {
+ typedef std::list<MoveOnly, some_alloc<MoveOnly>> C;
#if TEST_STD_VER >= 14
// In C++14, if POCS is set, swapping the allocator is required not to throw
- static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
#else
- static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
#endif
- }
+ }
#if TEST_STD_VER >= 14
- {
- typedef std::list<MoveOnly, some_alloc2<MoveOnly>> C;
+ {
+ typedef std::list<MoveOnly, some_alloc2<MoveOnly>> C;
// if the allocators are always equal, then the swap can be noexcept
- static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
#endif
-
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/list/range_concept_conformance.compile.pass.cpp b/libcxx/test/std/containers/sequences/list/range_concept_conformance.compile.pass.cpp
index 20484efc5e09acf..6f62dedb878d5a9 100644
--- a/libcxx/test/std/containers/sequences/list/range_concept_conformance.compile.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/range_concept_conformance.compile.pass.cpp
@@ -17,7 +17,6 @@
using range = std::list<int>;
-
static_assert(std::same_as<std::ranges::iterator_t<range>, range::iterator>);
static_assert(std::ranges::common_range<range>);
static_assert(std::ranges::bidirectional_range<range>);
diff --git a/libcxx/test/std/containers/sequences/list/types.pass.cpp b/libcxx/test/std/containers/sequences/list/types.pass.cpp
index a2d49080f1bcbbf..755c8bf4df29dd1 100644
--- a/libcxx/test/std/containers/sequences/list/types.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/types.pass.cpp
@@ -47,11 +47,12 @@ static_assert(std::is_same<my_derived<int, min_allocator<int>>::base, my_base>::
static_assert(std::is_same<my_derived<my_base, min_allocator<my_base>>::base, my_base>::value, "");
#endif
-struct A { std::list<A> v; }; // incomplete type support
+struct A {
+ std::list<A> v;
+}; // incomplete type support
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::list<int> C;
static_assert((std::is_same<C::value_type, int>::value), "");
static_assert((std::is_same<C::allocator_type, std::allocator<int> >::value), "");
@@ -65,13 +66,15 @@ int main(int, char**)
static_assert((std::is_signed<typename C::
diff erence_type>::value), "");
static_assert((std::is_unsigned<typename C::size_type>::value), "");
static_assert((std::is_same<typename C::
diff erence_type,
- typename std::iterator_traits<typename C::iterator>::
diff erence_type>::value), "");
+ typename std::iterator_traits<typename C::iterator>::
diff erence_type>::value),
+ "");
static_assert((std::is_same<typename C::
diff erence_type,
- typename std::iterator_traits<typename C::const_iterator>::
diff erence_type>::value), "");
- }
+ typename std::iterator_traits<typename C::const_iterator>::
diff erence_type>::value),
+ "");
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::list<int, min_allocator<int>> C;
static_assert((std::is_same<C::value_type, int>::value), "");
static_assert((std::is_same<C::allocator_type, min_allocator<int> >::value), "");
@@ -83,10 +86,12 @@ int main(int, char**)
static_assert((std::is_signed<typename C::
diff erence_type>::value), "");
static_assert((std::is_unsigned<typename C::size_type>::value), "");
static_assert((std::is_same<typename C::
diff erence_type,
- typename std::iterator_traits<typename C::iterator>::
diff erence_type>::value), "");
+ typename std::iterator_traits<typename C::iterator>::
diff erence_type>::value),
+ "");
static_assert((std::is_same<typename C::
diff erence_type,
- typename std::iterator_traits<typename C::const_iterator>::
diff erence_type>::value), "");
- }
+ typename std::iterator_traits<typename C::const_iterator>::
diff erence_type>::value),
+ "");
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/vector.bool/append_range.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/append_range.pass.cpp
index aafeec766944905..84047ea15c6cf5c 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/append_range.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/append_range.pass.cpp
@@ -31,12 +31,12 @@ constexpr bool test() {
});
});
- { // Vector may or may not need to reallocate because of the insertion -- make sure to test both cases.
+ { // Vector may or may not need to reallocate because of the insertion -- make sure to test both cases.
{ // Ensure reallocation happens.
- constexpr int N = 255;
- bool in[N] = {};
+ constexpr int N = 255;
+ bool in[N] = {};
std::vector<bool> v = {0, 0, 0, 1, 1, 0, 0, 0};
- auto initial = v;
+ auto initial = v;
assert(v.capacity() < v.size() + std::ranges::size(in));
v.append_range(in);
@@ -48,7 +48,7 @@ constexpr bool test() {
}
{ // Ensure no reallocation happens.
- bool in[] = {1, 1, 1, 1, 0, 0, 1, 1, 1, 1};
+ bool in[] = {1, 1, 1, 1, 0, 0, 1, 1, 1, 1};
std::vector<bool> v = {0, 0, 0, 1, 1, 0, 0, 0};
v.reserve(v.size() + std::ranges::size(in));
assert(v.capacity() >= v.size() + std::ranges::size(in));
diff --git a/libcxx/test/std/containers/sequences/vector.bool/assign_copy.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/assign_copy.pass.cpp
index c4866ea4c9b45d0..214447860189762 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/assign_copy.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/assign_copy.pass.cpp
@@ -16,40 +16,38 @@
#include "test_allocator.h"
#include "min_allocator.h"
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- {
- std::vector<bool, test_allocator<bool> > l(3, true, test_allocator<bool>(5));
- std::vector<bool, test_allocator<bool> > l2(l, test_allocator<bool>(3));
- l2 = l;
- assert(l2 == l);
- assert(l2.get_allocator() == test_allocator<bool>(3));
- }
- {
- std::vector<bool, other_allocator<bool> > l(3, true, other_allocator<bool>(5));
- std::vector<bool, other_allocator<bool> > l2(l, other_allocator<bool>(3));
- l2 = l;
- assert(l2 == l);
- assert(l2.get_allocator() == other_allocator<bool>(5));
- }
+TEST_CONSTEXPR_CXX20 bool tests() {
+ {
+ std::vector<bool, test_allocator<bool> > l(3, true, test_allocator<bool>(5));
+ std::vector<bool, test_allocator<bool> > l2(l, test_allocator<bool>(3));
+ l2 = l;
+ assert(l2 == l);
+ assert(l2.get_allocator() == test_allocator<bool>(3));
+ }
+ {
+ std::vector<bool, other_allocator<bool> > l(3, true, other_allocator<bool>(5));
+ std::vector<bool, other_allocator<bool> > l2(l, other_allocator<bool>(3));
+ l2 = l;
+ assert(l2 == l);
+ assert(l2.get_allocator() == other_allocator<bool>(5));
+ }
#if TEST_STD_VER >= 11
- {
- std::vector<bool, min_allocator<bool> > l(3, true, min_allocator<bool>());
- std::vector<bool, min_allocator<bool> > l2(l, min_allocator<bool>());
- l2 = l;
- assert(l2 == l);
- assert(l2.get_allocator() == min_allocator<bool>());
- }
+ {
+ std::vector<bool, min_allocator<bool> > l(3, true, min_allocator<bool>());
+ std::vector<bool, min_allocator<bool> > l2(l, min_allocator<bool>());
+ l2 = l;
+ assert(l2 == l);
+ assert(l2.get_allocator() == min_allocator<bool>());
+ }
#endif
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector.bool/assign_initializer_list.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/assign_initializer_list.pass.cpp
index 0f5ec9061f52d33..3c48c0cceba0f63 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/assign_initializer_list.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/assign_initializer_list.pass.cpp
@@ -18,9 +18,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- {
+TEST_CONSTEXPR_CXX20 bool tests() {
+ {
std::vector<bool> d;
d.assign({true, false, false, true});
assert(d.size() == 4);
@@ -28,8 +27,8 @@ TEST_CONSTEXPR_CXX20 bool tests()
assert(d[1] == false);
assert(d[2] == false);
assert(d[3] == true);
- }
- {
+ }
+ {
std::vector<bool, min_allocator<bool>> d;
d.assign({true, false, false, true});
assert(d.size() == 4);
@@ -37,16 +36,15 @@ TEST_CONSTEXPR_CXX20 bool tests()
assert(d[1] == false);
assert(d[2] == false);
assert(d[3] == true);
- }
+ }
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector.bool/assign_move.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/assign_move.pass.cpp
index 10271efc3f40383..48ef5e3a8c262f0 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/assign_move.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/assign_move.pass.cpp
@@ -18,73 +18,67 @@
#include "test_allocator.h"
#include "min_allocator.h"
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- {
- std::vector<bool, test_allocator<bool> > l(test_allocator<bool>(5));
- std::vector<bool, test_allocator<bool> > lo(test_allocator<bool>(5));
- for (int i = 1; i <= 3; ++i)
- {
- l.push_back(i);
- lo.push_back(i);
- }
- std::vector<bool, test_allocator<bool> > l2(test_allocator<bool>(5));
- l2 = std::move(l);
- assert(l2 == lo);
- LIBCPP_ASSERT(l.empty());
- assert(l2.get_allocator() == lo.get_allocator());
+TEST_CONSTEXPR_CXX20 bool tests() {
+ {
+ std::vector<bool, test_allocator<bool> > l(test_allocator<bool>(5));
+ std::vector<bool, test_allocator<bool> > lo(test_allocator<bool>(5));
+ for (int i = 1; i <= 3; ++i) {
+ l.push_back(i);
+ lo.push_back(i);
}
- {
- std::vector<bool, test_allocator<bool> > l(test_allocator<bool>(5));
- std::vector<bool, test_allocator<bool> > lo(test_allocator<bool>(5));
- for (int i = 1; i <= 3; ++i)
- {
- l.push_back(i);
- lo.push_back(i);
- }
- std::vector<bool, test_allocator<bool> > l2(test_allocator<bool>(6));
- l2 = std::move(l);
- assert(l2 == lo);
- assert(!l.empty());
- assert(l2.get_allocator() == test_allocator<bool>(6));
+ std::vector<bool, test_allocator<bool> > l2(test_allocator<bool>(5));
+ l2 = std::move(l);
+ assert(l2 == lo);
+ LIBCPP_ASSERT(l.empty());
+ assert(l2.get_allocator() == lo.get_allocator());
+ }
+ {
+ std::vector<bool, test_allocator<bool> > l(test_allocator<bool>(5));
+ std::vector<bool, test_allocator<bool> > lo(test_allocator<bool>(5));
+ for (int i = 1; i <= 3; ++i) {
+ l.push_back(i);
+ lo.push_back(i);
}
- {
- std::vector<bool, other_allocator<bool> > l(other_allocator<bool>(5));
- std::vector<bool, other_allocator<bool> > lo(other_allocator<bool>(5));
- for (int i = 1; i <= 3; ++i)
- {
- l.push_back(i);
- lo.push_back(i);
- }
- std::vector<bool, other_allocator<bool> > l2(other_allocator<bool>(6));
- l2 = std::move(l);
- assert(l2 == lo);
- assert(l.empty());
- assert(l2.get_allocator() == lo.get_allocator());
+ std::vector<bool, test_allocator<bool> > l2(test_allocator<bool>(6));
+ l2 = std::move(l);
+ assert(l2 == lo);
+ assert(!l.empty());
+ assert(l2.get_allocator() == test_allocator<bool>(6));
+ }
+ {
+ std::vector<bool, other_allocator<bool> > l(other_allocator<bool>(5));
+ std::vector<bool, other_allocator<bool> > lo(other_allocator<bool>(5));
+ for (int i = 1; i <= 3; ++i) {
+ l.push_back(i);
+ lo.push_back(i);
}
- {
- std::vector<bool, min_allocator<bool> > l(min_allocator<bool>{});
- std::vector<bool, min_allocator<bool> > lo(min_allocator<bool>{});
- for (int i = 1; i <= 3; ++i)
- {
- l.push_back(i);
- lo.push_back(i);
- }
- std::vector<bool, min_allocator<bool> > l2(min_allocator<bool>{});
- l2 = std::move(l);
- assert(l2 == lo);
- assert(l.empty());
- assert(l2.get_allocator() == lo.get_allocator());
+ std::vector<bool, other_allocator<bool> > l2(other_allocator<bool>(6));
+ l2 = std::move(l);
+ assert(l2 == lo);
+ assert(l.empty());
+ assert(l2.get_allocator() == lo.get_allocator());
+ }
+ {
+ std::vector<bool, min_allocator<bool> > l(min_allocator<bool>{});
+ std::vector<bool, min_allocator<bool> > lo(min_allocator<bool>{});
+ for (int i = 1; i <= 3; ++i) {
+ l.push_back(i);
+ lo.push_back(i);
}
+ std::vector<bool, min_allocator<bool> > l2(min_allocator<bool>{});
+ l2 = std::move(l);
+ assert(l2 == lo);
+ assert(l.empty());
+ assert(l2.get_allocator() == lo.get_allocator());
+ }
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector.bool/assign_range.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/assign_range.pass.cpp
index a8cbb32c2655e2c..1e215e49b53fdc3 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/assign_range.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/assign_range.pass.cpp
@@ -32,10 +32,10 @@ constexpr bool test() {
});
});
- { // Vector may or may not need to reallocate because of the assignment -- make sure to test both cases.
+ { // Vector may or may not need to reallocate because of the assignment -- make sure to test both cases.
{ // Ensure reallocation happens. Note that `vector<bool>` typically reserves a lot of capacity.
- constexpr int N = 255;
- bool in[N] = {};
+ constexpr int N = 255;
+ bool in[N] = {};
std::vector<bool> v = {0, 0, 0, 1, 1, 0, 0, 0};
assert(v.capacity() < v.size() + std::ranges::size(in));
@@ -44,7 +44,7 @@ constexpr bool test() {
}
{ // Ensure no reallocation happens.
- bool in[] = {1, 1, 0, 1, 1};
+ bool in[] = {1, 1, 0, 1, 1};
std::vector<bool> v = {0, 0, 0, 1, 1, 0, 0, 0};
v.assign_range(in);
diff --git a/libcxx/test/std/containers/sequences/vector.bool/capacity.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/capacity.pass.cpp
index 986453a189049cb..46946bf07456c1c 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/capacity.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/capacity.pass.cpp
@@ -17,39 +17,37 @@
#include "test_macros.h"
#include "min_allocator.h"
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- {
- std::vector<bool> v;
- assert(v.capacity() == 0);
- }
- {
- std::vector<bool> v(100);
- assert(v.capacity() >= 100);
- v.push_back(0);
- assert(v.capacity() >= 101);
- }
+TEST_CONSTEXPR_CXX20 bool tests() {
+ {
+ std::vector<bool> v;
+ assert(v.capacity() == 0);
+ }
+ {
+ std::vector<bool> v(100);
+ assert(v.capacity() >= 100);
+ v.push_back(0);
+ assert(v.capacity() >= 101);
+ }
#if TEST_STD_VER >= 11
- {
- std::vector<bool, min_allocator<bool>> v;
- assert(v.capacity() == 0);
- }
- {
- std::vector<bool, min_allocator<bool>> v(100);
- assert(v.capacity() >= 100);
- v.push_back(0);
- assert(v.capacity() >= 101);
- }
+ {
+ std::vector<bool, min_allocator<bool>> v;
+ assert(v.capacity() == 0);
+ }
+ {
+ std::vector<bool, min_allocator<bool>> v(100);
+ assert(v.capacity() >= 100);
+ v.push_back(0);
+ assert(v.capacity() >= 101);
+ }
#endif
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector.bool/compare.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/compare.pass.cpp
index 0f818029c1ff980..5300447c5357920 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/compare.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/compare.pass.cpp
@@ -21,69 +21,69 @@
#include "test_comparisons.h"
TEST_CONSTEXPR_CXX20 bool test() {
- typedef std::vector<bool> VB;
- {
- const VB v1, v2;
- assert(testComparisons(v1, v2, true, false));
- }
- {
- const VB v1(1, true);
- const VB v2(1, true);
- assert(testComparisons(v1, v2, true, false));
- }
- {
- const VB v1(1, false);
- const VB v2(1, true);
- assert(testComparisons(v1, v2, false, true));
- }
- {
- const VB v1, v2(1, true);
- assert(testComparisons(v1, v2, false, true));
- }
- {
- bool items1[3] = {false, true, false};
- bool items2[3] = {false, true, true};
- const VB v1(items1, items1 + 3);
- const VB v2(items2, items2 + 3);
- assert(testComparisons(v1, v2, false, true));
- }
- {
- bool items1[3] = {false, false, false};
- bool items2[3] = {false, true, false};
- const VB v1(items1, items1 + 3);
- const VB v2(items2, items2 + 3);
- assert(testComparisons(v1, v2, false, true));
- }
- {
- bool items1[2] = {false, true};
- bool items2[3] = {false, true, false};
- const VB v1(items1, items1 + 2);
- const VB v2(items2, items2 + 3);
- assert(testComparisons(v1, v2, false, true));
- }
- {
- bool items[3] = {false, true, false};
- const VB v1(items, items + 3);
- const VB v2(1, true);
- assert(testComparisons(v1, v2, false, true));
- }
- {
- assert( (std::vector<bool>() == std::vector<bool>()));
- assert(!(std::vector<bool>() != std::vector<bool>()));
- assert(!(std::vector<bool>() < std::vector<bool>()));
- assert( (std::vector<bool>() <= std::vector<bool>()));
- assert(!(std::vector<bool>() > std::vector<bool>()));
- assert( (std::vector<bool>() >= std::vector<bool>()));
- }
+ typedef std::vector<bool> VB;
+ {
+ const VB v1, v2;
+ assert(testComparisons(v1, v2, true, false));
+ }
+ {
+ const VB v1(1, true);
+ const VB v2(1, true);
+ assert(testComparisons(v1, v2, true, false));
+ }
+ {
+ const VB v1(1, false);
+ const VB v2(1, true);
+ assert(testComparisons(v1, v2, false, true));
+ }
+ {
+ const VB v1, v2(1, true);
+ assert(testComparisons(v1, v2, false, true));
+ }
+ {
+ bool items1[3] = {false, true, false};
+ bool items2[3] = {false, true, true};
+ const VB v1(items1, items1 + 3);
+ const VB v2(items2, items2 + 3);
+ assert(testComparisons(v1, v2, false, true));
+ }
+ {
+ bool items1[3] = {false, false, false};
+ bool items2[3] = {false, true, false};
+ const VB v1(items1, items1 + 3);
+ const VB v2(items2, items2 + 3);
+ assert(testComparisons(v1, v2, false, true));
+ }
+ {
+ bool items1[2] = {false, true};
+ bool items2[3] = {false, true, false};
+ const VB v1(items1, items1 + 2);
+ const VB v2(items2, items2 + 3);
+ assert(testComparisons(v1, v2, false, true));
+ }
+ {
+ bool items[3] = {false, true, false};
+ const VB v1(items, items + 3);
+ const VB v2(1, true);
+ assert(testComparisons(v1, v2, false, true));
+ }
+ {
+ assert((std::vector<bool>() == std::vector<bool>()));
+ assert(!(std::vector<bool>() != std::vector<bool>()));
+ assert(!(std::vector<bool>() < std::vector<bool>()));
+ assert((std::vector<bool>() <= std::vector<bool>()));
+ assert(!(std::vector<bool>() > std::vector<bool>()));
+ assert((std::vector<bool>() >= std::vector<bool>()));
+ }
- return true;
+ return true;
}
int main(int, char**) {
- test();
+ test();
#if TEST_STD_VER > 17
- static_assert(test());
+ static_assert(test());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector.bool/const_reference.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/const_reference.pass.cpp
index c2cb7f0298ddbe8..dd81f3208daa26c 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/const_reference.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/const_reference.pass.cpp
@@ -33,7 +33,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
int main(int, char**) {
test();
#if TEST_STD_VER > 17
- static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/vector.bool/construct_default.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/construct_default.pass.cpp
index 8f07524d070bb62..09d33369aebcd3d 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/construct_default.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/construct_default.pass.cpp
@@ -15,7 +15,6 @@
// For vector<>, this was added to the standard by N4258,
// but vector<bool> was not changed.
-
#include <vector>
#include <cassert>
@@ -24,64 +23,62 @@
#include "min_allocator.h"
template <class C>
-TEST_CONSTEXPR_CXX20 void test0()
-{
+TEST_CONSTEXPR_CXX20 void test0() {
#if TEST_STD_VER > 14
- LIBCPP_STATIC_ASSERT((noexcept(C{})), "" );
+ LIBCPP_STATIC_ASSERT((noexcept(C{})), "");
#elif TEST_STD_VER >= 11
- LIBCPP_STATIC_ASSERT((noexcept(C()) == noexcept(typename C::allocator_type())), "" );
+ LIBCPP_STATIC_ASSERT((noexcept(C()) == noexcept(typename C::allocator_type())), "");
#endif
- C c;
- LIBCPP_ASSERT(c.__invariants());
- assert(c.empty());
- assert(c.get_allocator() == typename C::allocator_type());
+ C c;
+ LIBCPP_ASSERT(c.__invariants());
+ assert(c.empty());
+ assert(c.get_allocator() == typename C::allocator_type());
#if TEST_STD_VER >= 11
- C c1 = {};
- LIBCPP_ASSERT(c1.__invariants());
- assert(c1.empty());
- assert(c1.get_allocator() == typename C::allocator_type());
+ C c1 = {};
+ LIBCPP_ASSERT(c1.__invariants());
+ assert(c1.empty());
+ assert(c1.get_allocator() == typename C::allocator_type());
#endif
}
template <class C>
-TEST_CONSTEXPR_CXX20 void test1(const typename C::allocator_type& a)
-{
+TEST_CONSTEXPR_CXX20 void test1(const typename C::allocator_type& a) {
#if TEST_STD_VER > 14
- LIBCPP_STATIC_ASSERT((noexcept(C{typename C::allocator_type{}})), "" );
+ LIBCPP_STATIC_ASSERT((noexcept(C{typename C::allocator_type{}})), "");
#elif TEST_STD_VER >= 11
- LIBCPP_STATIC_ASSERT((noexcept(C(typename C::allocator_type())) == std::is_nothrow_copy_constructible<typename C::allocator_type>::value), "" );
+ LIBCPP_STATIC_ASSERT((noexcept(C(typename C::allocator_type())) ==
+ std::is_nothrow_copy_constructible<typename C::allocator_type>::value),
+ "");
#endif
- C c(a);
- LIBCPP_ASSERT(c.__invariants());
- assert(c.empty());
- assert(c.get_allocator() == a);
+ C c(a);
+ LIBCPP_ASSERT(c.__invariants());
+ assert(c.empty());
+ assert(c.get_allocator() == a);
}
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- {
+TEST_CONSTEXPR_CXX20 bool tests() {
+ {
test0<std::vector<bool> >();
test1<std::vector<bool, test_allocator<bool> > >(test_allocator<bool>(3));
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
test0<std::vector<bool, min_allocator<bool>> >();
test1<std::vector<bool, min_allocator<bool> > >(min_allocator<bool>());
- }
- {
+ }
+ {
test0<std::vector<bool, explicit_allocator<bool>> >();
test1<std::vector<bool, explicit_allocator<bool> > >(explicit_allocator<bool>());
- }
+ }
#endif
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector.bool/construct_iter_iter.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/construct_iter_iter.pass.cpp
index 2f520d5abbf3e36..e9fb2e6ecfbaca5 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/construct_iter_iter.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/construct_iter_iter.pass.cpp
@@ -20,40 +20,40 @@
#include "min_allocator.h"
template <class C, class Iterator>
-TEST_CONSTEXPR_CXX20 void test(Iterator first, Iterator last)
-{
- C c(first, last);
- LIBCPP_ASSERT(c.__invariants());
- assert(c.size() == static_cast<std::size_t>(std::distance(first, last)));
- for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i, ++first)
- assert(*i == *first);
+TEST_CONSTEXPR_CXX20 void test(Iterator first, Iterator last) {
+ C c(first, last);
+ LIBCPP_ASSERT(c.__invariants());
+ assert(c.size() == static_cast<std::size_t>(std::distance(first, last)));
+ for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i, ++first)
+ assert(*i == *first);
}
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- bool a[] = {0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0};
- bool* an = a + sizeof(a)/sizeof(a[0]);
- test<std::vector<bool> >(cpp17_input_iterator<const bool*>(a), cpp17_input_iterator<const bool*>(an));
- test<std::vector<bool> >(forward_iterator<const bool*>(a), forward_iterator<const bool*>(an));
- test<std::vector<bool> >(bidirectional_iterator<const bool*>(a), bidirectional_iterator<const bool*>(an));
- test<std::vector<bool> >(random_access_iterator<const bool*>(a), random_access_iterator<const bool*>(an));
- test<std::vector<bool> >(a, an);
+TEST_CONSTEXPR_CXX20 bool tests() {
+ bool a[] = {0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0};
+ bool* an = a + sizeof(a) / sizeof(a[0]);
+ test<std::vector<bool> >(cpp17_input_iterator<const bool*>(a), cpp17_input_iterator<const bool*>(an));
+ test<std::vector<bool> >(forward_iterator<const bool*>(a), forward_iterator<const bool*>(an));
+ test<std::vector<bool> >(bidirectional_iterator<const bool*>(a), bidirectional_iterator<const bool*>(an));
+ test<std::vector<bool> >(random_access_iterator<const bool*>(a), random_access_iterator<const bool*>(an));
+ test<std::vector<bool> >(a, an);
#if TEST_STD_VER >= 11
- test<std::vector<bool, min_allocator<bool>> >(cpp17_input_iterator<const bool*>(a), cpp17_input_iterator<const bool*>(an));
- test<std::vector<bool, min_allocator<bool>> >(forward_iterator<const bool*>(a), forward_iterator<const bool*>(an));
- test<std::vector<bool, min_allocator<bool>> >(bidirectional_iterator<const bool*>(a), bidirectional_iterator<const bool*>(an));
- test<std::vector<bool, min_allocator<bool>> >(random_access_iterator<const bool*>(a), random_access_iterator<const bool*>(an));
- test<std::vector<bool, min_allocator<bool>> >(a, an);
+ test<std::vector<bool, min_allocator<bool>> >(
+ cpp17_input_iterator<const bool*>(a), cpp17_input_iterator<const bool*>(an));
+ test<std::vector<bool, min_allocator<bool>> >(forward_iterator<const bool*>(a), forward_iterator<const bool*>(an));
+ test<std::vector<bool, min_allocator<bool>> >(
+ bidirectional_iterator<const bool*>(a), bidirectional_iterator<const bool*>(an));
+ test<std::vector<bool, min_allocator<bool>> >(
+ random_access_iterator<const bool*>(a), random_access_iterator<const bool*>(an));
+ test<std::vector<bool, min_allocator<bool>> >(a, an);
#endif
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector.bool/construct_iter_iter_alloc.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/construct_iter_iter_alloc.pass.cpp
index 57e1cb2e0b50272..71a176a0a64ba77 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/construct_iter_iter_alloc.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/construct_iter_iter_alloc.pass.cpp
@@ -21,46 +21,47 @@
#include "min_allocator.h"
template <class C, class Iterator>
-TEST_CONSTEXPR_CXX20 void test(Iterator first, Iterator last, const typename C::allocator_type& a)
-{
- C c(first, last, a);
- LIBCPP_ASSERT(c.__invariants());
- assert(c.size() == static_cast<std::size_t>(std::distance(first, last)));
- for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i, ++first)
- assert(*i == *first);
+TEST_CONSTEXPR_CXX20 void test(Iterator first, Iterator last, const typename C::allocator_type& a) {
+ C c(first, last, a);
+ LIBCPP_ASSERT(c.__invariants());
+ assert(c.size() == static_cast<std::size_t>(std::distance(first, last)));
+ for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i, ++first)
+ assert(*i == *first);
}
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- bool a[] = {0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0};
- bool* an = a + sizeof(a)/sizeof(a[0]);
- {
+TEST_CONSTEXPR_CXX20 bool tests() {
+ bool a[] = {0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0};
+ bool* an = a + sizeof(a) / sizeof(a[0]);
+ {
std::allocator<bool> alloc;
test<std::vector<bool> >(cpp17_input_iterator<const bool*>(a), cpp17_input_iterator<const bool*>(an), alloc);
test<std::vector<bool> >(forward_iterator<const bool*>(a), forward_iterator<const bool*>(an), alloc);
test<std::vector<bool> >(bidirectional_iterator<const bool*>(a), bidirectional_iterator<const bool*>(an), alloc);
test<std::vector<bool> >(random_access_iterator<const bool*>(a), random_access_iterator<const bool*>(an), alloc);
test<std::vector<bool> >(a, an, alloc);
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
min_allocator<bool> alloc;
- test<std::vector<bool, min_allocator<bool>> >(cpp17_input_iterator<const bool*>(a), cpp17_input_iterator<const bool*>(an), alloc);
- test<std::vector<bool, min_allocator<bool>> >(forward_iterator<const bool*>(a), forward_iterator<const bool*>(an), alloc);
- test<std::vector<bool, min_allocator<bool>> >(bidirectional_iterator<const bool*>(a), bidirectional_iterator<const bool*>(an), alloc);
- test<std::vector<bool, min_allocator<bool>> >(random_access_iterator<const bool*>(a), random_access_iterator<const bool*>(an), alloc);
+ test<std::vector<bool, min_allocator<bool>> >(
+ cpp17_input_iterator<const bool*>(a), cpp17_input_iterator<const bool*>(an), alloc);
+ test<std::vector<bool, min_allocator<bool>> >(
+ forward_iterator<const bool*>(a), forward_iterator<const bool*>(an), alloc);
+ test<std::vector<bool, min_allocator<bool>> >(
+ bidirectional_iterator<const bool*>(a), bidirectional_iterator<const bool*>(an), alloc);
+ test<std::vector<bool, min_allocator<bool>> >(
+ random_access_iterator<const bool*>(a), random_access_iterator<const bool*>(an), alloc);
test<std::vector<bool, min_allocator<bool>> >(a, an, alloc);
- }
+ }
#endif
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector.bool/construct_size.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/construct_size.pass.cpp
index bcc5a16859d3613..80b3fe307c93a61 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/construct_size.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/construct_size.pass.cpp
@@ -19,16 +19,15 @@
#include "test_allocator.h"
template <class C>
-TEST_CONSTEXPR_CXX20 void test2(typename C::size_type n,
- typename C::allocator_type const& a = typename C::allocator_type ())
-{
+TEST_CONSTEXPR_CXX20 void
+test2(typename C::size_type n, typename C::allocator_type const& a = typename C::allocator_type()) {
#if TEST_STD_VER >= 14
- C c(n, a);
- LIBCPP_ASSERT(c.__invariants());
- assert(c.size() == n);
- assert(c.get_allocator() == a);
- for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i)
- assert(*i == typename C::value_type());
+ C c(n, a);
+ LIBCPP_ASSERT(c.__invariants());
+ assert(c.size() == n);
+ assert(c.get_allocator() == a);
+ for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i)
+ assert(*i == typename C::value_type());
#else
((void)n);
((void)a);
@@ -36,39 +35,35 @@ TEST_CONSTEXPR_CXX20 void test2(typename C::size_type n,
}
template <class C>
-TEST_CONSTEXPR_CXX20 void test1(typename C::size_type n)
-{
- C c(n);
- LIBCPP_ASSERT(c.__invariants());
- assert(c.size() == n);
- assert(c.get_allocator() == typename C::allocator_type());
- for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i)
- assert(*i == typename C::value_type());
+TEST_CONSTEXPR_CXX20 void test1(typename C::size_type n) {
+ C c(n);
+ LIBCPP_ASSERT(c.__invariants());
+ assert(c.size() == n);
+ assert(c.get_allocator() == typename C::allocator_type());
+ for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i)
+ assert(*i == typename C::value_type());
}
template <class C>
-TEST_CONSTEXPR_CXX20 void test(typename C::size_type n)
-{
- test1<C> ( n );
- test2<C> ( n );
+TEST_CONSTEXPR_CXX20 void test(typename C::size_type n) {
+ test1<C>(n);
+ test2<C>(n);
}
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- test<std::vector<bool> >(50);
+TEST_CONSTEXPR_CXX20 bool tests() {
+ test<std::vector<bool> >(50);
#if TEST_STD_VER >= 11
- test<std::vector<bool, min_allocator<bool>> >(50);
- test2<std::vector<bool, test_allocator<bool>> >( 100, test_allocator<bool>(23));
+ test<std::vector<bool, min_allocator<bool>> >(50);
+ test2<std::vector<bool, test_allocator<bool>> >(100, test_allocator<bool>(23));
#endif
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector.bool/construct_size_value.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/construct_size_value.pass.cpp
index 629e8ba57ca85e7..17d3ea2c5dd8d94 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/construct_size_value.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/construct_size_value.pass.cpp
@@ -18,30 +18,27 @@
#include "min_allocator.h"
template <class C>
-TEST_CONSTEXPR_CXX20 void test(typename C::size_type n, const typename C::value_type& x)
-{
- C c(n, x);
- LIBCPP_ASSERT(c.__invariants());
- assert(c.size() == n);
- for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i)
- assert(*i == x);
+TEST_CONSTEXPR_CXX20 void test(typename C::size_type n, const typename C::value_type& x) {
+ C c(n, x);
+ LIBCPP_ASSERT(c.__invariants());
+ assert(c.size() == n);
+ for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i)
+ assert(*i == x);
}
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- test<std::vector<bool> >(50, true);
+TEST_CONSTEXPR_CXX20 bool tests() {
+ test<std::vector<bool> >(50, true);
#if TEST_STD_VER >= 11
- test<std::vector<bool, min_allocator<bool>> >(50, true);
+ test<std::vector<bool, min_allocator<bool>> >(50, true);
#endif
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector.bool/construct_size_value_alloc.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/construct_size_value_alloc.pass.cpp
index 94a44ad282b7151..f63b7b35c2daa41 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/construct_size_value_alloc.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/construct_size_value_alloc.pass.cpp
@@ -18,33 +18,29 @@
#include "min_allocator.h"
template <class C>
-TEST_CONSTEXPR_CXX20 void test(typename C::size_type n,
- const typename C::value_type& x,
- const typename C::allocator_type& a)
-{
- C c(n, x, a);
- LIBCPP_ASSERT(c.__invariants());
- assert(a == c.get_allocator());
- assert(c.size() == n);
- for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i)
- assert(*i == x);
+TEST_CONSTEXPR_CXX20 void
+test(typename C::size_type n, const typename C::value_type& x, const typename C::allocator_type& a) {
+ C c(n, x, a);
+ LIBCPP_ASSERT(c.__invariants());
+ assert(a == c.get_allocator());
+ assert(c.size() == n);
+ for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i)
+ assert(*i == x);
}
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- test<std::vector<bool> >(50, true, std::allocator<bool>());
+TEST_CONSTEXPR_CXX20 bool tests() {
+ test<std::vector<bool> >(50, true, std::allocator<bool>());
#if TEST_STD_VER >= 11
- test<std::vector<bool, min_allocator<bool>> >(50, true, min_allocator<bool>());
+ test<std::vector<bool, min_allocator<bool>> >(50, true, min_allocator<bool>());
#endif
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector.bool/copy.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/copy.pass.cpp
index bfd37e956dbdf08..15b26e8054df821 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/copy.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/copy.pass.cpp
@@ -19,56 +19,53 @@
#include "min_allocator.h"
template <class C>
-TEST_CONSTEXPR_CXX20 void test(const C& x)
-{
- typename C::size_type s = x.size();
- C c(x);
- LIBCPP_ASSERT(c.__invariants());
- assert(c.size() == s);
- assert(c == x);
+TEST_CONSTEXPR_CXX20 void test(const C& x) {
+ typename C::size_type s = x.size();
+ C c(x);
+ LIBCPP_ASSERT(c.__invariants());
+ assert(c.size() == s);
+ assert(c == x);
}
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- {
- bool a[] = {0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0};
- bool* an = a + sizeof(a)/sizeof(a[0]);
- test(std::vector<bool>(a, an));
- }
- {
- std::vector<bool, test_allocator<bool> > v(3, true, test_allocator<bool>(5));
- std::vector<bool, test_allocator<bool> > v2 = v;
- assert(v2 == v);
- assert(v2.get_allocator() == v.get_allocator());
- }
+TEST_CONSTEXPR_CXX20 bool tests() {
+ {
+ bool a[] = {0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0};
+ bool* an = a + sizeof(a) / sizeof(a[0]);
+ test(std::vector<bool>(a, an));
+ }
+ {
+ std::vector<bool, test_allocator<bool> > v(3, true, test_allocator<bool>(5));
+ std::vector<bool, test_allocator<bool> > v2 = v;
+ assert(v2 == v);
+ assert(v2.get_allocator() == v.get_allocator());
+ }
#if TEST_STD_VER >= 11
- {
- std::vector<bool, other_allocator<bool> > v(3, true, other_allocator<bool>(5));
- std::vector<bool, other_allocator<bool> > v2 = v;
- assert(v2 == v);
- assert(v2.get_allocator() == other_allocator<bool>(-2));
- }
- {
- bool a[] = {0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0};
- bool* an = a + sizeof(a)/sizeof(a[0]);
- test(std::vector<bool, min_allocator<bool>>(a, an));
- }
- {
- std::vector<bool, min_allocator<bool> > v(3, true, min_allocator<bool>());
- std::vector<bool, min_allocator<bool> > v2 = v;
- assert(v2 == v);
- assert(v2.get_allocator() == v.get_allocator());
- }
+ {
+ std::vector<bool, other_allocator<bool> > v(3, true, other_allocator<bool>(5));
+ std::vector<bool, other_allocator<bool> > v2 = v;
+ assert(v2 == v);
+ assert(v2.get_allocator() == other_allocator<bool>(-2));
+ }
+ {
+ bool a[] = {0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0};
+ bool* an = a + sizeof(a) / sizeof(a[0]);
+ test(std::vector<bool, min_allocator<bool>>(a, an));
+ }
+ {
+ std::vector<bool, min_allocator<bool> > v(3, true, min_allocator<bool>());
+ std::vector<bool, min_allocator<bool> > v2 = v;
+ assert(v2 == v);
+ assert(v2.get_allocator() == v.get_allocator());
+ }
#endif
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector.bool/copy_alloc.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/copy_alloc.pass.cpp
index 468bf5d866004ef..d22b7c5d584474a 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/copy_alloc.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/copy_alloc.pass.cpp
@@ -18,56 +18,53 @@
#include "min_allocator.h"
template <class C>
-TEST_CONSTEXPR_CXX20 void test(const C& x, const typename C::allocator_type& a)
-{
- typename C::size_type s = x.size();
- C c(x, a);
- LIBCPP_ASSERT(c.__invariants());
- assert(c.size() == s);
- assert(c == x);
+TEST_CONSTEXPR_CXX20 void test(const C& x, const typename C::allocator_type& a) {
+ typename C::size_type s = x.size();
+ C c(x, a);
+ LIBCPP_ASSERT(c.__invariants());
+ assert(c.size() == s);
+ assert(c == x);
}
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- {
- bool a[] = {0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0};
- bool* an = a + sizeof(a)/sizeof(a[0]);
- test(std::vector<bool>(a, an), std::allocator<bool>());
- }
- {
- std::vector<bool, test_allocator<bool> > l(3, true, test_allocator<bool>(5));
- std::vector<bool, test_allocator<bool> > l2(l, test_allocator<bool>(3));
- assert(l2 == l);
- assert(l2.get_allocator() == test_allocator<bool>(3));
- }
- {
- std::vector<bool, other_allocator<bool> > l(3, true, other_allocator<bool>(5));
- std::vector<bool, other_allocator<bool> > l2(l, other_allocator<bool>(3));
- assert(l2 == l);
- assert(l2.get_allocator() == other_allocator<bool>(3));
- }
+TEST_CONSTEXPR_CXX20 bool tests() {
+ {
+ bool a[] = {0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0};
+ bool* an = a + sizeof(a) / sizeof(a[0]);
+ test(std::vector<bool>(a, an), std::allocator<bool>());
+ }
+ {
+ std::vector<bool, test_allocator<bool> > l(3, true, test_allocator<bool>(5));
+ std::vector<bool, test_allocator<bool> > l2(l, test_allocator<bool>(3));
+ assert(l2 == l);
+ assert(l2.get_allocator() == test_allocator<bool>(3));
+ }
+ {
+ std::vector<bool, other_allocator<bool> > l(3, true, other_allocator<bool>(5));
+ std::vector<bool, other_allocator<bool> > l2(l, other_allocator<bool>(3));
+ assert(l2 == l);
+ assert(l2.get_allocator() == other_allocator<bool>(3));
+ }
#if TEST_STD_VER >= 11
- {
- bool a[] = {0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0};
- bool* an = a + sizeof(a)/sizeof(a[0]);
- test(std::vector<bool, min_allocator<bool>>(a, an), min_allocator<bool>());
- }
- {
- std::vector<bool, min_allocator<bool> > l(3, true, min_allocator<bool>());
- std::vector<bool, min_allocator<bool> > l2(l, min_allocator<bool>());
- assert(l2 == l);
- assert(l2.get_allocator() == min_allocator<bool>());
- }
+ {
+ bool a[] = {0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0};
+ bool* an = a + sizeof(a) / sizeof(a[0]);
+ test(std::vector<bool, min_allocator<bool>>(a, an), min_allocator<bool>());
+ }
+ {
+ std::vector<bool, min_allocator<bool> > l(3, true, min_allocator<bool>());
+ std::vector<bool, min_allocator<bool> > l2(l, min_allocator<bool>());
+ assert(l2 == l);
+ assert(l2.get_allocator() == min_allocator<bool>());
+ }
#endif
return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector.bool/default_noexcept.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/default_noexcept.pass.cpp
index a43b6483b0535b1..080170962509042 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/default_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/default_noexcept.pass.cpp
@@ -16,7 +16,6 @@
// For vector<>, this was added to the standard by N4258,
// but vector<bool> was not changed.
-
#include <vector>
#include <cassert>
@@ -24,31 +23,29 @@
#include "test_allocator.h"
template <class T>
-struct some_alloc
-{
- typedef T value_type;
- some_alloc(const some_alloc&);
+struct some_alloc {
+ typedef T value_type;
+ some_alloc(const some_alloc&);
};
-int main(int, char**)
-{
+int main(int, char**) {
#if defined(_LIBCPP_VERSION)
- {
- typedef std::vector<bool> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
- }
- {
- typedef std::vector<bool, test_allocator<bool>> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
- }
- {
- typedef std::vector<bool, other_allocator<bool>> C;
- static_assert(!std::is_nothrow_default_constructible<C>::value, "");
- }
- {
- typedef std::vector<bool, some_alloc<bool>> C;
- static_assert(!std::is_nothrow_default_constructible<C>::value, "");
- }
+ {
+ typedef std::vector<bool> C;
+ static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ }
+ {
+ typedef std::vector<bool, test_allocator<bool>> C;
+ static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ }
+ {
+ typedef std::vector<bool, other_allocator<bool>> C;
+ static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+ }
+ {
+ typedef std::vector<bool, some_alloc<bool>> C;
+ static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+ }
#endif // _LIBCPP_VERSION
return 0;
diff --git a/libcxx/test/std/containers/sequences/vector.bool/dtor_noexcept.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/dtor_noexcept.pass.cpp
index 569a95f8bc9f6be..f8f3c76f8c3d9c1 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/dtor_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/dtor_noexcept.pass.cpp
@@ -19,32 +19,30 @@
#include "test_allocator.h"
template <class T>
-struct some_alloc
-{
- typedef T value_type;
- some_alloc(const some_alloc&);
- ~some_alloc() noexcept(false);
+struct some_alloc {
+ typedef T value_type;
+ some_alloc(const some_alloc&);
+ ~some_alloc() noexcept(false);
};
-int main(int, char**)
-{
- {
- typedef std::vector<bool> C;
- static_assert(std::is_nothrow_destructible<C>::value, "");
- }
- {
- typedef std::vector<bool, test_allocator<bool>> C;
- static_assert(std::is_nothrow_destructible<C>::value, "");
- }
- {
- typedef std::vector<bool, other_allocator<bool>> C;
- static_assert(std::is_nothrow_destructible<C>::value, "");
- }
+int main(int, char**) {
+ {
+ typedef std::vector<bool> C;
+ static_assert(std::is_nothrow_destructible<C>::value, "");
+ }
+ {
+ typedef std::vector<bool, test_allocator<bool>> C;
+ static_assert(std::is_nothrow_destructible<C>::value, "");
+ }
+ {
+ typedef std::vector<bool, other_allocator<bool>> C;
+ static_assert(std::is_nothrow_destructible<C>::value, "");
+ }
#if defined(_LIBCPP_VERSION)
- {
- typedef std::vector<bool, some_alloc<bool>> C;
- static_assert(!std::is_nothrow_destructible<C>::value, "");
- }
+ {
+ typedef std::vector<bool, some_alloc<bool>> C;
+ static_assert(!std::is_nothrow_destructible<C>::value, "");
+ }
#endif // _LIBCPP_VERSION
return 0;
diff --git a/libcxx/test/std/containers/sequences/vector.bool/emplace.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/emplace.pass.cpp
index 134af5a7979a19e..810a1968605d849 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/emplace.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/emplace.pass.cpp
@@ -17,62 +17,60 @@
#include "test_macros.h"
#include "min_allocator.h"
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- {
- typedef std::vector<bool> C;
- C c;
+TEST_CONSTEXPR_CXX20 bool tests() {
+ {
+ typedef std::vector<bool> C;
+ C c;
- C::iterator i = c.emplace(c.cbegin());
- assert(i == c.begin());
- assert(c.size() == 1);
- assert(c.front() == false);
+ C::iterator i = c.emplace(c.cbegin());
+ assert(i == c.begin());
+ assert(c.size() == 1);
+ assert(c.front() == false);
- i = c.emplace(c.cend(), true);
- assert(i == c.end()-1);
- assert(c.size() == 2);
- assert(c.front() == false);
- assert(c.back() == true);
+ i = c.emplace(c.cend(), true);
+ assert(i == c.end() - 1);
+ assert(c.size() == 2);
+ assert(c.front() == false);
+ assert(c.back() == true);
- i = c.emplace(c.cbegin()+1, true);
- assert(i == c.begin()+1);
- assert(c.size() == 3);
- assert(c.front() == false);
- assert(c[1] == true);
- assert(c.back() == true);
- }
- {
- typedef std::vector<bool, min_allocator<bool>> C;
- C c;
+ i = c.emplace(c.cbegin() + 1, true);
+ assert(i == c.begin() + 1);
+ assert(c.size() == 3);
+ assert(c.front() == false);
+ assert(c[1] == true);
+ assert(c.back() == true);
+ }
+ {
+ typedef std::vector<bool, min_allocator<bool>> C;
+ C c;
- C::iterator i = c.emplace(c.cbegin());
- assert(i == c.begin());
- assert(c.size() == 1);
- assert(c.front() == false);
+ C::iterator i = c.emplace(c.cbegin());
+ assert(i == c.begin());
+ assert(c.size() == 1);
+ assert(c.front() == false);
- i = c.emplace(c.cend(), true);
- assert(i == c.end()-1);
- assert(c.size() == 2);
- assert(c.front() == false);
- assert(c.back() == true);
+ i = c.emplace(c.cend(), true);
+ assert(i == c.end() - 1);
+ assert(c.size() == 2);
+ assert(c.front() == false);
+ assert(c.back() == true);
- i = c.emplace(c.cbegin()+1, true);
- assert(i == c.begin()+1);
- assert(c.size() == 3);
- assert(c.size() == 3);
- assert(c.front() == false);
- assert(c[1] == true);
- assert(c.back() == true);
- }
+ i = c.emplace(c.cbegin() + 1, true);
+ assert(i == c.begin() + 1);
+ assert(c.size() == 3);
+ assert(c.size() == 3);
+ assert(c.front() == false);
+ assert(c[1] == true);
+ assert(c.back() == true);
+ }
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector.bool/emplace_back.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/emplace_back.pass.cpp
index fccf6e5fb962ca2..87da6fd9f60194b 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/emplace_back.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/emplace_back.pass.cpp
@@ -18,84 +18,82 @@
#include "test_macros.h"
#include "min_allocator.h"
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- {
- typedef std::vector<bool> C;
- C c;
+TEST_CONSTEXPR_CXX20 bool tests() {
+ {
+ typedef std::vector<bool> C;
+ C c;
#if TEST_STD_VER > 14
- typedef C::reference Ref;
- Ref r1 = c.emplace_back();
- assert(c.size() == 1);
- assert(c.front() == false);
- r1 = true;
- assert(c.front() == true);
- r1 = false;
- Ref r2 = c.emplace_back(true);
- assert(c.size() == 2);
- assert(c.front() == false);
- assert(c.back() == true);
- r2 = false;
- assert(c.back() == false);
- r2 = true;
+ typedef C::reference Ref;
+ Ref r1 = c.emplace_back();
+ assert(c.size() == 1);
+ assert(c.front() == false);
+ r1 = true;
+ assert(c.front() == true);
+ r1 = false;
+ Ref r2 = c.emplace_back(true);
+ assert(c.size() == 2);
+ assert(c.front() == false);
+ assert(c.back() == true);
+ r2 = false;
+ assert(c.back() == false);
+ r2 = true;
#else
- c.emplace_back();
- assert(c.size() == 1);
- assert(c.front() == false);
- c.emplace_back(true);
- assert(c.size() == 2);
- assert(c.front() == false);
- assert(c.back() == true);
+ c.emplace_back();
+ assert(c.size() == 1);
+ assert(c.front() == false);
+ c.emplace_back(true);
+ assert(c.size() == 2);
+ assert(c.front() == false);
+ assert(c.back() == true);
#endif
- c.emplace_back(true);
- assert(c.size() == 3);
- assert(c.front() == false);
- assert(c[1] == true);
- assert(c.back() == true);
- }
- {
- typedef std::vector<bool, min_allocator<bool>> C;
- C c;
+ c.emplace_back(true);
+ assert(c.size() == 3);
+ assert(c.front() == false);
+ assert(c[1] == true);
+ assert(c.back() == true);
+ }
+ {
+ typedef std::vector<bool, min_allocator<bool>> C;
+ C c;
#if TEST_STD_VER > 14
- typedef C::reference Ref;
- Ref r1 = c.emplace_back();
- assert(c.size() == 1);
- assert(c.front() == false);
- r1 = true;
- assert(c.front() == true);
- r1 = false;
- Ref r2 = c.emplace_back(true);
- assert(c.size() == 2);
- assert(c.front() == false);
- assert(c.back() == true);
- r2 = false;
- assert(c.back() == false);
- r2 = true;
+ typedef C::reference Ref;
+ Ref r1 = c.emplace_back();
+ assert(c.size() == 1);
+ assert(c.front() == false);
+ r1 = true;
+ assert(c.front() == true);
+ r1 = false;
+ Ref r2 = c.emplace_back(true);
+ assert(c.size() == 2);
+ assert(c.front() == false);
+ assert(c.back() == true);
+ r2 = false;
+ assert(c.back() == false);
+ r2 = true;
#else
- c.emplace_back();
- assert(c.size() == 1);
- assert(c.front() == false);
- c.emplace_back(true);
- assert(c.size() == 2);
- assert(c.front() == false);
- assert(c.back() == true);
+ c.emplace_back();
+ assert(c.size() == 1);
+ assert(c.front() == false);
+ c.emplace_back(true);
+ assert(c.size() == 2);
+ assert(c.front() == false);
+ assert(c.back() == true);
#endif
- c.emplace_back(true);
- assert(c.size() == 3);
- assert(c.front() == false);
- assert(c[1] == true);
- assert(c.back() == true);
- }
+ c.emplace_back(true);
+ assert(c.size() == 3);
+ assert(c.front() == false);
+ assert(c[1] == true);
+ assert(c.back() == true);
+ }
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector.bool/empty.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/empty.pass.cpp
index ec4d2f97045dd0b..806a04cf061ad4d 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/empty.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/empty.pass.cpp
@@ -18,9 +18,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- {
+TEST_CONSTEXPR_CXX20 bool tests() {
+ {
typedef std::vector<bool> C;
C c;
ASSERT_NOEXCEPT(c.empty());
@@ -29,9 +28,9 @@ TEST_CONSTEXPR_CXX20 bool tests()
assert(!c.empty());
c.clear();
assert(c.empty());
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::vector<bool, min_allocator<bool>> C;
C c;
ASSERT_NOEXCEPT(c.empty());
@@ -40,17 +39,16 @@ TEST_CONSTEXPR_CXX20 bool tests()
assert(!c.empty());
c.clear();
assert(c.empty());
- }
+ }
#endif
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector.bool/empty.verify.cpp b/libcxx/test/std/containers/sequences/vector.bool/empty.verify.cpp
index 167e095b798f4d6..71b17ff68d19226 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/empty.verify.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/empty.verify.cpp
@@ -17,6 +17,6 @@
#include <vector>
void f() {
- std::vector<bool> c;
- c.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::vector<bool> c;
+ c.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}
diff --git a/libcxx/test/std/containers/sequences/vector.bool/enabled_hash.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/enabled_hash.pass.cpp
index 66361202f8c0036..41cedd68fe50e87 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/enabled_hash.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/enabled_hash.pass.cpp
@@ -30,7 +30,7 @@ int main(int, char**) {
test_library_hash_specializations_available();
test();
#if TEST_STD_VER > 17
- static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/vector.bool/erase_iter.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/erase_iter.pass.cpp
index 42d1e76a9c7705a..2479d4c048013c6 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/erase_iter.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/erase_iter.pass.cpp
@@ -18,11 +18,10 @@
#include "test_macros.h"
#include "min_allocator.h"
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- bool a1[] = {1, 0, 1};
- {
- std::vector<bool> l1(a1, a1+3);
+TEST_CONSTEXPR_CXX20 bool tests() {
+ bool a1[] = {1, 0, 1};
+ {
+ std::vector<bool> l1(a1, a1 + 3);
std::vector<bool>::const_iterator i = l1.begin();
++i;
std::vector<bool>::iterator j = l1.erase(i);
@@ -40,10 +39,10 @@ TEST_CONSTEXPR_CXX20 bool tests()
assert(j == l1.end());
assert(l1.size() == 0);
assert(std::distance(l1.begin(), l1.end()) == 0);
- }
+ }
#if TEST_STD_VER >= 11
- {
- std::vector<bool, min_allocator<bool>> l1(a1, a1+3);
+ {
+ std::vector<bool, min_allocator<bool>> l1(a1, a1 + 3);
std::vector<bool, min_allocator<bool>>::const_iterator i = l1.begin();
++i;
std::vector<bool, min_allocator<bool>>::iterator j = l1.erase(i);
@@ -61,17 +60,16 @@ TEST_CONSTEXPR_CXX20 bool tests()
assert(j == l1.end());
assert(l1.size() == 0);
assert(std::distance(l1.begin(), l1.end()) == 0);
- }
+ }
#endif
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector.bool/erase_iter_iter.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/erase_iter_iter.pass.cpp
index c19ce9987e1e162..1afd481b40efe95 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/erase_iter_iter.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/erase_iter_iter.pass.cpp
@@ -18,80 +18,78 @@
#include "test_macros.h"
#include "min_allocator.h"
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- bool a1[] = {1, 0, 1};
- {
- std::vector<bool> l1(a1, a1+3);
- std::vector<bool>::iterator i = l1.erase(l1.cbegin(), l1.cbegin());
- assert(l1.size() == 3);
- assert(std::distance(l1.cbegin(), l1.cend()) == 3);
- assert(i == l1.begin());
- }
- {
- std::vector<bool> l1(a1, a1+3);
- std::vector<bool>::iterator i = l1.erase(l1.cbegin(), std::next(l1.cbegin()));
- assert(l1.size() == 2);
- assert(std::distance(l1.cbegin(), l1.cend()) == 2);
- assert(i == l1.begin());
- assert(l1 == std::vector<bool>(a1+1, a1+3));
- }
- {
- std::vector<bool> l1(a1, a1+3);
- std::vector<bool>::iterator i = l1.erase(l1.cbegin(), std::next(l1.cbegin(), 2));
- assert(l1.size() == 1);
- assert(std::distance(l1.cbegin(), l1.cend()) == 1);
- assert(i == l1.begin());
- assert(l1 == std::vector<bool>(a1+2, a1+3));
- }
- {
- std::vector<bool> l1(a1, a1+3);
- std::vector<bool>::iterator i = l1.erase(l1.cbegin(), std::next(l1.cbegin(), 3));
- assert(l1.size() == 0);
- assert(std::distance(l1.cbegin(), l1.cend()) == 0);
- assert(i == l1.begin());
- }
+TEST_CONSTEXPR_CXX20 bool tests() {
+ bool a1[] = {1, 0, 1};
+ {
+ std::vector<bool> l1(a1, a1 + 3);
+ std::vector<bool>::iterator i = l1.erase(l1.cbegin(), l1.cbegin());
+ assert(l1.size() == 3);
+ assert(std::distance(l1.cbegin(), l1.cend()) == 3);
+ assert(i == l1.begin());
+ }
+ {
+ std::vector<bool> l1(a1, a1 + 3);
+ std::vector<bool>::iterator i = l1.erase(l1.cbegin(), std::next(l1.cbegin()));
+ assert(l1.size() == 2);
+ assert(std::distance(l1.cbegin(), l1.cend()) == 2);
+ assert(i == l1.begin());
+ assert(l1 == std::vector<bool>(a1 + 1, a1 + 3));
+ }
+ {
+ std::vector<bool> l1(a1, a1 + 3);
+ std::vector<bool>::iterator i = l1.erase(l1.cbegin(), std::next(l1.cbegin(), 2));
+ assert(l1.size() == 1);
+ assert(std::distance(l1.cbegin(), l1.cend()) == 1);
+ assert(i == l1.begin());
+ assert(l1 == std::vector<bool>(a1 + 2, a1 + 3));
+ }
+ {
+ std::vector<bool> l1(a1, a1 + 3);
+ std::vector<bool>::iterator i = l1.erase(l1.cbegin(), std::next(l1.cbegin(), 3));
+ assert(l1.size() == 0);
+ assert(std::distance(l1.cbegin(), l1.cend()) == 0);
+ assert(i == l1.begin());
+ }
#if TEST_STD_VER >= 11
- {
- std::vector<bool, min_allocator<bool>> l1(a1, a1+3);
- std::vector<bool, min_allocator<bool>>::iterator i = l1.erase(l1.cbegin(), l1.cbegin());
- assert(l1.size() == 3);
- assert(std::distance(l1.cbegin(), l1.cend()) == 3);
- assert(i == l1.begin());
- }
- {
- std::vector<bool, min_allocator<bool>> l1(a1, a1+3);
- std::vector<bool, min_allocator<bool>>::iterator i = l1.erase(l1.cbegin(), std::next(l1.cbegin()));
- assert(l1.size() == 2);
- assert(std::distance(l1.cbegin(), l1.cend()) == 2);
- assert(i == l1.begin());
- assert((l1 == std::vector<bool, min_allocator<bool>>(a1+1, a1+3)));
- }
- {
- std::vector<bool, min_allocator<bool>> l1(a1, a1+3);
- std::vector<bool, min_allocator<bool>>::iterator i = l1.erase(l1.cbegin(), std::next(l1.cbegin(), 2));
- assert(l1.size() == 1);
- assert(std::distance(l1.cbegin(), l1.cend()) == 1);
- assert(i == l1.begin());
- assert((l1 == std::vector<bool, min_allocator<bool>>(a1+2, a1+3)));
- }
- {
- std::vector<bool, min_allocator<bool>> l1(a1, a1+3);
- std::vector<bool, min_allocator<bool>>::iterator i = l1.erase(l1.cbegin(), std::next(l1.cbegin(), 3));
- assert(l1.size() == 0);
- assert(std::distance(l1.cbegin(), l1.cend()) == 0);
- assert(i == l1.begin());
- }
+ {
+ std::vector<bool, min_allocator<bool>> l1(a1, a1 + 3);
+ std::vector<bool, min_allocator<bool>>::iterator i = l1.erase(l1.cbegin(), l1.cbegin());
+ assert(l1.size() == 3);
+ assert(std::distance(l1.cbegin(), l1.cend()) == 3);
+ assert(i == l1.begin());
+ }
+ {
+ std::vector<bool, min_allocator<bool>> l1(a1, a1 + 3);
+ std::vector<bool, min_allocator<bool>>::iterator i = l1.erase(l1.cbegin(), std::next(l1.cbegin()));
+ assert(l1.size() == 2);
+ assert(std::distance(l1.cbegin(), l1.cend()) == 2);
+ assert(i == l1.begin());
+ assert((l1 == std::vector<bool, min_allocator<bool>>(a1 + 1, a1 + 3)));
+ }
+ {
+ std::vector<bool, min_allocator<bool>> l1(a1, a1 + 3);
+ std::vector<bool, min_allocator<bool>>::iterator i = l1.erase(l1.cbegin(), std::next(l1.cbegin(), 2));
+ assert(l1.size() == 1);
+ assert(std::distance(l1.cbegin(), l1.cend()) == 1);
+ assert(i == l1.begin());
+ assert((l1 == std::vector<bool, min_allocator<bool>>(a1 + 2, a1 + 3)));
+ }
+ {
+ std::vector<bool, min_allocator<bool>> l1(a1, a1 + 3);
+ std::vector<bool, min_allocator<bool>>::iterator i = l1.erase(l1.cbegin(), std::next(l1.cbegin(), 3));
+ assert(l1.size() == 0);
+ assert(std::distance(l1.cbegin(), l1.cend()) == 0);
+ assert(i == l1.begin());
+ }
#endif
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector.bool/find.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/find.pass.cpp
index 73cca82e79f11c1..744496fcc0234e6 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/find.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/find.pass.cpp
@@ -20,35 +20,31 @@
#include "test_macros.h"
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- {
- for (unsigned i = 1; i < 256; ++i)
- {
- std::vector<bool> b(i,true);
- std::vector<bool>::iterator j = std::find(b.begin()+1, b.end(), false);
- assert(static_cast<std::size_t>(j-b.begin()) == i);
- assert(b.end() == j);
- }
+TEST_CONSTEXPR_CXX20 bool tests() {
+ {
+ for (unsigned i = 1; i < 256; ++i) {
+ std::vector<bool> b(i, true);
+ std::vector<bool>::iterator j = std::find(b.begin() + 1, b.end(), false);
+ assert(static_cast<std::size_t>(j - b.begin()) == i);
+ assert(b.end() == j);
}
- {
- for (unsigned i = 1; i < 256; ++i)
- {
- std::vector<bool> b(i,false);
- std::vector<bool>::iterator j = std::find(b.begin()+1, b.end(), true);
- assert(static_cast<std::size_t>(j-b.begin()) == i);
- assert(b.end() == j);
- }
+ }
+ {
+ for (unsigned i = 1; i < 256; ++i) {
+ std::vector<bool> b(i, false);
+ std::vector<bool>::iterator j = std::find(b.begin() + 1, b.end(), true);
+ assert(static_cast<std::size_t>(j - b.begin()) == i);
+ assert(b.end() == j);
}
+ }
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector.bool/get_allocator.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/get_allocator.pass.cpp
index a088cd8119abc7a..efd4310f9f88d09 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/get_allocator.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/get_allocator.pass.cpp
@@ -19,25 +19,25 @@
#include "test_macros.h"
TEST_CONSTEXPR_CXX20 bool test() {
- {
- std::allocator<bool> alloc;
- const std::vector<bool> vb(alloc);
- assert(vb.get_allocator() == alloc);
- }
- {
- other_allocator<bool> alloc(1);
- const std::vector<bool, other_allocator<bool> > vb(alloc);
- assert(vb.get_allocator() == alloc);
- }
-
- return true;
+ {
+ std::allocator<bool> alloc;
+ const std::vector<bool> vb(alloc);
+ assert(vb.get_allocator() == alloc);
+ }
+ {
+ other_allocator<bool> alloc(1);
+ const std::vector<bool, other_allocator<bool> > vb(alloc);
+ assert(vb.get_allocator() == alloc);
+ }
+
+ return true;
}
int main(int, char**) {
test();
#if TEST_STD_VER > 17
- static_assert(test());
+ static_assert(test());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector.bool/initializer_list.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/initializer_list.pass.cpp
index 9b13922240d5740..83ca3efd51984a9 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/initializer_list.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/initializer_list.pass.cpp
@@ -18,33 +18,31 @@
#include "test_macros.h"
#include "min_allocator.h"
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- {
+TEST_CONSTEXPR_CXX20 bool tests() {
+ {
std::vector<bool> d = {true, false, false, true};
assert(d.size() == 4);
assert(d[0] == true);
assert(d[1] == false);
assert(d[2] == false);
assert(d[3] == true);
- }
- {
+ }
+ {
std::vector<bool, min_allocator<bool>> d = {true, false, false, true};
assert(d.size() == 4);
assert(d[0] == true);
assert(d[1] == false);
assert(d[2] == false);
assert(d[3] == true);
- }
+ }
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector.bool/initializer_list_alloc.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/initializer_list_alloc.pass.cpp
index 0d5dd8a79fc53e6..b26c62c647f0a87 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/initializer_list_alloc.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/initializer_list_alloc.pass.cpp
@@ -19,9 +19,8 @@
#include "test_allocator.h"
#include "min_allocator.h"
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- {
+TEST_CONSTEXPR_CXX20 bool tests() {
+ {
std::vector<bool, test_allocator<bool>> d({true, false, false, true}, test_allocator<bool>(3));
assert(d.get_allocator() == test_allocator<bool>(3));
assert(d.size() == 4);
@@ -29,8 +28,8 @@ TEST_CONSTEXPR_CXX20 bool tests()
assert(d[1] == false);
assert(d[2] == false);
assert(d[3] == true);
- }
- {
+ }
+ {
std::vector<bool, min_allocator<bool>> d({true, false, false, true}, min_allocator<bool>());
assert(d.get_allocator() == min_allocator<bool>());
assert(d.size() == 4);
@@ -38,16 +37,15 @@ TEST_CONSTEXPR_CXX20 bool tests()
assert(d[1] == false);
assert(d[2] == false);
assert(d[3] == true);
- }
+ }
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector.bool/insert_iter_initializer_list.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/insert_iter_initializer_list.pass.cpp
index 2462e05f2036003..2642770675b4ebf 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/insert_iter_initializer_list.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/insert_iter_initializer_list.pass.cpp
@@ -18,9 +18,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- {
+TEST_CONSTEXPR_CXX20 bool tests() {
+ {
std::vector<bool> d(10, true);
std::vector<bool>::iterator i = d.insert(d.cbegin() + 2, {false, true, true, false});
assert(d.size() == 14);
@@ -39,8 +38,8 @@ TEST_CONSTEXPR_CXX20 bool tests()
assert(d[11] == true);
assert(d[12] == true);
assert(d[13] == true);
- }
- {
+ }
+ {
std::vector<bool, min_allocator<bool>> d(10, true);
std::vector<bool, min_allocator<bool>>::iterator i = d.insert(d.cbegin() + 2, {false, true, true, false});
assert(d.size() == 14);
@@ -59,16 +58,15 @@ TEST_CONSTEXPR_CXX20 bool tests()
assert(d[11] == true);
assert(d[12] == true);
assert(d[13] == true);
- }
+ }
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector.bool/insert_iter_iter_iter.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/insert_iter_iter_iter.pass.cpp
index d3e1297aeec928e..3ab437c9a154618 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/insert_iter_iter_iter.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/insert_iter_iter_iter.pass.cpp
@@ -20,136 +20,138 @@
#include "test_iterators.h"
#include "min_allocator.h"
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- {
- std::vector<bool> v(100);
- bool a[] = {1, 0, 0, 1, 1};
- const unsigned N = sizeof(a)/sizeof(a[0]);
- std::vector<bool>::iterator i = v.insert(v.cbegin() + 10, cpp17_input_iterator<const bool*>(a),
- cpp17_input_iterator<const bool*>(a+N));
- assert(v.size() == 100 + N);
- assert(i == v.begin() + 10);
- std::size_t j;
- for (j = 0; j < 10; ++j)
- assert(v[j] == 0);
- for (std::size_t k = 0; k < N; ++j, ++k)
- assert(v[j] == a[k]);
- for (; j < v.size(); ++j)
- assert(v[j] == 0);
- }
- {
- std::vector<bool> v(100);
- bool a[] = {1, 0, 0, 1, 1};
- const unsigned N = sizeof(a)/sizeof(a[0]);
- std::vector<bool>::iterator i = v.insert(v.cbegin() + 10, forward_iterator<const bool*>(a),
- forward_iterator<const bool*>(a+N));
- assert(v.size() == 100 + N);
- assert(i == v.begin() + 10);
- int j;
- for (j = 0; j < 10; ++j)
- assert(v[j] == 0);
- for (std::size_t k = 0; k < N; ++j, ++k)
- assert(v[j] == a[k]);
- for (; j < 105; ++j)
- assert(v[j] == 0);
- }
- {
- std::vector<bool> v(100);
- while(v.size() < v.capacity()) v.push_back(false);
- std::size_t sz = v.size();
- bool a[] = {1, 0, 0, 1, 1};
- const unsigned N = sizeof(a)/sizeof(a[0]);
- std::vector<bool>::iterator i = v.insert(v.cbegin() + 10, forward_iterator<const bool*>(a),
- forward_iterator<const bool*>(a+N));
- assert(v.size() == sz + N);
- assert(i == v.begin() + 10);
- std::size_t j;
- for (j = 0; j < 10; ++j)
- assert(v[j] == 0);
- for (std::size_t k = 0; k < N; ++j, ++k)
- assert(v[j] == a[k]);
- for (; j < v.size(); ++j)
- assert(v[j] == 0);
- }
- {
- std::vector<bool> v(100);
- while(v.size() < v.capacity()) v.push_back(false);
- v.pop_back(); v.pop_back(); v.pop_back();
- std::size_t sz = v.size();
- bool a[] = {1, 0, 0, 1, 1};
- const unsigned N = sizeof(a)/sizeof(a[0]);
- std::vector<bool>::iterator i = v.insert(v.cbegin() + 10, forward_iterator<const bool*>(a),
- forward_iterator<const bool*>(a+N));
- assert(v.size() == sz + N);
- assert(i == v.begin() + 10);
- std::size_t j;
- for (j = 0; j < 10; ++j)
- assert(v[j] == 0);
- for (std::size_t k = 0; k < N; ++j, ++k)
- assert(v[j] == a[k]);
- for (; j < v.size(); ++j)
- assert(v[j] == 0);
- }
+TEST_CONSTEXPR_CXX20 bool tests() {
+ {
+ std::vector<bool> v(100);
+ bool a[] = {1, 0, 0, 1, 1};
+ const unsigned N = sizeof(a) / sizeof(a[0]);
+ std::vector<bool>::iterator i =
+ v.insert(v.cbegin() + 10, cpp17_input_iterator<const bool*>(a), cpp17_input_iterator<const bool*>(a + N));
+ assert(v.size() == 100 + N);
+ assert(i == v.begin() + 10);
+ std::size_t j;
+ for (j = 0; j < 10; ++j)
+ assert(v[j] == 0);
+ for (std::size_t k = 0; k < N; ++j, ++k)
+ assert(v[j] == a[k]);
+ for (; j < v.size(); ++j)
+ assert(v[j] == 0);
+ }
+ {
+ std::vector<bool> v(100);
+ bool a[] = {1, 0, 0, 1, 1};
+ const unsigned N = sizeof(a) / sizeof(a[0]);
+ std::vector<bool>::iterator i =
+ v.insert(v.cbegin() + 10, forward_iterator<const bool*>(a), forward_iterator<const bool*>(a + N));
+ assert(v.size() == 100 + N);
+ assert(i == v.begin() + 10);
+ int j;
+ for (j = 0; j < 10; ++j)
+ assert(v[j] == 0);
+ for (std::size_t k = 0; k < N; ++j, ++k)
+ assert(v[j] == a[k]);
+ for (; j < 105; ++j)
+ assert(v[j] == 0);
+ }
+ {
+ std::vector<bool> v(100);
+ while (v.size() < v.capacity())
+ v.push_back(false);
+ std::size_t sz = v.size();
+ bool a[] = {1, 0, 0, 1, 1};
+ const unsigned N = sizeof(a) / sizeof(a[0]);
+ std::vector<bool>::iterator i =
+ v.insert(v.cbegin() + 10, forward_iterator<const bool*>(a), forward_iterator<const bool*>(a + N));
+ assert(v.size() == sz + N);
+ assert(i == v.begin() + 10);
+ std::size_t j;
+ for (j = 0; j < 10; ++j)
+ assert(v[j] == 0);
+ for (std::size_t k = 0; k < N; ++j, ++k)
+ assert(v[j] == a[k]);
+ for (; j < v.size(); ++j)
+ assert(v[j] == 0);
+ }
+ {
+ std::vector<bool> v(100);
+ while (v.size() < v.capacity())
+ v.push_back(false);
+ v.pop_back();
+ v.pop_back();
+ v.pop_back();
+ std::size_t sz = v.size();
+ bool a[] = {1, 0, 0, 1, 1};
+ const unsigned N = sizeof(a) / sizeof(a[0]);
+ std::vector<bool>::iterator i =
+ v.insert(v.cbegin() + 10, forward_iterator<const bool*>(a), forward_iterator<const bool*>(a + N));
+ assert(v.size() == sz + N);
+ assert(i == v.begin() + 10);
+ std::size_t j;
+ for (j = 0; j < 10; ++j)
+ assert(v[j] == 0);
+ for (std::size_t k = 0; k < N; ++j, ++k)
+ assert(v[j] == a[k]);
+ for (; j < v.size(); ++j)
+ assert(v[j] == 0);
+ }
#if TEST_STD_VER >= 11
- {
- std::vector<bool, explicit_allocator<bool>> v(100);
- bool a[] = {1, 0, 0, 1, 1};
- const unsigned N = sizeof(a)/sizeof(a[0]);
- std::vector<bool, explicit_allocator<bool>>::iterator i = v.insert(v.cbegin() + 10, cpp17_input_iterator<const bool*>(a),
- cpp17_input_iterator<const bool*>(a+N));
- assert(v.size() == 100 + N);
- assert(i == v.begin() + 10);
- std::size_t j;
- for (j = 0; j < 10; ++j)
- assert(v[j] == 0);
- for (std::size_t k = 0; k < N; ++j, ++k)
- assert(v[j] == a[k]);
- for (; j < v.size(); ++j)
- assert(v[j] == 0);
- }
- {
- std::vector<bool, min_allocator<bool>> v(100);
- bool a[] = {1, 0, 0, 1, 1};
- const unsigned N = sizeof(a)/sizeof(a[0]);
- std::vector<bool, min_allocator<bool>>::iterator i = v.insert(v.cbegin() + 10, cpp17_input_iterator<const bool*>(a),
- cpp17_input_iterator<const bool*>(a+N));
- assert(v.size() == 100 + N);
- assert(i == v.begin() + 10);
- std::size_t j;
- for (j = 0; j < 10; ++j)
- assert(v[j] == 0);
- for (std::size_t k = 0; k < N; ++j, ++k)
- assert(v[j] == a[k]);
- for (; j < v.size(); ++j)
- assert(v[j] == 0);
- }
- {
- std::vector<bool, min_allocator<bool>> v(100);
- bool a[] = {1, 0, 0, 1, 1};
- const unsigned N = sizeof(a)/sizeof(a[0]);
- std::vector<bool, min_allocator<bool>>::iterator i = v.insert(v.cbegin() + 10, forward_iterator<const bool*>(a),
- forward_iterator<const bool*>(a+N));
- assert(v.size() == 100 + N);
- assert(i == v.begin() + 10);
- std::size_t j;
- for (j = 0; j < 10; ++j)
- assert(v[j] == 0);
- for (std::size_t k = 0; k < N; ++j, ++k)
- assert(v[j] == a[k]);
- for (; j < v.size(); ++j)
- assert(v[j] == 0);
- }
+ {
+ std::vector<bool, explicit_allocator<bool>> v(100);
+ bool a[] = {1, 0, 0, 1, 1};
+ const unsigned N = sizeof(a) / sizeof(a[0]);
+ std::vector<bool, explicit_allocator<bool>>::iterator i =
+ v.insert(v.cbegin() + 10, cpp17_input_iterator<const bool*>(a), cpp17_input_iterator<const bool*>(a + N));
+ assert(v.size() == 100 + N);
+ assert(i == v.begin() + 10);
+ std::size_t j;
+ for (j = 0; j < 10; ++j)
+ assert(v[j] == 0);
+ for (std::size_t k = 0; k < N; ++j, ++k)
+ assert(v[j] == a[k]);
+ for (; j < v.size(); ++j)
+ assert(v[j] == 0);
+ }
+ {
+ std::vector<bool, min_allocator<bool>> v(100);
+ bool a[] = {1, 0, 0, 1, 1};
+ const unsigned N = sizeof(a) / sizeof(a[0]);
+ std::vector<bool, min_allocator<bool>>::iterator i =
+ v.insert(v.cbegin() + 10, cpp17_input_iterator<const bool*>(a), cpp17_input_iterator<const bool*>(a + N));
+ assert(v.size() == 100 + N);
+ assert(i == v.begin() + 10);
+ std::size_t j;
+ for (j = 0; j < 10; ++j)
+ assert(v[j] == 0);
+ for (std::size_t k = 0; k < N; ++j, ++k)
+ assert(v[j] == a[k]);
+ for (; j < v.size(); ++j)
+ assert(v[j] == 0);
+ }
+ {
+ std::vector<bool, min_allocator<bool>> v(100);
+ bool a[] = {1, 0, 0, 1, 1};
+ const unsigned N = sizeof(a) / sizeof(a[0]);
+ std::vector<bool, min_allocator<bool>>::iterator i =
+ v.insert(v.cbegin() + 10, forward_iterator<const bool*>(a), forward_iterator<const bool*>(a + N));
+ assert(v.size() == 100 + N);
+ assert(i == v.begin() + 10);
+ std::size_t j;
+ for (j = 0; j < 10; ++j)
+ assert(v[j] == 0);
+ for (std::size_t k = 0; k < N; ++j, ++k)
+ assert(v[j] == a[k]);
+ for (; j < v.size(); ++j)
+ assert(v[j] == 0);
+ }
#endif
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector.bool/insert_iter_size_value.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/insert_iter_size_value.pass.cpp
index 484c57eadb65310..51481fbea1dafa1 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/insert_iter_size_value.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/insert_iter_size_value.pass.cpp
@@ -18,83 +18,83 @@
#include "test_macros.h"
#include "min_allocator.h"
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- {
- std::vector<bool> v(100);
- std::vector<bool>::iterator i = v.insert(v.cbegin() + 10, 5, 1);
- assert(v.size() == 105);
- assert(i == v.begin() + 10);
- std::size_t j;
- for (j = 0; j < 10; ++j)
- assert(v[j] == 0);
- for (; j < 15; ++j)
- assert(v[j] == 1);
- for (++j; j < v.size(); ++j)
- assert(v[j] == 0);
- }
- {
- std::vector<bool> v(100);
- while(v.size() < v.capacity()) v.push_back(false);
- std::size_t sz = v.size();
- std::vector<bool>::iterator i = v.insert(v.cbegin() + 10, 5, 1);
- assert(v.size() == sz + 5);
- assert(i == v.begin() + 10);
- std::size_t j;
- for (j = 0; j < 10; ++j)
- assert(v[j] == 0);
- for (; j < 15; ++j)
- assert(v[j] == 1);
- for (++j; j < v.size(); ++j)
- assert(v[j] == 0);
- }
- {
- std::vector<bool> v(100);
- while(v.size() < v.capacity()) v.push_back(false);
- v.pop_back(); v.pop_back();
- std::size_t sz = v.size();
- std::vector<bool>::iterator i = v.insert(v.cbegin() + 10, 5, 1);
- assert(v.size() == sz + 5);
- assert(i == v.begin() + 10);
- std::size_t j;
- for (j = 0; j < 10; ++j)
- assert(v[j] == 0);
- for (; j < 15; ++j)
- assert(v[j] == 1);
- for (++j; j < v.size(); ++j)
- assert(v[j] == 0);
- }
+TEST_CONSTEXPR_CXX20 bool tests() {
+ {
+ std::vector<bool> v(100);
+ std::vector<bool>::iterator i = v.insert(v.cbegin() + 10, 5, 1);
+ assert(v.size() == 105);
+ assert(i == v.begin() + 10);
+ std::size_t j;
+ for (j = 0; j < 10; ++j)
+ assert(v[j] == 0);
+ for (; j < 15; ++j)
+ assert(v[j] == 1);
+ for (++j; j < v.size(); ++j)
+ assert(v[j] == 0);
+ }
+ {
+ std::vector<bool> v(100);
+ while (v.size() < v.capacity())
+ v.push_back(false);
+ std::size_t sz = v.size();
+ std::vector<bool>::iterator i = v.insert(v.cbegin() + 10, 5, 1);
+ assert(v.size() == sz + 5);
+ assert(i == v.begin() + 10);
+ std::size_t j;
+ for (j = 0; j < 10; ++j)
+ assert(v[j] == 0);
+ for (; j < 15; ++j)
+ assert(v[j] == 1);
+ for (++j; j < v.size(); ++j)
+ assert(v[j] == 0);
+ }
+ {
+ std::vector<bool> v(100);
+ while (v.size() < v.capacity())
+ v.push_back(false);
+ v.pop_back();
+ v.pop_back();
+ std::size_t sz = v.size();
+ std::vector<bool>::iterator i = v.insert(v.cbegin() + 10, 5, 1);
+ assert(v.size() == sz + 5);
+ assert(i == v.begin() + 10);
+ std::size_t j;
+ for (j = 0; j < 10; ++j)
+ assert(v[j] == 0);
+ for (; j < 15; ++j)
+ assert(v[j] == 1);
+ for (++j; j < v.size(); ++j)
+ assert(v[j] == 0);
+ }
#if TEST_STD_VER >= 11
- {
- std::vector<bool, explicit_allocator<bool>> v(10);
- std::vector<bool, explicit_allocator<bool>>::iterator i
- = v.insert(v.cbegin() + 10, 5, 1);
- assert(v.size() == 15);
- assert(i == v.begin() + 10);
- }
- {
- std::vector<bool, min_allocator<bool>> v(100);
- std::vector<bool, min_allocator<bool>>::iterator i = v.insert(v.cbegin() + 10, 5, 1);
- assert(v.size() == 105);
- assert(i == v.begin() + 10);
- std::size_t j;
- for (j = 0; j < 10; ++j)
- assert(v[j] == 0);
- for (; j < 15; ++j)
- assert(v[j] == 1);
- for (++j; j < v.size(); ++j)
- assert(v[j] == 0);
- }
+ {
+ std::vector<bool, explicit_allocator<bool>> v(10);
+ std::vector<bool, explicit_allocator<bool>>::iterator i = v.insert(v.cbegin() + 10, 5, 1);
+ assert(v.size() == 15);
+ assert(i == v.begin() + 10);
+ }
+ {
+ std::vector<bool, min_allocator<bool>> v(100);
+ std::vector<bool, min_allocator<bool>>::iterator i = v.insert(v.cbegin() + 10, 5, 1);
+ assert(v.size() == 105);
+ assert(i == v.begin() + 10);
+ std::size_t j;
+ for (j = 0; j < 10; ++j)
+ assert(v[j] == 0);
+ for (; j < 15; ++j)
+ assert(v[j] == 1);
+ for (++j; j < v.size(); ++j)
+ assert(v[j] == 0);
+ }
#endif
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector.bool/insert_iter_value.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/insert_iter_value.pass.cpp
index bb59de3b185a9be..70c1e7867eec5bf 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/insert_iter_value.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/insert_iter_value.pass.cpp
@@ -18,80 +18,80 @@
#include "test_macros.h"
#include "min_allocator.h"
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- {
- std::vector<bool> v(100);
- std::vector<bool>::iterator i = v.insert(v.cbegin() + 10, 1);
- assert(v.size() == 101);
- assert(i == v.begin() + 10);
- std::size_t j;
- for (j = 0; j < 10; ++j)
- assert(v[j] == 0);
- assert(v[j] == 1);
- for (++j; j < v.size(); ++j)
- assert(v[j] == 0);
- }
- {
- std::vector<bool> v(100);
- while(v.size() < v.capacity()) v.push_back(false);
- std::size_t sz = v.size();
- std::vector<bool>::iterator i = v.insert(v.cbegin() + 10, 1);
- assert(v.size() == sz + 1);
- assert(i == v.begin() + 10);
- std::size_t j;
- for (j = 0; j < 10; ++j)
- assert(v[j] == 0);
- assert(v[j] == 1);
- for (++j; j < v.size(); ++j)
- assert(v[j] == 0);
- }
- {
- std::vector<bool> v(100);
- while(v.size() < v.capacity()) v.push_back(false);
- v.pop_back(); v.pop_back();
- std::size_t sz = v.size();
- std::vector<bool>::iterator i = v.insert(v.cbegin() + 10, 1);
- assert(v.size() == sz + 1);
- assert(i == v.begin() + 10);
- std::size_t j;
- for (j = 0; j < 10; ++j)
- assert(v[j] == 0);
- assert(v[j] == 1);
- for (++j; j < v.size(); ++j)
- assert(v[j] == 0);
- }
+TEST_CONSTEXPR_CXX20 bool tests() {
+ {
+ std::vector<bool> v(100);
+ std::vector<bool>::iterator i = v.insert(v.cbegin() + 10, 1);
+ assert(v.size() == 101);
+ assert(i == v.begin() + 10);
+ std::size_t j;
+ for (j = 0; j < 10; ++j)
+ assert(v[j] == 0);
+ assert(v[j] == 1);
+ for (++j; j < v.size(); ++j)
+ assert(v[j] == 0);
+ }
+ {
+ std::vector<bool> v(100);
+ while (v.size() < v.capacity())
+ v.push_back(false);
+ std::size_t sz = v.size();
+ std::vector<bool>::iterator i = v.insert(v.cbegin() + 10, 1);
+ assert(v.size() == sz + 1);
+ assert(i == v.begin() + 10);
+ std::size_t j;
+ for (j = 0; j < 10; ++j)
+ assert(v[j] == 0);
+ assert(v[j] == 1);
+ for (++j; j < v.size(); ++j)
+ assert(v[j] == 0);
+ }
+ {
+ std::vector<bool> v(100);
+ while (v.size() < v.capacity())
+ v.push_back(false);
+ v.pop_back();
+ v.pop_back();
+ std::size_t sz = v.size();
+ std::vector<bool>::iterator i = v.insert(v.cbegin() + 10, 1);
+ assert(v.size() == sz + 1);
+ assert(i == v.begin() + 10);
+ std::size_t j;
+ for (j = 0; j < 10; ++j)
+ assert(v[j] == 0);
+ assert(v[j] == 1);
+ for (++j; j < v.size(); ++j)
+ assert(v[j] == 0);
+ }
#if TEST_STD_VER >= 11
- {
- std::vector<bool, explicit_allocator<bool>> v(10);
- std::vector<bool, explicit_allocator<bool>>::iterator i
- = v.insert(v.cbegin() + 10, 1);
- assert(v.size() == 11);
- assert(i == v.begin() + 10);
- assert(*i == 1);
- }
- {
- std::vector<bool, min_allocator<bool>> v(100);
- std::vector<bool, min_allocator<bool>>::iterator i = v.insert(v.cbegin() + 10, 1);
- assert(v.size() == 101);
- assert(i == v.begin() + 10);
- std::size_t j;
- for (j = 0; j < 10; ++j)
- assert(v[j] == 0);
- assert(v[j] == 1);
- for (++j; j < v.size(); ++j)
- assert(v[j] == 0);
- }
+ {
+ std::vector<bool, explicit_allocator<bool>> v(10);
+ std::vector<bool, explicit_allocator<bool>>::iterator i = v.insert(v.cbegin() + 10, 1);
+ assert(v.size() == 11);
+ assert(i == v.begin() + 10);
+ assert(*i == 1);
+ }
+ {
+ std::vector<bool, min_allocator<bool>> v(100);
+ std::vector<bool, min_allocator<bool>>::iterator i = v.insert(v.cbegin() + 10, 1);
+ assert(v.size() == 101);
+ assert(i == v.begin() + 10);
+ std::size_t j;
+ for (j = 0; j < 10; ++j)
+ assert(v[j] == 0);
+ assert(v[j] == 1);
+ for (++j; j < v.size(); ++j)
+ assert(v[j] == 0);
+ }
#endif
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector.bool/insert_range.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/insert_range.pass.cpp
index d8f19d47e99429d..e9a84150feb825a 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/insert_range.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/insert_range.pass.cpp
@@ -32,12 +32,12 @@ constexpr bool test() {
});
});
- { // Vector may or may not need to reallocate because of the insertion -- make sure to test both cases.
+ { // Vector may or may not need to reallocate because of the insertion -- make sure to test both cases.
{ // Ensure reallocation happens.
- constexpr int N = 255;
- bool in[N] = {};
+ constexpr int N = 255;
+ bool in[N] = {};
std::vector<bool> v = {0, 0, 0, 1, 1, 0, 0, 0};
- auto initial = v;
+ auto initial = v;
assert(v.capacity() < v.size() + std::ranges::size(in));
v.insert_range(v.end(), in);
@@ -49,7 +49,7 @@ constexpr bool test() {
}
{ // Ensure no reallocation happens.
- bool in[] = {1, 1, 1, 1, 0, 0, 1, 1, 1, 1};
+ bool in[] = {1, 1, 1, 1, 0, 0, 1, 1, 1, 1};
std::vector<bool> v = {0, 0, 0, 1, 1, 0, 0, 0};
v.reserve(v.size() + std::ranges::size(in));
assert(v.capacity() >= v.size() + std::ranges::size(in));
diff --git a/libcxx/test/std/containers/sequences/vector.bool/iterator_concept_conformance.compile.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/iterator_concept_conformance.compile.pass.cpp
index ba2627e09bd45dc..c66f6a9e60353ea 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/iterator_concept_conformance.compile.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/iterator_concept_conformance.compile.pass.cpp
@@ -15,27 +15,27 @@
#include "test_macros.h"
-using iterator = std::vector<bool>::iterator;
-using const_iterator = std::vector<bool>::const_iterator;
-using reverse_iterator = std::vector<bool>::reverse_iterator;
+using iterator = std::vector<bool>::iterator;
+using const_iterator = std::vector<bool>::const_iterator;
+using reverse_iterator = std::vector<bool>::reverse_iterator;
using const_reverse_iterator = std::vector<bool>::const_reverse_iterator;
-using value_type = bool;
+using value_type = bool;
-static_assert( std::random_access_iterator<iterator>);
-static_assert( std::random_access_iterator<reverse_iterator>);
+static_assert(std::random_access_iterator<iterator>);
+static_assert(std::random_access_iterator<reverse_iterator>);
static_assert(!std::contiguous_iterator<iterator>);
static_assert(!std::contiguous_iterator<reverse_iterator>);
#if TEST_STD_VER > 20
-static_assert( std::indirectly_writable<iterator, value_type>);
+static_assert(std::indirectly_writable<iterator, value_type>);
#else
static_assert(!std::indirectly_writable<iterator, value_type>);
#endif
-static_assert( std::sentinel_for<iterator, iterator>);
-static_assert( std::sentinel_for<iterator, const_iterator>);
+static_assert(std::sentinel_for<iterator, iterator>);
+static_assert(std::sentinel_for<iterator, const_iterator>);
static_assert(!std::sentinel_for<iterator, reverse_iterator>);
static_assert(!std::sentinel_for<iterator, const_reverse_iterator>);
-static_assert( std::sized_sentinel_for<iterator, iterator>);
-static_assert( std::sized_sentinel_for<iterator, const_iterator>);
+static_assert(std::sized_sentinel_for<iterator, iterator>);
+static_assert(std::sized_sentinel_for<iterator, const_iterator>);
static_assert(!std::sized_sentinel_for<iterator, reverse_iterator>);
static_assert(!std::sized_sentinel_for<iterator, const_reverse_iterator>);
static_assert(std::indirectly_movable<iterator, bool*>);
@@ -44,17 +44,17 @@ static_assert(std::indirectly_copyable<iterator, bool*>);
static_assert(std::indirectly_copyable_storable<iterator, bool*>);
static_assert(std::indirectly_swappable<iterator, iterator>);
-static_assert( std::random_access_iterator<const_iterator>);
-static_assert( std::random_access_iterator<const_reverse_iterator>);
+static_assert(std::random_access_iterator<const_iterator>);
+static_assert(std::random_access_iterator<const_reverse_iterator>);
static_assert(!std::contiguous_iterator<const_iterator>);
static_assert(!std::contiguous_iterator<const_reverse_iterator>);
static_assert(!std::indirectly_writable<const_iterator, value_type>);
-static_assert( std::sentinel_for<const_iterator, iterator>);
-static_assert( std::sentinel_for<const_iterator, const_iterator>);
+static_assert(std::sentinel_for<const_iterator, iterator>);
+static_assert(std::sentinel_for<const_iterator, const_iterator>);
static_assert(!std::sentinel_for<const_iterator, reverse_iterator>);
static_assert(!std::sentinel_for<const_iterator, const_reverse_iterator>);
-static_assert( std::sized_sentinel_for<const_iterator, iterator>);
-static_assert( std::sized_sentinel_for<const_iterator, const_iterator>);
+static_assert(std::sized_sentinel_for<const_iterator, iterator>);
+static_assert(std::sized_sentinel_for<const_iterator, const_iterator>);
static_assert(!std::sized_sentinel_for<const_iterator, reverse_iterator>);
static_assert(!std::sized_sentinel_for<const_iterator, const_reverse_iterator>);
static_assert(!std::indirectly_swappable<const_iterator, const_iterator>);
diff --git a/libcxx/test/std/containers/sequences/vector.bool/iterators.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/iterators.pass.cpp
index 1e4877e8d24430d..278d70284e0b132 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/iterators.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/iterators.pass.cpp
@@ -22,163 +22,161 @@
#include "test_macros.h"
#include "min_allocator.h"
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- using IterRefT = std::iterator_traits<std::vector<bool>::iterator>::reference;
- ASSERT_SAME_TYPE(IterRefT, std::vector<bool>::reference);
+TEST_CONSTEXPR_CXX20 bool tests() {
+ using IterRefT = std::iterator_traits<std::vector<bool>::iterator>::reference;
+ ASSERT_SAME_TYPE(IterRefT, std::vector<bool>::reference);
- using ConstIterRefT = std::iterator_traits<std::vector<bool>::const_iterator>::reference;
+ using ConstIterRefT = std::iterator_traits<std::vector<bool>::const_iterator>::reference;
#if !defined(_LIBCPP_VERSION) || defined(_LIBCPP_ABI_BITSET_VECTOR_BOOL_CONST_SUBSCRIPT_RETURN_BOOL)
- ASSERT_SAME_TYPE(ConstIterRefT, bool);
+ ASSERT_SAME_TYPE(ConstIterRefT, bool);
#else
- ASSERT_SAME_TYPE(ConstIterRefT, std::__bit_const_reference<std::vector<bool> >);
+ ASSERT_SAME_TYPE(ConstIterRefT, std::__bit_const_reference<std::vector<bool> >);
#endif
- {
- typedef bool T;
- typedef std::vector<T> C;
- C c;
- C::iterator i = c.begin();
- C::iterator j = c.end();
- assert(std::distance(i, j) == 0);
- assert(i == j);
- }
- {
- typedef bool T;
- typedef std::vector<T> C;
- const C c;
- C::const_iterator i = c.begin();
- C::const_iterator j = c.end();
- assert(std::distance(i, j) == 0);
- assert(i == j);
- }
- {
- typedef bool T;
- typedef std::vector<T> C;
- C c;
- C::const_iterator i = c.cbegin();
- C::const_iterator j = c.cend();
- assert(std::distance(i, j) == 0);
- assert(i == j);
- assert(i == c.end());
- }
- {
- typedef bool T;
- typedef std::vector<T> C;
- C::iterator i;
- C::const_iterator j;
- (void) i;
- (void) j;
- }
+ {
+ typedef bool T;
+ typedef std::vector<T> C;
+ C c;
+ C::iterator i = c.begin();
+ C::iterator j = c.end();
+ assert(std::distance(i, j) == 0);
+ assert(i == j);
+ }
+ {
+ typedef bool T;
+ typedef std::vector<T> C;
+ const C c;
+ C::const_iterator i = c.begin();
+ C::const_iterator j = c.end();
+ assert(std::distance(i, j) == 0);
+ assert(i == j);
+ }
+ {
+ typedef bool T;
+ typedef std::vector<T> C;
+ C c;
+ C::const_iterator i = c.cbegin();
+ C::const_iterator j = c.cend();
+ assert(std::distance(i, j) == 0);
+ assert(i == j);
+ assert(i == c.end());
+ }
+ {
+ typedef bool T;
+ typedef std::vector<T> C;
+ C::iterator i;
+ C::const_iterator j;
+ (void)i;
+ (void)j;
+ }
#if TEST_STD_VER >= 11
- {
- typedef bool T;
- typedef std::vector<T, min_allocator<T>> C;
- C c;
- C::iterator i = c.begin();
- C::iterator j = c.end();
- assert(std::distance(i, j) == 0);
+ {
+ typedef bool T;
+ typedef std::vector<T, min_allocator<T>> C;
+ C c;
+ C::iterator i = c.begin();
+ C::iterator j = c.end();
+ assert(std::distance(i, j) == 0);
- assert(i == j);
- assert(!(i != j));
+ assert(i == j);
+ assert(!(i != j));
- assert(!(i < j));
- assert((i <= j));
+ assert(!(i < j));
+ assert((i <= j));
- assert(!(i > j));
- assert((i >= j));
+ assert(!(i > j));
+ assert((i >= j));
# if TEST_STD_VER >= 20
- // P1614 + LWG3352
- std::same_as<std::strong_ordering> decltype(auto) r = i <=> j;
- assert(r == std::strong_ordering::equal);
+ // P1614 + LWG3352
+ std::same_as<std::strong_ordering> decltype(auto) r = i <=> j;
+ assert(r == std::strong_ordering::equal);
# endif
- }
- {
- typedef bool T;
- typedef std::vector<T, min_allocator<T>> C;
- const C c;
- C::const_iterator i = c.begin();
- C::const_iterator j = c.end();
- assert(std::distance(i, j) == 0);
+ }
+ {
+ typedef bool T;
+ typedef std::vector<T, min_allocator<T>> C;
+ const C c;
+ C::const_iterator i = c.begin();
+ C::const_iterator j = c.end();
+ assert(std::distance(i, j) == 0);
- assert(i == j);
- assert(!(i != j));
+ assert(i == j);
+ assert(!(i != j));
- assert(!(i < j));
- assert((i <= j));
+ assert(!(i < j));
+ assert((i <= j));
- assert(!(i > j));
- assert((i >= j));
+ assert(!(i > j));
+ assert((i >= j));
# if TEST_STD_VER >= 20
- // P1614 + LWG3352
- std::same_as<std::strong_ordering> decltype(auto) r = i <=> j;
- assert(r == std::strong_ordering::equal);
+ // P1614 + LWG3352
+ std::same_as<std::strong_ordering> decltype(auto) r = i <=> j;
+ assert(r == std::strong_ordering::equal);
# endif
- }
- {
- typedef bool T;
- typedef std::vector<T, min_allocator<T>> C;
- C c;
- C::const_iterator i = c.cbegin();
- C::const_iterator j = c.cend();
- assert(std::distance(i, j) == 0);
- assert(i == j);
- assert(i == c.end());
- }
- {
- typedef bool T;
- typedef std::vector<T, min_allocator<T>> C;
- C::iterator i;
- C::const_iterator j;
- (void) i;
- (void) j;
- }
+ }
+ {
+ typedef bool T;
+ typedef std::vector<T, min_allocator<T>> C;
+ C c;
+ C::const_iterator i = c.cbegin();
+ C::const_iterator j = c.cend();
+ assert(std::distance(i, j) == 0);
+ assert(i == j);
+ assert(i == c.end());
+ }
+ {
+ typedef bool T;
+ typedef std::vector<T, min_allocator<T>> C;
+ C::iterator i;
+ C::const_iterator j;
+ (void)i;
+ (void)j;
+ }
#endif
#if TEST_STD_VER > 11
- { // N3644 testing
- std::vector<bool>::iterator ii1{}, ii2{};
- std::vector<bool>::iterator ii4 = ii1;
- std::vector<bool>::const_iterator cii{};
- assert ( ii1 == ii2 );
- assert ( ii1 == ii4 );
-
- assert (!(ii1 != ii2 ));
-
- assert ( (ii1 == cii ));
- assert ( (cii == ii1 ));
- assert (!(ii1 != cii ));
- assert (!(cii != ii1 ));
- assert (!(ii1 < cii ));
- assert (!(cii < ii1 ));
- assert ( (ii1 <= cii ));
- assert ( (cii <= ii1 ));
- assert (!(ii1 > cii ));
- assert (!(cii > ii1 ));
- assert ( (ii1 >= cii ));
- assert ( (cii >= ii1 ));
- assert (cii - ii1 == 0);
- assert (ii1 - cii == 0);
+ { // N3644 testing
+ std::vector<bool>::iterator ii1{}, ii2{};
+ std::vector<bool>::iterator ii4 = ii1;
+ std::vector<bool>::const_iterator cii{};
+ assert(ii1 == ii2);
+ assert(ii1 == ii4);
+
+ assert(!(ii1 != ii2));
+
+ assert((ii1 == cii));
+ assert((cii == ii1));
+ assert(!(ii1 != cii));
+ assert(!(cii != ii1));
+ assert(!(ii1 < cii));
+ assert(!(cii < ii1));
+ assert((ii1 <= cii));
+ assert((cii <= ii1));
+ assert(!(ii1 > cii));
+ assert(!(cii > ii1));
+ assert((ii1 >= cii));
+ assert((cii >= ii1));
+ assert(cii - ii1 == 0);
+ assert(ii1 - cii == 0);
# if TEST_STD_VER >= 20
- // P1614 + LWG3352
- std::same_as<std::strong_ordering> decltype(auto) r1 = ii1 <=> ii2;
- assert(r1 == std::strong_ordering::equal);
+ // P1614 + LWG3352
+ std::same_as<std::strong_ordering> decltype(auto) r1 = ii1 <=> ii2;
+ assert(r1 == std::strong_ordering::equal);
- std::same_as<std::strong_ordering> decltype(auto) r2 = cii <=> ii2;
- assert(r2 == std::strong_ordering::equal);
+ std::same_as<std::strong_ordering> decltype(auto) r2 = cii <=> ii2;
+ assert(r2 == std::strong_ordering::equal);
# endif // TEST_STD_VER > 20
- }
+ }
#endif
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector.bool/move.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/move.pass.cpp
index 56de3372258151b..a69f0b573898623 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/move.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/move.pass.cpp
@@ -18,88 +18,83 @@
#include "test_allocator.h"
#include "min_allocator.h"
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- test_allocator_statistics alloc_stats;
- {
- std::vector<bool, test_allocator<bool> > l(test_allocator<bool>(5, &alloc_stats));
- std::vector<bool, test_allocator<bool> > lo(test_allocator<bool>(5, &alloc_stats));
- for (int i = 1; i <= 3; ++i)
- {
- l.push_back(true);
- lo.push_back(true);
- }
- std::vector<bool, test_allocator<bool> > l2 = std::move(l);
- assert(l2 == lo);
- assert(l.empty());
- assert(l2.get_allocator() == lo.get_allocator());
+TEST_CONSTEXPR_CXX20 bool tests() {
+ test_allocator_statistics alloc_stats;
+ {
+ std::vector<bool, test_allocator<bool> > l(test_allocator<bool>(5, &alloc_stats));
+ std::vector<bool, test_allocator<bool> > lo(test_allocator<bool>(5, &alloc_stats));
+ for (int i = 1; i <= 3; ++i) {
+ l.push_back(true);
+ lo.push_back(true);
}
- {
- std::vector<bool, other_allocator<bool> > l(other_allocator<bool>(5));
- std::vector<bool, other_allocator<bool> > lo(other_allocator<bool>(5));
- for (int i = 1; i <= 3; ++i)
- {
- l.push_back(true);
- lo.push_back(true);
- }
- std::vector<bool, other_allocator<bool> > l2 = std::move(l);
- assert(l2 == lo);
- assert(l.empty());
- assert(l2.get_allocator() == lo.get_allocator());
+ std::vector<bool, test_allocator<bool> > l2 = std::move(l);
+ assert(l2 == lo);
+ assert(l.empty());
+ assert(l2.get_allocator() == lo.get_allocator());
+ }
+ {
+ std::vector<bool, other_allocator<bool> > l(other_allocator<bool>(5));
+ std::vector<bool, other_allocator<bool> > lo(other_allocator<bool>(5));
+ for (int i = 1; i <= 3; ++i) {
+ l.push_back(true);
+ lo.push_back(true);
}
- {
- std::vector<bool, min_allocator<bool> > l(min_allocator<bool>{});
- std::vector<bool, min_allocator<bool> > lo(min_allocator<bool>{});
- for (int i = 1; i <= 3; ++i)
- {
- l.push_back(true);
- lo.push_back(true);
- }
- std::vector<bool, min_allocator<bool> > l2 = std::move(l);
- assert(l2 == lo);
- assert(l.empty());
- assert(l2.get_allocator() == lo.get_allocator());
+ std::vector<bool, other_allocator<bool> > l2 = std::move(l);
+ assert(l2 == lo);
+ assert(l.empty());
+ assert(l2.get_allocator() == lo.get_allocator());
+ }
+ {
+ std::vector<bool, min_allocator<bool> > l(min_allocator<bool>{});
+ std::vector<bool, min_allocator<bool> > lo(min_allocator<bool>{});
+ for (int i = 1; i <= 3; ++i) {
+ l.push_back(true);
+ lo.push_back(true);
}
+ std::vector<bool, min_allocator<bool> > l2 = std::move(l);
+ assert(l2 == lo);
+ assert(l.empty());
+ assert(l2.get_allocator() == lo.get_allocator());
+ }
+ {
+ alloc_stats.clear();
+ using Vect = std::vector<bool, test_allocator<bool> >;
+ using AllocT = Vect::allocator_type;
+ Vect v(test_allocator<bool>(42, 101, &alloc_stats));
+ assert(alloc_stats.count == 1);
{
- alloc_stats.clear();
- using Vect = std::vector<bool, test_allocator<bool> >;
- using AllocT = Vect::allocator_type;
- Vect v(test_allocator<bool>(42, 101, &alloc_stats));
- assert(alloc_stats.count == 1);
- {
- const AllocT& a = v.get_allocator();
- assert(alloc_stats.count == 2);
- assert(a.get_data() == 42);
- assert(a.get_id() == 101);
- }
- assert(alloc_stats.count == 1);
- alloc_stats.clear_ctor_counters();
-
- Vect v2 = std::move(v);
+ const AllocT& a = v.get_allocator();
assert(alloc_stats.count == 2);
- assert(alloc_stats.copied == 0);
- assert(alloc_stats.moved == 1);
- {
- const AllocT& a1 = v.get_allocator();
- assert(a1.get_id() == test_alloc_base::moved_value);
- assert(a1.get_data() == 42);
+ assert(a.get_data() == 42);
+ assert(a.get_id() == 101);
+ }
+ assert(alloc_stats.count == 1);
+ alloc_stats.clear_ctor_counters();
+
+ Vect v2 = std::move(v);
+ assert(alloc_stats.count == 2);
+ assert(alloc_stats.copied == 0);
+ assert(alloc_stats.moved == 1);
+ {
+ const AllocT& a1 = v.get_allocator();
+ assert(a1.get_id() == test_alloc_base::moved_value);
+ assert(a1.get_data() == 42);
- const AllocT& a2 = v2.get_allocator();
- assert(a2.get_id() == 101);
- assert(a2.get_data() == 42);
+ const AllocT& a2 = v2.get_allocator();
+ assert(a2.get_id() == 101);
+ assert(a2.get_data() == 42);
- assert(a1 == a2);
- }
+ assert(a1 == a2);
}
+ }
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector.bool/move_alloc.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/move_alloc.pass.cpp
index 1f41657eb56eac9..01e7410040686a1 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/move_alloc.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/move_alloc.pass.cpp
@@ -18,69 +18,63 @@
#include "test_allocator.h"
#include "min_allocator.h"
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- {
- std::vector<bool, test_allocator<bool> > l(test_allocator<bool>(5));
- std::vector<bool, test_allocator<bool> > lo(test_allocator<bool>(5));
- for (int i = 1; i <= 3; ++i)
- {
- l.push_back(i);
- lo.push_back(i);
- }
- std::vector<bool, test_allocator<bool> > l2(std::move(l), test_allocator<bool>(6));
- assert(l2 == lo);
- assert(!l.empty());
- assert(l2.get_allocator() == test_allocator<bool>(6));
+TEST_CONSTEXPR_CXX20 bool tests() {
+ {
+ std::vector<bool, test_allocator<bool> > l(test_allocator<bool>(5));
+ std::vector<bool, test_allocator<bool> > lo(test_allocator<bool>(5));
+ for (int i = 1; i <= 3; ++i) {
+ l.push_back(i);
+ lo.push_back(i);
}
- {
- std::vector<bool, test_allocator<bool> > l(test_allocator<bool>(5));
- std::vector<bool, test_allocator<bool> > lo(test_allocator<bool>(5));
- for (int i = 1; i <= 3; ++i)
- {
- l.push_back(i);
- lo.push_back(i);
- }
- std::vector<bool, test_allocator<bool> > l2(std::move(l), test_allocator<bool>(5));
- assert(l2 == lo);
- assert(l.empty());
- assert(l2.get_allocator() == test_allocator<bool>(5));
+ std::vector<bool, test_allocator<bool> > l2(std::move(l), test_allocator<bool>(6));
+ assert(l2 == lo);
+ assert(!l.empty());
+ assert(l2.get_allocator() == test_allocator<bool>(6));
+ }
+ {
+ std::vector<bool, test_allocator<bool> > l(test_allocator<bool>(5));
+ std::vector<bool, test_allocator<bool> > lo(test_allocator<bool>(5));
+ for (int i = 1; i <= 3; ++i) {
+ l.push_back(i);
+ lo.push_back(i);
}
- {
- std::vector<bool, other_allocator<bool> > l(other_allocator<bool>(5));
- std::vector<bool, other_allocator<bool> > lo(other_allocator<bool>(5));
- for (int i = 1; i <= 3; ++i)
- {
- l.push_back(i);
- lo.push_back(i);
- }
- std::vector<bool, other_allocator<bool> > l2(std::move(l), other_allocator<bool>(4));
- assert(l2 == lo);
- assert(!l.empty());
- assert(l2.get_allocator() == other_allocator<bool>(4));
+ std::vector<bool, test_allocator<bool> > l2(std::move(l), test_allocator<bool>(5));
+ assert(l2 == lo);
+ assert(l.empty());
+ assert(l2.get_allocator() == test_allocator<bool>(5));
+ }
+ {
+ std::vector<bool, other_allocator<bool> > l(other_allocator<bool>(5));
+ std::vector<bool, other_allocator<bool> > lo(other_allocator<bool>(5));
+ for (int i = 1; i <= 3; ++i) {
+ l.push_back(i);
+ lo.push_back(i);
}
- {
- std::vector<bool, min_allocator<bool> > l(min_allocator<bool>{});
- std::vector<bool, min_allocator<bool> > lo(min_allocator<bool>{});
- for (int i = 1; i <= 3; ++i)
- {
- l.push_back(i);
- lo.push_back(i);
- }
- std::vector<bool, min_allocator<bool> > l2(std::move(l), min_allocator<bool>());
- assert(l2 == lo);
- assert(l.empty());
- assert(l2.get_allocator() == min_allocator<bool>());
+ std::vector<bool, other_allocator<bool> > l2(std::move(l), other_allocator<bool>(4));
+ assert(l2 == lo);
+ assert(!l.empty());
+ assert(l2.get_allocator() == other_allocator<bool>(4));
+ }
+ {
+ std::vector<bool, min_allocator<bool> > l(min_allocator<bool>{});
+ std::vector<bool, min_allocator<bool> > lo(min_allocator<bool>{});
+ for (int i = 1; i <= 3; ++i) {
+ l.push_back(i);
+ lo.push_back(i);
}
+ std::vector<bool, min_allocator<bool> > l2(std::move(l), min_allocator<bool>());
+ assert(l2 == lo);
+ assert(l.empty());
+ assert(l2.get_allocator() == min_allocator<bool>());
+ }
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector.bool/move_assign_noexcept.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/move_assign_noexcept.pass.cpp
index c40d1e557267feb..5a69213c3b4efef 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/move_assign_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/move_assign_noexcept.pass.cpp
@@ -24,78 +24,74 @@
#include "test_allocator.h"
template <class T>
-struct some_alloc
-{
- typedef T value_type;
- some_alloc(const some_alloc&);
+struct some_alloc {
+ typedef T value_type;
+ some_alloc(const some_alloc&);
};
template <class T>
-struct some_alloc2
-{
- typedef T value_type;
+struct some_alloc2 {
+ typedef T value_type;
- some_alloc2() {}
- some_alloc2(const some_alloc2&);
- void deallocate(void*, unsigned) {}
+ some_alloc2() {}
+ some_alloc2(const some_alloc2&);
+ void deallocate(void*, unsigned) {}
- typedef std::false_type propagate_on_container_move_assignment;
- typedef std::true_type is_always_equal;
+ typedef std::false_type propagate_on_container_move_assignment;
+ typedef std::true_type is_always_equal;
};
template <class T>
-struct some_alloc3
-{
- typedef T value_type;
+struct some_alloc3 {
+ typedef T value_type;
- some_alloc3() {}
- some_alloc3(const some_alloc3&);
- void deallocate(void*, unsigned) {}
+ some_alloc3() {}
+ some_alloc3(const some_alloc3&);
+ void deallocate(void*, unsigned) {}
- typedef std::false_type propagate_on_container_move_assignment;
- typedef std::false_type is_always_equal;
+ typedef std::false_type propagate_on_container_move_assignment;
+ typedef std::false_type is_always_equal;
};
-int main(int, char**)
-{
+int main(int, char**) {
#if defined(_LIBCPP_VERSION)
- {
- typedef std::vector<bool> C;
- static_assert(std::is_nothrow_move_assignable<C>::value, "");
- }
+ {
+ typedef std::vector<bool> C;
+ static_assert(std::is_nothrow_move_assignable<C>::value, "");
+ }
#endif // _LIBCPP_VERSION
- {
- typedef std::vector<bool, test_allocator<bool>> C;
- static_assert(!std::is_nothrow_move_assignable<C>::value, "");
- }
+ {
+ typedef std::vector<bool, test_allocator<bool>> C;
+ static_assert(!std::is_nothrow_move_assignable<C>::value, "");
+ }
#if defined(_LIBCPP_VERSION)
- {
- typedef std::vector<bool, other_allocator<bool>> C;
- static_assert(std::is_nothrow_move_assignable<C>::value, "");
- }
+ {
+ typedef std::vector<bool, other_allocator<bool>> C;
+ static_assert(std::is_nothrow_move_assignable<C>::value, "");
+ }
#endif // _LIBCPP_VERSION
- {
+ {
#if TEST_STD_VER > 14
-#if defined(_LIBCPP_VERSION)
- typedef std::vector<bool, some_alloc<bool>> C;
- static_assert( std::is_nothrow_move_assignable<C>::value, "");
-#endif // _LIBCPP_VERSION
+# if defined(_LIBCPP_VERSION)
+ typedef std::vector<bool, some_alloc<bool>> C;
+ static_assert(std::is_nothrow_move_assignable<C>::value, "");
+# endif // _LIBCPP_VERSION
#else
- typedef std::vector<bool, some_alloc<bool>> C;
- static_assert(!std::is_nothrow_move_assignable<C>::value, "");
+ typedef std::vector<bool, some_alloc<bool>> C;
+ static_assert(!std::is_nothrow_move_assignable<C>::value, "");
#endif
- }
+ }
#if TEST_STD_VER > 14
-#if defined(_LIBCPP_VERSION)
- { // POCMA false, is_always_equal true
- typedef std::vector<bool, some_alloc2<bool>> C;
- static_assert( std::is_nothrow_move_assignable<C>::value, "");
- }
-#endif // _LIBCPP_VERSION
- { // POCMA false, is_always_equal false
- typedef std::vector<bool, some_alloc3<bool>> C;
- static_assert(!std::is_nothrow_move_assignable<C>::value, "");
- }
+# if defined(_LIBCPP_VERSION)
+ { // POCMA false, is_always_equal true
+ typedef std::vector<bool, some_alloc2<bool>> C;
+ static_assert(std::is_nothrow_move_assignable<C>::value, "");
+ }
+# endif // _LIBCPP_VERSION
+ { // POCMA false, is_always_equal false
+ typedef std::vector<bool, some_alloc3<bool>> C;
+ static_assert(!std::is_nothrow_move_assignable<C>::value, "");
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/vector.bool/move_noexcept.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/move_noexcept.pass.cpp
index ccd8185d3f3d665..d0d231f48953afe 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/move_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/move_noexcept.pass.cpp
@@ -22,40 +22,38 @@
#include "test_allocator.h"
template <class T>
-struct some_alloc
-{
- typedef T value_type;
- some_alloc(const some_alloc&);
+struct some_alloc {
+ typedef T value_type;
+ some_alloc(const some_alloc&);
};
-int main(int, char**)
-{
+int main(int, char**) {
#if defined(_LIBCPP_VERSION)
- {
- typedef std::vector<bool> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
- }
- {
- typedef std::vector<bool, test_allocator<bool>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
- }
- {
- typedef std::vector<bool, other_allocator<bool>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
- }
+ {
+ typedef std::vector<bool> C;
+ static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ }
+ {
+ typedef std::vector<bool, test_allocator<bool>> C;
+ static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ }
+ {
+ typedef std::vector<bool, other_allocator<bool>> C;
+ static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ }
#endif // _LIBCPP_VERSION
- {
+ {
// In C++17, move constructors for allocators are not allowed to throw
#if TEST_STD_VER > 14
-#if defined(_LIBCPP_VERSION)
- typedef std::vector<bool, some_alloc<bool>> C;
- static_assert( std::is_nothrow_move_constructible<C>::value, "");
-#endif // _LIBCPP_VERSION
+# if defined(_LIBCPP_VERSION)
+ typedef std::vector<bool, some_alloc<bool>> C;
+ static_assert(std::is_nothrow_move_constructible<C>::value, "");
+# endif // _LIBCPP_VERSION
#else
- typedef std::vector<bool, some_alloc<bool>> C;
- static_assert(!std::is_nothrow_move_constructible<C>::value, "");
+ typedef std::vector<bool, some_alloc<bool>> C;
+ static_assert(!std::is_nothrow_move_constructible<C>::value, "");
#endif
- }
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector.bool/op_equal_initializer_list.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/op_equal_initializer_list.pass.cpp
index 618357120c6bdb8..bffccffbc03dc7c 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/op_equal_initializer_list.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/op_equal_initializer_list.pass.cpp
@@ -18,9 +18,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- {
+TEST_CONSTEXPR_CXX20 bool tests() {
+ {
std::vector<bool> d;
d = {true, false, false, true};
assert(d.size() == 4);
@@ -28,8 +27,8 @@ TEST_CONSTEXPR_CXX20 bool tests()
assert(d[1] == false);
assert(d[2] == false);
assert(d[3] == true);
- }
- {
+ }
+ {
std::vector<bool, min_allocator<bool>> d;
d = {true, false, false, true};
assert(d.size() == 4);
@@ -37,16 +36,15 @@ TEST_CONSTEXPR_CXX20 bool tests()
assert(d[1] == false);
assert(d[2] == false);
assert(d[3] == true);
- }
+ }
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector.bool/push_back.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/push_back.pass.cpp
index 25f8fb6b29dfe03..ca892154f9c3621 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/push_back.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/push_back.pass.cpp
@@ -18,43 +18,39 @@
#include "test_macros.h"
#include "min_allocator.h"
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- {
- bool a[] = {0, 1, 1, 0, 1, 0, 0};
- const unsigned N = sizeof(a)/sizeof(a[0]);
- std::vector<bool> c;
- for (unsigned i = 0; i < N; ++i)
- {
- c.push_back(a[i]);
- assert(c.size() == i+1);
- for (std::size_t j = 0; j < c.size(); ++j)
- assert(c[j] == a[j]);
- }
+TEST_CONSTEXPR_CXX20 bool tests() {
+ {
+ bool a[] = {0, 1, 1, 0, 1, 0, 0};
+ const unsigned N = sizeof(a) / sizeof(a[0]);
+ std::vector<bool> c;
+ for (unsigned i = 0; i < N; ++i) {
+ c.push_back(a[i]);
+ assert(c.size() == i + 1);
+ for (std::size_t j = 0; j < c.size(); ++j)
+ assert(c[j] == a[j]);
}
+ }
#if TEST_STD_VER >= 11
- {
- bool a[] = {0, 1, 1, 0, 1, 0, 0};
- const unsigned N = sizeof(a)/sizeof(a[0]);
- std::vector<bool, min_allocator<bool>> c;
- for (unsigned i = 0; i < N; ++i)
- {
- c.push_back(a[i]);
- assert(c.size() == i+1);
- for (std::size_t j = 0; j < c.size(); ++j)
- assert(c[j] == a[j]);
- }
+ {
+ bool a[] = {0, 1, 1, 0, 1, 0, 0};
+ const unsigned N = sizeof(a) / sizeof(a[0]);
+ std::vector<bool, min_allocator<bool>> c;
+ for (unsigned i = 0; i < N; ++i) {
+ c.push_back(a[i]);
+ assert(c.size() == i + 1);
+ for (std::size_t j = 0; j < c.size(); ++j)
+ assert(c[j] == a[j]);
}
+ }
#endif
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector.bool/range_concept_conformance.compile.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/range_concept_conformance.compile.pass.cpp
index 410cf834bf72433..dc2332df84f11d1 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/range_concept_conformance.compile.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/range_concept_conformance.compile.pass.cpp
@@ -17,7 +17,6 @@
using range = std::vector<bool>;
-
static_assert(std::same_as<std::ranges::iterator_t<range>, range::iterator>);
static_assert(std::ranges::common_range<range>);
static_assert(std::ranges::random_access_range<range>);
diff --git a/libcxx/test/std/containers/sequences/vector.bool/reference.swap.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/reference.swap.pass.cpp
index 8879d1f1d358cfb..a0476b6fc305b41 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/reference.swap.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/reference.swap.pass.cpp
@@ -16,34 +16,31 @@
#include "test_macros.h"
-TEST_CONSTEXPR_CXX20 bool tests()
-{
+TEST_CONSTEXPR_CXX20 bool tests() {
+ bool a[] = {false, true, false, true};
+ bool* an = a + sizeof(a) / sizeof(a[0]);
- bool a[] = {false, true, false, true};
- bool* an = a + sizeof(a)/sizeof(a[0]);
-
- std::vector<bool> v(a, an);
- std::vector<bool>::reference r1 = v[0];
- std::vector<bool>::reference r2 = v[3];
+ std::vector<bool> v(a, an);
+ std::vector<bool>::reference r1 = v[0];
+ std::vector<bool>::reference r2 = v[3];
#if TEST_STD_VER >= 11
- static_assert((noexcept(v.swap(r1,r2))), "");
+ static_assert((noexcept(v.swap(r1, r2))), "");
#endif
- assert(!r1);
- assert( r2);
- v.swap(r1, r2);
- assert( r1);
- assert(!r2);
+ assert(!r1);
+ assert(r2);
+ v.swap(r1, r2);
+ assert(r1);
+ assert(!r2);
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector.bool/reference/assign_bool.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/reference/assign_bool.pass.cpp
index 64dcc3c608214a3..0ce88b393c51680 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/reference/assign_bool.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/reference/assign_bool.pass.cpp
@@ -20,7 +20,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
typedef std::vector<bool>::reference Ref;
vec.push_back(true);
vec.push_back(false);
- Ref ref = vec[0];
+ Ref ref = vec[0];
const Ref cref = vec[0];
assert(ref);
@@ -48,7 +48,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
int main(int, char**) {
test();
#if TEST_STD_VER > 17
- static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/vector.bool/reference/assign_copy.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/reference/assign_copy.pass.cpp
index 7568eb2f3cc3e96..a877aea16e6ab72 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/reference/assign_copy.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/reference/assign_copy.pass.cpp
@@ -23,19 +23,19 @@ TEST_CONSTEXPR_CXX20 bool test() {
vec.push_back(false);
Ref ref1 = vec[0];
Ref ref2 = vec[1];
- ref2 = ref1;
+ ref2 = ref1;
// Ref&
{
vec[0] = false;
vec[1] = true;
- ref1 = ref2;
+ ref1 = ref2;
assert(vec[0]);
assert(vec[1]);
}
{
vec[0] = true;
vec[1] = false;
- ref1 = ref2;
+ ref1 = ref2;
assert(!vec[0]);
assert(!vec[1]);
}
@@ -43,14 +43,14 @@ TEST_CONSTEXPR_CXX20 bool test() {
{
vec[0] = false;
vec[1] = true;
- ref1 = std::move(ref2);
+ ref1 = std::move(ref2);
assert(vec[0]);
assert(vec[1]);
}
{
vec[0] = true;
vec[1] = false;
- ref1 = std::move(ref2);
+ ref1 = std::move(ref2);
assert(!vec[0]);
assert(!vec[1]);
}
@@ -58,14 +58,14 @@ TEST_CONSTEXPR_CXX20 bool test() {
{
vec[0] = false;
vec[1] = true;
- ref1 = static_cast<const Ref&>(ref2);
+ ref1 = static_cast<const Ref&>(ref2);
assert(vec[0]);
assert(vec[1]);
}
{
vec[0] = true;
vec[1] = false;
- ref1 = static_cast<const Ref&>(ref2);
+ ref1 = static_cast<const Ref&>(ref2);
assert(!vec[0]);
assert(!vec[1]);
}
@@ -75,7 +75,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
int main(int, char**) {
test();
#if TEST_STD_VER > 17
- static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/vector.bool/reference/ctor_copy.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/reference/ctor_copy.pass.cpp
index 46ac18ab493b7a6..5b7303828b5e8ff 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/reference/ctor_copy.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/reference/ctor_copy.pass.cpp
@@ -19,7 +19,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
std::vector<bool> vec;
typedef std::vector<bool>::reference Ref;
vec.push_back(true);
- Ref ref = vec[0];
+ Ref ref = vec[0];
Ref ref2 = ref;
assert(ref == ref2 && ref2);
ref.flip();
@@ -31,7 +31,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
int main(int, char**) {
test();
#if TEST_STD_VER > 17
- static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/vector.bool/reference/flip.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/reference/flip.pass.cpp
index 080975656ac9ef4..4c5b15ea0c1ba00 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/reference/flip.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/reference/flip.pass.cpp
@@ -36,7 +36,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
int main(int, char**) {
test();
#if TEST_STD_VER > 17
- static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/vector.bool/reference/operator_bool.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/reference/operator_bool.pass.cpp
index 02abd0e6be766b6..2fa00f8f9264684 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/reference/operator_bool.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/reference/operator_bool.pass.cpp
@@ -23,9 +23,9 @@ TEST_CONSTEXPR_CXX20 bool test() {
vec.push_back(true);
vec.push_back(false);
- Ref true_ref = vec[0];
+ Ref true_ref = vec[0];
Ref false_ref = vec[1];
- bool b = true_ref;
+ bool b = true_ref;
assert(b);
assert(true_ref);
assert(!false_ref);
@@ -36,7 +36,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
int main(int, char**) {
test();
#if TEST_STD_VER > 17
- static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/vector.bool/reserve.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/reserve.pass.cpp
index e179fb95aac2260..e0caeb0083fbb6c 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/reserve.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/reserve.pass.cpp
@@ -19,71 +19,69 @@
#include "min_allocator.h"
#include "test_allocator.h"
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- {
- std::vector<bool> v;
- v.reserve(10);
- assert(v.capacity() >= 10);
- }
- {
- std::vector<bool> v(100);
- assert(v.capacity() >= 100);
- v.reserve(50);
- assert(v.size() == 100);
- assert(v.capacity() >= 100);
- v.reserve(150);
- assert(v.size() == 100);
- assert(v.capacity() >= 150);
- }
+TEST_CONSTEXPR_CXX20 bool tests() {
+ {
+ std::vector<bool> v;
+ v.reserve(10);
+ assert(v.capacity() >= 10);
+ }
+ {
+ std::vector<bool> v(100);
+ assert(v.capacity() >= 100);
+ v.reserve(50);
+ assert(v.size() == 100);
+ assert(v.capacity() >= 100);
+ v.reserve(150);
+ assert(v.size() == 100);
+ assert(v.capacity() >= 150);
+ }
#if TEST_STD_VER >= 11
- {
- std::vector<bool, min_allocator<bool>> v;
- v.reserve(10);
- assert(v.capacity() >= 10);
- }
- {
- std::vector<bool, explicit_allocator<bool>> v;
- v.reserve(10);
- assert(v.capacity() >= 10);
- }
- {
- std::vector<bool, min_allocator<bool>> v(100);
- assert(v.capacity() >= 100);
- v.reserve(50);
- assert(v.size() == 100);
- assert(v.capacity() >= 100);
- v.reserve(150);
- assert(v.size() == 100);
- assert(v.capacity() >= 150);
- }
+ {
+ std::vector<bool, min_allocator<bool>> v;
+ v.reserve(10);
+ assert(v.capacity() >= 10);
+ }
+ {
+ std::vector<bool, explicit_allocator<bool>> v;
+ v.reserve(10);
+ assert(v.capacity() >= 10);
+ }
+ {
+ std::vector<bool, min_allocator<bool>> v(100);
+ assert(v.capacity() >= 100);
+ v.reserve(50);
+ assert(v.size() == 100);
+ assert(v.capacity() >= 100);
+ v.reserve(150);
+ assert(v.size() == 100);
+ assert(v.capacity() >= 150);
+ }
#endif
#ifndef TEST_HAS_NO_EXCEPTIONS
- if (!TEST_IS_CONSTANT_EVALUATED) {
- std::vector<bool, limited_allocator<bool, 10> > v;
- v.reserve(5);
- try {
- // A typical implementation would allocate chunks of bits.
- // In libc++ the chunk has the same size as the machine word. It is
- // reasonable to assume that in practice no implementation would use
- // 64 kB or larger chunks.
- v.reserve(10 * 65536);
- assert(false);
- } catch (const std::length_error&) {
- // no-op
- }
- assert(v.capacity() >= 5);
+ if (!TEST_IS_CONSTANT_EVALUATED) {
+ std::vector<bool, limited_allocator<bool, 10> > v;
+ v.reserve(5);
+ try {
+ // A typical implementation would allocate chunks of bits.
+ // In libc++ the chunk has the same size as the machine word. It is
+ // reasonable to assume that in practice no implementation would use
+ // 64 kB or larger chunks.
+ v.reserve(10 * 65536);
+ assert(false);
+ } catch (const std::length_error&) {
+ // no-op
}
+ assert(v.capacity() >= 5);
+ }
#endif
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector.bool/resize_size.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/resize_size.pass.cpp
index ef83dbf0a9741bc..690537a3bbbf0d5 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/resize_size.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/resize_size.pass.cpp
@@ -17,51 +17,49 @@
#include "test_macros.h"
#include "min_allocator.h"
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- {
- std::vector<bool> v(100);
- v.resize(50);
- assert(v.size() == 50);
- assert(v.capacity() >= 100);
- v.resize(200);
- assert(v.size() == 200);
- assert(v.capacity() >= 200);
- v.reserve(400);
- v.resize(300); // check the case when resizing and we already have room
- assert(v.size() == 300);
- assert(v.capacity() >= 400);
- }
+TEST_CONSTEXPR_CXX20 bool tests() {
+ {
+ std::vector<bool> v(100);
+ v.resize(50);
+ assert(v.size() == 50);
+ assert(v.capacity() >= 100);
+ v.resize(200);
+ assert(v.size() == 200);
+ assert(v.capacity() >= 200);
+ v.reserve(400);
+ v.resize(300); // check the case when resizing and we already have room
+ assert(v.size() == 300);
+ assert(v.capacity() >= 400);
+ }
#if TEST_STD_VER >= 11
- {
- std::vector<bool, explicit_allocator<bool>> v;
- v.resize(10);
- assert(v.size() == 10);
- assert(v.capacity() >= 10);
- }
- {
- std::vector<bool, min_allocator<bool>> v(100);
- v.resize(50);
- assert(v.size() == 50);
- assert(v.capacity() >= 100);
- v.resize(200);
- assert(v.size() == 200);
- assert(v.capacity() >= 200);
- v.reserve(400);
- v.resize(300); // check the case when resizing and we already have room
- assert(v.size() == 300);
- assert(v.capacity() >= 400);
- }
+ {
+ std::vector<bool, explicit_allocator<bool>> v;
+ v.resize(10);
+ assert(v.size() == 10);
+ assert(v.capacity() >= 10);
+ }
+ {
+ std::vector<bool, min_allocator<bool>> v(100);
+ v.resize(50);
+ assert(v.size() == 50);
+ assert(v.capacity() >= 100);
+ v.resize(200);
+ assert(v.size() == 200);
+ assert(v.capacity() >= 200);
+ v.reserve(400);
+ v.resize(300); // check the case when resizing and we already have room
+ assert(v.size() == 300);
+ assert(v.capacity() >= 400);
+ }
#endif
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector.bool/resize_size_value.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/resize_size_value.pass.cpp
index fa7ae3d3420a4ab..138a837e8a2f6ab 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/resize_size_value.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/resize_size_value.pass.cpp
@@ -17,47 +17,45 @@
#include "test_macros.h"
#include "min_allocator.h"
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- {
- std::vector<bool> v(100);
- v.resize(50, 1);
- assert(v.size() == 50);
- assert(v.capacity() >= 100);
- assert(v == std::vector<bool>(50));
- v.resize(200, 1);
- assert(v.size() == 200);
- assert(v.capacity() >= 200);
- for (unsigned i = 0; i < 50; ++i)
- assert(v[i] == 0);
- for (unsigned i = 50; i < 200; ++i)
- assert(v[i] == 1);
- }
+TEST_CONSTEXPR_CXX20 bool tests() {
+ {
+ std::vector<bool> v(100);
+ v.resize(50, 1);
+ assert(v.size() == 50);
+ assert(v.capacity() >= 100);
+ assert(v == std::vector<bool>(50));
+ v.resize(200, 1);
+ assert(v.size() == 200);
+ assert(v.capacity() >= 200);
+ for (unsigned i = 0; i < 50; ++i)
+ assert(v[i] == 0);
+ for (unsigned i = 50; i < 200; ++i)
+ assert(v[i] == 1);
+ }
#if TEST_STD_VER >= 11
- {
- std::vector<bool, min_allocator<bool>> v(100);
- v.resize(50, 1);
- assert(v.size() == 50);
- assert(v.capacity() >= 100);
- assert((v == std::vector<bool, min_allocator<bool>>(50)));
- v.resize(200, 1);
- assert(v.size() == 200);
- assert(v.capacity() >= 200);
- for (unsigned i = 0; i < 50; ++i)
- assert(v[i] == 0);
- for (unsigned i = 50; i < 200; ++i)
- assert(v[i] == 1);
- }
+ {
+ std::vector<bool, min_allocator<bool>> v(100);
+ v.resize(50, 1);
+ assert(v.size() == 50);
+ assert(v.capacity() >= 100);
+ assert((v == std::vector<bool, min_allocator<bool>>(50)));
+ v.resize(200, 1);
+ assert(v.size() == 200);
+ assert(v.capacity() >= 200);
+ for (unsigned i = 0; i < 50; ++i)
+ assert(v[i] == 0);
+ for (unsigned i = 50; i < 200; ++i)
+ assert(v[i] == 1);
+ }
#endif
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector.bool/size.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/size.pass.cpp
index 33f8b72dd4722ce..aeac3293ec6066f 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/size.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/size.pass.cpp
@@ -18,9 +18,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- {
+TEST_CONSTEXPR_CXX20 bool tests() {
+ {
typedef std::vector<bool> C;
C c;
ASSERT_NOEXCEPT(c.size());
@@ -37,9 +36,9 @@ TEST_CONSTEXPR_CXX20 bool tests()
assert(c.size() == 1);
c.erase(c.begin());
assert(c.size() == 0);
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::vector<bool, min_allocator<bool>> C;
C c;
ASSERT_NOEXCEPT(c.size());
@@ -56,17 +55,16 @@ TEST_CONSTEXPR_CXX20 bool tests()
assert(c.size() == 1);
c.erase(c.begin());
assert(c.size() == 0);
- }
+ }
#endif
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector.bool/swap.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/swap.pass.cpp
index edd28ef30847122..9b29a245e389a36 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/swap.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/swap.pass.cpp
@@ -17,93 +17,91 @@
#include "test_allocator.h"
#include "min_allocator.h"
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- {
- std::vector<bool> v1(100);
- std::vector<bool> v2(200);
- v1.swap(v2);
- assert(v1.size() == 200);
- assert(v1.capacity() >= 200);
- assert(v2.size() == 100);
- assert(v2.capacity() >= 100);
- }
- {
- typedef test_allocator<bool> A;
- std::vector<bool, A> v1(100, true, A(1, 1));
- std::vector<bool, A> v2(200, false, A(1, 2));
- swap(v1, v2);
- assert(v1.size() == 200);
- assert(v1.capacity() >= 200);
- assert(v2.size() == 100);
- assert(v2.capacity() >= 100);
- assert(v1.get_allocator().get_id() == 1);
- assert(v2.get_allocator().get_id() == 2);
- }
- {
- typedef other_allocator<bool> A;
- std::vector<bool, A> v1(100, true, A(1));
- std::vector<bool, A> v2(200, false, A(2));
- swap(v1, v2);
- assert(v1.size() == 200);
- assert(v1.capacity() >= 200);
- assert(v2.size() == 100);
- assert(v2.capacity() >= 100);
- assert(v1.get_allocator() == A(2));
- assert(v2.get_allocator() == A(1));
- }
- {
- std::vector<bool> v(2);
- std::vector<bool>::reference r1 = v[0];
- std::vector<bool>::reference r2 = v[1];
- r1 = true;
- using std::swap;
- swap(r1, r2);
- assert(v[0] == false);
- assert(v[1] == true);
- }
+TEST_CONSTEXPR_CXX20 bool tests() {
+ {
+ std::vector<bool> v1(100);
+ std::vector<bool> v2(200);
+ v1.swap(v2);
+ assert(v1.size() == 200);
+ assert(v1.capacity() >= 200);
+ assert(v2.size() == 100);
+ assert(v2.capacity() >= 100);
+ }
+ {
+ typedef test_allocator<bool> A;
+ std::vector<bool, A> v1(100, true, A(1, 1));
+ std::vector<bool, A> v2(200, false, A(1, 2));
+ swap(v1, v2);
+ assert(v1.size() == 200);
+ assert(v1.capacity() >= 200);
+ assert(v2.size() == 100);
+ assert(v2.capacity() >= 100);
+ assert(v1.get_allocator().get_id() == 1);
+ assert(v2.get_allocator().get_id() == 2);
+ }
+ {
+ typedef other_allocator<bool> A;
+ std::vector<bool, A> v1(100, true, A(1));
+ std::vector<bool, A> v2(200, false, A(2));
+ swap(v1, v2);
+ assert(v1.size() == 200);
+ assert(v1.capacity() >= 200);
+ assert(v2.size() == 100);
+ assert(v2.capacity() >= 100);
+ assert(v1.get_allocator() == A(2));
+ assert(v2.get_allocator() == A(1));
+ }
+ {
+ std::vector<bool> v(2);
+ std::vector<bool>::reference r1 = v[0];
+ std::vector<bool>::reference r2 = v[1];
+ r1 = true;
+ using std::swap;
+ swap(r1, r2);
+ assert(v[0] == false);
+ assert(v[1] == true);
+ }
#if TEST_STD_VER >= 11
- {
- std::vector<bool, min_allocator<bool>> v1(100);
- std::vector<bool, min_allocator<bool>> v2(200);
- v1.swap(v2);
- assert(v1.size() == 200);
- assert(v1.capacity() >= 200);
- assert(v2.size() == 100);
- assert(v2.capacity() >= 100);
- }
- {
- typedef min_allocator<bool> A;
- std::vector<bool, A> v1(100, true, A());
- std::vector<bool, A> v2(200, false, A());
- swap(v1, v2);
- assert(v1.size() == 200);
- assert(v1.capacity() >= 200);
- assert(v2.size() == 100);
- assert(v2.capacity() >= 100);
- assert(v1.get_allocator() == A());
- assert(v2.get_allocator() == A());
- }
- {
- std::vector<bool, min_allocator<bool>> v(2);
- std::vector<bool, min_allocator<bool>>::reference r1 = v[0];
- std::vector<bool, min_allocator<bool>>::reference r2 = v[1];
- r1 = true;
- using std::swap;
- swap(r1, r2);
- assert(v[0] == false);
- assert(v[1] == true);
- }
+ {
+ std::vector<bool, min_allocator<bool>> v1(100);
+ std::vector<bool, min_allocator<bool>> v2(200);
+ v1.swap(v2);
+ assert(v1.size() == 200);
+ assert(v1.capacity() >= 200);
+ assert(v2.size() == 100);
+ assert(v2.capacity() >= 100);
+ }
+ {
+ typedef min_allocator<bool> A;
+ std::vector<bool, A> v1(100, true, A());
+ std::vector<bool, A> v2(200, false, A());
+ swap(v1, v2);
+ assert(v1.size() == 200);
+ assert(v1.capacity() >= 200);
+ assert(v2.size() == 100);
+ assert(v2.capacity() >= 100);
+ assert(v1.get_allocator() == A());
+ assert(v2.get_allocator() == A());
+ }
+ {
+ std::vector<bool, min_allocator<bool>> v(2);
+ std::vector<bool, min_allocator<bool>>::reference r1 = v[0];
+ std::vector<bool, min_allocator<bool>>::reference r2 = v[1];
+ r1 = true;
+ using std::swap;
+ swap(r1, r2);
+ assert(v[0] == false);
+ assert(v[1] == true);
+ }
#endif
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector.bool/swap_noexcept.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/swap_noexcept.pass.cpp
index 40f7ae05be9b9b8..1683191403709a6 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/swap_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/swap_noexcept.pass.cpp
@@ -28,66 +28,63 @@
#include "test_allocator.h"
template <class T>
-struct some_alloc
-{
- typedef T value_type;
+struct some_alloc {
+ typedef T value_type;
- some_alloc() {}
- some_alloc(const some_alloc&);
- void deallocate(void*, unsigned) {}
+ some_alloc() {}
+ some_alloc(const some_alloc&);
+ void deallocate(void*, unsigned) {}
- typedef std::true_type propagate_on_container_swap;
+ typedef std::true_type propagate_on_container_swap;
};
template <class T>
-struct some_alloc2
-{
- typedef T value_type;
+struct some_alloc2 {
+ typedef T value_type;
- some_alloc2() {}
- some_alloc2(const some_alloc2&);
- void deallocate(void*, unsigned) {}
+ some_alloc2() {}
+ some_alloc2(const some_alloc2&);
+ void deallocate(void*, unsigned) {}
- typedef std::false_type propagate_on_container_swap;
- typedef std::true_type is_always_equal;
+ typedef std::false_type propagate_on_container_swap;
+ typedef std::true_type is_always_equal;
};
-int main(int, char**)
-{
+int main(int, char**) {
#if defined(_LIBCPP_VERSION)
- {
- typedef std::vector<bool> C;
- static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- {
- typedef std::vector<bool, test_allocator<bool>> C;
- static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- {
- typedef std::vector<bool, other_allocator<bool>> C;
- static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
+ {
+ typedef std::vector<bool> C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
+ {
+ typedef std::vector<bool, test_allocator<bool>> C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
+ {
+ typedef std::vector<bool, other_allocator<bool>> C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
#endif // _LIBCPP_VERSION
- {
+ {
#if TEST_STD_VER >= 14
-#if defined(_LIBCPP_VERSION)
+# if defined(_LIBCPP_VERSION)
// In C++14, if POCS is set, swapping the allocator is required not to throw
- typedef std::vector<bool, some_alloc<bool>> C;
- static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
-#endif // _LIBCPP_VERSION
+ typedef std::vector<bool, some_alloc<bool>> C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+# endif // _LIBCPP_VERSION
#else
- typedef std::vector<bool, some_alloc<bool>> C;
- static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ typedef std::vector<bool, some_alloc<bool>> C;
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
#endif
- }
+ }
#if TEST_STD_VER >= 14
-#if defined(_LIBCPP_VERSION)
- {
- typedef std::vector<bool, some_alloc2<bool>> C;
+# if defined(_LIBCPP_VERSION)
+ {
+ typedef std::vector<bool, some_alloc2<bool>> C;
// if the allocators are always equal, then the swap can be noexcept
- static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
-#endif // _LIBCPP_VERSION
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
+# endif // _LIBCPP_VERSION
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/vector.bool/types.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/types.pass.cpp
index d75d7151473521b..4aaf02ef31f8b80 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/types.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/types.pass.cpp
@@ -37,49 +37,47 @@
#include "min_allocator.h"
template <class Allocator>
-void
-test()
-{
- typedef std::vector<bool, Allocator> C;
+void test() {
+ typedef std::vector<bool, Allocator> C;
- static_assert((std::is_same<typename C::value_type, bool>::value), "");
- static_assert((std::is_same<typename C::value_type, typename Allocator::value_type>::value), "");
- static_assert((std::is_same<typename C::allocator_type, Allocator>::value), "");
- static_assert((std::is_same<typename C::size_type, typename std::allocator_traits<Allocator>::size_type>::value), "");
- static_assert((std::is_same<typename C::
diff erence_type, typename std::allocator_traits<Allocator>::
diff erence_type>::value), "");
+ static_assert((std::is_same<typename C::value_type, bool>::value), "");
+ static_assert((std::is_same<typename C::value_type, typename Allocator::value_type>::value), "");
+ static_assert((std::is_same<typename C::allocator_type, Allocator>::value), "");
+ static_assert((std::is_same<typename C::size_type, typename std::allocator_traits<Allocator>::size_type>::value), "");
+ static_assert(
+ (std::is_same<typename C::
diff erence_type, typename std::allocator_traits<Allocator>::
diff erence_type>::value),
+ "");
- static_assert((std::is_signed<typename C::
diff erence_type>::value), "");
- static_assert((std::is_unsigned<typename C::size_type>::value), "");
- static_assert((std::is_same<typename C::
diff erence_type,
- typename std::iterator_traits<typename C::iterator>::
diff erence_type>::value), "");
- static_assert((std::is_same<typename C::
diff erence_type,
- typename std::iterator_traits<typename C::const_iterator>::
diff erence_type>::value), "");
+ static_assert((std::is_signed<typename C::
diff erence_type>::value), "");
+ static_assert((std::is_unsigned<typename C::size_type>::value), "");
+ static_assert((std::is_same<typename C::
diff erence_type,
+ typename std::iterator_traits<typename C::iterator>::
diff erence_type>::value),
+ "");
+ static_assert((std::is_same<typename C::
diff erence_type,
+ typename std::iterator_traits<typename C::const_iterator>::
diff erence_type>::value),
+ "");
- static_assert((std::is_same<
- typename std::iterator_traits<typename C::iterator>::iterator_category,
- std::random_access_iterator_tag>::value), "");
- static_assert((std::is_same<
- typename std::iterator_traits<typename C::const_iterator>::iterator_category,
- std::random_access_iterator_tag>::value), "");
- static_assert((std::is_same<
- typename C::reverse_iterator,
- std::reverse_iterator<typename C::iterator> >::value), "");
- static_assert((std::is_same<
- typename C::const_reverse_iterator,
- std::reverse_iterator<typename C::const_iterator> >::value), "");
+ static_assert((std::is_same< typename std::iterator_traits<typename C::iterator>::iterator_category,
+ std::random_access_iterator_tag>::value),
+ "");
+ static_assert((std::is_same< typename std::iterator_traits<typename C::const_iterator>::iterator_category,
+ std::random_access_iterator_tag>::value),
+ "");
+ static_assert((std::is_same< typename C::reverse_iterator, std::reverse_iterator<typename C::iterator> >::value), "");
+ static_assert(
+ (std::is_same< typename C::const_reverse_iterator, std::reverse_iterator<typename C::const_iterator> >::value),
+ "");
#if !defined(_LIBCPP_VERSION) || defined(_LIBCPP_ABI_BITSET_VECTOR_BOOL_CONST_SUBSCRIPT_RETURN_BOOL)
- static_assert(std::is_same<typename C::const_reference, bool>::value, "");
+ static_assert(std::is_same<typename C::const_reference, bool>::value, "");
#endif
}
-int main(int, char**)
-{
- test<test_allocator<bool> >();
- test<std::allocator<bool> >();
- static_assert((std::is_same<std::vector<bool>::allocator_type,
- std::allocator<bool> >::value), "");
+int main(int, char**) {
+ test<test_allocator<bool> >();
+ test<std::allocator<bool> >();
+ static_assert((std::is_same<std::vector<bool>::allocator_type, std::allocator<bool> >::value), "");
#if TEST_STD_VER >= 11
- test<min_allocator<bool> >();
+ test<min_allocator<bool> >();
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/vector.bool/vector_bool.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/vector_bool.pass.cpp
index b927f2a4dbdde66..e270869a8320f3b 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/vector_bool.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/vector_bool.pass.cpp
@@ -24,14 +24,13 @@
#include "test_macros.h"
#include "min_allocator.h"
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- {
+TEST_CONSTEXPR_CXX20 bool tests() {
+ {
typedef std::vector<bool> T;
typedef std::hash<T> H;
#if TEST_STD_VER <= 14
- static_assert((std::is_same<H::argument_type, T>::value), "" );
- static_assert((std::is_same<H::result_type, std::size_t>::value), "" );
+ static_assert((std::is_same<H::argument_type, T>::value), "");
+ static_assert((std::is_same<H::result_type, std::size_t>::value), "");
#endif
ASSERT_NOEXCEPT(H()(T()));
@@ -39,31 +38,30 @@ TEST_CONSTEXPR_CXX20 bool tests()
T vb(std::begin(ba), std::end(ba));
H h;
assert(h(vb) != 0);
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::vector<bool, min_allocator<bool>> T;
typedef std::hash<T> H;
-#if TEST_STD_VER <= 14
- static_assert((std::is_same<H::argument_type, T>::value), "" );
- static_assert((std::is_same<H::result_type, std::size_t>::value), "" );
-#endif
+# if TEST_STD_VER <= 14
+ static_assert((std::is_same<H::argument_type, T>::value), "");
+ static_assert((std::is_same<H::result_type, std::size_t>::value), "");
+# endif
ASSERT_NOEXCEPT(H()(T()));
bool ba[] = {true, false, true, true, false};
T vb(std::begin(ba), std::end(ba));
H h;
assert(h(vb) != 0);
- }
+ }
#endif
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector/access.pass.cpp b/libcxx/test/std/containers/sequences/vector/access.pass.cpp
index 026cf92c2d723e8..efee03d342f54a3 100644
--- a/libcxx/test/std/containers/sequences/vector/access.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/access.pass.cpp
@@ -30,101 +30,102 @@
template <class C>
TEST_CONSTEXPR_CXX20 C make(int size, int start) {
- C c;
- for (int i = 0; i < size; ++i)
- c.push_back(start + i);
- return c;
+ C c;
+ for (int i = 0; i < size; ++i)
+ c.push_back(start + i);
+ return c;
}
template <class Vector>
TEST_CONSTEXPR_CXX20 void test_get_basic(Vector& c, int start_value) {
- const int n = static_cast<int>(c.size());
- for (int i = 0; i < n; ++i)
- assert(c[i] == start_value + i);
- for (int i = 0; i < n; ++i)
- assert(c.at(i) == start_value + i);
+ const int n = static_cast<int>(c.size());
+ for (int i = 0; i < n; ++i)
+ assert(c[i] == start_value + i);
+ for (int i = 0; i < n; ++i)
+ assert(c.at(i) == start_value + i);
#ifndef TEST_HAS_NO_EXCEPTIONS
- if (!TEST_IS_CONSTANT_EVALUATED) {
- try {
- TEST_IGNORE_NODISCARD c.at(n);
- assert(false);
- } catch (const std::out_of_range&) {}
+ if (!TEST_IS_CONSTANT_EVALUATED) {
+ try {
+ TEST_IGNORE_NODISCARD c.at(n);
+ assert(false);
+ } catch (const std::out_of_range&) {
}
+ }
#endif
- assert(c.front() == start_value);
- assert(c.back() == start_value + n - 1);
+ assert(c.front() == start_value);
+ assert(c.back() == start_value + n - 1);
}
template <class Vector>
TEST_CONSTEXPR_CXX20 void test_get() {
- int start_value = 35;
- Vector c = make<Vector>(10, start_value);
- const Vector& cc = c;
- test_get_basic(c, start_value);
- test_get_basic(cc, start_value);
+ int start_value = 35;
+ Vector c = make<Vector>(10, start_value);
+ const Vector& cc = c;
+ test_get_basic(c, start_value);
+ test_get_basic(cc, start_value);
}
template <class Vector>
TEST_CONSTEXPR_CXX20 void test_set() {
- int start_value = 35;
- const int n = 10;
- Vector c = make<Vector>(n, start_value);
-
- for (int i = 0; i < n; ++i) {
- assert(c[i] == start_value + i);
- c[i] = start_value + i + 1;
- assert(c[i] == start_value + i + 1);
- }
- for (int i = 0; i < n; ++i) {
- assert(c.at(i) == start_value + i + 1);
- c.at(i) = start_value + i + 2;
- assert(c.at(i) == start_value + i + 2);
- }
-
- assert(c.front() == start_value + 2);
- c.front() = start_value + 3;
- assert(c.front() == start_value + 3);
-
- assert(c.back() == start_value + n + 1);
- c.back() = start_value + n + 2;
- assert(c.back() == start_value + n + 2);
+ int start_value = 35;
+ const int n = 10;
+ Vector c = make<Vector>(n, start_value);
+
+ for (int i = 0; i < n; ++i) {
+ assert(c[i] == start_value + i);
+ c[i] = start_value + i + 1;
+ assert(c[i] == start_value + i + 1);
+ }
+ for (int i = 0; i < n; ++i) {
+ assert(c.at(i) == start_value + i + 1);
+ c.at(i) = start_value + i + 2;
+ assert(c.at(i) == start_value + i + 2);
+ }
+
+ assert(c.front() == start_value + 2);
+ c.front() = start_value + 3;
+ assert(c.front() == start_value + 3);
+
+ assert(c.back() == start_value + n + 1);
+ c.back() = start_value + n + 2;
+ assert(c.back() == start_value + n + 2);
}
template <class Vector>
TEST_CONSTEXPR_CXX20 void test() {
- test_get<Vector>();
- test_set<Vector>();
+ test_get<Vector>();
+ test_set<Vector>();
- Vector c;
- const Vector& cc = c;
- ASSERT_SAME_TYPE(typename Vector::reference, decltype(c[0]));
- ASSERT_SAME_TYPE(typename Vector::const_reference, decltype(cc[0]));
+ Vector c;
+ const Vector& cc = c;
+ ASSERT_SAME_TYPE(typename Vector::reference, decltype(c[0]));
+ ASSERT_SAME_TYPE(typename Vector::const_reference, decltype(cc[0]));
- ASSERT_SAME_TYPE(typename Vector::reference, decltype(c.at(0)));
- ASSERT_SAME_TYPE(typename Vector::const_reference, decltype(cc.at(0)));
+ ASSERT_SAME_TYPE(typename Vector::reference, decltype(c.at(0)));
+ ASSERT_SAME_TYPE(typename Vector::const_reference, decltype(cc.at(0)));
- ASSERT_SAME_TYPE(typename Vector::reference, decltype(c.front()));
- ASSERT_SAME_TYPE(typename Vector::const_reference, decltype(cc.front()));
+ ASSERT_SAME_TYPE(typename Vector::reference, decltype(c.front()));
+ ASSERT_SAME_TYPE(typename Vector::const_reference, decltype(cc.front()));
- ASSERT_SAME_TYPE(typename Vector::reference, decltype(c.back()));
- ASSERT_SAME_TYPE(typename Vector::const_reference, decltype(cc.back()));
+ ASSERT_SAME_TYPE(typename Vector::reference, decltype(c.back()));
+ ASSERT_SAME_TYPE(typename Vector::const_reference, decltype(cc.back()));
}
TEST_CONSTEXPR_CXX20 bool tests() {
- test<std::vector<int> >();
+ test<std::vector<int> >();
#if TEST_STD_VER >= 11
- test<std::vector<int, min_allocator<int> > >();
- test<std::vector<int, safe_allocator<int> > >();
+ test<std::vector<int, min_allocator<int> > >();
+ test<std::vector<int, safe_allocator<int> > >();
#endif
- return true;
+ return true;
}
int main(int, char**) {
- tests();
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector/addressof.compile.pass.cpp b/libcxx/test/std/containers/sequences/vector/addressof.compile.pass.cpp
index 120b7b289af93e6..86f8d0e17e665a5 100644
--- a/libcxx/test/std/containers/sequences/vector/addressof.compile.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/addressof.compile.pass.cpp
@@ -39,8 +39,12 @@ void test(
v = std::move(v);
// construction
- { Vector v2(std::move(v)); }
- { Vector v2(std::move(v), std::allocator<operator_hijacker>()); }
+ {
+ Vector v2(std::move(v));
+ }
+ {
+ Vector v2(std::move(v), std::allocator<operator_hijacker>());
+ }
// swap
v.swap(v);
diff --git a/libcxx/test/std/containers/sequences/vector/allocator_mismatch.verify.cpp b/libcxx/test/std/containers/sequences/vector/allocator_mismatch.verify.cpp
index 97edbf4d64f67b7..eb23c67689ee36b 100644
--- a/libcxx/test/std/containers/sequences/vector/allocator_mismatch.verify.cpp
+++ b/libcxx/test/std/containers/sequences/vector/allocator_mismatch.verify.cpp
@@ -12,4 +12,4 @@
#include <vector>
std::vector<int, std::allocator<long> > v;
- // expected-error-re@*:* {{static assertion failed{{.*}}Allocator::value_type must be same type as value_type}}
+// expected-error-re@*:* {{static assertion failed{{.*}}Allocator::value_type must be same type as value_type}}
diff --git a/libcxx/test/std/containers/sequences/vector/compare.pass.cpp b/libcxx/test/std/containers/sequences/vector/compare.pass.cpp
index 917095e1f138d33..413767e52a4d685 100644
--- a/libcxx/test/std/containers/sequences/vector/compare.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/compare.pass.cpp
@@ -21,109 +21,109 @@
#include "test_comparisons.h"
TEST_CONSTEXPR_CXX20 bool test() {
- {
- const std::vector<int> c1, c2;
- assert(testComparisons(c1, c2, true, false));
- }
- {
- const std::vector<int> c1(1, 1), c2(1, 2);
- assert(testComparisons(c1, c2, false, true));
- }
- {
- const std::vector<int> c1, c2(1, 2);
- assert(testComparisons(c1, c2, false, true));
- }
- {
- int items1[3] = {1, 2, 1};
- int items2[3] = {1, 2, 2};
- const std::vector<int> c1(items1, items1 + 3);
- const std::vector<int> c2(items2, items2 + 3);
- assert(testComparisons(c1, c2, false, true));
- }
- {
- int items1[3] = {3, 2, 3};
- int items2[3] = {3, 1, 3};
- const std::vector<int> c1(items1, items1 + 3);
- const std::vector<int> c2(items2, items2 + 3);
+ {
+ const std::vector<int> c1, c2;
+ assert(testComparisons(c1, c2, true, false));
+ }
+ {
+ const std::vector<int> c1(1, 1), c2(1, 2);
+ assert(testComparisons(c1, c2, false, true));
+ }
+ {
+ const std::vector<int> c1, c2(1, 2);
+ assert(testComparisons(c1, c2, false, true));
+ }
+ {
+ int items1[3] = {1, 2, 1};
+ int items2[3] = {1, 2, 2};
+ const std::vector<int> c1(items1, items1 + 3);
+ const std::vector<int> c2(items2, items2 + 3);
+ assert(testComparisons(c1, c2, false, true));
+ }
+ {
+ int items1[3] = {3, 2, 3};
+ int items2[3] = {3, 1, 3};
+ const std::vector<int> c1(items1, items1 + 3);
+ const std::vector<int> c2(items2, items2 + 3);
- assert(testComparisons(c1, c2, false, false));
- }
- {
- int items1[2] = {1, 2};
- int items2[3] = {1, 2, 0};
- const std::vector<int> c1(items1, items1 + 2);
- const std::vector<int> c2(items2, items2 + 3);
- assert(testComparisons(c1, c2, false, true));
- }
- {
- int items1[3] = {1, 2, 0};
- const std::vector<int> c1(items1, items1 + 3);
- const std::vector<int> c2(1, 3);
- assert(testComparisons(c1, c2, false, true));
- }
- {
- const std::vector<LessAndEqComp> c1, c2;
- assert(testComparisons(c1, c2, true, false));
- }
- {
- const std::vector<LessAndEqComp> c1(1, LessAndEqComp(1));
- const std::vector<LessAndEqComp> c2(1, LessAndEqComp(1));
- assert(testComparisons(c1, c2, true, false));
- }
- {
- const std::vector<LessAndEqComp> c1(1, LessAndEqComp(1));
- const std::vector<LessAndEqComp> c2(1, LessAndEqComp(2));
- assert(testComparisons(c1, c2, false, true));
- }
- {
- const std::vector<LessAndEqComp> c1;
- const std::vector<LessAndEqComp> c2(1, LessAndEqComp(2));
- assert(testComparisons(c1, c2, false, true));
- }
- {
- LessAndEqComp items1[3] = {LessAndEqComp(1), LessAndEqComp(2), LessAndEqComp(2)};
- LessAndEqComp items2[3] = {LessAndEqComp(1), LessAndEqComp(2), LessAndEqComp(1)};
- const std::vector<LessAndEqComp> c1(items1, items1 + 3);
- const std::vector<LessAndEqComp> c2(items2, items2 + 3);
- assert(testComparisons(c1, c2, false, false));
- }
- {
- LessAndEqComp items1[3] = {LessAndEqComp(3), LessAndEqComp(3), LessAndEqComp(3)};
- LessAndEqComp items2[3] = {LessAndEqComp(3), LessAndEqComp(2), LessAndEqComp(3)};
- const std::vector<LessAndEqComp> c1(items1, items1 + 3);
- const std::vector<LessAndEqComp> c2(items2, items2 + 3);
- assert(testComparisons(c1, c2, false, false));
- }
- {
- LessAndEqComp items1[2] = {LessAndEqComp(1), LessAndEqComp(2)};
- LessAndEqComp items2[3] = {LessAndEqComp(1), LessAndEqComp(2), LessAndEqComp(0)};
- const std::vector<LessAndEqComp> c1(items1, items1 + 2);
- const std::vector<LessAndEqComp> c2(items2, items2 + 3);
- assert(testComparisons(c1, c2, false, true));
- }
- {
- LessAndEqComp items1[3] = {LessAndEqComp(1), LessAndEqComp(2), LessAndEqComp(0)};
- const std::vector<LessAndEqComp> c1(items1, items1 + 3);
- const std::vector<LessAndEqComp> c2(1, LessAndEqComp(3));
- assert(testComparisons(c1, c2, false, true));
- }
- {
- assert((std::vector<int>() == std::vector<int>()));
- assert(!(std::vector<int>() != std::vector<int>()));
- assert(!(std::vector<int>() < std::vector<int>()));
- assert((std::vector<int>() <= std::vector<int>()));
- assert(!(std::vector<int>() > std::vector<int>()));
- assert((std::vector<int>() >= std::vector<int>()));
- }
+ assert(testComparisons(c1, c2, false, false));
+ }
+ {
+ int items1[2] = {1, 2};
+ int items2[3] = {1, 2, 0};
+ const std::vector<int> c1(items1, items1 + 2);
+ const std::vector<int> c2(items2, items2 + 3);
+ assert(testComparisons(c1, c2, false, true));
+ }
+ {
+ int items1[3] = {1, 2, 0};
+ const std::vector<int> c1(items1, items1 + 3);
+ const std::vector<int> c2(1, 3);
+ assert(testComparisons(c1, c2, false, true));
+ }
+ {
+ const std::vector<LessAndEqComp> c1, c2;
+ assert(testComparisons(c1, c2, true, false));
+ }
+ {
+ const std::vector<LessAndEqComp> c1(1, LessAndEqComp(1));
+ const std::vector<LessAndEqComp> c2(1, LessAndEqComp(1));
+ assert(testComparisons(c1, c2, true, false));
+ }
+ {
+ const std::vector<LessAndEqComp> c1(1, LessAndEqComp(1));
+ const std::vector<LessAndEqComp> c2(1, LessAndEqComp(2));
+ assert(testComparisons(c1, c2, false, true));
+ }
+ {
+ const std::vector<LessAndEqComp> c1;
+ const std::vector<LessAndEqComp> c2(1, LessAndEqComp(2));
+ assert(testComparisons(c1, c2, false, true));
+ }
+ {
+ LessAndEqComp items1[3] = {LessAndEqComp(1), LessAndEqComp(2), LessAndEqComp(2)};
+ LessAndEqComp items2[3] = {LessAndEqComp(1), LessAndEqComp(2), LessAndEqComp(1)};
+ const std::vector<LessAndEqComp> c1(items1, items1 + 3);
+ const std::vector<LessAndEqComp> c2(items2, items2 + 3);
+ assert(testComparisons(c1, c2, false, false));
+ }
+ {
+ LessAndEqComp items1[3] = {LessAndEqComp(3), LessAndEqComp(3), LessAndEqComp(3)};
+ LessAndEqComp items2[3] = {LessAndEqComp(3), LessAndEqComp(2), LessAndEqComp(3)};
+ const std::vector<LessAndEqComp> c1(items1, items1 + 3);
+ const std::vector<LessAndEqComp> c2(items2, items2 + 3);
+ assert(testComparisons(c1, c2, false, false));
+ }
+ {
+ LessAndEqComp items1[2] = {LessAndEqComp(1), LessAndEqComp(2)};
+ LessAndEqComp items2[3] = {LessAndEqComp(1), LessAndEqComp(2), LessAndEqComp(0)};
+ const std::vector<LessAndEqComp> c1(items1, items1 + 2);
+ const std::vector<LessAndEqComp> c2(items2, items2 + 3);
+ assert(testComparisons(c1, c2, false, true));
+ }
+ {
+ LessAndEqComp items1[3] = {LessAndEqComp(1), LessAndEqComp(2), LessAndEqComp(0)};
+ const std::vector<LessAndEqComp> c1(items1, items1 + 3);
+ const std::vector<LessAndEqComp> c2(1, LessAndEqComp(3));
+ assert(testComparisons(c1, c2, false, true));
+ }
+ {
+ assert((std::vector<int>() == std::vector<int>()));
+ assert(!(std::vector<int>() != std::vector<int>()));
+ assert(!(std::vector<int>() < std::vector<int>()));
+ assert((std::vector<int>() <= std::vector<int>()));
+ assert(!(std::vector<int>() > std::vector<int>()));
+ assert((std::vector<int>() >= std::vector<int>()));
+ }
- return true;
+ return true;
}
int main(int, char**) {
- test();
+ test();
#if TEST_STD_VER > 17
- static_assert(test());
+ static_assert(test());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector/contiguous.pass.cpp b/libcxx/test/std/containers/sequences/vector/contiguous.pass.cpp
index 3c992ba9bb5942b..898f824e65ac0d1 100644
--- a/libcxx/test/std/containers/sequences/vector/contiguous.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/contiguous.pass.cpp
@@ -18,53 +18,50 @@
#include "min_allocator.h"
template <class C>
-TEST_CONSTEXPR_CXX20 void test_contiguous(const C &c)
-{
- for ( std::size_t i = 0; i < c.size(); ++i )
- assert ( *(c.begin() + static_cast<typename C::
diff erence_type>(i)) == *(std::addressof(*c.begin()) + i));
+TEST_CONSTEXPR_CXX20 void test_contiguous(const C& c) {
+ for (std::size_t i = 0; i < c.size(); ++i)
+ assert(*(c.begin() + static_cast<typename C::
diff erence_type>(i)) == *(std::addressof(*c.begin()) + i));
}
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- {
+TEST_CONSTEXPR_CXX20 bool tests() {
+ {
typedef int T;
typedef std::vector<T> C;
test_contiguous(C());
test_contiguous(C(3, 5));
- }
+ }
- {
+ {
typedef double T;
typedef test_allocator<T> A;
typedef std::vector<T, A> C;
test_contiguous(C(A(3)));
test_contiguous(C(7, 9.0, A(5)));
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef double T;
typedef min_allocator<T> A;
typedef std::vector<T, A> C;
test_contiguous(C(A{}));
test_contiguous(C(9, 11.0, A{}));
- }
- {
- typedef double T;
- typedef safe_allocator<T> A;
- typedef std::vector<T, A> C;
- test_contiguous(C(A{}));
- test_contiguous(C(9, 11.0, A{}));
- }
+ }
+ {
+ typedef double T;
+ typedef safe_allocator<T> A;
+ typedef std::vector<T, A> C;
+ test_contiguous(C(A{}));
+ test_contiguous(C(9, 11.0, A{}));
+ }
#endif
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector/get_allocator.pass.cpp b/libcxx/test/std/containers/sequences/vector/get_allocator.pass.cpp
index c0003acae75ef23..0398ff8bb1fd8c5 100644
--- a/libcxx/test/std/containers/sequences/vector/get_allocator.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/get_allocator.pass.cpp
@@ -19,25 +19,25 @@
#include "test_macros.h"
TEST_CONSTEXPR_CXX20 bool test() {
- {
- std::allocator<int> alloc;
- const std::vector<int> v(alloc);
- assert(v.get_allocator() == alloc);
- }
- {
- other_allocator<int> alloc(1);
- const std::vector<int, other_allocator<int> > v(alloc);
- assert(v.get_allocator() == alloc);
- }
-
- return true;
+ {
+ std::allocator<int> alloc;
+ const std::vector<int> v(alloc);
+ assert(v.get_allocator() == alloc);
+ }
+ {
+ other_allocator<int> alloc(1);
+ const std::vector<int, other_allocator<int> > v(alloc);
+ assert(v.get_allocator() == alloc);
+ }
+
+ return true;
}
int main(int, char**) {
- test();
+ test();
#if TEST_STD_VER > 17
- static_assert(test());
+ static_assert(test());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector/iterator_concept_conformance.compile.pass.cpp b/libcxx/test/std/containers/sequences/vector/iterator_concept_conformance.compile.pass.cpp
index f0dc2ba834ae16e..41b5bde5e9ad32b 100644
--- a/libcxx/test/std/containers/sequences/vector/iterator_concept_conformance.compile.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/iterator_concept_conformance.compile.pass.cpp
@@ -14,68 +14,68 @@
#include <iterator>
-using iterator = std::vector<int>::iterator;
-using const_iterator = std::vector<int>::const_iterator;
-using reverse_iterator = std::vector<int>::reverse_iterator;
+using iterator = std::vector<int>::iterator;
+using const_iterator = std::vector<int>::const_iterator;
+using reverse_iterator = std::vector<int>::reverse_iterator;
using const_reverse_iterator = std::vector<int>::const_reverse_iterator;
-using value_type = int;
+using value_type = int;
-static_assert( std::contiguous_iterator<iterator>);
-static_assert( std::random_access_iterator<reverse_iterator>);
+static_assert(std::contiguous_iterator<iterator>);
+static_assert(std::random_access_iterator<reverse_iterator>);
static_assert(!std::contiguous_iterator<reverse_iterator>);
-static_assert( std::indirectly_writable<iterator, value_type>);
-static_assert( std::sentinel_for<iterator, iterator>);
-static_assert( std::sentinel_for<iterator, const_iterator>);
+static_assert(std::indirectly_writable<iterator, value_type>);
+static_assert(std::sentinel_for<iterator, iterator>);
+static_assert(std::sentinel_for<iterator, const_iterator>);
static_assert(!std::sentinel_for<iterator, reverse_iterator>);
static_assert(!std::sentinel_for<iterator, const_reverse_iterator>);
-static_assert( std::sized_sentinel_for<iterator, iterator>);
-static_assert( std::sized_sentinel_for<iterator, const_iterator>);
+static_assert(std::sized_sentinel_for<iterator, iterator>);
+static_assert(std::sized_sentinel_for<iterator, const_iterator>);
static_assert(!std::sized_sentinel_for<iterator, reverse_iterator>);
static_assert(!std::sized_sentinel_for<iterator, const_reverse_iterator>);
-static_assert( std::indirectly_movable<iterator, iterator>);
-static_assert( std::indirectly_movable_storable<iterator, iterator>);
+static_assert(std::indirectly_movable<iterator, iterator>);
+static_assert(std::indirectly_movable_storable<iterator, iterator>);
static_assert(!std::indirectly_movable<iterator, const_iterator>);
static_assert(!std::indirectly_movable_storable<iterator, const_iterator>);
-static_assert( std::indirectly_movable<iterator, reverse_iterator>);
-static_assert( std::indirectly_movable_storable<iterator, reverse_iterator>);
+static_assert(std::indirectly_movable<iterator, reverse_iterator>);
+static_assert(std::indirectly_movable_storable<iterator, reverse_iterator>);
static_assert(!std::indirectly_movable<iterator, const_reverse_iterator>);
static_assert(!std::indirectly_movable_storable<iterator, const_reverse_iterator>);
-static_assert( std::indirectly_copyable<iterator, iterator>);
-static_assert( std::indirectly_copyable_storable<iterator, iterator>);
+static_assert(std::indirectly_copyable<iterator, iterator>);
+static_assert(std::indirectly_copyable_storable<iterator, iterator>);
static_assert(!std::indirectly_copyable<iterator, const_iterator>);
static_assert(!std::indirectly_copyable_storable<iterator, const_iterator>);
-static_assert( std::indirectly_copyable<iterator, reverse_iterator>);
-static_assert( std::indirectly_copyable_storable<iterator, reverse_iterator>);
+static_assert(std::indirectly_copyable<iterator, reverse_iterator>);
+static_assert(std::indirectly_copyable_storable<iterator, reverse_iterator>);
static_assert(!std::indirectly_copyable<iterator, const_reverse_iterator>);
static_assert(!std::indirectly_copyable_storable<iterator, const_reverse_iterator>);
static_assert(std::indirectly_swappable<iterator, iterator>);
-static_assert( std::contiguous_iterator<const_iterator>);
-static_assert( std::random_access_iterator<const_reverse_iterator>);
+static_assert(std::contiguous_iterator<const_iterator>);
+static_assert(std::random_access_iterator<const_reverse_iterator>);
static_assert(!std::contiguous_iterator<const_reverse_iterator>);
static_assert(!std::indirectly_writable<const_iterator, value_type>);
-static_assert( std::sentinel_for<const_iterator, iterator>);
-static_assert( std::sentinel_for<const_iterator, const_iterator>);
+static_assert(std::sentinel_for<const_iterator, iterator>);
+static_assert(std::sentinel_for<const_iterator, const_iterator>);
static_assert(!std::sentinel_for<const_iterator, reverse_iterator>);
static_assert(!std::sentinel_for<const_iterator, const_reverse_iterator>);
-static_assert( std::sized_sentinel_for<const_iterator, iterator>);
-static_assert( std::sized_sentinel_for<const_iterator, const_iterator>);
+static_assert(std::sized_sentinel_for<const_iterator, iterator>);
+static_assert(std::sized_sentinel_for<const_iterator, const_iterator>);
static_assert(!std::sized_sentinel_for<const_iterator, reverse_iterator>);
static_assert(!std::sized_sentinel_for<const_iterator, const_reverse_iterator>);
-static_assert( std::indirectly_movable<const_iterator, iterator>);
-static_assert( std::indirectly_movable_storable<const_iterator, iterator>);
+static_assert(std::indirectly_movable<const_iterator, iterator>);
+static_assert(std::indirectly_movable_storable<const_iterator, iterator>);
static_assert(!std::indirectly_movable<const_iterator, const_iterator>);
static_assert(!std::indirectly_movable_storable<const_iterator, const_iterator>);
-static_assert( std::indirectly_movable<const_iterator, reverse_iterator>);
-static_assert( std::indirectly_movable_storable<const_iterator, reverse_iterator>);
+static_assert(std::indirectly_movable<const_iterator, reverse_iterator>);
+static_assert(std::indirectly_movable_storable<const_iterator, reverse_iterator>);
static_assert(!std::indirectly_movable<const_iterator, const_reverse_iterator>);
static_assert(!std::indirectly_movable_storable<const_iterator, const_reverse_iterator>);
-static_assert( std::indirectly_copyable<const_iterator, iterator>);
-static_assert( std::indirectly_copyable_storable<const_iterator, iterator>);
+static_assert(std::indirectly_copyable<const_iterator, iterator>);
+static_assert(std::indirectly_copyable_storable<const_iterator, iterator>);
static_assert(!std::indirectly_copyable<const_iterator, const_iterator>);
static_assert(!std::indirectly_copyable_storable<const_iterator, const_iterator>);
-static_assert( std::indirectly_copyable<const_iterator, reverse_iterator>);
-static_assert( std::indirectly_copyable_storable<const_iterator, reverse_iterator>);
+static_assert(std::indirectly_copyable<const_iterator, reverse_iterator>);
+static_assert(std::indirectly_copyable_storable<const_iterator, reverse_iterator>);
static_assert(!std::indirectly_copyable<const_iterator, const_reverse_iterator>);
static_assert(!std::indirectly_copyable_storable<const_iterator, const_reverse_iterator>);
static_assert(!std::indirectly_swappable<const_iterator, const_iterator>);
diff --git a/libcxx/test/std/containers/sequences/vector/iterators.pass.cpp b/libcxx/test/std/containers/sequences/vector/iterators.pass.cpp
index 0aa7ad0d42ed72d..5b0b9f4d1d76372 100644
--- a/libcxx/test/std/containers/sequences/vector/iterators.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/iterators.pass.cpp
@@ -22,206 +22,203 @@
#include "test_macros.h"
#include "min_allocator.h"
-struct A
-{
- int first;
- int second;
+struct A {
+ int first;
+ int second;
};
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- {
- typedef int T;
- typedef std::vector<T> C;
- C c;
- C::iterator i = c.begin();
- C::iterator j = c.end();
- assert(std::distance(i, j) == 0);
- assert(i == j);
- }
- {
- typedef int T;
- typedef std::vector<T> C;
- const C c;
- C::const_iterator i = c.begin();
- C::const_iterator j = c.end();
- assert(std::distance(i, j) == 0);
- assert(i == j);
- }
- {
- typedef int T;
- typedef std::vector<T> C;
- C c;
- C::const_iterator i = c.cbegin();
- C::const_iterator j = c.cend();
- assert(std::distance(i, j) == 0);
- assert(i == j);
- assert(i == c.end());
- }
- {
- typedef int T;
- typedef std::vector<T> C;
- const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- C c(std::begin(t), std::end(t));
- C::iterator i = c.begin();
- assert(*i == 0);
- ++i;
- assert(*i == 1);
- *i = 10;
- assert(*i == 10);
- assert(std::distance(c.begin(), c.end()) == 10);
- }
- {
- typedef int T;
- typedef std::vector<T> C;
- C::iterator i;
- C::const_iterator j;
- (void) i;
- (void) j;
- }
+TEST_CONSTEXPR_CXX20 bool tests() {
+ {
+ typedef int T;
+ typedef std::vector<T> C;
+ C c;
+ C::iterator i = c.begin();
+ C::iterator j = c.end();
+ assert(std::distance(i, j) == 0);
+ assert(i == j);
+ }
+ {
+ typedef int T;
+ typedef std::vector<T> C;
+ const C c;
+ C::const_iterator i = c.begin();
+ C::const_iterator j = c.end();
+ assert(std::distance(i, j) == 0);
+ assert(i == j);
+ }
+ {
+ typedef int T;
+ typedef std::vector<T> C;
+ C c;
+ C::const_iterator i = c.cbegin();
+ C::const_iterator j = c.cend();
+ assert(std::distance(i, j) == 0);
+ assert(i == j);
+ assert(i == c.end());
+ }
+ {
+ typedef int T;
+ typedef std::vector<T> C;
+ const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ C c(std::begin(t), std::end(t));
+ C::iterator i = c.begin();
+ assert(*i == 0);
+ ++i;
+ assert(*i == 1);
+ *i = 10;
+ assert(*i == 10);
+ assert(std::distance(c.begin(), c.end()) == 10);
+ }
+ {
+ typedef int T;
+ typedef std::vector<T> C;
+ C::iterator i;
+ C::const_iterator j;
+ (void)i;
+ (void)j;
+ }
#if TEST_STD_VER >= 11
- {
- typedef int T;
- typedef std::vector<T, min_allocator<T>> C;
- C c;
- C::iterator i = c.begin();
- C::iterator j = c.end();
- assert(std::distance(i, j) == 0);
+ {
+ typedef int T;
+ typedef std::vector<T, min_allocator<T>> C;
+ C c;
+ C::iterator i = c.begin();
+ C::iterator j = c.end();
+ assert(std::distance(i, j) == 0);
- assert(i == j);
- assert(!(i != j));
+ assert(i == j);
+ assert(!(i != j));
- assert(!(i < j));
- assert((i <= j));
+ assert(!(i < j));
+ assert((i <= j));
- assert(!(i > j));
- assert((i >= j));
+ assert(!(i > j));
+ assert((i >= j));
# if TEST_STD_VER >= 20
- // P1614 + LWG3352
- // When the allocator does not have operator<=> then the iterator uses a
- // fallback to provide operator<=>.
- // Make sure to test with an allocator that does not have operator<=>.
- static_assert(!std::three_way_comparable<min_allocator<int>, std::strong_ordering>);
- static_assert(std::three_way_comparable<typename C::iterator, std::strong_ordering>);
-
- std::same_as<std::strong_ordering> decltype(auto) r1 = i <=> j;
- assert(r1 == std::strong_ordering::equal);
+ // P1614 + LWG3352
+ // When the allocator does not have operator<=> then the iterator uses a
+ // fallback to provide operator<=>.
+ // Make sure to test with an allocator that does not have operator<=>.
+ static_assert(!std::three_way_comparable<min_allocator<int>, std::strong_ordering>);
+ static_assert(std::three_way_comparable<typename C::iterator, std::strong_ordering>);
+
+ std::same_as<std::strong_ordering> decltype(auto) r1 = i <=> j;
+ assert(r1 == std::strong_ordering::equal);
# endif
- }
- {
- typedef int T;
- typedef std::vector<T, min_allocator<T>> C;
- const C c;
- C::const_iterator i = c.begin();
- C::const_iterator j = c.end();
- assert(std::distance(i, j) == 0);
+ }
+ {
+ typedef int T;
+ typedef std::vector<T, min_allocator<T>> C;
+ const C c;
+ C::const_iterator i = c.begin();
+ C::const_iterator j = c.end();
+ assert(std::distance(i, j) == 0);
- assert(i == j);
- assert(!(i != j));
+ assert(i == j);
+ assert(!(i != j));
- assert(!(i < j));
- assert((i <= j));
+ assert(!(i < j));
+ assert((i <= j));
- assert(!(i > j));
- assert((i >= j));
+ assert(!(i > j));
+ assert((i >= j));
# if TEST_STD_VER >= 20
- // When the allocator does not have operator<=> then the iterator uses a
- // fallback to provide operator<=>.
- // Make sure to test with an allocator that does not have operator<=>.
- static_assert(!std::three_way_comparable<min_allocator<int>, std::strong_ordering>);
- static_assert(std::three_way_comparable<typename C::iterator, std::strong_ordering>);
-
- std::same_as<std::strong_ordering> decltype(auto) r1 = i <=> j;
- assert(r1 == std::strong_ordering::equal);
+ // When the allocator does not have operator<=> then the iterator uses a
+ // fallback to provide operator<=>.
+ // Make sure to test with an allocator that does not have operator<=>.
+ static_assert(!std::three_way_comparable<min_allocator<int>, std::strong_ordering>);
+ static_assert(std::three_way_comparable<typename C::iterator, std::strong_ordering>);
+
+ std::same_as<std::strong_ordering> decltype(auto) r1 = i <=> j;
+ assert(r1 == std::strong_ordering::equal);
# endif
- }
- {
- typedef int T;
- typedef std::vector<T, min_allocator<T>> C;
- C c;
- C::const_iterator i = c.cbegin();
- C::const_iterator j = c.cend();
- assert(std::distance(i, j) == 0);
- assert(i == j);
- assert(i == c.end());
- }
- {
- typedef int T;
- typedef std::vector<T, min_allocator<T>> C;
- const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- C c(std::begin(t), std::end(t));
- C::iterator i = c.begin();
- assert(*i == 0);
- ++i;
- assert(*i == 1);
- *i = 10;
- assert(*i == 10);
- assert(std::distance(c.begin(), c.end()) == 10);
- }
- {
- typedef int T;
- typedef std::vector<T, min_allocator<T>> C;
- C::iterator i;
- C::const_iterator j;
- (void) i;
- (void) j;
- }
- {
- typedef A T;
- typedef std::vector<T, min_allocator<T>> C;
- C c = {A{1, 2}};
- C::iterator i = c.begin();
- i->first = 3;
- C::const_iterator j = i;
- assert(j->first == 3);
- }
+ }
+ {
+ typedef int T;
+ typedef std::vector<T, min_allocator<T>> C;
+ C c;
+ C::const_iterator i = c.cbegin();
+ C::const_iterator j = c.cend();
+ assert(std::distance(i, j) == 0);
+ assert(i == j);
+ assert(i == c.end());
+ }
+ {
+ typedef int T;
+ typedef std::vector<T, min_allocator<T>> C;
+ const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ C c(std::begin(t), std::end(t));
+ C::iterator i = c.begin();
+ assert(*i == 0);
+ ++i;
+ assert(*i == 1);
+ *i = 10;
+ assert(*i == 10);
+ assert(std::distance(c.begin(), c.end()) == 10);
+ }
+ {
+ typedef int T;
+ typedef std::vector<T, min_allocator<T>> C;
+ C::iterator i;
+ C::const_iterator j;
+ (void)i;
+ (void)j;
+ }
+ {
+ typedef A T;
+ typedef std::vector<T, min_allocator<T>> C;
+ C c = {A{1, 2}};
+ C::iterator i = c.begin();
+ i->first = 3;
+ C::const_iterator j = i;
+ assert(j->first == 3);
+ }
#endif
#if TEST_STD_VER > 11
- { // N3644 testing
- typedef std::vector<int> C;
- C::iterator ii1{}, ii2{};
- C::iterator ii4 = ii1;
- C::const_iterator cii{};
- assert ( ii1 == ii2 );
- assert ( ii1 == ii4 );
-
- assert (!(ii1 != ii2 ));
-
- assert ( (ii1 == cii ));
- assert ( (cii == ii1 ));
- assert (!(ii1 != cii ));
- assert (!(cii != ii1 ));
- assert (!(ii1 < cii ));
- assert (!(cii < ii1 ));
- assert ( (ii1 <= cii ));
- assert ( (cii <= ii1 ));
- assert (!(ii1 > cii ));
- assert (!(cii > ii1 ));
- assert ( (ii1 >= cii ));
- assert ( (cii >= ii1 ));
- assert (cii - ii1 == 0);
- assert (ii1 - cii == 0);
+ { // N3644 testing
+ typedef std::vector<int> C;
+ C::iterator ii1{}, ii2{};
+ C::iterator ii4 = ii1;
+ C::const_iterator cii{};
+ assert(ii1 == ii2);
+ assert(ii1 == ii4);
+
+ assert(!(ii1 != ii2));
+
+ assert((ii1 == cii));
+ assert((cii == ii1));
+ assert(!(ii1 != cii));
+ assert(!(cii != ii1));
+ assert(!(ii1 < cii));
+ assert(!(cii < ii1));
+ assert((ii1 <= cii));
+ assert((cii <= ii1));
+ assert(!(ii1 > cii));
+ assert(!(cii > ii1));
+ assert((ii1 >= cii));
+ assert((cii >= ii1));
+ assert(cii - ii1 == 0);
+ assert(ii1 - cii == 0);
# if TEST_STD_VER >= 20
- // P1614 + LWG3352
- std::same_as<std::strong_ordering> decltype(auto) r1 = ii1 <=> ii2;
- assert(r1 == std::strong_ordering::equal);
+ // P1614 + LWG3352
+ std::same_as<std::strong_ordering> decltype(auto) r1 = ii1 <=> ii2;
+ assert(r1 == std::strong_ordering::equal);
- std::same_as<std::strong_ordering> decltype(auto) r2 = cii <=> ii2;
- assert(r2 == std::strong_ordering::equal);
+ std::same_as<std::strong_ordering> decltype(auto) r2 = cii <=> ii2;
+ assert(r2 == std::strong_ordering::equal);
# endif // TEST_STD_VER > 20
- }
+ }
#endif // TEST_STD_VER > 11
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector/range_concept_conformance.compile.pass.cpp b/libcxx/test/std/containers/sequences/vector/range_concept_conformance.compile.pass.cpp
index 36c68f73494a956..47db59240a4eddc 100644
--- a/libcxx/test/std/containers/sequences/vector/range_concept_conformance.compile.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/range_concept_conformance.compile.pass.cpp
@@ -17,7 +17,6 @@
using range = std::vector<int>;
-
static_assert(std::same_as<std::ranges::iterator_t<range>, range::iterator>);
static_assert(std::ranges::common_range<range>);
static_assert(std::ranges::random_access_range<range>);
diff --git a/libcxx/test/std/containers/sequences/vector/reverse_iterators.pass.cpp b/libcxx/test/std/containers/sequences/vector/reverse_iterators.pass.cpp
index 1591f912f3372c9..5baeac5bf2549ad 100644
--- a/libcxx/test/std/containers/sequences/vector/reverse_iterators.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/reverse_iterators.pass.cpp
@@ -23,64 +23,64 @@
template <class Vector>
TEST_CONSTEXPR_CXX20 void check_vector_reverse_iterators() {
+ {
+ Vector vec;
+ assert(vec.rbegin() == vec.rend());
+ assert(vec.crbegin() == vec.crend());
+ }
+ {
+ const int n = 10;
+ Vector vec;
+ const Vector& cvec = vec;
+ vec.reserve(n);
+ for (int i = 0; i < n; ++i)
+ vec.push_back(i);
{
- Vector vec;
- assert(vec.rbegin() == vec.rend());
- assert(vec.crbegin() == vec.crend());
+ int iterations = 0;
+
+ for (typename Vector::const_reverse_iterator it = vec.crbegin(); it != vec.crend(); ++it) {
+ assert(*it == (n - iterations - 1));
+ ++iterations;
+ }
+ assert(iterations == n);
}
{
- const int n = 10;
- Vector vec;
- const Vector& cvec = vec;
- vec.reserve(n);
- for (int i = 0; i < n; ++i)
- vec.push_back(i);
- {
- int iterations = 0;
-
- for (typename Vector::const_reverse_iterator it = vec.crbegin(); it != vec.crend(); ++it) {
- assert(*it == (n - iterations - 1));
- ++iterations;
- }
- assert(iterations == n);
- }
- {
- assert(cvec.rbegin() == vec.crbegin());
- assert(cvec.rend() == vec.crend());
- }
- {
- int iterations = 0;
-
- for (typename Vector::reverse_iterator it = vec.rbegin(); it != vec.rend(); ++it) {
- assert(*it == (n - iterations - 1));
- *it = 40;
- assert(*it == 40);
- ++iterations;
- }
- assert(iterations == n);
- }
+ assert(cvec.rbegin() == vec.crbegin());
+ assert(cvec.rend() == vec.crend());
+ }
+ {
+ int iterations = 0;
- assert(std::distance(vec.rbegin(), vec.rend()) == n);
- assert(std::distance(cvec.rbegin(), cvec.rend()) == n);
- assert(std::distance(vec.crbegin(), vec.crend()) == n);
- assert(std::distance(cvec.crbegin(), cvec.crend()) == n);
+ for (typename Vector::reverse_iterator it = vec.rbegin(); it != vec.rend(); ++it) {
+ assert(*it == (n - iterations - 1));
+ *it = 40;
+ assert(*it == 40);
+ ++iterations;
+ }
+ assert(iterations == n);
}
+
+ assert(std::distance(vec.rbegin(), vec.rend()) == n);
+ assert(std::distance(cvec.rbegin(), cvec.rend()) == n);
+ assert(std::distance(vec.crbegin(), vec.crend()) == n);
+ assert(std::distance(cvec.crbegin(), cvec.crend()) == n);
+ }
}
TEST_CONSTEXPR_CXX20 bool test() {
- check_vector_reverse_iterators<std::vector<int> >();
+ check_vector_reverse_iterators<std::vector<int> >();
#if TEST_STD_VER >= 11
- check_vector_reverse_iterators<std::vector<int, min_allocator<int> > >();
+ check_vector_reverse_iterators<std::vector<int, min_allocator<int> > >();
#endif
- return true;
+ return true;
}
int main(int, char**) {
- test();
+ test();
#if TEST_STD_VER > 17
- static_assert(test());
+ static_assert(test());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector/types.pass.cpp b/libcxx/test/std/containers/sequences/vector/types.pass.cpp
index f4d7fa088842fca..c3aa60bd30c7e20 100644
--- a/libcxx/test/std/containers/sequences/vector/types.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/types.pass.cpp
@@ -37,66 +37,60 @@
#include "../../Copyable.h"
#include "min_allocator.h"
-struct A { std::vector<A> v; }; // incomplete type support
+struct A {
+ std::vector<A> v;
+}; // incomplete type support
template <class T, class Allocator>
-void
-test()
-{
- typedef std::vector<T, Allocator> C;
+void test() {
+ typedef std::vector<T, Allocator> C;
-// TODO: These tests should use allocator_traits to get stuff, rather than
-// blindly pulling typedefs out of the allocator. This is why we can't call
-// test<int, min_allocator<int>>() below.
- static_assert((std::is_same<typename C::value_type, T>::value), "");
- static_assert(
- (std::is_same<typename C::value_type, typename std::allocator_traits<Allocator>::value_type>::value), "");
- static_assert((std::is_same<typename C::allocator_type, Allocator>::value), "");
- static_assert(
- (std::is_same<typename C::size_type, typename std::allocator_traits<Allocator>::size_type>::value), "");
- static_assert(
- (std::is_same<typename C::
diff erence_type, typename std::allocator_traits<Allocator>::
diff erence_type>::value),
- "");
- static_assert(
- (std::is_same<typename C::reference, typename std::allocator_traits<Allocator>::value_type&>::value), "");
- static_assert((std::is_same<typename C::const_reference,
- const typename std::allocator_traits<Allocator>::value_type&>::value),
- "");
- static_assert((std::is_same<typename C::pointer, typename std::allocator_traits<Allocator>::pointer>::value), "");
- static_assert(
- (std::is_same<typename C::const_pointer, typename std::allocator_traits<Allocator>::const_pointer>::value), "");
+ // TODO: These tests should use allocator_traits to get stuff, rather than
+ // blindly pulling typedefs out of the allocator. This is why we can't call
+ // test<int, min_allocator<int>>() below.
+ static_assert((std::is_same<typename C::value_type, T>::value), "");
+ static_assert(
+ (std::is_same<typename C::value_type, typename std::allocator_traits<Allocator>::value_type>::value), "");
+ static_assert((std::is_same<typename C::allocator_type, Allocator>::value), "");
+ static_assert((std::is_same<typename C::size_type, typename std::allocator_traits<Allocator>::size_type>::value), "");
+ static_assert(
+ (std::is_same<typename C::
diff erence_type, typename std::allocator_traits<Allocator>::
diff erence_type>::value),
+ "");
+ static_assert(
+ (std::is_same<typename C::reference, typename std::allocator_traits<Allocator>::value_type&>::value), "");
+ static_assert(
+ (std::is_same<typename C::const_reference, const typename std::allocator_traits<Allocator>::value_type&>::value),
+ "");
+ static_assert((std::is_same<typename C::pointer, typename std::allocator_traits<Allocator>::pointer>::value), "");
+ static_assert(
+ (std::is_same<typename C::const_pointer, typename std::allocator_traits<Allocator>::const_pointer>::value), "");
- static_assert((std::is_signed<typename C::
diff erence_type>::value), "");
- static_assert((std::is_unsigned<typename C::size_type>::value), "");
-// static_assert((std::is_same<typename C::
diff erence_type,
-// typename std::iterator_traits<typename C::iterator>::
diff erence_type>::value), "");
-// static_assert((std::is_same<typename C::
diff erence_type,
-// typename std::iterator_traits<typename C::const_iterator>::
diff erence_type>::value), "");
+ static_assert((std::is_signed<typename C::
diff erence_type>::value), "");
+ static_assert((std::is_unsigned<typename C::size_type>::value), "");
+ // static_assert((std::is_same<typename C::
diff erence_type,
+ // typename std::iterator_traits<typename C::iterator>::
diff erence_type>::value), "");
+ // static_assert((std::is_same<typename C::
diff erence_type,
+ // typename std::iterator_traits<typename C::const_iterator>::
diff erence_type>::value), "");
- static_assert((std::is_same<
- typename std::iterator_traits<typename C::iterator>::iterator_category,
- std::random_access_iterator_tag>::value), "");
- static_assert((std::is_same<
- typename std::iterator_traits<typename C::const_iterator>::iterator_category,
- std::random_access_iterator_tag>::value), "");
- static_assert((std::is_same<
- typename C::reverse_iterator,
- std::reverse_iterator<typename C::iterator> >::value), "");
- static_assert((std::is_same<
- typename C::const_reverse_iterator,
- std::reverse_iterator<typename C::const_iterator> >::value), "");
+ static_assert((std::is_same< typename std::iterator_traits<typename C::iterator>::iterator_category,
+ std::random_access_iterator_tag>::value),
+ "");
+ static_assert((std::is_same< typename std::iterator_traits<typename C::const_iterator>::iterator_category,
+ std::random_access_iterator_tag>::value),
+ "");
+ static_assert((std::is_same< typename C::reverse_iterator, std::reverse_iterator<typename C::iterator> >::value), "");
+ static_assert(
+ (std::is_same< typename C::const_reverse_iterator, std::reverse_iterator<typename C::const_iterator> >::value),
+ "");
}
-int main(int, char**)
-{
- test<int, test_allocator<int> >();
- test<int*, std::allocator<int*> >();
- test<Copyable, test_allocator<Copyable> >();
- static_assert((std::is_same<std::vector<char>::allocator_type,
- std::allocator<char> >::value), "");
+int main(int, char**) {
+ test<int, test_allocator<int> >();
+ test<int*, std::allocator<int*> >();
+ test<Copyable, test_allocator<Copyable> >();
+ static_assert((std::is_same<std::vector<char>::allocator_type, std::allocator<char> >::value), "");
#if TEST_STD_VER >= 11
- {
-
+ {
typedef std::vector<int, min_allocator<int> > C;
static_assert((std::is_same<C::value_type, int>::value), "");
static_assert((std::is_same<C::allocator_type, min_allocator<int> >::value), "");
@@ -107,11 +101,11 @@ int main(int, char**)
static_assert((std::is_signed<typename C::
diff erence_type>::value), "");
static_assert((std::is_unsigned<typename C::size_type>::value), "");
-// static_assert((std::is_same<typename C::
diff erence_type,
-// typename std::iterator_traits<typename C::iterator>::
diff erence_type>::value), "");
-// static_assert((std::is_same<typename C::
diff erence_type,
-// typename std::iterator_traits<typename C::const_iterator>::
diff erence_type>::value), "");
- }
+ // static_assert((std::is_same<typename C::
diff erence_type,
+ // typename std::iterator_traits<typename C::iterator>::
diff erence_type>::value), "");
+ // static_assert((std::is_same<typename C::
diff erence_type,
+ // typename std::iterator_traits<typename C::const_iterator>::
diff erence_type>::value), "");
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/vector/vector.capacity/capacity.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.capacity/capacity.pass.cpp
index b2eb33c6c5f53e4..b28d31d9f9bb657 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.capacity/capacity.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.capacity/capacity.pass.cpp
@@ -17,43 +17,41 @@
#include "min_allocator.h"
#include "asan_testing.h"
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- {
- std::vector<int> v;
- assert(v.capacity() == 0);
- assert(is_contiguous_container_asan_correct(v));
- }
- {
- std::vector<int> v(100);
- assert(v.capacity() == 100);
- v.push_back(0);
- assert(v.capacity() > 101);
- assert(is_contiguous_container_asan_correct(v));
- }
+TEST_CONSTEXPR_CXX20 bool tests() {
+ {
+ std::vector<int> v;
+ assert(v.capacity() == 0);
+ assert(is_contiguous_container_asan_correct(v));
+ }
+ {
+ std::vector<int> v(100);
+ assert(v.capacity() == 100);
+ v.push_back(0);
+ assert(v.capacity() > 101);
+ assert(is_contiguous_container_asan_correct(v));
+ }
#if TEST_STD_VER >= 11
- {
- std::vector<int, min_allocator<int>> v;
- assert(v.capacity() == 0);
- assert(is_contiguous_container_asan_correct(v));
- }
- {
- std::vector<int, min_allocator<int>> v(100);
- assert(v.capacity() == 100);
- v.push_back(0);
- assert(v.capacity() > 101);
- assert(is_contiguous_container_asan_correct(v));
- }
+ {
+ std::vector<int, min_allocator<int>> v;
+ assert(v.capacity() == 0);
+ assert(is_contiguous_container_asan_correct(v));
+ }
+ {
+ std::vector<int, min_allocator<int>> v(100);
+ assert(v.capacity() == 100);
+ v.push_back(0);
+ assert(v.capacity() > 101);
+ assert(is_contiguous_container_asan_correct(v));
+ }
#endif
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector/vector.capacity/empty.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.capacity/empty.pass.cpp
index ad4d7b310af7641..b691a74a0420837 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.capacity/empty.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.capacity/empty.pass.cpp
@@ -19,7 +19,7 @@
#include "min_allocator.h"
TEST_CONSTEXPR_CXX20 bool tests() {
- {
+ {
typedef std::vector<int> C;
C c;
ASSERT_NOEXCEPT(c.empty());
@@ -28,9 +28,9 @@ TEST_CONSTEXPR_CXX20 bool tests() {
assert(!c.empty());
c.clear();
assert(c.empty());
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::vector<int, min_allocator<int>> C;
C c;
ASSERT_NOEXCEPT(c.empty());
@@ -39,27 +39,26 @@ TEST_CONSTEXPR_CXX20 bool tests() {
assert(!c.empty());
c.clear();
assert(c.empty());
- }
- {
- typedef std::vector<int, safe_allocator<int>> C;
- C c;
- ASSERT_NOEXCEPT(c.empty());
- assert(c.empty());
- c.push_back(C::value_type(1));
- assert(!c.empty());
- c.clear();
- assert(c.empty());
- }
+ }
+ {
+ typedef std::vector<int, safe_allocator<int>> C;
+ C c;
+ ASSERT_NOEXCEPT(c.empty());
+ assert(c.empty());
+ c.push_back(C::value_type(1));
+ assert(!c.empty());
+ c.clear();
+ assert(c.empty());
+ }
#endif
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector/vector.capacity/empty.verify.cpp b/libcxx/test/std/containers/sequences/vector/vector.capacity/empty.verify.cpp
index 4cea844f1e3572b..0de3913b0c5c2c7 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.capacity/empty.verify.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.capacity/empty.verify.cpp
@@ -17,6 +17,6 @@
#include <vector>
void f() {
- std::vector<int> c;
- c.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::vector<int> c;
+ c.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}
diff --git a/libcxx/test/std/containers/sequences/vector/vector.capacity/resize_size.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.capacity/resize_size.pass.cpp
index 967daf99f27c71d..ddd15a700cab213 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.capacity/resize_size.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.capacity/resize_size.pass.cpp
@@ -20,86 +20,85 @@
#include "asan_testing.h"
TEST_CONSTEXPR_CXX20 bool tests() {
- {
- std::vector<int> v(100);
- v.resize(50);
- assert(v.size() == 50);
- assert(v.capacity() == 100);
- assert(is_contiguous_container_asan_correct(v));
- v.resize(200);
- assert(v.size() == 200);
- assert(v.capacity() >= 200);
- assert(is_contiguous_container_asan_correct(v));
- }
- {
- // Add 1 for implementations that dynamically allocate a container proxy.
- std::vector<int, limited_allocator<int, 300 + 1> > v(100);
- v.resize(50);
- assert(v.size() == 50);
- assert(v.capacity() == 100);
- assert(is_contiguous_container_asan_correct(v));
- v.resize(200);
- assert(v.size() == 200);
- assert(v.capacity() >= 200);
- assert(is_contiguous_container_asan_correct(v));
- }
+ {
+ std::vector<int> v(100);
+ v.resize(50);
+ assert(v.size() == 50);
+ assert(v.capacity() == 100);
+ assert(is_contiguous_container_asan_correct(v));
+ v.resize(200);
+ assert(v.size() == 200);
+ assert(v.capacity() >= 200);
+ assert(is_contiguous_container_asan_correct(v));
+ }
+ {
+ // Add 1 for implementations that dynamically allocate a container proxy.
+ std::vector<int, limited_allocator<int, 300 + 1> > v(100);
+ v.resize(50);
+ assert(v.size() == 50);
+ assert(v.capacity() == 100);
+ assert(is_contiguous_container_asan_correct(v));
+ v.resize(200);
+ assert(v.size() == 200);
+ assert(v.capacity() >= 200);
+ assert(is_contiguous_container_asan_correct(v));
+ }
#if TEST_STD_VER >= 11
- {
- std::vector<MoveOnly> v(100);
- v.resize(50);
- assert(v.size() == 50);
- assert(v.capacity() == 100);
- assert(is_contiguous_container_asan_correct(v));
- v.resize(200);
- assert(v.size() == 200);
- assert(v.capacity() >= 200);
- assert(is_contiguous_container_asan_correct(v));
- }
- {
- // Add 1 for implementations that dynamically allocate a container proxy.
- std::vector<MoveOnly, limited_allocator<MoveOnly, 300 + 1> > v(100);
- v.resize(50);
- assert(v.size() == 50);
- assert(v.capacity() == 100);
- assert(is_contiguous_container_asan_correct(v));
- v.resize(200);
- assert(v.size() == 200);
- assert(v.capacity() >= 200);
- assert(is_contiguous_container_asan_correct(v));
- }
- {
- std::vector<MoveOnly, min_allocator<MoveOnly>> v(100);
- v.resize(50);
- assert(v.size() == 50);
- assert(v.capacity() == 100);
- assert(is_contiguous_container_asan_correct(v));
- v.resize(200);
- assert(v.size() == 200);
- assert(v.capacity() >= 200);
- assert(is_contiguous_container_asan_correct(v));
- }
- {
- std::vector<int, safe_allocator<int>> v(100);
- v.resize(50);
- assert(v.size() == 50);
- assert(v.capacity() == 100);
- assert(is_contiguous_container_asan_correct(v));
- v.resize(200);
- assert(v.size() == 200);
- assert(v.capacity() >= 200);
- assert(is_contiguous_container_asan_correct(v));
- }
+ {
+ std::vector<MoveOnly> v(100);
+ v.resize(50);
+ assert(v.size() == 50);
+ assert(v.capacity() == 100);
+ assert(is_contiguous_container_asan_correct(v));
+ v.resize(200);
+ assert(v.size() == 200);
+ assert(v.capacity() >= 200);
+ assert(is_contiguous_container_asan_correct(v));
+ }
+ {
+ // Add 1 for implementations that dynamically allocate a container proxy.
+ std::vector<MoveOnly, limited_allocator<MoveOnly, 300 + 1> > v(100);
+ v.resize(50);
+ assert(v.size() == 50);
+ assert(v.capacity() == 100);
+ assert(is_contiguous_container_asan_correct(v));
+ v.resize(200);
+ assert(v.size() == 200);
+ assert(v.capacity() >= 200);
+ assert(is_contiguous_container_asan_correct(v));
+ }
+ {
+ std::vector<MoveOnly, min_allocator<MoveOnly>> v(100);
+ v.resize(50);
+ assert(v.size() == 50);
+ assert(v.capacity() == 100);
+ assert(is_contiguous_container_asan_correct(v));
+ v.resize(200);
+ assert(v.size() == 200);
+ assert(v.capacity() >= 200);
+ assert(is_contiguous_container_asan_correct(v));
+ }
+ {
+ std::vector<int, safe_allocator<int>> v(100);
+ v.resize(50);
+ assert(v.size() == 50);
+ assert(v.capacity() == 100);
+ assert(is_contiguous_container_asan_correct(v));
+ v.resize(200);
+ assert(v.size() == 200);
+ assert(v.capacity() >= 200);
+ assert(is_contiguous_container_asan_correct(v));
+ }
#endif
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/vector/vector.capacity/resize_size_value.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.capacity/resize_size_value.pass.cpp
index a880bcf1f9499c6..f4005eadd369ef2 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.capacity/resize_size_value.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.capacity/resize_size_value.pass.cpp
@@ -18,97 +18,96 @@
#include "asan_testing.h"
TEST_CONSTEXPR_CXX20 bool tests() {
- {
- std::vector<int> v(100);
- v.resize(50, 1);
- assert(v.size() == 50);
- assert(v.capacity() == 100);
- assert(v == std::vector<int>(50));
- v.resize(200, 1);
- assert(v.size() == 200);
- assert(v.capacity() >= 200);
- assert(is_contiguous_container_asan_correct(v));
- for (unsigned i = 0; i < 50; ++i)
- assert(v[i] == 0);
- for (unsigned i = 50; i < 200; ++i)
- assert(v[i] == 1);
- }
- {
- // Add 1 for implementations that dynamically allocate a container proxy.
- std::vector<int, limited_allocator<int, 300 + 1> > v(100);
- v.resize(50, 1);
- assert(v.size() == 50);
- assert(v.capacity() == 100);
- v.resize(200, 1);
- assert(v.size() == 200);
- assert(v.capacity() >= 200);
- assert(is_contiguous_container_asan_correct(v));
- }
+ {
+ std::vector<int> v(100);
+ v.resize(50, 1);
+ assert(v.size() == 50);
+ assert(v.capacity() == 100);
+ assert(v == std::vector<int>(50));
+ v.resize(200, 1);
+ assert(v.size() == 200);
+ assert(v.capacity() >= 200);
+ assert(is_contiguous_container_asan_correct(v));
+ for (unsigned i = 0; i < 50; ++i)
+ assert(v[i] == 0);
+ for (unsigned i = 50; i < 200; ++i)
+ assert(v[i] == 1);
+ }
+ {
+ // Add 1 for implementations that dynamically allocate a container proxy.
+ std::vector<int, limited_allocator<int, 300 + 1> > v(100);
+ v.resize(50, 1);
+ assert(v.size() == 50);
+ assert(v.capacity() == 100);
+ v.resize(200, 1);
+ assert(v.size() == 200);
+ assert(v.capacity() >= 200);
+ assert(is_contiguous_container_asan_correct(v));
+ }
#if TEST_STD_VER >= 11
- {
- std::vector<int, min_allocator<int>> v(100);
- v.resize(50, 1);
- assert(v.size() == 50);
- assert(v.capacity() == 100);
- assert(is_contiguous_container_asan_correct(v));
- assert((v == std::vector<int, min_allocator<int>>(50)));
- v.resize(200, 1);
- assert(v.size() == 200);
- assert(v.capacity() >= 200);
- assert(is_contiguous_container_asan_correct(v));
- for (unsigned i = 0; i < 50; ++i)
- assert(v[i] == 0);
- for (unsigned i = 50; i < 200; ++i)
- assert(v[i] == 1);
- }
- {
- std::vector<int, min_allocator<int>> v(100);
- v.resize(50, 1);
- assert(v.size() == 50);
- assert(v.capacity() == 100);
- assert(is_contiguous_container_asan_correct(v));
- v.resize(200, 1);
- assert(v.size() == 200);
- assert(v.capacity() >= 200);
- assert(is_contiguous_container_asan_correct(v));
- }
- {
- std::vector<int, safe_allocator<int>> v(100);
- v.resize(50, 1);
- assert(v.size() == 50);
- assert(v.capacity() == 100);
- assert(is_contiguous_container_asan_correct(v));
- assert((v == std::vector<int, safe_allocator<int>>(50)));
- v.resize(200, 1);
- assert(v.size() == 200);
- assert(v.capacity() >= 200);
- assert(is_contiguous_container_asan_correct(v));
- for (unsigned i = 0; i < 50; ++i)
- assert(v[i] == 0);
- for (unsigned i = 50; i < 200; ++i)
- assert(v[i] == 1);
- }
- {
- std::vector<int, safe_allocator<int>> v(100);
- v.resize(50, 1);
- assert(v.size() == 50);
- assert(v.capacity() == 100);
- assert(is_contiguous_container_asan_correct(v));
- v.resize(200, 1);
- assert(v.size() == 200);
- assert(v.capacity() >= 200);
- assert(is_contiguous_container_asan_correct(v));
- }
+ {
+ std::vector<int, min_allocator<int>> v(100);
+ v.resize(50, 1);
+ assert(v.size() == 50);
+ assert(v.capacity() == 100);
+ assert(is_contiguous_container_asan_correct(v));
+ assert((v == std::vector<int, min_allocator<int>>(50)));
+ v.resize(200, 1);
+ assert(v.size() == 200);
+ assert(v.capacity() >= 200);
+ assert(is_contiguous_container_asan_correct(v));
+ for (unsigned i = 0; i < 50; ++i)
+ assert(v[i] == 0);
+ for (unsigned i = 50; i < 200; ++i)
+ assert(v[i] == 1);
+ }
+ {
+ std::vector<int, min_allocator<int>> v(100);
+ v.resize(50, 1);
+ assert(v.size() == 50);
+ assert(v.capacity() == 100);
+ assert(is_contiguous_container_asan_correct(v));
+ v.resize(200, 1);
+ assert(v.size() == 200);
+ assert(v.capacity() >= 200);
+ assert(is_contiguous_container_asan_correct(v));
+ }
+ {
+ std::vector<int, safe_allocator<int>> v(100);
+ v.resize(50, 1);
+ assert(v.size() == 50);
+ assert(v.capacity() == 100);
+ assert(is_contiguous_container_asan_correct(v));
+ assert((v == std::vector<int, safe_allocator<int>>(50)));
+ v.resize(200, 1);
+ assert(v.size() == 200);
+ assert(v.capacity() >= 200);
+ assert(is_contiguous_container_asan_correct(v));
+ for (unsigned i = 0; i < 50; ++i)
+ assert(v[i] == 0);
+ for (unsigned i = 50; i < 200; ++i)
+ assert(v[i] == 1);
+ }
+ {
+ std::vector<int, safe_allocator<int>> v(100);
+ v.resize(50, 1);
+ assert(v.size() == 50);
+ assert(v.capacity() == 100);
+ assert(is_contiguous_container_asan_correct(v));
+ v.resize(200, 1);
+ assert(v.size() == 200);
+ assert(v.capacity() >= 200);
+ assert(is_contiguous_container_asan_correct(v));
+ }
#endif
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector/vector.capacity/size.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.capacity/size.pass.cpp
index f38aab1e13845b3..89f3404a2ca32ff 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.capacity/size.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.capacity/size.pass.cpp
@@ -18,9 +18,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- {
+TEST_CONSTEXPR_CXX20 bool tests() {
+ {
typedef std::vector<int> C;
C c;
ASSERT_NOEXCEPT(c.size());
@@ -37,9 +36,9 @@ TEST_CONSTEXPR_CXX20 bool tests()
assert(c.size() == 1);
c.erase(c.begin());
assert(c.size() == 0);
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::vector<int, min_allocator<int>> C;
C c;
ASSERT_NOEXCEPT(c.size());
@@ -56,35 +55,34 @@ TEST_CONSTEXPR_CXX20 bool tests()
assert(c.size() == 1);
c.erase(c.begin());
assert(c.size() == 0);
- }
- {
- typedef std::vector<int, safe_allocator<int>> C;
- C c;
- ASSERT_NOEXCEPT(c.size());
- assert(c.size() == 0);
- c.push_back(C::value_type(2));
- assert(c.size() == 1);
- c.push_back(C::value_type(1));
- assert(c.size() == 2);
- c.push_back(C::value_type(3));
- assert(c.size() == 3);
- c.erase(c.begin());
- assert(c.size() == 2);
- c.erase(c.begin());
- assert(c.size() == 1);
- c.erase(c.begin());
- assert(c.size() == 0);
- }
+ }
+ {
+ typedef std::vector<int, safe_allocator<int>> C;
+ C c;
+ ASSERT_NOEXCEPT(c.size());
+ assert(c.size() == 0);
+ c.push_back(C::value_type(2));
+ assert(c.size() == 1);
+ c.push_back(C::value_type(1));
+ assert(c.size() == 2);
+ c.push_back(C::value_type(3));
+ assert(c.size() == 3);
+ c.erase(c.begin());
+ assert(c.size() == 2);
+ c.erase(c.begin());
+ assert(c.size() == 1);
+ c.erase(c.begin());
+ assert(c.size() == 0);
+ }
#endif
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector/vector.capacity/swap.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.capacity/swap.pass.cpp
index 1b2ac76eb2b5fd9..d5e0f7028c3ed50 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.capacity/swap.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.capacity/swap.pass.cpp
@@ -18,56 +18,55 @@
#include "asan_testing.h"
TEST_CONSTEXPR_CXX20 bool tests() {
- {
- std::vector<int> v1(100);
- std::vector<int> v2(200);
- assert(is_contiguous_container_asan_correct(v1));
- assert(is_contiguous_container_asan_correct(v2));
- v1.swap(v2);
- assert(v1.size() == 200);
- assert(v1.capacity() == 200);
- assert(is_contiguous_container_asan_correct(v1));
- assert(v2.size() == 100);
- assert(v2.capacity() == 100);
- assert(is_contiguous_container_asan_correct(v2));
- }
+ {
+ std::vector<int> v1(100);
+ std::vector<int> v2(200);
+ assert(is_contiguous_container_asan_correct(v1));
+ assert(is_contiguous_container_asan_correct(v2));
+ v1.swap(v2);
+ assert(v1.size() == 200);
+ assert(v1.capacity() == 200);
+ assert(is_contiguous_container_asan_correct(v1));
+ assert(v2.size() == 100);
+ assert(v2.capacity() == 100);
+ assert(is_contiguous_container_asan_correct(v2));
+ }
#if TEST_STD_VER >= 11
- {
- std::vector<int, min_allocator<int>> v1(100);
- std::vector<int, min_allocator<int>> v2(200);
- assert(is_contiguous_container_asan_correct(v1));
- assert(is_contiguous_container_asan_correct(v2));
- v1.swap(v2);
- assert(v1.size() == 200);
- assert(v1.capacity() == 200);
- assert(is_contiguous_container_asan_correct(v1));
- assert(v2.size() == 100);
- assert(v2.capacity() == 100);
- assert(is_contiguous_container_asan_correct(v2));
- }
- {
- std::vector<int, safe_allocator<int>> v1(100);
- std::vector<int, safe_allocator<int>> v2(200);
- assert(is_contiguous_container_asan_correct(v1));
- assert(is_contiguous_container_asan_correct(v2));
- v1.swap(v2);
- assert(v1.size() == 200);
- assert(v1.capacity() == 200);
- assert(is_contiguous_container_asan_correct(v1));
- assert(v2.size() == 100);
- assert(v2.capacity() == 100);
- assert(is_contiguous_container_asan_correct(v2));
- }
+ {
+ std::vector<int, min_allocator<int>> v1(100);
+ std::vector<int, min_allocator<int>> v2(200);
+ assert(is_contiguous_container_asan_correct(v1));
+ assert(is_contiguous_container_asan_correct(v2));
+ v1.swap(v2);
+ assert(v1.size() == 200);
+ assert(v1.capacity() == 200);
+ assert(is_contiguous_container_asan_correct(v1));
+ assert(v2.size() == 100);
+ assert(v2.capacity() == 100);
+ assert(is_contiguous_container_asan_correct(v2));
+ }
+ {
+ std::vector<int, safe_allocator<int>> v1(100);
+ std::vector<int, safe_allocator<int>> v2(200);
+ assert(is_contiguous_container_asan_correct(v1));
+ assert(is_contiguous_container_asan_correct(v2));
+ v1.swap(v2);
+ assert(v1.size() == 200);
+ assert(v1.capacity() == 200);
+ assert(is_contiguous_container_asan_correct(v1));
+ assert(v2.size() == 100);
+ assert(v2.capacity() == 100);
+ assert(is_contiguous_container_asan_correct(v2));
+ }
#endif
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/assign_copy.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/assign_copy.pass.cpp
index e0e227e8dc0c64f..064d807c36ce06b 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.cons/assign_copy.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.cons/assign_copy.pass.cpp
@@ -18,83 +18,82 @@
#include "allocators.h"
TEST_CONSTEXPR_CXX20 bool tests() {
- {
- std::vector<int, test_allocator<int> > l(3, 2, test_allocator<int>(5));
- std::vector<int, test_allocator<int> > l2(l, test_allocator<int>(3));
- l2 = l;
- assert(l2 == l);
- assert(l2.get_allocator() == test_allocator<int>(3));
- }
- {
- std::vector<int, other_allocator<int> > l(3, 2, other_allocator<int>(5));
- std::vector<int, other_allocator<int> > l2(l, other_allocator<int>(3));
- l2 = l;
- assert(l2 == l);
- assert(l2.get_allocator() == other_allocator<int>(5));
- }
+ {
+ std::vector<int, test_allocator<int> > l(3, 2, test_allocator<int>(5));
+ std::vector<int, test_allocator<int> > l2(l, test_allocator<int>(3));
+ l2 = l;
+ assert(l2 == l);
+ assert(l2.get_allocator() == test_allocator<int>(3));
+ }
+ {
+ std::vector<int, other_allocator<int> > l(3, 2, other_allocator<int>(5));
+ std::vector<int, other_allocator<int> > l2(l, other_allocator<int>(3));
+ l2 = l;
+ assert(l2 == l);
+ assert(l2.get_allocator() == other_allocator<int>(5));
+ }
#if TEST_STD_VER >= 11
- {
- // Test with Allocator::propagate_on_container_copy_assignment == false_type
- using Alloc = NonPOCCAAllocator<int>;
- bool copy_assigned_into = false;
- std::vector<int, Alloc> l(3, 2, Alloc(5, nullptr));
- std::vector<int, Alloc> l2(l, Alloc(3, ©_assigned_into));
- assert(!copy_assigned_into);
- l2 = l;
- assert(!copy_assigned_into);
- assert(l2 == l);
- assert(l2.get_allocator() == Alloc(3, nullptr));
- }
- {
- // Test with Allocator::propagate_on_container_copy_assignment == true_type
- // and equal allocators
- using Alloc = POCCAAllocator<int>;
- bool copy_assigned_into = false;
- std::vector<int, Alloc> l(3, 2, Alloc(5, nullptr));
- std::vector<int, Alloc> l2(l, Alloc(5, ©_assigned_into));
- assert(!copy_assigned_into);
- l2 = l;
- assert(copy_assigned_into);
- assert(l2 == l);
- assert(l2.get_allocator() == Alloc(5, nullptr));
- }
- {
- // Test with Allocator::propagate_on_container_copy_assignment == true_type
- // and unequal allocators
- using Alloc = POCCAAllocator<int>;
- bool copy_assigned_into = false;
- std::vector<int, Alloc> l(3, 2, Alloc(5, nullptr));
- std::vector<int, Alloc> l2(l, Alloc(3, ©_assigned_into));
- assert(!copy_assigned_into);
- l2 = l;
- assert(copy_assigned_into);
- assert(l2 == l);
- assert(l2.get_allocator() == Alloc(5, nullptr));
- }
- {
- std::vector<int, min_allocator<int> > l(3, 2, min_allocator<int>());
- std::vector<int, min_allocator<int> > l2(l, min_allocator<int>());
- l2 = l;
- assert(l2 == l);
- assert(l2.get_allocator() == min_allocator<int>());
- }
- {
- std::vector<int, safe_allocator<int> > l(3, 2, safe_allocator<int>());
- std::vector<int, safe_allocator<int> > l2(l, safe_allocator<int>());
- l2 = l;
- assert(l2 == l);
- assert(l2.get_allocator() == safe_allocator<int>());
- }
+ {
+ // Test with Allocator::propagate_on_container_copy_assignment == false_type
+ using Alloc = NonPOCCAAllocator<int>;
+ bool copy_assigned_into = false;
+ std::vector<int, Alloc> l(3, 2, Alloc(5, nullptr));
+ std::vector<int, Alloc> l2(l, Alloc(3, ©_assigned_into));
+ assert(!copy_assigned_into);
+ l2 = l;
+ assert(!copy_assigned_into);
+ assert(l2 == l);
+ assert(l2.get_allocator() == Alloc(3, nullptr));
+ }
+ {
+ // Test with Allocator::propagate_on_container_copy_assignment == true_type
+ // and equal allocators
+ using Alloc = POCCAAllocator<int>;
+ bool copy_assigned_into = false;
+ std::vector<int, Alloc> l(3, 2, Alloc(5, nullptr));
+ std::vector<int, Alloc> l2(l, Alloc(5, ©_assigned_into));
+ assert(!copy_assigned_into);
+ l2 = l;
+ assert(copy_assigned_into);
+ assert(l2 == l);
+ assert(l2.get_allocator() == Alloc(5, nullptr));
+ }
+ {
+ // Test with Allocator::propagate_on_container_copy_assignment == true_type
+ // and unequal allocators
+ using Alloc = POCCAAllocator<int>;
+ bool copy_assigned_into = false;
+ std::vector<int, Alloc> l(3, 2, Alloc(5, nullptr));
+ std::vector<int, Alloc> l2(l, Alloc(3, ©_assigned_into));
+ assert(!copy_assigned_into);
+ l2 = l;
+ assert(copy_assigned_into);
+ assert(l2 == l);
+ assert(l2.get_allocator() == Alloc(5, nullptr));
+ }
+ {
+ std::vector<int, min_allocator<int> > l(3, 2, min_allocator<int>());
+ std::vector<int, min_allocator<int> > l2(l, min_allocator<int>());
+ l2 = l;
+ assert(l2 == l);
+ assert(l2.get_allocator() == min_allocator<int>());
+ }
+ {
+ std::vector<int, safe_allocator<int> > l(3, 2, safe_allocator<int>());
+ std::vector<int, safe_allocator<int> > l2(l, safe_allocator<int>());
+ l2 = l;
+ assert(l2 == l);
+ assert(l2.get_allocator() == safe_allocator<int>());
+ }
#endif
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/assign_initializer_list.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/assign_initializer_list.pass.cpp
index 19a1b77603552a8..0be881875be2dc8 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.cons/assign_initializer_list.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.cons/assign_initializer_list.pass.cpp
@@ -20,43 +20,41 @@
#include "asan_testing.h"
template <typename Vec>
-TEST_CONSTEXPR_CXX20 void test(Vec &v)
-{
- v.assign({3, 4, 5, 6});
- assert(v.size() == 4);
- assert(is_contiguous_container_asan_correct(v));
- assert(v[0] == 3);
- assert(v[1] == 4);
- assert(v[2] == 5);
- assert(v[3] == 6);
+TEST_CONSTEXPR_CXX20 void test(Vec& v) {
+ v.assign({3, 4, 5, 6});
+ assert(v.size() == 4);
+ assert(is_contiguous_container_asan_correct(v));
+ assert(v[0] == 3);
+ assert(v[1] == 4);
+ assert(v[2] == 5);
+ assert(v[3] == 6);
}
TEST_CONSTEXPR_CXX20 bool tests() {
- {
+ {
typedef std::vector<int> V;
V d1;
V d2;
- d2.reserve(10); // no reallocation during assign.
+ d2.reserve(10); // no reallocation during assign.
test(d1);
test(d2);
- }
- {
+ }
+ {
typedef std::vector<int, min_allocator<int>> V;
V d1;
V d2;
- d2.reserve(10); // no reallocation during assign.
+ d2.reserve(10); // no reallocation during assign.
test(d1);
test(d2);
- }
+ }
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/assign_move.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/assign_move.pass.cpp
index 58081fa0ecef596..aad7908168105e8 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.cons/assign_move.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.cons/assign_move.pass.cpp
@@ -21,107 +21,102 @@
#include "asan_testing.h"
TEST_CONSTEXPR_CXX20 bool tests() {
- {
- std::vector<MoveOnly, test_allocator<MoveOnly> > l(test_allocator<MoveOnly>(5));
- std::vector<MoveOnly, test_allocator<MoveOnly> > lo(test_allocator<MoveOnly>(5));
- for (int i = 1; i <= 3; ++i)
- {
- l.push_back(i);
- lo.push_back(i);
- }
- assert(is_contiguous_container_asan_correct(l));
- assert(is_contiguous_container_asan_correct(lo));
- std::vector<MoveOnly, test_allocator<MoveOnly> > l2(test_allocator<MoveOnly>(5));
- l2 = std::move(l);
- assert(l2 == lo);
- assert(l.empty());
- assert(l2.get_allocator() == lo.get_allocator());
- assert(is_contiguous_container_asan_correct(l2));
+ {
+ std::vector<MoveOnly, test_allocator<MoveOnly> > l(test_allocator<MoveOnly>(5));
+ std::vector<MoveOnly, test_allocator<MoveOnly> > lo(test_allocator<MoveOnly>(5));
+ for (int i = 1; i <= 3; ++i) {
+ l.push_back(i);
+ lo.push_back(i);
}
- {
- std::vector<MoveOnly, test_allocator<MoveOnly> > l(test_allocator<MoveOnly>(5));
- std::vector<MoveOnly, test_allocator<MoveOnly> > lo(test_allocator<MoveOnly>(5));
- assert(is_contiguous_container_asan_correct(l));
- assert(is_contiguous_container_asan_correct(lo));
- for (int i = 1; i <= 3; ++i)
- {
- l.push_back(i);
- lo.push_back(i);
- }
- assert(is_contiguous_container_asan_correct(l));
- assert(is_contiguous_container_asan_correct(lo));
- std::vector<MoveOnly, test_allocator<MoveOnly> > l2(test_allocator<MoveOnly>(6));
- l2 = std::move(l);
- assert(l2 == lo);
- assert(!l.empty());
- assert(l2.get_allocator() == test_allocator<MoveOnly>(6));
- assert(is_contiguous_container_asan_correct(l2));
+ assert(is_contiguous_container_asan_correct(l));
+ assert(is_contiguous_container_asan_correct(lo));
+ std::vector<MoveOnly, test_allocator<MoveOnly> > l2(test_allocator<MoveOnly>(5));
+ l2 = std::move(l);
+ assert(l2 == lo);
+ assert(l.empty());
+ assert(l2.get_allocator() == lo.get_allocator());
+ assert(is_contiguous_container_asan_correct(l2));
+ }
+ {
+ std::vector<MoveOnly, test_allocator<MoveOnly> > l(test_allocator<MoveOnly>(5));
+ std::vector<MoveOnly, test_allocator<MoveOnly> > lo(test_allocator<MoveOnly>(5));
+ assert(is_contiguous_container_asan_correct(l));
+ assert(is_contiguous_container_asan_correct(lo));
+ for (int i = 1; i <= 3; ++i) {
+ l.push_back(i);
+ lo.push_back(i);
}
- {
- std::vector<MoveOnly, other_allocator<MoveOnly> > l(other_allocator<MoveOnly>(5));
- std::vector<MoveOnly, other_allocator<MoveOnly> > lo(other_allocator<MoveOnly>(5));
- assert(is_contiguous_container_asan_correct(l));
- assert(is_contiguous_container_asan_correct(lo));
- for (int i = 1; i <= 3; ++i)
- {
- l.push_back(i);
- lo.push_back(i);
- }
- assert(is_contiguous_container_asan_correct(l));
- assert(is_contiguous_container_asan_correct(lo));
- std::vector<MoveOnly, other_allocator<MoveOnly> > l2(other_allocator<MoveOnly>(6));
- l2 = std::move(l);
- assert(l2 == lo);
- assert(l.empty());
- assert(l2.get_allocator() == lo.get_allocator());
- assert(is_contiguous_container_asan_correct(l2));
+ assert(is_contiguous_container_asan_correct(l));
+ assert(is_contiguous_container_asan_correct(lo));
+ std::vector<MoveOnly, test_allocator<MoveOnly> > l2(test_allocator<MoveOnly>(6));
+ l2 = std::move(l);
+ assert(l2 == lo);
+ assert(!l.empty());
+ assert(l2.get_allocator() == test_allocator<MoveOnly>(6));
+ assert(is_contiguous_container_asan_correct(l2));
+ }
+ {
+ std::vector<MoveOnly, other_allocator<MoveOnly> > l(other_allocator<MoveOnly>(5));
+ std::vector<MoveOnly, other_allocator<MoveOnly> > lo(other_allocator<MoveOnly>(5));
+ assert(is_contiguous_container_asan_correct(l));
+ assert(is_contiguous_container_asan_correct(lo));
+ for (int i = 1; i <= 3; ++i) {
+ l.push_back(i);
+ lo.push_back(i);
}
- {
- std::vector<MoveOnly, min_allocator<MoveOnly> > l((min_allocator<MoveOnly>()));
- std::vector<MoveOnly, min_allocator<MoveOnly> > lo((min_allocator<MoveOnly>()));
- assert(is_contiguous_container_asan_correct(l));
- assert(is_contiguous_container_asan_correct(lo));
- for (int i = 1; i <= 3; ++i)
- {
- l.push_back(i);
- lo.push_back(i);
- }
- assert(is_contiguous_container_asan_correct(l));
- assert(is_contiguous_container_asan_correct(lo));
- std::vector<MoveOnly, min_allocator<MoveOnly> > l2((min_allocator<MoveOnly>()));
- l2 = std::move(l);
- assert(l2 == lo);
- assert(l.empty());
- assert(l2.get_allocator() == lo.get_allocator());
- assert(is_contiguous_container_asan_correct(l2));
+ assert(is_contiguous_container_asan_correct(l));
+ assert(is_contiguous_container_asan_correct(lo));
+ std::vector<MoveOnly, other_allocator<MoveOnly> > l2(other_allocator<MoveOnly>(6));
+ l2 = std::move(l);
+ assert(l2 == lo);
+ assert(l.empty());
+ assert(l2.get_allocator() == lo.get_allocator());
+ assert(is_contiguous_container_asan_correct(l2));
+ }
+ {
+ std::vector<MoveOnly, min_allocator<MoveOnly> > l((min_allocator<MoveOnly>()));
+ std::vector<MoveOnly, min_allocator<MoveOnly> > lo((min_allocator<MoveOnly>()));
+ assert(is_contiguous_container_asan_correct(l));
+ assert(is_contiguous_container_asan_correct(lo));
+ for (int i = 1; i <= 3; ++i) {
+ l.push_back(i);
+ lo.push_back(i);
}
- {
- std::vector<MoveOnly, safe_allocator<MoveOnly> > l((safe_allocator<MoveOnly>()));
- std::vector<MoveOnly, safe_allocator<MoveOnly> > lo((safe_allocator<MoveOnly>()));
- assert(is_contiguous_container_asan_correct(l));
- assert(is_contiguous_container_asan_correct(lo));
- for (int i = 1; i <= 3; ++i) {
- l.push_back(i);
- lo.push_back(i);
- }
- assert(is_contiguous_container_asan_correct(l));
- assert(is_contiguous_container_asan_correct(lo));
- std::vector<MoveOnly, safe_allocator<MoveOnly> > l2((safe_allocator<MoveOnly>()));
- l2 = std::move(l);
- assert(l2 == lo);
- assert(l.empty());
- assert(l2.get_allocator() == lo.get_allocator());
- assert(is_contiguous_container_asan_correct(l2));
+ assert(is_contiguous_container_asan_correct(l));
+ assert(is_contiguous_container_asan_correct(lo));
+ std::vector<MoveOnly, min_allocator<MoveOnly> > l2((min_allocator<MoveOnly>()));
+ l2 = std::move(l);
+ assert(l2 == lo);
+ assert(l.empty());
+ assert(l2.get_allocator() == lo.get_allocator());
+ assert(is_contiguous_container_asan_correct(l2));
+ }
+ {
+ std::vector<MoveOnly, safe_allocator<MoveOnly> > l((safe_allocator<MoveOnly>()));
+ std::vector<MoveOnly, safe_allocator<MoveOnly> > lo((safe_allocator<MoveOnly>()));
+ assert(is_contiguous_container_asan_correct(l));
+ assert(is_contiguous_container_asan_correct(lo));
+ for (int i = 1; i <= 3; ++i) {
+ l.push_back(i);
+ lo.push_back(i);
}
+ assert(is_contiguous_container_asan_correct(l));
+ assert(is_contiguous_container_asan_correct(lo));
+ std::vector<MoveOnly, safe_allocator<MoveOnly> > l2((safe_allocator<MoveOnly>()));
+ l2 = std::move(l);
+ assert(l2 == lo);
+ assert(l.empty());
+ assert(l2.get_allocator() == lo.get_allocator());
+ assert(is_contiguous_container_asan_correct(l2));
+ }
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/assign_size_value.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/assign_size_value.pass.cpp
index 896aa40c0db9514..8526cf587ed3fc6 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.cons/assign_size_value.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.cons/assign_size_value.pass.cpp
@@ -21,48 +21,46 @@
TEST_CONSTEXPR bool is6(int x) { return x == 6; }
template <typename Vec>
-TEST_CONSTEXPR_CXX20 void test(Vec &v)
-{
- v.assign(5, 6);
- assert(v.size() == 5);
- assert(is_contiguous_container_asan_correct(v));
- assert(std::all_of(v.begin(), v.end(), is6));
+TEST_CONSTEXPR_CXX20 void test(Vec& v) {
+ v.assign(5, 6);
+ assert(v.size() == 5);
+ assert(is_contiguous_container_asan_correct(v));
+ assert(std::all_of(v.begin(), v.end(), is6));
}
TEST_CONSTEXPR_CXX20 bool tests() {
- {
+ {
typedef std::vector<int> V;
V d1;
V d2;
- d2.reserve(10); // no reallocation during assign.
+ d2.reserve(10); // no reallocation during assign.
test(d1);
test(d2);
- }
- {
+ }
+ {
std::vector<int> vec;
vec.reserve(32);
vec.resize(16); // destruction during assign
test(vec);
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::vector<int, min_allocator<int>> V;
V d1;
V d2;
- d2.reserve(10); // no reallocation during assign.
+ d2.reserve(10); // no reallocation during assign.
test(d1);
test(d2);
- }
+ }
#endif
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/construct_default.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/construct_default.pass.cpp
index 9a135b64a336ced..9be4e95156fa9fd 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.cons/construct_default.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.cons/construct_default.pass.cpp
@@ -22,88 +22,85 @@
#include "asan_testing.h"
template <class C>
-TEST_CONSTEXPR_CXX20 void test0()
-{
+TEST_CONSTEXPR_CXX20 void test0() {
#if TEST_STD_VER > 14
- static_assert((noexcept(C{})), "" );
+ static_assert((noexcept(C{})), "");
#elif TEST_STD_VER >= 11
- static_assert((noexcept(C()) == noexcept(typename C::allocator_type())), "" );
+ static_assert((noexcept(C()) == noexcept(typename C::allocator_type())), "");
#endif
- C c;
- LIBCPP_ASSERT(c.__invariants());
- assert(c.empty());
- assert(c.get_allocator() == typename C::allocator_type());
- LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
+ C c;
+ LIBCPP_ASSERT(c.__invariants());
+ assert(c.empty());
+ assert(c.get_allocator() == typename C::allocator_type());
+ LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
#if TEST_STD_VER >= 11
- C c1 = {};
- LIBCPP_ASSERT(c1.__invariants());
- assert(c1.empty());
- assert(c1.get_allocator() == typename C::allocator_type());
- LIBCPP_ASSERT(is_contiguous_container_asan_correct(c1));
+ C c1 = {};
+ LIBCPP_ASSERT(c1.__invariants());
+ assert(c1.empty());
+ assert(c1.get_allocator() == typename C::allocator_type());
+ LIBCPP_ASSERT(is_contiguous_container_asan_correct(c1));
#endif
}
template <class C>
-TEST_CONSTEXPR_CXX20 void test1(const typename C::allocator_type& a)
-{
+TEST_CONSTEXPR_CXX20 void test1(const typename C::allocator_type& a) {
#if TEST_STD_VER > 14
- static_assert((noexcept(C{typename C::allocator_type{}})), "" );
+ static_assert((noexcept(C{typename C::allocator_type{}})), "");
#elif TEST_STD_VER >= 11
- static_assert((noexcept(C(typename C::allocator_type())) == std::is_nothrow_copy_constructible<typename C::allocator_type>::value), "" );
+ static_assert((noexcept(C(typename C::allocator_type())) ==
+ std::is_nothrow_copy_constructible<typename C::allocator_type>::value),
+ "");
#endif
- C c(a);
- LIBCPP_ASSERT(c.__invariants());
- assert(c.empty());
- assert(c.get_allocator() == a);
- LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
+ C c(a);
+ LIBCPP_ASSERT(c.__invariants());
+ assert(c.empty());
+ assert(c.get_allocator() == a);
+ LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
}
TEST_CONSTEXPR_CXX20 bool tests() {
- {
+ {
test0<std::vector<int> >();
test0<std::vector<NotConstructible> >();
test1<std::vector<int, test_allocator<int> > >(test_allocator<int>(3));
- test1<std::vector<NotConstructible, test_allocator<NotConstructible> > >
- (test_allocator<NotConstructible>(5));
- }
- {
- std::vector<int, limited_allocator<int, 10> > v;
- assert(v.empty());
- }
+ test1<std::vector<NotConstructible, test_allocator<NotConstructible> > >(test_allocator<NotConstructible>(5));
+ }
+ {
+ std::vector<int, limited_allocator<int, 10> > v;
+ assert(v.empty());
+ }
#if TEST_STD_VER >= 11
- {
+ {
test0<std::vector<int, min_allocator<int>> >();
test0<std::vector<NotConstructible, min_allocator<NotConstructible>> >();
test1<std::vector<int, min_allocator<int> > >(min_allocator<int>{});
- test1<std::vector<NotConstructible, min_allocator<NotConstructible> > >
- (min_allocator<NotConstructible>{});
- }
- {
- std::vector<int, min_allocator<int> > v;
- assert(v.empty());
- }
+ test1<std::vector<NotConstructible, min_allocator<NotConstructible> > >(min_allocator<NotConstructible>{});
+ }
+ {
+ std::vector<int, min_allocator<int> > v;
+ assert(v.empty());
+ }
- {
+ {
test0<std::vector<int, explicit_allocator<int>> >();
test0<std::vector<NotConstructible, explicit_allocator<NotConstructible>> >();
test1<std::vector<int, explicit_allocator<int> > >(explicit_allocator<int>{});
- test1<std::vector<NotConstructible, explicit_allocator<NotConstructible> > >
- (explicit_allocator<NotConstructible>{});
- }
- {
- std::vector<int, explicit_allocator<int> > v;
- assert(v.empty());
- }
+ test1<std::vector<NotConstructible, explicit_allocator<NotConstructible> > >(
+ explicit_allocator<NotConstructible>{});
+ }
+ {
+ std::vector<int, explicit_allocator<int> > v;
+ assert(v.empty());
+ }
#endif
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp
index 3a66bac344c876a..bac2ea2b4ca1e0f 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp
@@ -20,8 +20,8 @@
#include "min_allocator.h"
#include "asan_testing.h"
#if TEST_STD_VER >= 11
-#include "emplace_constructible.h"
-#include "container_test_types.h"
+# include "emplace_constructible.h"
+# include "container_test_types.h"
#endif
template <class C, class Iterator>
@@ -31,9 +31,8 @@ TEST_CONSTEXPR_CXX20 void test(Iterator first, Iterator last) {
LIBCPP_ASSERT(c.__invariants());
assert(c.size() == static_cast<std::size_t>(std::distance(first, last)));
LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
- for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e;
- ++i, ++first)
- assert(*i == *first);
+ for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i, ++first)
+ assert(*i == *first);
}
// Test with an empty range
{
@@ -47,14 +46,10 @@ TEST_CONSTEXPR_CXX20 void test(Iterator first, Iterator last) {
TEST_CONSTEXPR_CXX20 void basic_test_cases() {
int a[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 1, 0};
int* an = a + sizeof(a) / sizeof(a[0]);
- test<std::vector<int> >(cpp17_input_iterator<const int*>(a),
- cpp17_input_iterator<const int*>(an));
- test<std::vector<int> >(forward_iterator<const int*>(a),
- forward_iterator<const int*>(an));
- test<std::vector<int> >(bidirectional_iterator<const int*>(a),
- bidirectional_iterator<const int*>(an));
- test<std::vector<int> >(random_access_iterator<const int*>(a),
- random_access_iterator<const int*>(an));
+ test<std::vector<int> >(cpp17_input_iterator<const int*>(a), cpp17_input_iterator<const int*>(an));
+ test<std::vector<int> >(forward_iterator<const int*>(a), forward_iterator<const int*>(an));
+ test<std::vector<int> >(bidirectional_iterator<const int*>(a), bidirectional_iterator<const int*>(an));
+ test<std::vector<int> >(random_access_iterator<const int*>(a), random_access_iterator<const int*>(an));
test<std::vector<int> >(a, an);
test<std::vector<int, limited_allocator<int, 63> > >(
@@ -63,23 +58,18 @@ TEST_CONSTEXPR_CXX20 void basic_test_cases() {
test<std::vector<int, limited_allocator<int, 18 + 1> > >(
forward_iterator<const int*>(a), forward_iterator<const int*>(an));
test<std::vector<int, limited_allocator<int, 18 + 1> > >(
- bidirectional_iterator<const int*>(a),
- bidirectional_iterator<const int*>(an));
+ bidirectional_iterator<const int*>(a), bidirectional_iterator<const int*>(an));
test<std::vector<int, limited_allocator<int, 18 + 1> > >(
- random_access_iterator<const int*>(a),
- random_access_iterator<const int*>(an));
+ random_access_iterator<const int*>(a), random_access_iterator<const int*>(an));
test<std::vector<int, limited_allocator<int, 18 + 1> > >(a, an);
#if TEST_STD_VER >= 11
- test<std::vector<int, min_allocator<int> > >(cpp17_input_iterator<const int*>(a),
- cpp17_input_iterator<const int*>(an));
test<std::vector<int, min_allocator<int> > >(
- forward_iterator<const int*>(a), forward_iterator<const int*>(an));
+ cpp17_input_iterator<const int*>(a), cpp17_input_iterator<const int*>(an));
+ test<std::vector<int, min_allocator<int> > >(forward_iterator<const int*>(a), forward_iterator<const int*>(an));
test<std::vector<int, min_allocator<int> > >(
- bidirectional_iterator<const int*>(a),
- bidirectional_iterator<const int*>(an));
+ bidirectional_iterator<const int*>(a), bidirectional_iterator<const int*>(an));
test<std::vector<int, min_allocator<int> > >(
- random_access_iterator<const int*>(a),
- random_access_iterator<const int*>(an));
+ random_access_iterator<const int*>(a), random_access_iterator<const int*>(an));
test<std::vector<int> >(a, an);
test<std::vector<int, safe_allocator<int> > >(
cpp17_input_iterator<const int*>(a), cpp17_input_iterator<const int*>(an));
@@ -102,7 +92,7 @@ TEST_CONSTEXPR_CXX20 void emplaceable_concept_tests() {
int arr1[] = {42};
int arr2[] = {1, 101, 42};
{
- using T = EmplaceConstructible<int>;
+ using T = EmplaceConstructible<int>;
using It = forward_iterator<int*>;
{
std::vector<T> v(It(arr1), It(std::end(arr1)));
@@ -116,7 +106,7 @@ TEST_CONSTEXPR_CXX20 void emplaceable_concept_tests() {
}
}
{
- using T = EmplaceConstructibleAndMoveInsertable<int>;
+ using T = EmplaceConstructibleAndMoveInsertable<int>;
using It = cpp17_input_iterator<int*>;
{
std::vector<T> v(It(arr1), It(std::end(arr1)));
@@ -141,7 +131,7 @@ void test_ctor_under_alloc() {
int arr1[] = {42};
int arr2[] = {1, 101, 42};
{
- using C = TCT::vector<>;
+ using C = TCT::vector<>;
using It = forward_iterator<int*>;
{
ExpectConstructGuard<int&> G(1);
@@ -153,7 +143,7 @@ void test_ctor_under_alloc() {
}
}
{
- using C = TCT::vector<>;
+ using C = TCT::vector<>;
using It = cpp17_input_iterator<int*>;
{
ExpectConstructGuard<int&> G(1);
@@ -168,9 +158,15 @@ void test_ctor_under_alloc() {
}
// In C++03, you can't instantiate a template with a local type.
-struct B1 { int x; };
-struct B2 { int y; };
-struct Der : B1, B2 { int z; };
+struct B1 {
+ int x;
+};
+struct B2 {
+ int y;
+};
+struct Der : B1, B2 {
+ int z;
+};
// Initialize a vector with a
diff erent value type.
TEST_CONSTEXPR_CXX20 void test_ctor_with_
diff erent_value_type() {
@@ -188,7 +184,7 @@ TEST_CONSTEXPR_CXX20 void test_ctor_with_
diff erent_value_type() {
}
{
Der z;
- Der *array[1] = { &z };
+ Der* array[1] = {&z};
// Though the types Der* and B2* are very similar, initialization still cannot
// be done with `memcpy`.
std::vector<B2*> v(array, array + 1);
@@ -196,7 +192,7 @@ TEST_CONSTEXPR_CXX20 void test_ctor_with_
diff erent_value_type() {
}
{
// Though the types are
diff erent, initialization can be done with `memcpy`.
- std::int32_t array[1] = { -1 };
+ std::int32_t array[1] = {-1};
std::vector<std::uint32_t> v(array, array + 1);
assert(v[0] == 4294967295U);
}
@@ -210,12 +206,11 @@ TEST_CONSTEXPR_CXX20 bool tests() {
return true;
}
-int main(int, char**)
-{
- tests();
- test_ctor_under_alloc();
+int main(int, char**) {
+ tests();
+ test_ctor_under_alloc();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp
index 42fb5f7c054b6a6..de325040f4a19d0 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp
@@ -21,8 +21,8 @@
#include "min_allocator.h"
#include "asan_testing.h"
#if TEST_STD_VER >= 11
-#include "emplace_constructible.h"
-#include "container_test_types.h"
+# include "emplace_constructible.h"
+# include "container_test_types.h"
#endif
template <class C, class Iterator, class A>
@@ -31,8 +31,7 @@ TEST_CONSTEXPR_CXX20 void test(Iterator first, Iterator last, const A& a) {
LIBCPP_ASSERT(c.__invariants());
assert(c.size() == static_cast<std::size_t>(std::distance(first, last)));
LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
- for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e;
- ++i, ++first)
+ for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i, ++first)
assert(*i == *first);
}
@@ -54,14 +53,10 @@ TEST_CONSTEXPR_CXX20 void basic_tests() {
int a[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 1, 0};
int* an = a + sizeof(a) / sizeof(a[0]);
std::allocator<int> alloc;
- test<std::vector<int> >(cpp17_input_iterator<const int*>(a),
- cpp17_input_iterator<const int*>(an), alloc);
- test<std::vector<int> >(forward_iterator<const int*>(a),
- forward_iterator<const int*>(an), alloc);
- test<std::vector<int> >(bidirectional_iterator<const int*>(a),
- bidirectional_iterator<const int*>(an), alloc);
- test<std::vector<int> >(random_access_iterator<const int*>(a),
- random_access_iterator<const int*>(an), alloc);
+ test<std::vector<int> >(cpp17_input_iterator<const int*>(a), cpp17_input_iterator<const int*>(an), alloc);
+ test<std::vector<int> >(forward_iterator<const int*>(a), forward_iterator<const int*>(an), alloc);
+ test<std::vector<int> >(bidirectional_iterator<const int*>(a), bidirectional_iterator<const int*>(an), alloc);
+ test<std::vector<int> >(random_access_iterator<const int*>(a), random_access_iterator<const int*>(an), alloc);
test<std::vector<int> >(a, an, alloc);
}
#if TEST_STD_VER >= 11
@@ -72,14 +67,11 @@ TEST_CONSTEXPR_CXX20 void basic_tests() {
test<std::vector<int, min_allocator<int> > >(
cpp17_input_iterator<const int*>(a), cpp17_input_iterator<const int*>(an), alloc);
test<std::vector<int, min_allocator<int> > >(
- forward_iterator<const int*>(a), forward_iterator<const int*>(an),
- alloc);
+ forward_iterator<const int*>(a), forward_iterator<const int*>(an), alloc);
test<std::vector<int, min_allocator<int> > >(
- bidirectional_iterator<const int*>(a),
- bidirectional_iterator<const int*>(an), alloc);
+ bidirectional_iterator<const int*>(a), bidirectional_iterator<const int*>(an), alloc);
test<std::vector<int, min_allocator<int> > >(
- random_access_iterator<const int*>(a),
- random_access_iterator<const int*>(an), alloc);
+ random_access_iterator<const int*>(a), random_access_iterator<const int*>(an), alloc);
test<std::vector<int, min_allocator<int> > >(a, an, alloc);
test<std::vector<int, implicit_conv_allocator<int> > >(a, an, nullptr);
}
@@ -112,8 +104,8 @@ TEST_CONSTEXPR_CXX20 void emplaceable_concept_tests() {
int arr1[] = {42};
int arr2[] = {1, 101, 42};
{
- using T = EmplaceConstructible<int>;
- using It = forward_iterator<int*>;
+ using T = EmplaceConstructible<int>;
+ using It = forward_iterator<int*>;
using Alloc = std::allocator<T>;
Alloc a;
{
@@ -128,8 +120,8 @@ TEST_CONSTEXPR_CXX20 void emplaceable_concept_tests() {
}
}
{
- using T = EmplaceConstructibleAndMoveInsertable<int>;
- using It = cpp17_input_iterator<int*>;
+ using T = EmplaceConstructibleAndMoveInsertable<int>;
+ using It = cpp17_input_iterator<int*>;
using Alloc = std::allocator<T>;
Alloc a;
{
@@ -153,8 +145,8 @@ void test_ctor_under_alloc() {
int arr1[] = {42};
int arr2[] = {1, 101, 42};
{
- using C = TCT::vector<>;
- using It = forward_iterator<int*>;
+ using C = TCT::vector<>;
+ using It = forward_iterator<int*>;
using Alloc = typename C::allocator_type;
Alloc a;
{
@@ -167,8 +159,8 @@ void test_ctor_under_alloc() {
}
}
{
- using C = TCT::vector<>;
- using It = cpp17_input_iterator<int*>;
+ using C = TCT::vector<>;
+ using It = cpp17_input_iterator<int*>;
using Alloc = typename C::allocator_type;
Alloc a;
{
diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/construct_size.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/construct_size.pass.cpp
index 1dc7cd9bc7c1bf8..cbae3653d995f80 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.cons/construct_size.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.cons/construct_size.pass.cpp
@@ -21,69 +21,67 @@
#include "asan_testing.h"
template <class C>
-TEST_CONSTEXPR_CXX20
-void test(typename C::size_type n,
- typename C::allocator_type const& a = typename C::allocator_type())
-{
- (void)a;
- // Test without a custom allocator
- {
- C c(n);
- LIBCPP_ASSERT(c.__invariants());
- assert(c.size() == n);
- assert(c.get_allocator() == typename C::allocator_type());
- LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
+TEST_CONSTEXPR_CXX20 void
+test(typename C::size_type n, typename C::allocator_type const& a = typename C::allocator_type()) {
+ (void)a;
+ // Test without a custom allocator
+ {
+ C c(n);
+ LIBCPP_ASSERT(c.__invariants());
+ assert(c.size() == n);
+ assert(c.get_allocator() == typename C::allocator_type());
+ LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
#if TEST_STD_VER >= 11
- for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i)
- assert(*i == typename C::value_type());
+ for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i)
+ assert(*i == typename C::value_type());
#endif
- }
+ }
- // Test with a custom allocator
+ // Test with a custom allocator
#if TEST_STD_VER >= 14
- {
- C c(n, a);
- LIBCPP_ASSERT(c.__invariants());
- assert(c.size() == n);
- assert(c.get_allocator() == a);
- LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
- for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i)
- assert(*i == typename C::value_type());
- }
+ {
+ C c(n, a);
+ LIBCPP_ASSERT(c.__invariants());
+ assert(c.size() == n);
+ assert(c.get_allocator() == a);
+ LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
+ for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i)
+ assert(*i == typename C::value_type());
+ }
#endif
}
TEST_CONSTEXPR_CXX20 bool tests() {
- test<std::vector<int> >(0);
- test<std::vector<int> >(50);
+ test<std::vector<int> >(0);
+ test<std::vector<int> >(50);
#if TEST_STD_VER >= 11
- test<std::vector<int, min_allocator<int>>>(0);
- test<std::vector<int, min_allocator<int>>>(50);
- test<std::vector<int, safe_allocator<int>>>(0);
- test<std::vector<int, safe_allocator<int>>>(50);
+ test<std::vector<int, min_allocator<int>>>(0);
+ test<std::vector<int, min_allocator<int>>>(50);
+ test<std::vector<int, safe_allocator<int>>>(0);
+ test<std::vector<int, safe_allocator<int>>>(50);
#endif
- return true;
+ return true;
}
int main(int, char**) {
- tests();
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- test<std::vector<DefaultOnly> >(0);
- test<std::vector<DefaultOnly> >(500);
- assert(DefaultOnly::count == 0);
+ test<std::vector<DefaultOnly> >(0);
+ test<std::vector<DefaultOnly> >(500);
+ assert(DefaultOnly::count == 0);
#if TEST_STD_VER >= 11
- test<std::vector<DefaultOnly, min_allocator<DefaultOnly>>>(0);
- test<std::vector<DefaultOnly, min_allocator<DefaultOnly>>>(500);
- test<std::vector<DefaultOnly, safe_allocator<DefaultOnly>>>(0);
- test<std::vector<DefaultOnly, safe_allocator<DefaultOnly>>>(500);
- test<std::vector<DefaultOnly, test_allocator<DefaultOnly>>>(0, test_allocator<DefaultOnly>(23));
- test<std::vector<DefaultOnly, test_allocator<DefaultOnly>>>(100, test_allocator<DefaultOnly>(23));
- assert(DefaultOnly::count == 0);
+ test<std::vector<DefaultOnly, min_allocator<DefaultOnly>>>(0);
+ test<std::vector<DefaultOnly, min_allocator<DefaultOnly>>>(500);
+ test<std::vector<DefaultOnly, safe_allocator<DefaultOnly>>>(0);
+ test<std::vector<DefaultOnly, safe_allocator<DefaultOnly>>>(500);
+ test<std::vector<DefaultOnly, test_allocator<DefaultOnly>>>(0, test_allocator<DefaultOnly>(23));
+ test<std::vector<DefaultOnly, test_allocator<DefaultOnly>>>(100, test_allocator<DefaultOnly>(23));
+ assert(DefaultOnly::count == 0);
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/construct_size_value.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/construct_size_value.pass.cpp
index 0f24e77cd47e096..de2df027dd530eb 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.cons/construct_size_value.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.cons/construct_size_value.pass.cpp
@@ -19,39 +19,36 @@
#include "asan_testing.h"
template <class C>
-TEST_CONSTEXPR_CXX20 void
-test(typename C::size_type n, const typename C::value_type& x)
-{
- C c(n, x);
- LIBCPP_ASSERT(c.__invariants());
- assert(c.size() == n);
- LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
- for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i)
- assert(*i == x);
+TEST_CONSTEXPR_CXX20 void test(typename C::size_type n, const typename C::value_type& x) {
+ C c(n, x);
+ LIBCPP_ASSERT(c.__invariants());
+ assert(c.size() == n);
+ LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
+ for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i)
+ assert(*i == x);
}
TEST_CONSTEXPR_CXX20 bool tests() {
- test<std::vector<int> >(0, 3);
- test<std::vector<int> >(50, 3);
- // Add 1 for implementations that dynamically allocate a container proxy.
- test<std::vector<int, limited_allocator<int, 50 + 1> > >(0, 5);
- test<std::vector<int, limited_allocator<int, 50 + 1> > >(50, 5);
- test<std::vector<int, limited_allocator<int, 50 + 1> > >(50, 5);
+ test<std::vector<int> >(0, 3);
+ test<std::vector<int> >(50, 3);
+ // Add 1 for implementations that dynamically allocate a container proxy.
+ test<std::vector<int, limited_allocator<int, 50 + 1> > >(0, 5);
+ test<std::vector<int, limited_allocator<int, 50 + 1> > >(50, 5);
+ test<std::vector<int, limited_allocator<int, 50 + 1> > >(50, 5);
#if TEST_STD_VER >= 11
- test<std::vector<int, min_allocator<int>> >(0, 3);
- test<std::vector<int, min_allocator<int>> >(50, 3);
- test<std::vector<int, safe_allocator<int>> >(0, 3);
- test<std::vector<int, safe_allocator<int>> >(50, 3);
+ test<std::vector<int, min_allocator<int>> >(0, 3);
+ test<std::vector<int, min_allocator<int>> >(50, 3);
+ test<std::vector<int, safe_allocator<int>> >(0, 3);
+ test<std::vector<int, safe_allocator<int>> >(50, 3);
#endif
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/construct_size_value_alloc.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/construct_size_value_alloc.pass.cpp
index eb34de8bc9b3107..c6d66d49831706a 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.cons/construct_size_value_alloc.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.cons/construct_size_value_alloc.pass.cpp
@@ -19,36 +19,33 @@
template <class C>
TEST_CONSTEXPR_CXX20 void
-test(typename C::size_type n, const typename C::value_type& x,
- const typename C::allocator_type& a)
-{
- C c(n, x, a);
- LIBCPP_ASSERT(c.__invariants());
- assert(a == c.get_allocator());
- assert(c.size() == n);
- LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
- for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i)
- assert(*i == x);
+test(typename C::size_type n, const typename C::value_type& x, const typename C::allocator_type& a) {
+ C c(n, x, a);
+ LIBCPP_ASSERT(c.__invariants());
+ assert(a == c.get_allocator());
+ assert(c.size() == n);
+ LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
+ for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i)
+ assert(*i == x);
}
TEST_CONSTEXPR_CXX20 bool tests() {
- test<std::vector<int> >(0, 3, std::allocator<int>());
- test<std::vector<int> >(50, 3, std::allocator<int>());
+ test<std::vector<int> >(0, 3, std::allocator<int>());
+ test<std::vector<int> >(50, 3, std::allocator<int>());
#if TEST_STD_VER >= 11
- test<std::vector<int, min_allocator<int>> >(0, 3, min_allocator<int>());
- test<std::vector<int, min_allocator<int>> >(50, 3, min_allocator<int>());
- test<std::vector<int, safe_allocator<int>> >(0, 3, safe_allocator<int>());
- test<std::vector<int, safe_allocator<int>> >(50, 3, safe_allocator<int>());
+ test<std::vector<int, min_allocator<int>> >(0, 3, min_allocator<int>());
+ test<std::vector<int, min_allocator<int>> >(50, 3, min_allocator<int>());
+ test<std::vector<int, safe_allocator<int>> >(0, 3, safe_allocator<int>());
+ test<std::vector<int, safe_allocator<int>> >(50, 3, safe_allocator<int>());
#endif
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/copy.move_only.verify.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/copy.move_only.verify.cpp
index af8ca01370f0800..ce3173d4dd062cf 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.cons/copy.move_only.verify.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.cons/copy.move_only.verify.cpp
@@ -15,6 +15,7 @@
#include "MoveOnly.h"
void f() {
- std::vector<MoveOnly> v;
- std::vector<MoveOnly> copy = v; // expected-error-re@* {{{{(no matching function for call to '__construct_at')|(call to deleted constructor of 'MoveOnly')}}}}
+ std::vector<MoveOnly> v;
+ std::vector<MoveOnly> copy =
+ v; // expected-error-re@* {{{{(no matching function for call to '__construct_at')|(call to deleted constructor of 'MoveOnly')}}}}
}
diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/copy.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/copy.pass.cpp
index b0e626381454e02..ce5b42575b46f6d 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.cons/copy.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.cons/copy.pass.cpp
@@ -19,101 +19,98 @@
#include "asan_testing.h"
template <class C>
-TEST_CONSTEXPR_CXX20 void
-test(const C& x)
-{
- typename C::size_type s = x.size();
- C c(x);
- LIBCPP_ASSERT(c.__invariants());
- assert(c.size() == s);
- assert(c == x);
- LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
+TEST_CONSTEXPR_CXX20 void test(const C& x) {
+ typename C::size_type s = x.size();
+ C c(x);
+ LIBCPP_ASSERT(c.__invariants());
+ assert(c.size() == s);
+ assert(c == x);
+ LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
}
TEST_CONSTEXPR_CXX20 bool tests() {
- {
- int a[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 1, 0};
- int* an = a + sizeof(a)/sizeof(a[0]);
- test(std::vector<int>(a, an));
- }
- {
- std::vector<int, test_allocator<int> > v(3, 2, test_allocator<int>(5));
- std::vector<int, test_allocator<int> > v2 = v;
- assert(is_contiguous_container_asan_correct(v));
- assert(is_contiguous_container_asan_correct(v2));
- assert(v2 == v);
- assert(v2.get_allocator() == v.get_allocator());
- assert(is_contiguous_container_asan_correct(v));
- assert(is_contiguous_container_asan_correct(v2));
- }
- {
- // Test copy ctor with empty source
- std::vector<int, test_allocator<int> > v(test_allocator<int>(5));
- std::vector<int, test_allocator<int> > v2 = v;
- assert(is_contiguous_container_asan_correct(v));
- assert(is_contiguous_container_asan_correct(v2));
- assert(v2 == v);
- assert(v2.get_allocator() == v.get_allocator());
- assert(is_contiguous_container_asan_correct(v));
- assert(is_contiguous_container_asan_correct(v2));
- assert(v2.empty());
- }
+ {
+ int a[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 1, 0};
+ int* an = a + sizeof(a) / sizeof(a[0]);
+ test(std::vector<int>(a, an));
+ }
+ {
+ std::vector<int, test_allocator<int> > v(3, 2, test_allocator<int>(5));
+ std::vector<int, test_allocator<int> > v2 = v;
+ assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v2));
+ assert(v2 == v);
+ assert(v2.get_allocator() == v.get_allocator());
+ assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v2));
+ }
+ {
+ // Test copy ctor with empty source
+ std::vector<int, test_allocator<int> > v(test_allocator<int>(5));
+ std::vector<int, test_allocator<int> > v2 = v;
+ assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v2));
+ assert(v2 == v);
+ assert(v2.get_allocator() == v.get_allocator());
+ assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v2));
+ assert(v2.empty());
+ }
#if TEST_STD_VER >= 11
- {
- std::vector<int, other_allocator<int> > v(3, 2, other_allocator<int>(5));
- std::vector<int, other_allocator<int> > v2 = v;
- assert(is_contiguous_container_asan_correct(v));
- assert(is_contiguous_container_asan_correct(v2));
- assert(v2 == v);
- assert(v2.get_allocator() == other_allocator<int>(-2));
- assert(is_contiguous_container_asan_correct(v));
- assert(is_contiguous_container_asan_correct(v2));
- }
- {
- int a[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 1, 0};
- int* an = a + sizeof(a)/sizeof(a[0]);
- test(std::vector<int, min_allocator<int>>(a, an));
- test(std::vector<int, safe_allocator<int>>(a, an));
- }
- {
- std::vector<int, min_allocator<int> > v(3, 2, min_allocator<int>());
- std::vector<int, min_allocator<int> > v2 = v;
- assert(is_contiguous_container_asan_correct(v));
- assert(is_contiguous_container_asan_correct(v2));
- assert(v2 == v);
- assert(v2.get_allocator() == v.get_allocator());
- assert(is_contiguous_container_asan_correct(v));
- assert(is_contiguous_container_asan_correct(v2));
- }
- {
- std::vector<int, safe_allocator<int> > v(3, 2, safe_allocator<int>());
- std::vector<int, safe_allocator<int> > v2 = v;
- assert(is_contiguous_container_asan_correct(v));
- assert(is_contiguous_container_asan_correct(v2));
- assert(v2 == v);
- assert(v2.get_allocator() == v.get_allocator());
- assert(is_contiguous_container_asan_correct(v));
- assert(is_contiguous_container_asan_correct(v2));
- }
+ {
+ std::vector<int, other_allocator<int> > v(3, 2, other_allocator<int>(5));
+ std::vector<int, other_allocator<int> > v2 = v;
+ assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v2));
+ assert(v2 == v);
+ assert(v2.get_allocator() == other_allocator<int>(-2));
+ assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v2));
+ }
+ {
+ int a[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 1, 0};
+ int* an = a + sizeof(a) / sizeof(a[0]);
+ test(std::vector<int, min_allocator<int>>(a, an));
+ test(std::vector<int, safe_allocator<int>>(a, an));
+ }
+ {
+ std::vector<int, min_allocator<int> > v(3, 2, min_allocator<int>());
+ std::vector<int, min_allocator<int> > v2 = v;
+ assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v2));
+ assert(v2 == v);
+ assert(v2.get_allocator() == v.get_allocator());
+ assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v2));
+ }
+ {
+ std::vector<int, safe_allocator<int> > v(3, 2, safe_allocator<int>());
+ std::vector<int, safe_allocator<int> > v2 = v;
+ assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v2));
+ assert(v2 == v);
+ assert(v2.get_allocator() == v.get_allocator());
+ assert(is_contiguous_container_asan_correct(v));
+ assert(is_contiguous_container_asan_correct(v2));
+ }
#endif
- return true;
+ return true;
}
void test_copy_from_volatile_src() {
- volatile int src[] = {1, 2, 3};
- std::vector<int> v(src, src + 3);
- assert(v[0] == 1);
- assert(v[1] == 2);
- assert(v[2] == 3);
+ volatile int src[] = {1, 2, 3};
+ std::vector<int> v(src, src + 3);
+ assert(v[0] == 1);
+ assert(v[1] == 2);
+ assert(v[2] == 3);
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- test_copy_from_volatile_src();
- return 0;
+ test_copy_from_volatile_src();
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/copy_alloc.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/copy_alloc.pass.cpp
index 0c03c50aed2e8b3..2c598d5dc426f9b 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.cons/copy_alloc.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.cons/copy_alloc.pass.cpp
@@ -19,72 +19,69 @@
#include "asan_testing.h"
template <class C>
-TEST_CONSTEXPR_CXX20 void
-test(const C& x, const typename C::allocator_type& a)
-{
- typename C::size_type s = x.size();
- C c(x, a);
- LIBCPP_ASSERT(c.__invariants());
- assert(c.size() == s);
- assert(c == x);
- LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
+TEST_CONSTEXPR_CXX20 void test(const C& x, const typename C::allocator_type& a) {
+ typename C::size_type s = x.size();
+ C c(x, a);
+ LIBCPP_ASSERT(c.__invariants());
+ assert(c.size() == s);
+ assert(c == x);
+ LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
}
TEST_CONSTEXPR_CXX20 bool tests() {
- {
- int a[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 1, 0};
- int* an = a + sizeof(a)/sizeof(a[0]);
- test(std::vector<int>(a, an), std::allocator<int>());
- }
- {
- std::vector<int, test_allocator<int> > l(3, 2, test_allocator<int>(5));
- std::vector<int, test_allocator<int> > l2(l, test_allocator<int>(3));
- assert(l2 == l);
- assert(l2.get_allocator() == test_allocator<int>(3));
- }
- {
- std::vector<int, other_allocator<int> > l(3, 2, other_allocator<int>(5));
- std::vector<int, other_allocator<int> > l2(l, other_allocator<int>(3));
- assert(l2 == l);
- assert(l2.get_allocator() == other_allocator<int>(3));
- }
- {
- // Test copy ctor with allocator and empty source
- std::vector<int, other_allocator<int> > l(other_allocator<int>(5));
- std::vector<int, other_allocator<int> > l2(l, other_allocator<int>(3));
- assert(l2 == l);
- assert(l2.get_allocator() == other_allocator<int>(3));
- assert(l2.empty());
- }
+ {
+ int a[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 1, 0};
+ int* an = a + sizeof(a) / sizeof(a[0]);
+ test(std::vector<int>(a, an), std::allocator<int>());
+ }
+ {
+ std::vector<int, test_allocator<int> > l(3, 2, test_allocator<int>(5));
+ std::vector<int, test_allocator<int> > l2(l, test_allocator<int>(3));
+ assert(l2 == l);
+ assert(l2.get_allocator() == test_allocator<int>(3));
+ }
+ {
+ std::vector<int, other_allocator<int> > l(3, 2, other_allocator<int>(5));
+ std::vector<int, other_allocator<int> > l2(l, other_allocator<int>(3));
+ assert(l2 == l);
+ assert(l2.get_allocator() == other_allocator<int>(3));
+ }
+ {
+ // Test copy ctor with allocator and empty source
+ std::vector<int, other_allocator<int> > l(other_allocator<int>(5));
+ std::vector<int, other_allocator<int> > l2(l, other_allocator<int>(3));
+ assert(l2 == l);
+ assert(l2.get_allocator() == other_allocator<int>(3));
+ assert(l2.empty());
+ }
#if TEST_STD_VER >= 11
- {
- int a[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 1, 0};
- int* an = a + sizeof(a)/sizeof(a[0]);
- test(std::vector<int, min_allocator<int>>(a, an), min_allocator<int>());
- test(std::vector<int, safe_allocator<int>>(a, an), safe_allocator<int>());
- }
- {
- std::vector<int, min_allocator<int> > l(3, 2, min_allocator<int>());
- std::vector<int, min_allocator<int> > l2(l, min_allocator<int>());
- assert(l2 == l);
- assert(l2.get_allocator() == min_allocator<int>());
- }
- {
- std::vector<int, safe_allocator<int> > l(3, 2, safe_allocator<int>());
- std::vector<int, safe_allocator<int> > l2(l, safe_allocator<int>());
- assert(l2 == l);
- assert(l2.get_allocator() == safe_allocator<int>());
- }
+ {
+ int a[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 1, 0};
+ int* an = a + sizeof(a) / sizeof(a[0]);
+ test(std::vector<int, min_allocator<int>>(a, an), min_allocator<int>());
+ test(std::vector<int, safe_allocator<int>>(a, an), safe_allocator<int>());
+ }
+ {
+ std::vector<int, min_allocator<int> > l(3, 2, min_allocator<int>());
+ std::vector<int, min_allocator<int> > l2(l, min_allocator<int>());
+ assert(l2 == l);
+ assert(l2.get_allocator() == min_allocator<int>());
+ }
+ {
+ std::vector<int, safe_allocator<int> > l(3, 2, safe_allocator<int>());
+ std::vector<int, safe_allocator<int> > l2(l, safe_allocator<int>());
+ assert(l2 == l);
+ assert(l2.get_allocator() == safe_allocator<int>());
+ }
#endif
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/deduct.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/deduct.pass.cpp
index 322161d51750268..2408369c368ae32 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.cons/deduct.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.cons/deduct.pass.cpp
@@ -34,140 +34,139 @@
struct A {};
TEST_CONSTEXPR_CXX20 bool tests() {
-
-// Test the explicit deduction guides
- {
- const int arr[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
+ // Test the explicit deduction guides
+ {
+ const int arr[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
std::vector vec(std::begin(arr), std::end(arr));
static_assert(std::is_same_v<decltype(vec), std::vector<int>>, "");
assert(std::equal(vec.begin(), vec.end(), std::begin(arr), std::end(arr)));
- }
+ }
- {
- const long arr[] = {INT_MAX, 1L, 2L, 3L };
+ {
+ const long arr[] = {INT_MAX, 1L, 2L, 3L};
std::vector vec(std::begin(arr), std::end(arr), std::allocator<long>());
static_assert(std::is_same_v<decltype(vec)::value_type, long>, "");
assert(vec.size() == 4);
assert(vec[0] == INT_MAX);
assert(vec[1] == 1L);
assert(vec[2] == 2L);
- }
+ }
-// Test the implicit deduction guides
+ // Test the implicit deduction guides
- {
-// We don't expect this one to work.
-// std::vector vec(std::allocator<int>()); // vector (allocator &)
- }
+ {
+ // We don't expect this one to work.
+ // std::vector vec(std::allocator<int>()); // vector (allocator &)
+ }
- {
+ {
std::vector vec(1, A{}); // vector (size_type, T)
static_assert(std::is_same_v<decltype(vec)::value_type, A>, "");
static_assert(std::is_same_v<decltype(vec)::allocator_type, std::allocator<A>>, "");
assert(vec.size() == 1);
- }
+ }
- {
+ {
std::vector vec(1, A{}, test_allocator<A>()); // vector (size_type, T, allocator)
static_assert(std::is_same_v<decltype(vec)::value_type, A>, "");
static_assert(std::is_same_v<decltype(vec)::allocator_type, test_allocator<A>>, "");
assert(vec.size() == 1);
- }
+ }
- {
+ {
std::vector vec{1U, 2U, 3U, 4U, 5U}; // vector(initializer-list)
static_assert(std::is_same_v<decltype(vec)::value_type, unsigned>, "");
assert(vec.size() == 5);
assert(vec[2] == 3U);
- }
+ }
- {
+ {
std::vector vec({1.0, 2.0, 3.0, 4.0}, test_allocator<double>()); // vector(initializer-list, allocator)
static_assert(std::is_same_v<decltype(vec)::value_type, double>, "");
static_assert(std::is_same_v<decltype(vec)::allocator_type, test_allocator<double>>, "");
assert(vec.size() == 4);
assert(vec[3] == 4.0);
- }
+ }
- {
+ {
std::vector<long double> source;
std::vector vec(source); // vector(vector &)
static_assert(std::is_same_v<decltype(vec)::value_type, long double>, "");
static_assert(std::is_same_v<decltype(vec)::allocator_type, std::allocator<long double>>, "");
assert(vec.size() == 0);
- }
+ }
#if TEST_STD_VER >= 23
+ {
{
- {
- std::vector c(std::from_range, std::array<int, 0>());
- static_assert(std::is_same_v<decltype(c), std::vector<int>>);
- }
-
- {
- using Alloc = test_allocator<int>;
- std::vector c(std::from_range, std::array<int, 0>(), Alloc());
- static_assert(std::is_same_v<decltype(c), std::vector<int, Alloc>>);
- }
+ std::vector c(std::from_range, std::array<int, 0>());
+ static_assert(std::is_same_v<decltype(c), std::vector<int>>);
}
-#endif
-// A couple of vector<bool> tests, too!
{
+ using Alloc = test_allocator<int>;
+ std::vector c(std::from_range, std::array<int, 0>(), Alloc());
+ static_assert(std::is_same_v<decltype(c), std::vector<int, Alloc>>);
+ }
+ }
+#endif
+
+ // A couple of vector<bool> tests, too!
+ {
std::vector vec(3, true); // vector(initializer-list)
static_assert(std::is_same_v<decltype(vec)::value_type, bool>, "");
static_assert(std::is_same_v<decltype(vec)::allocator_type, std::allocator<bool>>, "");
assert(vec.size() == 3);
assert(vec[0] && vec[1] && vec[2]);
- }
+ }
- {
+ {
std::vector<bool> source;
std::vector vec(source); // vector(vector &)
static_assert(std::is_same_v<decltype(vec)::value_type, bool>, "");
static_assert(std::is_same_v<decltype(vec)::allocator_type, std::allocator<bool>>, "");
assert(vec.size() == 0);
+ }
+
+ {
+ typedef test_allocator<short> Alloc;
+ typedef test_allocator<int> ConvertibleToAlloc;
+
+ {
+ std::vector<short, Alloc> source;
+ std::vector vec(source, Alloc(2));
+ static_assert(std::is_same_v<decltype(vec), decltype(source)>);
+ }
+
+ {
+ std::vector<short, Alloc> source;
+ std::vector vec(source, ConvertibleToAlloc(2));
+ static_assert(std::is_same_v<decltype(vec), decltype(source)>);
+ }
+
+ {
+ std::vector<short, Alloc> source;
+ std::vector vec(std::move(source), Alloc(2));
+ static_assert(std::is_same_v<decltype(vec), decltype(source)>);
}
{
- typedef test_allocator<short> Alloc;
- typedef test_allocator<int> ConvertibleToAlloc;
-
- {
- std::vector<short, Alloc> source;
- std::vector vec(source, Alloc(2));
- static_assert(std::is_same_v<decltype(vec), decltype(source)>);
- }
-
- {
- std::vector<short, Alloc> source;
- std::vector vec(source, ConvertibleToAlloc(2));
- static_assert(std::is_same_v<decltype(vec), decltype(source)>);
- }
-
- {
- std::vector<short, Alloc> source;
- std::vector vec(std::move(source), Alloc(2));
- static_assert(std::is_same_v<decltype(vec), decltype(source)>);
- }
-
- {
- std::vector<short, Alloc> source;
- std::vector vec(std::move(source), ConvertibleToAlloc(2));
- static_assert(std::is_same_v<decltype(vec), decltype(source)>);
- }
+ std::vector<short, Alloc> source;
+ std::vector vec(std::move(source), ConvertibleToAlloc(2));
+ static_assert(std::is_same_v<decltype(vec), decltype(source)>);
}
+ }
- SequenceContainerDeductionGuidesSfinaeAway<std::vector, std::vector<int>>();
+ SequenceContainerDeductionGuidesSfinaeAway<std::vector, std::vector<int>>();
- return true;
+ return true;
}
int main(int, char**) {
- tests();
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/default.recursive.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/default.recursive.pass.cpp
index 310f9ccfc9c6cba..0dd33525978c178 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.cons/default.recursive.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.cons/default.recursive.pass.cpp
@@ -14,13 +14,8 @@
#include "test_macros.h"
-struct X
-{
- std::vector<X> q;
+struct X {
+ std::vector<X> q;
};
-int main(int, char**)
-{
-
- return 0;
-}
+int main(int, char**) { return 0; }
diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/default_noexcept.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/default_noexcept.pass.cpp
index 054ea6430f82a73..c22776edcd6d10d 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.cons/default_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.cons/default_noexcept.pass.cpp
@@ -14,7 +14,6 @@
// This *was* a conforming extension, but it was adopted in N4258.
-
#include <vector>
#include <cassert>
@@ -23,39 +22,37 @@
#include "test_allocator.h"
template <class T>
-struct some_alloc
-{
- typedef T value_type;
- some_alloc(const some_alloc&);
- void allocate(std::size_t);
+struct some_alloc {
+ typedef T value_type;
+ some_alloc(const some_alloc&);
+ void allocate(std::size_t);
};
TEST_CONSTEXPR_CXX20 bool tests() {
- {
- typedef std::vector<MoveOnly> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
- }
- {
- typedef std::vector<MoveOnly, test_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
- }
- {
- typedef std::vector<MoveOnly, other_allocator<MoveOnly>> C;
- static_assert(!std::is_nothrow_default_constructible<C>::value, "");
- }
- {
- typedef std::vector<MoveOnly, some_alloc<MoveOnly>> C;
- static_assert(!std::is_nothrow_default_constructible<C>::value, "");
- }
-
- return true;
+ {
+ typedef std::vector<MoveOnly> C;
+ static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ }
+ {
+ typedef std::vector<MoveOnly, test_allocator<MoveOnly>> C;
+ static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ }
+ {
+ typedef std::vector<MoveOnly, other_allocator<MoveOnly>> C;
+ static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+ }
+ {
+ typedef std::vector<MoveOnly, some_alloc<MoveOnly>> C;
+ static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+ }
+
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/dtor_noexcept.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/dtor_noexcept.pass.cpp
index 1b98b7598b97b4e..4a7e2cf4456766b 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.cons/dtor_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.cons/dtor_noexcept.pass.cpp
@@ -20,43 +20,40 @@
#include "test_allocator.h"
template <class T>
-struct some_alloc
-{
- typedef T value_type;
- some_alloc(const some_alloc&);
- ~some_alloc() noexcept(false);
- void allocate(std::size_t);
+struct some_alloc {
+ typedef T value_type;
+ some_alloc(const some_alloc&);
+ ~some_alloc() noexcept(false);
+ void allocate(std::size_t);
};
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- {
- typedef std::vector<MoveOnly> C;
- static_assert(std::is_nothrow_destructible<C>::value, "");
- }
- {
- typedef std::vector<MoveOnly, test_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_destructible<C>::value, "");
- }
- {
- typedef std::vector<MoveOnly, other_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_destructible<C>::value, "");
- }
+TEST_CONSTEXPR_CXX20 bool tests() {
+ {
+ typedef std::vector<MoveOnly> C;
+ static_assert(std::is_nothrow_destructible<C>::value, "");
+ }
+ {
+ typedef std::vector<MoveOnly, test_allocator<MoveOnly>> C;
+ static_assert(std::is_nothrow_destructible<C>::value, "");
+ }
+ {
+ typedef std::vector<MoveOnly, other_allocator<MoveOnly>> C;
+ static_assert(std::is_nothrow_destructible<C>::value, "");
+ }
#if defined(_LIBCPP_VERSION)
- {
- typedef std::vector<MoveOnly, some_alloc<MoveOnly>> C;
- static_assert(!std::is_nothrow_destructible<C>::value, "");
- }
+ {
+ typedef std::vector<MoveOnly, some_alloc<MoveOnly>> C;
+ static_assert(!std::is_nothrow_destructible<C>::value, "");
+ }
#endif // _LIBCPP_VERSION
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/initializer_list.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/initializer_list.pass.cpp
index af2f3e40a91b57f..02bb7f3a3ea9cfb 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.cons/initializer_list.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.cons/initializer_list.pass.cpp
@@ -18,9 +18,8 @@
#include "min_allocator.h"
#include "asan_testing.h"
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- {
+TEST_CONSTEXPR_CXX20 bool tests() {
+ {
std::vector<int> d = {3, 4, 5, 6};
assert(d.size() == 4);
assert(is_contiguous_container_asan_correct(d));
@@ -28,8 +27,8 @@ TEST_CONSTEXPR_CXX20 bool tests()
assert(d[1] == 4);
assert(d[2] == 5);
assert(d[3] == 6);
- }
- {
+ }
+ {
std::vector<int, min_allocator<int>> d = {3, 4, 5, 6};
assert(d.size() == 4);
assert(is_contiguous_container_asan_correct(d));
@@ -37,25 +36,24 @@ TEST_CONSTEXPR_CXX20 bool tests()
assert(d[1] == 4);
assert(d[2] == 5);
assert(d[3] == 6);
- }
- {
- std::vector<int, safe_allocator<int>> d = {3, 4, 5, 6};
- assert(d.size() == 4);
- assert(is_contiguous_container_asan_correct(d));
- assert(d[0] == 3);
- assert(d[1] == 4);
- assert(d[2] == 5);
- assert(d[3] == 6);
- }
+ }
+ {
+ std::vector<int, safe_allocator<int>> d = {3, 4, 5, 6};
+ assert(d.size() == 4);
+ assert(is_contiguous_container_asan_correct(d));
+ assert(d[0] == 3);
+ assert(d[1] == 4);
+ assert(d[2] == 5);
+ assert(d[3] == 6);
+ }
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/initializer_list_alloc.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/initializer_list_alloc.pass.cpp
index 8396e846816209c..bfc9b5a03a617d4 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.cons/initializer_list_alloc.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.cons/initializer_list_alloc.pass.cpp
@@ -20,9 +20,8 @@
#include "min_allocator.h"
#include "asan_testing.h"
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- {
+TEST_CONSTEXPR_CXX20 bool tests() {
+ {
std::vector<int, test_allocator<int>> d({3, 4, 5, 6}, test_allocator<int>(3));
assert(d.get_allocator() == test_allocator<int>(3));
assert(d.size() == 4);
@@ -31,8 +30,8 @@ TEST_CONSTEXPR_CXX20 bool tests()
assert(d[1] == 4);
assert(d[2] == 5);
assert(d[3] == 6);
- }
- {
+ }
+ {
std::vector<int, min_allocator<int>> d({3, 4, 5, 6}, min_allocator<int>());
assert(d.get_allocator() == min_allocator<int>());
assert(d.size() == 4);
@@ -41,38 +40,37 @@ TEST_CONSTEXPR_CXX20 bool tests()
assert(d[1] == 4);
assert(d[2] == 5);
assert(d[3] == 6);
- }
- {
+ }
+ {
std::vector<int, min_allocator<int>> d({}, min_allocator<int>());
assert(d.size() == 0);
assert(d.empty());
assert(is_contiguous_container_asan_correct(d));
- }
- {
- std::vector<int, safe_allocator<int>> d({3, 4, 5, 6}, safe_allocator<int>());
- assert(d.get_allocator() == safe_allocator<int>());
- assert(d.size() == 4);
- assert(is_contiguous_container_asan_correct(d));
- assert(d[0] == 3);
- assert(d[1] == 4);
- assert(d[2] == 5);
- assert(d[3] == 6);
- }
- {
- std::vector<int, safe_allocator<int>> d({}, safe_allocator<int>());
- assert(d.size() == 0);
- assert(d.empty());
- assert(is_contiguous_container_asan_correct(d));
- }
+ }
+ {
+ std::vector<int, safe_allocator<int>> d({3, 4, 5, 6}, safe_allocator<int>());
+ assert(d.get_allocator() == safe_allocator<int>());
+ assert(d.size() == 4);
+ assert(is_contiguous_container_asan_correct(d));
+ assert(d[0] == 3);
+ assert(d[1] == 4);
+ assert(d[2] == 5);
+ assert(d[3] == 6);
+ }
+ {
+ std::vector<int, safe_allocator<int>> d({}, safe_allocator<int>());
+ assert(d.size() == 0);
+ assert(d.empty());
+ assert(is_contiguous_container_asan_correct(d));
+ }
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/move.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/move.pass.cpp
index c8b8701cc491b77..6e83696b45bac19 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.cons/move.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.cons/move.pass.cpp
@@ -21,153 +21,148 @@
#include "min_allocator.h"
#include "asan_testing.h"
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- test_allocator_statistics alloc_stats;
- {
- std::vector<MoveOnly, test_allocator<MoveOnly> > l(test_allocator<MoveOnly>(5, &alloc_stats));
- std::vector<MoveOnly, test_allocator<MoveOnly> > lo(test_allocator<MoveOnly>(5, &alloc_stats));
- assert(is_contiguous_container_asan_correct(l));
- assert(is_contiguous_container_asan_correct(lo));
- for (int i = 1; i <= 3; ++i)
- {
- l.push_back(i);
- lo.push_back(i);
- }
- assert(is_contiguous_container_asan_correct(l));
- assert(is_contiguous_container_asan_correct(lo));
- std::vector<MoveOnly, test_allocator<MoveOnly> > l2 = std::move(l);
- assert(l2 == lo);
- assert(l.empty());
- assert(l2.get_allocator() == lo.get_allocator());
- assert(is_contiguous_container_asan_correct(l2));
- }
- {
- std::vector<MoveOnly, other_allocator<MoveOnly> > l(other_allocator<MoveOnly>(5));
- std::vector<MoveOnly, other_allocator<MoveOnly> > lo(other_allocator<MoveOnly>(5));
- assert(is_contiguous_container_asan_correct(l));
- assert(is_contiguous_container_asan_correct(lo));
- for (int i = 1; i <= 3; ++i)
- {
- l.push_back(i);
- lo.push_back(i);
- }
- assert(is_contiguous_container_asan_correct(l));
- assert(is_contiguous_container_asan_correct(lo));
- std::vector<MoveOnly, other_allocator<MoveOnly> > l2 = std::move(l);
- assert(l2 == lo);
- assert(l.empty());
- assert(l2.get_allocator() == lo.get_allocator());
- assert(is_contiguous_container_asan_correct(l2));
- }
- {
- int a1[] = {1, 3, 7, 9, 10};
- std::vector<int> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
- assert(is_contiguous_container_asan_correct(c1));
- std::vector<int>::const_iterator i = c1.begin();
- std::vector<int> c2 = std::move(c1);
- assert(is_contiguous_container_asan_correct(c2));
- std::vector<int>::iterator j = c2.erase(i);
- assert(*j == 3);
- assert(is_contiguous_container_asan_correct(c2));
+TEST_CONSTEXPR_CXX20 bool tests() {
+ test_allocator_statistics alloc_stats;
+ {
+ std::vector<MoveOnly, test_allocator<MoveOnly> > l(test_allocator<MoveOnly>(5, &alloc_stats));
+ std::vector<MoveOnly, test_allocator<MoveOnly> > lo(test_allocator<MoveOnly>(5, &alloc_stats));
+ assert(is_contiguous_container_asan_correct(l));
+ assert(is_contiguous_container_asan_correct(lo));
+ for (int i = 1; i <= 3; ++i) {
+ l.push_back(i);
+ lo.push_back(i);
}
- {
- std::vector<MoveOnly, min_allocator<MoveOnly> > l((min_allocator<MoveOnly>()));
- std::vector<MoveOnly, min_allocator<MoveOnly> > lo((min_allocator<MoveOnly>()));
- assert(is_contiguous_container_asan_correct(l));
- assert(is_contiguous_container_asan_correct(lo));
- for (int i = 1; i <= 3; ++i)
- {
- l.push_back(i);
- lo.push_back(i);
- }
- assert(is_contiguous_container_asan_correct(l));
- assert(is_contiguous_container_asan_correct(lo));
- std::vector<MoveOnly, min_allocator<MoveOnly> > l2 = std::move(l);
- assert(l2 == lo);
- assert(l.empty());
- assert(l2.get_allocator() == lo.get_allocator());
- assert(is_contiguous_container_asan_correct(l2));
+ assert(is_contiguous_container_asan_correct(l));
+ assert(is_contiguous_container_asan_correct(lo));
+ std::vector<MoveOnly, test_allocator<MoveOnly> > l2 = std::move(l);
+ assert(l2 == lo);
+ assert(l.empty());
+ assert(l2.get_allocator() == lo.get_allocator());
+ assert(is_contiguous_container_asan_correct(l2));
+ }
+ {
+ std::vector<MoveOnly, other_allocator<MoveOnly> > l(other_allocator<MoveOnly>(5));
+ std::vector<MoveOnly, other_allocator<MoveOnly> > lo(other_allocator<MoveOnly>(5));
+ assert(is_contiguous_container_asan_correct(l));
+ assert(is_contiguous_container_asan_correct(lo));
+ for (int i = 1; i <= 3; ++i) {
+ l.push_back(i);
+ lo.push_back(i);
}
- {
- int a1[] = {1, 3, 7, 9, 10};
- std::vector<int, min_allocator<int> > c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
- assert(is_contiguous_container_asan_correct(c1));
- std::vector<int, min_allocator<int> >::const_iterator i = c1.begin();
- std::vector<int, min_allocator<int> > c2 = std::move(c1);
- assert(is_contiguous_container_asan_correct(c2));
- std::vector<int, min_allocator<int> >::iterator j = c2.erase(i);
- assert(*j == 3);
- assert(is_contiguous_container_asan_correct(c2));
+ assert(is_contiguous_container_asan_correct(l));
+ assert(is_contiguous_container_asan_correct(lo));
+ std::vector<MoveOnly, other_allocator<MoveOnly> > l2 = std::move(l);
+ assert(l2 == lo);
+ assert(l.empty());
+ assert(l2.get_allocator() == lo.get_allocator());
+ assert(is_contiguous_container_asan_correct(l2));
+ }
+ {
+ int a1[] = {1, 3, 7, 9, 10};
+ std::vector<int> c1(a1, a1 + sizeof(a1) / sizeof(a1[0]));
+ assert(is_contiguous_container_asan_correct(c1));
+ std::vector<int>::const_iterator i = c1.begin();
+ std::vector<int> c2 = std::move(c1);
+ assert(is_contiguous_container_asan_correct(c2));
+ std::vector<int>::iterator j = c2.erase(i);
+ assert(*j == 3);
+ assert(is_contiguous_container_asan_correct(c2));
+ }
+ {
+ std::vector<MoveOnly, min_allocator<MoveOnly> > l((min_allocator<MoveOnly>()));
+ std::vector<MoveOnly, min_allocator<MoveOnly> > lo((min_allocator<MoveOnly>()));
+ assert(is_contiguous_container_asan_correct(l));
+ assert(is_contiguous_container_asan_correct(lo));
+ for (int i = 1; i <= 3; ++i) {
+ l.push_back(i);
+ lo.push_back(i);
}
- {
- std::vector<MoveOnly, safe_allocator<MoveOnly> > l((safe_allocator<MoveOnly>()));
- std::vector<MoveOnly, safe_allocator<MoveOnly> > lo((safe_allocator<MoveOnly>()));
- assert(is_contiguous_container_asan_correct(l));
- assert(is_contiguous_container_asan_correct(lo));
- for (int i = 1; i <= 3; ++i) {
- l.push_back(i);
- lo.push_back(i);
- }
- assert(is_contiguous_container_asan_correct(l));
- assert(is_contiguous_container_asan_correct(lo));
- std::vector<MoveOnly, safe_allocator<MoveOnly> > l2 = std::move(l);
- assert(l2 == lo);
- assert(l.empty());
- assert(l2.get_allocator() == lo.get_allocator());
- assert(is_contiguous_container_asan_correct(l2));
+ assert(is_contiguous_container_asan_correct(l));
+ assert(is_contiguous_container_asan_correct(lo));
+ std::vector<MoveOnly, min_allocator<MoveOnly> > l2 = std::move(l);
+ assert(l2 == lo);
+ assert(l.empty());
+ assert(l2.get_allocator() == lo.get_allocator());
+ assert(is_contiguous_container_asan_correct(l2));
+ }
+ {
+ int a1[] = {1, 3, 7, 9, 10};
+ std::vector<int, min_allocator<int> > c1(a1, a1 + sizeof(a1) / sizeof(a1[0]));
+ assert(is_contiguous_container_asan_correct(c1));
+ std::vector<int, min_allocator<int> >::const_iterator i = c1.begin();
+ std::vector<int, min_allocator<int> > c2 = std::move(c1);
+ assert(is_contiguous_container_asan_correct(c2));
+ std::vector<int, min_allocator<int> >::iterator j = c2.erase(i);
+ assert(*j == 3);
+ assert(is_contiguous_container_asan_correct(c2));
+ }
+ {
+ std::vector<MoveOnly, safe_allocator<MoveOnly> > l((safe_allocator<MoveOnly>()));
+ std::vector<MoveOnly, safe_allocator<MoveOnly> > lo((safe_allocator<MoveOnly>()));
+ assert(is_contiguous_container_asan_correct(l));
+ assert(is_contiguous_container_asan_correct(lo));
+ for (int i = 1; i <= 3; ++i) {
+ l.push_back(i);
+ lo.push_back(i);
}
+ assert(is_contiguous_container_asan_correct(l));
+ assert(is_contiguous_container_asan_correct(lo));
+ std::vector<MoveOnly, safe_allocator<MoveOnly> > l2 = std::move(l);
+ assert(l2 == lo);
+ assert(l.empty());
+ assert(l2.get_allocator() == lo.get_allocator());
+ assert(is_contiguous_container_asan_correct(l2));
+ }
+ {
+ int a1[] = {1, 3, 7, 9, 10};
+ std::vector<int, safe_allocator<int> > c1(a1, a1 + sizeof(a1) / sizeof(a1[0]));
+ assert(is_contiguous_container_asan_correct(c1));
+ std::vector<int, safe_allocator<int> >::const_iterator i = c1.begin();
+ std::vector<int, safe_allocator<int> > c2 = std::move(c1);
+ assert(is_contiguous_container_asan_correct(c2));
+ std::vector<int, safe_allocator<int> >::iterator j = c2.erase(i);
+ assert(*j == 3);
+ assert(is_contiguous_container_asan_correct(c2));
+ }
+ {
+ alloc_stats.clear();
+ using Vect = std::vector<int, test_allocator<int> >;
+ Vect v(test_allocator<int>(42, 101, &alloc_stats));
+ assert(alloc_stats.count == 1);
+ assert(alloc_stats.copied == 1);
+ assert(alloc_stats.moved == 0);
{
- int a1[] = {1, 3, 7, 9, 10};
- std::vector<int, safe_allocator<int> > c1(a1, a1 + sizeof(a1) / sizeof(a1[0]));
- assert(is_contiguous_container_asan_correct(c1));
- std::vector<int, safe_allocator<int> >::const_iterator i = c1.begin();
- std::vector<int, safe_allocator<int> > c2 = std::move(c1);
- assert(is_contiguous_container_asan_correct(c2));
- std::vector<int, safe_allocator<int> >::iterator j = c2.erase(i);
- assert(*j == 3);
- assert(is_contiguous_container_asan_correct(c2));
+ const test_allocator<int>& a = v.get_allocator();
+ assert(a.get_data() == 42);
+ assert(a.get_id() == 101);
}
- {
- alloc_stats.clear();
- using Vect = std::vector<int, test_allocator<int> >;
- Vect v(test_allocator<int>(42, 101, &alloc_stats));
- assert(alloc_stats.count == 1);
- assert(alloc_stats.copied == 1);
- assert(alloc_stats.moved == 0);
- {
- const test_allocator<int>& a = v.get_allocator();
- assert(a.get_data() == 42);
- assert(a.get_id() == 101);
- }
- assert(alloc_stats.count == 1);
- alloc_stats.clear_ctor_counters();
+ assert(alloc_stats.count == 1);
+ alloc_stats.clear_ctor_counters();
- Vect v2 = std::move(v);
- assert(alloc_stats.count == 2);
- assert(alloc_stats.copied == 0);
- assert(alloc_stats.moved == 1);
- {
- const test_allocator<int>& a1 = v.get_allocator();
- assert(a1.get_id() == test_alloc_base::moved_value);
- assert(a1.get_data() == 42);
+ Vect v2 = std::move(v);
+ assert(alloc_stats.count == 2);
+ assert(alloc_stats.copied == 0);
+ assert(alloc_stats.moved == 1);
+ {
+ const test_allocator<int>& a1 = v.get_allocator();
+ assert(a1.get_id() == test_alloc_base::moved_value);
+ assert(a1.get_data() == 42);
- const test_allocator<int>& a2 = v2.get_allocator();
- assert(a2.get_id() == 101);
- assert(a2.get_data() == 42);
+ const test_allocator<int>& a2 = v2.get_allocator();
+ assert(a2.get_id() == 101);
+ assert(a2.get_data() == 42);
- assert(a1 == a2);
- }
+ assert(a1 == a2);
}
+ }
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/move_alloc.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/move_alloc.pass.cpp
index fd0b995b54d54e2..8066f122e41ac5f 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.cons/move_alloc.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.cons/move_alloc.pass.cpp
@@ -20,106 +20,100 @@
#include "min_allocator.h"
#include "asan_testing.h"
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- {
- std::vector<MoveOnly, test_allocator<MoveOnly> > l(test_allocator<MoveOnly>(5));
- std::vector<MoveOnly, test_allocator<MoveOnly> > lo(test_allocator<MoveOnly>(5));
- assert(is_contiguous_container_asan_correct(l));
- assert(is_contiguous_container_asan_correct(lo));
- for (int i = 1; i <= 3; ++i)
- {
- l.push_back(i);
- lo.push_back(i);
- }
- assert(is_contiguous_container_asan_correct(l));
- assert(is_contiguous_container_asan_correct(lo));
- std::vector<MoveOnly, test_allocator<MoveOnly> > l2(std::move(l), test_allocator<MoveOnly>(6));
- assert(l2 == lo);
- assert(!l.empty());
- assert(l2.get_allocator() == test_allocator<MoveOnly>(6));
- assert(is_contiguous_container_asan_correct(l2));
+TEST_CONSTEXPR_CXX20 bool tests() {
+ {
+ std::vector<MoveOnly, test_allocator<MoveOnly> > l(test_allocator<MoveOnly>(5));
+ std::vector<MoveOnly, test_allocator<MoveOnly> > lo(test_allocator<MoveOnly>(5));
+ assert(is_contiguous_container_asan_correct(l));
+ assert(is_contiguous_container_asan_correct(lo));
+ for (int i = 1; i <= 3; ++i) {
+ l.push_back(i);
+ lo.push_back(i);
}
- {
- std::vector<MoveOnly, test_allocator<MoveOnly> > l(test_allocator<MoveOnly>(5));
- std::vector<MoveOnly, test_allocator<MoveOnly> > lo(test_allocator<MoveOnly>(5));
- assert(is_contiguous_container_asan_correct(l));
- assert(is_contiguous_container_asan_correct(lo));
- for (int i = 1; i <= 3; ++i)
- {
- l.push_back(i);
- lo.push_back(i);
- }
- assert(is_contiguous_container_asan_correct(l));
- assert(is_contiguous_container_asan_correct(lo));
- std::vector<MoveOnly, test_allocator<MoveOnly> > l2(std::move(l), test_allocator<MoveOnly>(5));
- assert(l2 == lo);
- assert(l.empty());
- assert(l2.get_allocator() == test_allocator<MoveOnly>(5));
- assert(is_contiguous_container_asan_correct(l2));
+ assert(is_contiguous_container_asan_correct(l));
+ assert(is_contiguous_container_asan_correct(lo));
+ std::vector<MoveOnly, test_allocator<MoveOnly> > l2(std::move(l), test_allocator<MoveOnly>(6));
+ assert(l2 == lo);
+ assert(!l.empty());
+ assert(l2.get_allocator() == test_allocator<MoveOnly>(6));
+ assert(is_contiguous_container_asan_correct(l2));
+ }
+ {
+ std::vector<MoveOnly, test_allocator<MoveOnly> > l(test_allocator<MoveOnly>(5));
+ std::vector<MoveOnly, test_allocator<MoveOnly> > lo(test_allocator<MoveOnly>(5));
+ assert(is_contiguous_container_asan_correct(l));
+ assert(is_contiguous_container_asan_correct(lo));
+ for (int i = 1; i <= 3; ++i) {
+ l.push_back(i);
+ lo.push_back(i);
}
- {
- std::vector<MoveOnly, other_allocator<MoveOnly> > l(other_allocator<MoveOnly>(5));
- std::vector<MoveOnly, other_allocator<MoveOnly> > lo(other_allocator<MoveOnly>(5));
- assert(is_contiguous_container_asan_correct(l));
- assert(is_contiguous_container_asan_correct(lo));
- for (int i = 1; i <= 3; ++i)
- {
- l.push_back(i);
- lo.push_back(i);
- }
- assert(is_contiguous_container_asan_correct(l));
- assert(is_contiguous_container_asan_correct(lo));
- std::vector<MoveOnly, other_allocator<MoveOnly> > l2(std::move(l), other_allocator<MoveOnly>(4));
- assert(l2 == lo);
- assert(!l.empty());
- assert(l2.get_allocator() == other_allocator<MoveOnly>(4));
- assert(is_contiguous_container_asan_correct(l2));
+ assert(is_contiguous_container_asan_correct(l));
+ assert(is_contiguous_container_asan_correct(lo));
+ std::vector<MoveOnly, test_allocator<MoveOnly> > l2(std::move(l), test_allocator<MoveOnly>(5));
+ assert(l2 == lo);
+ assert(l.empty());
+ assert(l2.get_allocator() == test_allocator<MoveOnly>(5));
+ assert(is_contiguous_container_asan_correct(l2));
+ }
+ {
+ std::vector<MoveOnly, other_allocator<MoveOnly> > l(other_allocator<MoveOnly>(5));
+ std::vector<MoveOnly, other_allocator<MoveOnly> > lo(other_allocator<MoveOnly>(5));
+ assert(is_contiguous_container_asan_correct(l));
+ assert(is_contiguous_container_asan_correct(lo));
+ for (int i = 1; i <= 3; ++i) {
+ l.push_back(i);
+ lo.push_back(i);
}
- {
- std::vector<MoveOnly, min_allocator<MoveOnly> > l((min_allocator<MoveOnly>()));
- std::vector<MoveOnly, min_allocator<MoveOnly> > lo((min_allocator<MoveOnly>()));
- assert(is_contiguous_container_asan_correct(l));
- assert(is_contiguous_container_asan_correct(lo));
- for (int i = 1; i <= 3; ++i)
- {
- l.push_back(i);
- lo.push_back(i);
- }
- assert(is_contiguous_container_asan_correct(l));
- assert(is_contiguous_container_asan_correct(lo));
- std::vector<MoveOnly, min_allocator<MoveOnly> > l2(std::move(l), min_allocator<MoveOnly>());
- assert(l2 == lo);
- assert(l.empty());
- assert(l2.get_allocator() == min_allocator<MoveOnly>());
- assert(is_contiguous_container_asan_correct(l2));
+ assert(is_contiguous_container_asan_correct(l));
+ assert(is_contiguous_container_asan_correct(lo));
+ std::vector<MoveOnly, other_allocator<MoveOnly> > l2(std::move(l), other_allocator<MoveOnly>(4));
+ assert(l2 == lo);
+ assert(!l.empty());
+ assert(l2.get_allocator() == other_allocator<MoveOnly>(4));
+ assert(is_contiguous_container_asan_correct(l2));
+ }
+ {
+ std::vector<MoveOnly, min_allocator<MoveOnly> > l((min_allocator<MoveOnly>()));
+ std::vector<MoveOnly, min_allocator<MoveOnly> > lo((min_allocator<MoveOnly>()));
+ assert(is_contiguous_container_asan_correct(l));
+ assert(is_contiguous_container_asan_correct(lo));
+ for (int i = 1; i <= 3; ++i) {
+ l.push_back(i);
+ lo.push_back(i);
}
- {
- std::vector<MoveOnly, safe_allocator<MoveOnly> > l((safe_allocator<MoveOnly>()));
- std::vector<MoveOnly, safe_allocator<MoveOnly> > lo((safe_allocator<MoveOnly>()));
- assert(is_contiguous_container_asan_correct(l));
- assert(is_contiguous_container_asan_correct(lo));
- for (int i = 1; i <= 3; ++i) {
- l.push_back(i);
- lo.push_back(i);
- }
- assert(is_contiguous_container_asan_correct(l));
- assert(is_contiguous_container_asan_correct(lo));
- std::vector<MoveOnly, safe_allocator<MoveOnly> > l2(std::move(l), safe_allocator<MoveOnly>());
- assert(l2 == lo);
- assert(l.empty());
- assert(l2.get_allocator() == safe_allocator<MoveOnly>());
- assert(is_contiguous_container_asan_correct(l2));
+ assert(is_contiguous_container_asan_correct(l));
+ assert(is_contiguous_container_asan_correct(lo));
+ std::vector<MoveOnly, min_allocator<MoveOnly> > l2(std::move(l), min_allocator<MoveOnly>());
+ assert(l2 == lo);
+ assert(l.empty());
+ assert(l2.get_allocator() == min_allocator<MoveOnly>());
+ assert(is_contiguous_container_asan_correct(l2));
+ }
+ {
+ std::vector<MoveOnly, safe_allocator<MoveOnly> > l((safe_allocator<MoveOnly>()));
+ std::vector<MoveOnly, safe_allocator<MoveOnly> > lo((safe_allocator<MoveOnly>()));
+ assert(is_contiguous_container_asan_correct(l));
+ assert(is_contiguous_container_asan_correct(lo));
+ for (int i = 1; i <= 3; ++i) {
+ l.push_back(i);
+ lo.push_back(i);
}
+ assert(is_contiguous_container_asan_correct(l));
+ assert(is_contiguous_container_asan_correct(lo));
+ std::vector<MoveOnly, safe_allocator<MoveOnly> > l2(std::move(l), safe_allocator<MoveOnly>());
+ assert(l2 == lo);
+ assert(l.empty());
+ assert(l2.get_allocator() == safe_allocator<MoveOnly>());
+ assert(is_contiguous_container_asan_correct(l2));
+ }
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/move_assign_noexcept.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/move_assign_noexcept.pass.cpp
index f466809bf2dd032..1719cbeba37dbe0 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.cons/move_assign_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.cons/move_assign_noexcept.pass.cpp
@@ -25,76 +25,71 @@
#include "test_allocator.h"
template <class T>
-struct some_alloc
-{
- typedef T value_type;
- some_alloc(const some_alloc&);
- void allocate(std::size_t);
+struct some_alloc {
+ typedef T value_type;
+ some_alloc(const some_alloc&);
+ void allocate(std::size_t);
};
template <class T>
-struct some_alloc2
-{
- typedef T value_type;
+struct some_alloc2 {
+ typedef T value_type;
- some_alloc2() {}
- some_alloc2(const some_alloc2&);
- void allocate(std::size_t);
- void deallocate(void*, unsigned) {}
+ some_alloc2() {}
+ some_alloc2(const some_alloc2&);
+ void allocate(std::size_t);
+ void deallocate(void*, unsigned) {}
- typedef std::false_type propagate_on_container_move_assignment;
- typedef std::true_type is_always_equal;
+ typedef std::false_type propagate_on_container_move_assignment;
+ typedef std::true_type is_always_equal;
};
template <class T>
-struct some_alloc3
-{
- typedef T value_type;
+struct some_alloc3 {
+ typedef T value_type;
- some_alloc3() {}
- some_alloc3(const some_alloc3&);
- void allocate(std::size_t);
- void deallocate(void*, unsigned) {}
+ some_alloc3() {}
+ some_alloc3(const some_alloc3&);
+ void allocate(std::size_t);
+ void deallocate(void*, unsigned) {}
- typedef std::false_type propagate_on_container_move_assignment;
- typedef std::false_type is_always_equal;
+ typedef std::false_type propagate_on_container_move_assignment;
+ typedef std::false_type is_always_equal;
};
-
-int main(int, char**)
-{
- {
- typedef std::vector<MoveOnly> C;
- static_assert(std::is_nothrow_move_assignable<C>::value, "");
- }
- {
- typedef std::vector<MoveOnly, test_allocator<MoveOnly>> C;
- static_assert(!std::is_nothrow_move_assignable<C>::value, "");
- }
- {
- typedef std::vector<MoveOnly, other_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_move_assignable<C>::value, "");
- }
- {
- typedef std::vector<MoveOnly, some_alloc<MoveOnly>> C;
+int main(int, char**) {
+ {
+ typedef std::vector<MoveOnly> C;
+ static_assert(std::is_nothrow_move_assignable<C>::value, "");
+ }
+ {
+ typedef std::vector<MoveOnly, test_allocator<MoveOnly>> C;
+ static_assert(!std::is_nothrow_move_assignable<C>::value, "");
+ }
+ {
+ typedef std::vector<MoveOnly, other_allocator<MoveOnly>> C;
+ static_assert(std::is_nothrow_move_assignable<C>::value, "");
+ }
+ {
+ typedef std::vector<MoveOnly, some_alloc<MoveOnly>> C;
// In C++17, move assignment for allocators are not allowed to throw
#if TEST_STD_VER > 14
- static_assert( std::is_nothrow_move_assignable<C>::value, "");
+ static_assert(std::is_nothrow_move_assignable<C>::value, "");
#else
- static_assert(!std::is_nothrow_move_assignable<C>::value, "");
+ static_assert(!std::is_nothrow_move_assignable<C>::value, "");
#endif
- }
+ }
#if TEST_STD_VER > 14
- { // POCMA false, is_always_equal true
- typedef std::vector<MoveOnly, some_alloc2<MoveOnly>> C;
- static_assert( std::is_nothrow_move_assignable<C>::value, "");
- }
- { // POCMA false, is_always_equal false
- typedef std::vector<MoveOnly, some_alloc3<MoveOnly>> C;
- static_assert(!std::is_nothrow_move_assignable<C>::value, "");
- }
+ { // POCMA false, is_always_equal true
+ typedef std::vector<MoveOnly, some_alloc2<MoveOnly>> C;
+ static_assert(std::is_nothrow_move_assignable<C>::value, "");
+ }
+ { // POCMA false, is_always_equal false
+ typedef std::vector<MoveOnly, some_alloc3<MoveOnly>> C;
+ static_assert(!std::is_nothrow_move_assignable<C>::value, "");
+ }
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/move_noexcept.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/move_noexcept.pass.cpp
index c2bfa5234065d8d..13dc6d41684faa0 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.cons/move_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.cons/move_noexcept.pass.cpp
@@ -23,36 +23,34 @@
#include "test_allocator.h"
template <class T>
-struct some_alloc
-{
- typedef T value_type;
- some_alloc(const some_alloc&);
- void allocate(std::size_t);
+struct some_alloc {
+ typedef T value_type;
+ some_alloc(const some_alloc&);
+ void allocate(std::size_t);
};
-int main(int, char**)
-{
- {
- typedef std::vector<MoveOnly> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
- }
- {
- typedef std::vector<MoveOnly, test_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
- }
- {
- typedef std::vector<MoveOnly, other_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
- }
- {
- typedef std::vector<MoveOnly, some_alloc<MoveOnly>> C;
+int main(int, char**) {
+ {
+ typedef std::vector<MoveOnly> C;
+ static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ }
+ {
+ typedef std::vector<MoveOnly, test_allocator<MoveOnly>> C;
+ static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ }
+ {
+ typedef std::vector<MoveOnly, other_allocator<MoveOnly>> C;
+ static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ }
+ {
+ typedef std::vector<MoveOnly, some_alloc<MoveOnly>> C;
// In C++17, move constructors for allocators are not allowed to throw
#if TEST_STD_VER > 14
- static_assert( std::is_nothrow_move_constructible<C>::value, "");
+ static_assert(std::is_nothrow_move_constructible<C>::value, "");
#else
- static_assert(!std::is_nothrow_move_constructible<C>::value, "");
+ static_assert(!std::is_nothrow_move_constructible<C>::value, "");
#endif
- }
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/op_equal_initializer_list.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/op_equal_initializer_list.pass.cpp
index f3d7b6a21b62eaa..893f909cf8c6c50 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.cons/op_equal_initializer_list.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.cons/op_equal_initializer_list.pass.cpp
@@ -19,9 +19,8 @@
#include "min_allocator.h"
#include "asan_testing.h"
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- {
+TEST_CONSTEXPR_CXX20 bool tests() {
+ {
std::vector<int> d;
d = {3, 4, 5, 6};
assert(d.size() == 4);
@@ -30,8 +29,8 @@ TEST_CONSTEXPR_CXX20 bool tests()
assert(d[1] == 4);
assert(d[2] == 5);
assert(d[3] == 6);
- }
- {
+ }
+ {
std::vector<int, min_allocator<int>> d;
d = {3, 4, 5, 6};
assert(d.size() == 4);
@@ -40,16 +39,15 @@ TEST_CONSTEXPR_CXX20 bool tests()
assert(d[1] == 4);
assert(d[2] == 5);
assert(d[3] == 6);
- }
+ }
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector/vector.data/data.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.data/data.pass.cpp
index 64b85424e54a5b0..50c4f5df8333e94 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.data/data.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.data/data.pass.cpp
@@ -18,72 +18,73 @@
#include "asan_testing.h"
struct Nasty {
- TEST_CONSTEXPR Nasty() : i_(0) {}
- TEST_CONSTEXPR Nasty(int i) : i_(i) {}
- TEST_CONSTEXPR_CXX20 ~Nasty() {}
+ TEST_CONSTEXPR Nasty() : i_(0) {}
+ TEST_CONSTEXPR Nasty(int i) : i_(i) {}
+ TEST_CONSTEXPR_CXX20 ~Nasty() {}
- Nasty * operator&() const { assert(false); return nullptr; }
- int i_;
+ Nasty* operator&() const {
+ assert(false);
+ return nullptr;
+ }
+ int i_;
};
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- {
- std::vector<int> v;
- assert(v.data() == 0);
- assert(is_contiguous_container_asan_correct(v));
- }
- {
- std::vector<int> v(100);
- assert(v.data() == std::addressof(v.front()));
- assert(is_contiguous_container_asan_correct(v));
- }
- {
- std::vector<Nasty> v(100);
- assert(v.data() == std::addressof(v.front()));
- assert(is_contiguous_container_asan_correct(v));
- }
+TEST_CONSTEXPR_CXX20 bool tests() {
+ {
+ std::vector<int> v;
+ assert(v.data() == 0);
+ assert(is_contiguous_container_asan_correct(v));
+ }
+ {
+ std::vector<int> v(100);
+ assert(v.data() == std::addressof(v.front()));
+ assert(is_contiguous_container_asan_correct(v));
+ }
+ {
+ std::vector<Nasty> v(100);
+ assert(v.data() == std::addressof(v.front()));
+ assert(is_contiguous_container_asan_correct(v));
+ }
#if TEST_STD_VER >= 11
- {
- std::vector<int, min_allocator<int>> v;
- assert(v.data() == 0);
- assert(is_contiguous_container_asan_correct(v));
- }
- {
- std::vector<int, min_allocator<int>> v(100);
- assert(v.data() == std::addressof(v.front()));
- assert(is_contiguous_container_asan_correct(v));
- }
- {
- std::vector<Nasty, min_allocator<Nasty>> v(100);
- assert(v.data() == std::addressof(v.front()));
- assert(is_contiguous_container_asan_correct(v));
- }
- {
- std::vector<int, safe_allocator<int>> v;
- assert(v.data() == 0);
- assert(is_contiguous_container_asan_correct(v));
- }
- {
- std::vector<int, safe_allocator<int>> v(100);
- assert(v.data() == std::addressof(v.front()));
- assert(is_contiguous_container_asan_correct(v));
- }
- {
- std::vector<Nasty, safe_allocator<Nasty>> v(100);
- assert(v.data() == std::addressof(v.front()));
- assert(is_contiguous_container_asan_correct(v));
- }
+ {
+ std::vector<int, min_allocator<int>> v;
+ assert(v.data() == 0);
+ assert(is_contiguous_container_asan_correct(v));
+ }
+ {
+ std::vector<int, min_allocator<int>> v(100);
+ assert(v.data() == std::addressof(v.front()));
+ assert(is_contiguous_container_asan_correct(v));
+ }
+ {
+ std::vector<Nasty, min_allocator<Nasty>> v(100);
+ assert(v.data() == std::addressof(v.front()));
+ assert(is_contiguous_container_asan_correct(v));
+ }
+ {
+ std::vector<int, safe_allocator<int>> v;
+ assert(v.data() == 0);
+ assert(is_contiguous_container_asan_correct(v));
+ }
+ {
+ std::vector<int, safe_allocator<int>> v(100);
+ assert(v.data() == std::addressof(v.front()));
+ assert(is_contiguous_container_asan_correct(v));
+ }
+ {
+ std::vector<Nasty, safe_allocator<Nasty>> v(100);
+ assert(v.data() == std::addressof(v.front()));
+ assert(is_contiguous_container_asan_correct(v));
+ }
#endif
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector/vector.data/data_const.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.data/data_const.pass.cpp
index 0cf0b22047352e6..6b45fbcfaf0c5b9 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.data/data_const.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.data/data_const.pass.cpp
@@ -18,72 +18,73 @@
#include "asan_testing.h"
struct Nasty {
- TEST_CONSTEXPR Nasty() : i_(0) {}
- TEST_CONSTEXPR Nasty(int i) : i_(i) {}
- TEST_CONSTEXPR_CXX20 ~Nasty() {}
+ TEST_CONSTEXPR Nasty() : i_(0) {}
+ TEST_CONSTEXPR Nasty(int i) : i_(i) {}
+ TEST_CONSTEXPR_CXX20 ~Nasty() {}
- Nasty * operator&() const { assert(false); return nullptr; }
- int i_;
+ Nasty* operator&() const {
+ assert(false);
+ return nullptr;
+ }
+ int i_;
};
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- {
- const std::vector<int> v;
- assert(v.data() == 0);
- assert(is_contiguous_container_asan_correct(v));
- }
- {
- const std::vector<int> v(100);
- assert(v.data() == std::addressof(v.front()));
- assert(is_contiguous_container_asan_correct(v));
- }
- {
- const std::vector<Nasty> v(100);
- assert(v.data() == std::addressof(v.front()));
- assert(is_contiguous_container_asan_correct(v));
- }
+TEST_CONSTEXPR_CXX20 bool tests() {
+ {
+ const std::vector<int> v;
+ assert(v.data() == 0);
+ assert(is_contiguous_container_asan_correct(v));
+ }
+ {
+ const std::vector<int> v(100);
+ assert(v.data() == std::addressof(v.front()));
+ assert(is_contiguous_container_asan_correct(v));
+ }
+ {
+ const std::vector<Nasty> v(100);
+ assert(v.data() == std::addressof(v.front()));
+ assert(is_contiguous_container_asan_correct(v));
+ }
#if TEST_STD_VER >= 11
- {
- const std::vector<int, min_allocator<int>> v;
- assert(v.data() == 0);
- assert(is_contiguous_container_asan_correct(v));
- }
- {
- const std::vector<int, min_allocator<int>> v(100);
- assert(v.data() == &v.front());
- assert(is_contiguous_container_asan_correct(v));
- }
- {
- const std::vector<Nasty, min_allocator<Nasty>> v(100);
- assert(v.data() == std::addressof(v.front()));
- assert(is_contiguous_container_asan_correct(v));
- }
- {
- const std::vector<int, safe_allocator<int>> v;
- assert(v.data() == 0);
- assert(is_contiguous_container_asan_correct(v));
- }
- {
- const std::vector<int, safe_allocator<int>> v(100);
- assert(v.data() == &v.front());
- assert(is_contiguous_container_asan_correct(v));
- }
- {
- const std::vector<Nasty, safe_allocator<Nasty>> v(100);
- assert(v.data() == std::addressof(v.front()));
- assert(is_contiguous_container_asan_correct(v));
- }
+ {
+ const std::vector<int, min_allocator<int>> v;
+ assert(v.data() == 0);
+ assert(is_contiguous_container_asan_correct(v));
+ }
+ {
+ const std::vector<int, min_allocator<int>> v(100);
+ assert(v.data() == &v.front());
+ assert(is_contiguous_container_asan_correct(v));
+ }
+ {
+ const std::vector<Nasty, min_allocator<Nasty>> v(100);
+ assert(v.data() == std::addressof(v.front()));
+ assert(is_contiguous_container_asan_correct(v));
+ }
+ {
+ const std::vector<int, safe_allocator<int>> v;
+ assert(v.data() == 0);
+ assert(is_contiguous_container_asan_correct(v));
+ }
+ {
+ const std::vector<int, safe_allocator<int>> v(100);
+ assert(v.data() == &v.front());
+ assert(is_contiguous_container_asan_correct(v));
+ }
+ {
+ const std::vector<Nasty, safe_allocator<Nasty>> v(100);
+ assert(v.data() == std::addressof(v.front()));
+ assert(is_contiguous_container_asan_correct(v));
+ }
#endif
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector/vector.erasure/erase.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.erasure/erase.pass.cpp
index 88b27d9634c5494..175d56c1d09de4b 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.erasure/erase.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.erasure/erase.pass.cpp
@@ -28,8 +28,7 @@ TEST_CONSTEXPR_CXX20 void test0(S s, U val, S expected, std::size_t expected_era
}
template <class S>
-TEST_CONSTEXPR_CXX20 void test()
-{
+TEST_CONSTEXPR_CXX20 void test() {
test0(S(), 1, S(), 0);
test0(S({1}), 1, S(), 1);
@@ -63,21 +62,19 @@ TEST_CONSTEXPR_CXX20 void test()
test0(S({1, 2, 1}), opt(3), S({1, 2, 1}), 0);
}
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- test<std::vector<int>>();
- test<std::vector<int, min_allocator<int>>> ();
- test<std::vector<int, test_allocator<int>>> ();
- test<std::vector<int, safe_allocator<int>>>();
+TEST_CONSTEXPR_CXX20 bool tests() {
+ test<std::vector<int>>();
+ test<std::vector<int, min_allocator<int>>>();
+ test<std::vector<int, test_allocator<int>>>();
+ test<std::vector<int, safe_allocator<int>>>();
- test<std::vector<long>>();
- test<std::vector<double>>();
+ test<std::vector<long>>();
+ test<std::vector<double>>();
- return true;
+ return true;
}
-int main(int, char**)
-{
+int main(int, char**) {
tests();
#if TEST_STD_VER > 17
static_assert(tests());
diff --git a/libcxx/test/std/containers/sequences/vector/vector.erasure/erase_if.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.erasure/erase_if.pass.cpp
index 015824a94457105..189986fe3fd4dc4 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.erasure/erase_if.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.erasure/erase_if.pass.cpp
@@ -27,62 +27,59 @@ TEST_CONSTEXPR_CXX20 void test0(S s, Pred p, S expected, std::size_t expected_er
}
template <typename S>
-TEST_CONSTEXPR_CXX20 void test()
-{
- auto is1 = [](auto v) { return v == 1;};
- auto is2 = [](auto v) { return v == 2;};
- auto is3 = [](auto v) { return v == 3;};
- auto is4 = [](auto v) { return v == 4;};
- auto True = [](auto) { return true; };
- auto False = [](auto) { return false; };
-
- test0(S(), is1, S(), 0);
-
- test0(S({1}), is1, S(), 1);
- test0(S({1}), is2, S({1}), 0);
-
- test0(S({1, 2}), is1, S({2}), 1);
- test0(S({1, 2}), is2, S({1}), 1);
- test0(S({1, 2}), is3, S({1, 2}), 0);
- test0(S({1, 1}), is1, S(), 2);
- test0(S({1, 1}), is3, S({1, 1}), 0);
-
- test0(S({1, 2, 3}), is1, S({2, 3}), 1);
- test0(S({1, 2, 3}), is2, S({1, 3}), 1);
- test0(S({1, 2, 3}), is3, S({1, 2}), 1);
- test0(S({1, 2, 3}), is4, S({1, 2, 3}), 0);
-
- test0(S({1, 1, 1}), is1, S(), 3);
- test0(S({1, 1, 1}), is2, S({1, 1, 1}), 0);
- test0(S({1, 1, 2}), is1, S({2}), 2);
- test0(S({1, 1, 2}), is2, S({1, 1}), 1);
- test0(S({1, 1, 2}), is3, S({1, 1, 2}), 0);
- test0(S({1, 2, 2}), is1, S({2, 2}), 1);
- test0(S({1, 2, 2}), is2, S({1}), 2);
- test0(S({1, 2, 2}), is3, S({1, 2, 2}), 0);
-
- test0(S({1, 2, 3}), True, S(), 3);
- test0(S({1, 2, 3}), False, S({1, 2, 3}), 0);
+TEST_CONSTEXPR_CXX20 void test() {
+ auto is1 = [](auto v) { return v == 1; };
+ auto is2 = [](auto v) { return v == 2; };
+ auto is3 = [](auto v) { return v == 3; };
+ auto is4 = [](auto v) { return v == 4; };
+ auto True = [](auto) { return true; };
+ auto False = [](auto) { return false; };
+
+ test0(S(), is1, S(), 0);
+
+ test0(S({1}), is1, S(), 1);
+ test0(S({1}), is2, S({1}), 0);
+
+ test0(S({1, 2}), is1, S({2}), 1);
+ test0(S({1, 2}), is2, S({1}), 1);
+ test0(S({1, 2}), is3, S({1, 2}), 0);
+ test0(S({1, 1}), is1, S(), 2);
+ test0(S({1, 1}), is3, S({1, 1}), 0);
+
+ test0(S({1, 2, 3}), is1, S({2, 3}), 1);
+ test0(S({1, 2, 3}), is2, S({1, 3}), 1);
+ test0(S({1, 2, 3}), is3, S({1, 2}), 1);
+ test0(S({1, 2, 3}), is4, S({1, 2, 3}), 0);
+
+ test0(S({1, 1, 1}), is1, S(), 3);
+ test0(S({1, 1, 1}), is2, S({1, 1, 1}), 0);
+ test0(S({1, 1, 2}), is1, S({2}), 2);
+ test0(S({1, 1, 2}), is2, S({1, 1}), 1);
+ test0(S({1, 1, 2}), is3, S({1, 1, 2}), 0);
+ test0(S({1, 2, 2}), is1, S({2, 2}), 1);
+ test0(S({1, 2, 2}), is2, S({1}), 2);
+ test0(S({1, 2, 2}), is3, S({1, 2, 2}), 0);
+
+ test0(S({1, 2, 3}), True, S(), 3);
+ test0(S({1, 2, 3}), False, S({1, 2, 3}), 0);
}
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- test<std::vector<int>>();
- test<std::vector<int, min_allocator<int>>> ();
- test<std::vector<int, test_allocator<int>>> ();
- test<std::vector<int, safe_allocator<int>>>();
+TEST_CONSTEXPR_CXX20 bool tests() {
+ test<std::vector<int>>();
+ test<std::vector<int, min_allocator<int>>>();
+ test<std::vector<int, test_allocator<int>>>();
+ test<std::vector<int, safe_allocator<int>>>();
- test<std::vector<long>>();
- test<std::vector<double>>();
+ test<std::vector<long>>();
+ test<std::vector<double>>();
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector/vector.modifiers/append_range.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.modifiers/append_range.pass.cpp
index 69e6df6fcffa851..7a5031e4676f207 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.modifiers/append_range.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.modifiers/append_range.pass.cpp
@@ -34,9 +34,9 @@ constexpr bool test() {
});
test_sequence_append_range_move_only<std::vector>();
- { // Vector may or may not need to reallocate because of the insertion -- make sure to test both cases.
+ { // Vector may or may not need to reallocate because of the insertion -- make sure to test both cases.
{ // Ensure reallocation happens.
- int in[] = {-1, -2, -3, -4, -5, -6, -7, -8, -9, -10};
+ int in[] = {-1, -2, -3, -4, -5, -6, -7, -8, -9, -10};
std::vector<int> v = {1, 2, 3, 4, 5, 6, 7, 8};
v.shrink_to_fit();
assert(v.capacity() < v.size() + std::ranges::size(in));
@@ -46,7 +46,7 @@ constexpr bool test() {
}
{ // Ensure no reallocation happens.
- int in[] = {-1, -2, -3, -4, -5, -6, -7, -8, -9, -10};
+ int in[] = {-1, -2, -3, -4, -5, -6, -7, -8, -9, -10};
std::vector<int> v = {1, 2, 3, 4, 5, 6, 7, 8};
v.reserve(v.size() + std::ranges::size(in));
assert(v.capacity() >= v.size() + std::ranges::size(in));
diff --git a/libcxx/test/std/containers/sequences/vector/vector.modifiers/assign_range.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.modifiers/assign_range.pass.cpp
index 6326ffca969668d..132343f45561592 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.modifiers/assign_range.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.modifiers/assign_range.pass.cpp
@@ -35,9 +35,9 @@ constexpr bool test() {
});
test_sequence_assign_range_move_only<std::vector>();
- { // Vector may or may not need to reallocate because of the assignment -- make sure to test both cases.
+ { // Vector may or may not need to reallocate because of the assignment -- make sure to test both cases.
{ // Ensure reallocation happens.
- int in[] = {-1, -2, -3, -4, -5, -6, -7, -8, -9, -10};
+ int in[] = {-1, -2, -3, -4, -5, -6, -7, -8, -9, -10};
std::vector<int> v = {1, 2, 3, 4, 5, 6, 7, 8};
v.shrink_to_fit();
assert(v.capacity() < v.size() + std::ranges::size(in));
@@ -47,7 +47,7 @@ constexpr bool test() {
}
{ // Ensure no reallocation happens -- the input range is shorter than the vector.
- int in[] = {-1, -2, -3, -4, -5};
+ int in[] = {-1, -2, -3, -4, -5};
std::vector<int> v = {1, 2, 3, 4, 5, 6, 7, 8};
v.assign_range(in);
@@ -55,7 +55,7 @@ constexpr bool test() {
}
{ // Ensure no reallocation happens -- the input range is longer than the vector but within capacity.
- int in[] = {-1, -2, -3, -4, -5, -6, -7, -8};
+ int in[] = {-1, -2, -3, -4, -5, -6, -7, -8};
std::vector<int> v = {1, 2, 3, 4, 5};
v.reserve(std::ranges::size(in));
assert(v.capacity() >= std::ranges::size(in));
diff --git a/libcxx/test/std/containers/sequences/vector/vector.modifiers/clear.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.modifiers/clear.pass.cpp
index 9390b8309736f2f..3c8ed17cafbd47f 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.modifiers/clear.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.modifiers/clear.pass.cpp
@@ -17,46 +17,44 @@
#include "min_allocator.h"
#include "asan_testing.h"
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- {
+TEST_CONSTEXPR_CXX20 bool tests() {
+ {
int a[] = {1, 2, 3};
- std::vector<int> c(a, a+3);
+ std::vector<int> c(a, a + 3);
ASSERT_NOEXCEPT(c.clear());
c.clear();
assert(c.empty());
LIBCPP_ASSERT(c.__invariants());
LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
int a[] = {1, 2, 3};
- std::vector<int, min_allocator<int>> c(a, a+3);
+ std::vector<int, min_allocator<int>> c(a, a + 3);
ASSERT_NOEXCEPT(c.clear());
c.clear();
assert(c.empty());
LIBCPP_ASSERT(c.__invariants());
LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
- }
- {
- int a[] = {1, 2, 3};
- std::vector<int, safe_allocator<int>> c(a, a + 3);
- ASSERT_NOEXCEPT(c.clear());
- c.clear();
- assert(c.empty());
- LIBCPP_ASSERT(c.__invariants());
- LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
- }
+ }
+ {
+ int a[] = {1, 2, 3};
+ std::vector<int, safe_allocator<int>> c(a, a + 3);
+ ASSERT_NOEXCEPT(c.clear());
+ c.clear();
+ assert(c.empty());
+ LIBCPP_ASSERT(c.__invariants());
+ LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
+ }
#endif
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector/vector.modifiers/emplace.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.modifiers/emplace.pass.cpp
index 4f5e36abb6bb8d2..667ce483806e77b 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.modifiers/emplace.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.modifiers/emplace.pass.cpp
@@ -20,151 +20,144 @@
#include "min_allocator.h"
#include "asan_testing.h"
-class A
-{
- int i_;
- double d_;
+class A {
+ int i_;
+ double d_;
+
+ A(const A&);
+ A& operator=(const A&);
- A(const A&);
- A& operator=(const A&);
public:
- TEST_CONSTEXPR_CXX14 A(int i, double d)
- : i_(i), d_(d) {}
+ TEST_CONSTEXPR_CXX14 A(int i, double d) : i_(i), d_(d) {}
- TEST_CONSTEXPR_CXX14 A(A&& a)
- : i_(a.i_),
- d_(a.d_)
- {
- a.i_ = 0;
- a.d_ = 0;
- }
+ TEST_CONSTEXPR_CXX14 A(A&& a) : i_(a.i_), d_(a.d_) {
+ a.i_ = 0;
+ a.d_ = 0;
+ }
- TEST_CONSTEXPR_CXX14 A& operator=(A&& a)
- {
- i_ = a.i_;
- d_ = a.d_;
- a.i_ = 0;
- a.d_ = 0;
- return *this;
- }
+ TEST_CONSTEXPR_CXX14 A& operator=(A&& a) {
+ i_ = a.i_;
+ d_ = a.d_;
+ a.i_ = 0;
+ a.d_ = 0;
+ return *this;
+ }
- TEST_CONSTEXPR_CXX14 int geti() const {return i_;}
- TEST_CONSTEXPR_CXX14 double getd() const {return d_;}
+ TEST_CONSTEXPR_CXX14 int geti() const { return i_; }
+ TEST_CONSTEXPR_CXX14 double getd() const { return d_; }
};
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- {
- std::vector<A> c;
- std::vector<A>::iterator i = c.emplace(c.cbegin(), 2, 3.5);
- assert(i == c.begin());
- assert(c.size() == 1);
- assert(c.front().geti() == 2);
- assert(c.front().getd() == 3.5);
- assert(is_contiguous_container_asan_correct(c));
- i = c.emplace(c.cend(), 3, 4.5);
- assert(i == c.end()-1);
- assert(c.size() == 2);
- assert(c.front().geti() == 2);
- assert(c.front().getd() == 3.5);
- assert(c.back().geti() == 3);
- assert(c.back().getd() == 4.5);
- assert(is_contiguous_container_asan_correct(c));
- i = c.emplace(c.cbegin()+1, 4, 6.5);
- assert(i == c.begin()+1);
- assert(c.size() == 3);
- assert(c.front().geti() == 2);
- assert(c.front().getd() == 3.5);
- assert(c[1].geti() == 4);
- assert(c[1].getd() == 6.5);
- assert(c.back().geti() == 3);
- assert(c.back().getd() == 4.5);
- assert(is_contiguous_container_asan_correct(c));
- }
- {
- std::vector<A, limited_allocator<A, 7> > c;
- std::vector<A, limited_allocator<A, 7> >::iterator i = c.emplace(c.cbegin(), 2, 3.5);
- assert(i == c.begin());
- assert(c.size() == 1);
- assert(c.front().geti() == 2);
- assert(c.front().getd() == 3.5);
- assert(is_contiguous_container_asan_correct(c));
- i = c.emplace(c.cend(), 3, 4.5);
- assert(i == c.end()-1);
- assert(c.size() == 2);
- assert(c.front().geti() == 2);
- assert(c.front().getd() == 3.5);
- assert(c.back().geti() == 3);
- assert(c.back().getd() == 4.5);
- assert(is_contiguous_container_asan_correct(c));
- i = c.emplace(c.cbegin()+1, 4, 6.5);
- assert(i == c.begin()+1);
- assert(c.size() == 3);
- assert(c.front().geti() == 2);
- assert(c.front().getd() == 3.5);
- assert(c[1].geti() == 4);
- assert(c[1].getd() == 6.5);
- assert(c.back().geti() == 3);
- assert(c.back().getd() == 4.5);
- assert(is_contiguous_container_asan_correct(c));
- }
- {
- std::vector<A, min_allocator<A> > c;
- std::vector<A, min_allocator<A> >::iterator i = c.emplace(c.cbegin(), 2, 3.5);
- assert(i == c.begin());
- assert(c.size() == 1);
- assert(c.front().geti() == 2);
- assert(c.front().getd() == 3.5);
- i = c.emplace(c.cend(), 3, 4.5);
- assert(i == c.end()-1);
- assert(c.size() == 2);
- assert(c.front().geti() == 2);
- assert(c.front().getd() == 3.5);
- assert(c.back().geti() == 3);
- assert(c.back().getd() == 4.5);
- i = c.emplace(c.cbegin()+1, 4, 6.5);
- assert(i == c.begin()+1);
- assert(c.size() == 3);
- assert(c.front().geti() == 2);
- assert(c.front().getd() == 3.5);
- assert(c[1].geti() == 4);
- assert(c[1].getd() == 6.5);
- assert(c.back().geti() == 3);
- assert(c.back().getd() == 4.5);
- }
- {
- std::vector<A, safe_allocator<A> > c;
- std::vector<A, safe_allocator<A> >::iterator i = c.emplace(c.cbegin(), 2, 3.5);
- assert(i == c.begin());
- assert(c.size() == 1);
- assert(c.front().geti() == 2);
- assert(c.front().getd() == 3.5);
- i = c.emplace(c.cend(), 3, 4.5);
- assert(i == c.end() - 1);
- assert(c.size() == 2);
- assert(c.front().geti() == 2);
- assert(c.front().getd() == 3.5);
- assert(c.back().geti() == 3);
- assert(c.back().getd() == 4.5);
- i = c.emplace(c.cbegin() + 1, 4, 6.5);
- assert(i == c.begin() + 1);
- assert(c.size() == 3);
- assert(c.front().geti() == 2);
- assert(c.front().getd() == 3.5);
- assert(c[1].geti() == 4);
- assert(c[1].getd() == 6.5);
- assert(c.back().geti() == 3);
- assert(c.back().getd() == 4.5);
- }
+TEST_CONSTEXPR_CXX20 bool tests() {
+ {
+ std::vector<A> c;
+ std::vector<A>::iterator i = c.emplace(c.cbegin(), 2, 3.5);
+ assert(i == c.begin());
+ assert(c.size() == 1);
+ assert(c.front().geti() == 2);
+ assert(c.front().getd() == 3.5);
+ assert(is_contiguous_container_asan_correct(c));
+ i = c.emplace(c.cend(), 3, 4.5);
+ assert(i == c.end() - 1);
+ assert(c.size() == 2);
+ assert(c.front().geti() == 2);
+ assert(c.front().getd() == 3.5);
+ assert(c.back().geti() == 3);
+ assert(c.back().getd() == 4.5);
+ assert(is_contiguous_container_asan_correct(c));
+ i = c.emplace(c.cbegin() + 1, 4, 6.5);
+ assert(i == c.begin() + 1);
+ assert(c.size() == 3);
+ assert(c.front().geti() == 2);
+ assert(c.front().getd() == 3.5);
+ assert(c[1].geti() == 4);
+ assert(c[1].getd() == 6.5);
+ assert(c.back().geti() == 3);
+ assert(c.back().getd() == 4.5);
+ assert(is_contiguous_container_asan_correct(c));
+ }
+ {
+ std::vector<A, limited_allocator<A, 7> > c;
+ std::vector<A, limited_allocator<A, 7> >::iterator i = c.emplace(c.cbegin(), 2, 3.5);
+ assert(i == c.begin());
+ assert(c.size() == 1);
+ assert(c.front().geti() == 2);
+ assert(c.front().getd() == 3.5);
+ assert(is_contiguous_container_asan_correct(c));
+ i = c.emplace(c.cend(), 3, 4.5);
+ assert(i == c.end() - 1);
+ assert(c.size() == 2);
+ assert(c.front().geti() == 2);
+ assert(c.front().getd() == 3.5);
+ assert(c.back().geti() == 3);
+ assert(c.back().getd() == 4.5);
+ assert(is_contiguous_container_asan_correct(c));
+ i = c.emplace(c.cbegin() + 1, 4, 6.5);
+ assert(i == c.begin() + 1);
+ assert(c.size() == 3);
+ assert(c.front().geti() == 2);
+ assert(c.front().getd() == 3.5);
+ assert(c[1].geti() == 4);
+ assert(c[1].getd() == 6.5);
+ assert(c.back().geti() == 3);
+ assert(c.back().getd() == 4.5);
+ assert(is_contiguous_container_asan_correct(c));
+ }
+ {
+ std::vector<A, min_allocator<A> > c;
+ std::vector<A, min_allocator<A> >::iterator i = c.emplace(c.cbegin(), 2, 3.5);
+ assert(i == c.begin());
+ assert(c.size() == 1);
+ assert(c.front().geti() == 2);
+ assert(c.front().getd() == 3.5);
+ i = c.emplace(c.cend(), 3, 4.5);
+ assert(i == c.end() - 1);
+ assert(c.size() == 2);
+ assert(c.front().geti() == 2);
+ assert(c.front().getd() == 3.5);
+ assert(c.back().geti() == 3);
+ assert(c.back().getd() == 4.5);
+ i = c.emplace(c.cbegin() + 1, 4, 6.5);
+ assert(i == c.begin() + 1);
+ assert(c.size() == 3);
+ assert(c.front().geti() == 2);
+ assert(c.front().getd() == 3.5);
+ assert(c[1].geti() == 4);
+ assert(c[1].getd() == 6.5);
+ assert(c.back().geti() == 3);
+ assert(c.back().getd() == 4.5);
+ }
+ {
+ std::vector<A, safe_allocator<A> > c;
+ std::vector<A, safe_allocator<A> >::iterator i = c.emplace(c.cbegin(), 2, 3.5);
+ assert(i == c.begin());
+ assert(c.size() == 1);
+ assert(c.front().geti() == 2);
+ assert(c.front().getd() == 3.5);
+ i = c.emplace(c.cend(), 3, 4.5);
+ assert(i == c.end() - 1);
+ assert(c.size() == 2);
+ assert(c.front().geti() == 2);
+ assert(c.front().getd() == 3.5);
+ assert(c.back().geti() == 3);
+ assert(c.back().getd() == 4.5);
+ i = c.emplace(c.cbegin() + 1, 4, 6.5);
+ assert(i == c.begin() + 1);
+ assert(c.size() == 3);
+ assert(c.front().geti() == 2);
+ assert(c.front().getd() == 3.5);
+ assert(c[1].geti() == 4);
+ assert(c[1].getd() == 6.5);
+ assert(c.back().geti() == 3);
+ assert(c.back().getd() == 4.5);
+ }
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector/vector.modifiers/emplace_back.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.modifiers/emplace_back.pass.cpp
index 730ed32bd7334ca..43216a1512fd600 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.modifiers/emplace_back.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.modifiers/emplace_back.pass.cpp
@@ -21,177 +21,169 @@
#include "test_allocator.h"
#include "asan_testing.h"
-class A
-{
- int i_;
- double d_;
+class A {
+ int i_;
+ double d_;
public:
- A(const A&) = delete;
- A& operator=(const A&) = delete;
+ A(const A&) = delete;
+ A& operator=(const A&) = delete;
- TEST_CONSTEXPR_CXX14 A(int i, double d)
- : i_(i), d_(d) {}
+ TEST_CONSTEXPR_CXX14 A(int i, double d) : i_(i), d_(d) {}
- TEST_CONSTEXPR_CXX14 A(A&& a)
- : i_(a.i_),
- d_(a.d_)
- {
- a.i_ = 0;
- a.d_ = 0;
- }
+ TEST_CONSTEXPR_CXX14 A(A&& a) : i_(a.i_), d_(a.d_) {
+ a.i_ = 0;
+ a.d_ = 0;
+ }
- TEST_CONSTEXPR_CXX14 A& operator=(A&& a)
- {
- i_ = a.i_;
- d_ = a.d_;
- a.i_ = 0;
- a.d_ = 0;
- return *this;
- }
+ TEST_CONSTEXPR_CXX14 A& operator=(A&& a) {
+ i_ = a.i_;
+ d_ = a.d_;
+ a.i_ = 0;
+ a.d_ = 0;
+ return *this;
+ }
- TEST_CONSTEXPR_CXX14 int geti() const {return i_;}
- TEST_CONSTEXPR_CXX14 double getd() const {return d_;}
+ TEST_CONSTEXPR_CXX14 int geti() const { return i_; }
+ TEST_CONSTEXPR_CXX14 double getd() const { return d_; }
};
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- {
- std::vector<A> c;
+TEST_CONSTEXPR_CXX20 bool tests() {
+ {
+ std::vector<A> c;
#if TEST_STD_VER > 14
- A& r1 = c.emplace_back(2, 3.5);
- assert(c.size() == 1);
- assert(&r1 == &c.back());
- assert(c.front().geti() == 2);
- assert(c.front().getd() == 3.5);
- assert(is_contiguous_container_asan_correct(c));
- A& r2 = c.emplace_back(3, 4.5);
- assert(c.size() == 2);
- assert(&r2 == &c.back());
+ A& r1 = c.emplace_back(2, 3.5);
+ assert(c.size() == 1);
+ assert(&r1 == &c.back());
+ assert(c.front().geti() == 2);
+ assert(c.front().getd() == 3.5);
+ assert(is_contiguous_container_asan_correct(c));
+ A& r2 = c.emplace_back(3, 4.5);
+ assert(c.size() == 2);
+ assert(&r2 == &c.back());
#else
- c.emplace_back(2, 3.5);
- assert(c.size() == 1);
- assert(c.front().geti() == 2);
- assert(c.front().getd() == 3.5);
- assert(is_contiguous_container_asan_correct(c));
- c.emplace_back(3, 4.5);
- assert(c.size() == 2);
+ c.emplace_back(2, 3.5);
+ assert(c.size() == 1);
+ assert(c.front().geti() == 2);
+ assert(c.front().getd() == 3.5);
+ assert(is_contiguous_container_asan_correct(c));
+ c.emplace_back(3, 4.5);
+ assert(c.size() == 2);
#endif
- assert(c.front().geti() == 2);
- assert(c.front().getd() == 3.5);
- assert(c.back().geti() == 3);
- assert(c.back().getd() == 4.5);
- assert(is_contiguous_container_asan_correct(c));
- }
- {
- std::vector<A, limited_allocator<A, 4> > c;
+ assert(c.front().geti() == 2);
+ assert(c.front().getd() == 3.5);
+ assert(c.back().geti() == 3);
+ assert(c.back().getd() == 4.5);
+ assert(is_contiguous_container_asan_correct(c));
+ }
+ {
+ std::vector<A, limited_allocator<A, 4> > c;
#if TEST_STD_VER > 14
- A& r1 = c.emplace_back(2, 3.5);
- assert(c.size() == 1);
- assert(&r1 == &c.back());
- assert(c.front().geti() == 2);
- assert(c.front().getd() == 3.5);
- assert(is_contiguous_container_asan_correct(c));
- A& r2 = c.emplace_back(3, 4.5);
- assert(c.size() == 2);
- assert(&r2 == &c.back());
+ A& r1 = c.emplace_back(2, 3.5);
+ assert(c.size() == 1);
+ assert(&r1 == &c.back());
+ assert(c.front().geti() == 2);
+ assert(c.front().getd() == 3.5);
+ assert(is_contiguous_container_asan_correct(c));
+ A& r2 = c.emplace_back(3, 4.5);
+ assert(c.size() == 2);
+ assert(&r2 == &c.back());
#else
- c.emplace_back(2, 3.5);
- assert(c.size() == 1);
- assert(c.front().geti() == 2);
- assert(c.front().getd() == 3.5);
- assert(is_contiguous_container_asan_correct(c));
- c.emplace_back(3, 4.5);
- assert(c.size() == 2);
+ c.emplace_back(2, 3.5);
+ assert(c.size() == 1);
+ assert(c.front().geti() == 2);
+ assert(c.front().getd() == 3.5);
+ assert(is_contiguous_container_asan_correct(c));
+ c.emplace_back(3, 4.5);
+ assert(c.size() == 2);
#endif
- assert(c.front().geti() == 2);
- assert(c.front().getd() == 3.5);
- assert(c.back().geti() == 3);
- assert(c.back().getd() == 4.5);
- assert(is_contiguous_container_asan_correct(c));
- }
- {
- std::vector<A, min_allocator<A> > c;
+ assert(c.front().geti() == 2);
+ assert(c.front().getd() == 3.5);
+ assert(c.back().geti() == 3);
+ assert(c.back().getd() == 4.5);
+ assert(is_contiguous_container_asan_correct(c));
+ }
+ {
+ std::vector<A, min_allocator<A> > c;
#if TEST_STD_VER > 14
- A& r1 = c.emplace_back(2, 3.5);
- assert(c.size() == 1);
- assert(&r1 == &c.back());
- assert(c.front().geti() == 2);
- assert(c.front().getd() == 3.5);
- assert(is_contiguous_container_asan_correct(c));
- A& r2 = c.emplace_back(3, 4.5);
- assert(c.size() == 2);
- assert(&r2 == &c.back());
+ A& r1 = c.emplace_back(2, 3.5);
+ assert(c.size() == 1);
+ assert(&r1 == &c.back());
+ assert(c.front().geti() == 2);
+ assert(c.front().getd() == 3.5);
+ assert(is_contiguous_container_asan_correct(c));
+ A& r2 = c.emplace_back(3, 4.5);
+ assert(c.size() == 2);
+ assert(&r2 == &c.back());
#else
- c.emplace_back(2, 3.5);
- assert(c.size() == 1);
- assert(c.front().geti() == 2);
- assert(c.front().getd() == 3.5);
- assert(is_contiguous_container_asan_correct(c));
- c.emplace_back(3, 4.5);
- assert(c.size() == 2);
+ c.emplace_back(2, 3.5);
+ assert(c.size() == 1);
+ assert(c.front().geti() == 2);
+ assert(c.front().getd() == 3.5);
+ assert(is_contiguous_container_asan_correct(c));
+ c.emplace_back(3, 4.5);
+ assert(c.size() == 2);
#endif
- assert(c.front().geti() == 2);
- assert(c.front().getd() == 3.5);
- assert(c.back().geti() == 3);
- assert(c.back().getd() == 4.5);
- assert(is_contiguous_container_asan_correct(c));
- }
- {
- std::vector<A, safe_allocator<A> > c;
+ assert(c.front().geti() == 2);
+ assert(c.front().getd() == 3.5);
+ assert(c.back().geti() == 3);
+ assert(c.back().getd() == 4.5);
+ assert(is_contiguous_container_asan_correct(c));
+ }
+ {
+ std::vector<A, safe_allocator<A> > c;
#if TEST_STD_VER > 14
- A& r1 = c.emplace_back(2, 3.5);
- assert(c.size() == 1);
- assert(&r1 == &c.back());
- assert(c.front().geti() == 2);
- assert(c.front().getd() == 3.5);
- assert(is_contiguous_container_asan_correct(c));
- A& r2 = c.emplace_back(3, 4.5);
- assert(c.size() == 2);
- assert(&r2 == &c.back());
+ A& r1 = c.emplace_back(2, 3.5);
+ assert(c.size() == 1);
+ assert(&r1 == &c.back());
+ assert(c.front().geti() == 2);
+ assert(c.front().getd() == 3.5);
+ assert(is_contiguous_container_asan_correct(c));
+ A& r2 = c.emplace_back(3, 4.5);
+ assert(c.size() == 2);
+ assert(&r2 == &c.back());
#else
- c.emplace_back(2, 3.5);
- assert(c.size() == 1);
- assert(c.front().geti() == 2);
- assert(c.front().getd() == 3.5);
- assert(is_contiguous_container_asan_correct(c));
- c.emplace_back(3, 4.5);
- assert(c.size() == 2);
+ c.emplace_back(2, 3.5);
+ assert(c.size() == 1);
+ assert(c.front().geti() == 2);
+ assert(c.front().getd() == 3.5);
+ assert(is_contiguous_container_asan_correct(c));
+ c.emplace_back(3, 4.5);
+ assert(c.size() == 2);
#endif
- assert(c.front().geti() == 2);
- assert(c.front().getd() == 3.5);
- assert(c.back().geti() == 3);
- assert(c.back().getd() == 4.5);
- assert(is_contiguous_container_asan_correct(c));
- }
- {
- std::vector<Tag_X, TaggingAllocator<Tag_X> > c;
- c.emplace_back();
- assert(c.size() == 1);
- c.emplace_back(1, 2, 3);
- assert(c.size() == 2);
- assert(is_contiguous_container_asan_correct(c));
- }
+ assert(c.front().geti() == 2);
+ assert(c.front().getd() == 3.5);
+ assert(c.back().geti() == 3);
+ assert(c.back().getd() == 4.5);
+ assert(is_contiguous_container_asan_correct(c));
+ }
+ {
+ std::vector<Tag_X, TaggingAllocator<Tag_X> > c;
+ c.emplace_back();
+ assert(c.size() == 1);
+ c.emplace_back(1, 2, 3);
+ assert(c.size() == 2);
+ assert(is_contiguous_container_asan_correct(c));
+ }
- { // LWG 2164
- int arr[] = {0, 1, 2, 3, 4};
- int sz = 5;
- std::vector<int> c(arr, arr+sz);
- while (c.size() < c.capacity())
- c.push_back(sz++);
- c.emplace_back(c.front());
- assert(c.back() == 0);
- for (int i = 0; i < sz; ++i)
- assert(c[i] == i);
- }
- return true;
+ { // LWG 2164
+ int arr[] = {0, 1, 2, 3, 4};
+ int sz = 5;
+ std::vector<int> c(arr, arr + sz);
+ while (c.size() < c.capacity())
+ c.push_back(sz++);
+ c.emplace_back(c.front());
+ assert(c.back() == 0);
+ for (int i = 0; i < sz; ++i)
+ assert(c[i] == i);
+ }
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector/vector.modifiers/emplace_extra.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.modifiers/emplace_extra.pass.cpp
index f186a0d97ae39b7..43990b148cad602 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.modifiers/emplace_extra.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.modifiers/emplace_extra.pass.cpp
@@ -20,82 +20,82 @@
#include "asan_testing.h"
TEST_CONSTEXPR_CXX20 bool tests() {
- {
- std::vector<int> v;
- v.reserve(3);
- assert(is_contiguous_container_asan_correct(v));
- v = { 1, 2, 3 };
- v.emplace(v.begin(), v.back());
- assert(v[0] == 3);
- assert(is_contiguous_container_asan_correct(v));
- }
- {
- std::vector<int> v;
- v.reserve(4);
- assert(is_contiguous_container_asan_correct(v));
- v = { 1, 2, 3 };
- v.emplace(v.begin(), v.back());
- assert(v[0] == 3);
- assert(is_contiguous_container_asan_correct(v));
- }
- {
- std::vector<int, min_allocator<int>> v;
- v.reserve(3);
- assert(is_contiguous_container_asan_correct(v));
- v = { 1, 2, 3 };
- v.emplace(v.begin(), v.back());
- assert(v[0] == 3);
- assert(is_contiguous_container_asan_correct(v));
- }
- {
- std::vector<int, min_allocator<int>> v;
- v.reserve(4);
- assert(is_contiguous_container_asan_correct(v));
- v = { 1, 2, 3 };
- v.emplace(v.begin(), v.back());
- assert(v[0] == 3);
- assert(is_contiguous_container_asan_correct(v));
- }
- {
- std::vector<int, safe_allocator<int>> v;
- v.reserve(3);
- assert(is_contiguous_container_asan_correct(v));
- v = {1, 2, 3};
- v.emplace(v.begin(), v.back());
- assert(v[0] == 3);
- assert(is_contiguous_container_asan_correct(v));
- }
- {
- std::vector<int, safe_allocator<int>> v;
- v.reserve(4);
- assert(is_contiguous_container_asan_correct(v));
- v = {1, 2, 3};
- v.emplace(v.begin(), v.back());
- assert(v[0] == 3);
- assert(is_contiguous_container_asan_correct(v));
- }
- {
- std::vector<int> v;
- v.reserve(8);
- std::size_t old_capacity = v.capacity();
- assert(old_capacity >= 8);
+ {
+ std::vector<int> v;
+ v.reserve(3);
+ assert(is_contiguous_container_asan_correct(v));
+ v = {1, 2, 3};
+ v.emplace(v.begin(), v.back());
+ assert(v[0] == 3);
+ assert(is_contiguous_container_asan_correct(v));
+ }
+ {
+ std::vector<int> v;
+ v.reserve(4);
+ assert(is_contiguous_container_asan_correct(v));
+ v = {1, 2, 3};
+ v.emplace(v.begin(), v.back());
+ assert(v[0] == 3);
+ assert(is_contiguous_container_asan_correct(v));
+ }
+ {
+ std::vector<int, min_allocator<int>> v;
+ v.reserve(3);
+ assert(is_contiguous_container_asan_correct(v));
+ v = {1, 2, 3};
+ v.emplace(v.begin(), v.back());
+ assert(v[0] == 3);
+ assert(is_contiguous_container_asan_correct(v));
+ }
+ {
+ std::vector<int, min_allocator<int>> v;
+ v.reserve(4);
+ assert(is_contiguous_container_asan_correct(v));
+ v = {1, 2, 3};
+ v.emplace(v.begin(), v.back());
+ assert(v[0] == 3);
+ assert(is_contiguous_container_asan_correct(v));
+ }
+ {
+ std::vector<int, safe_allocator<int>> v;
+ v.reserve(3);
+ assert(is_contiguous_container_asan_correct(v));
+ v = {1, 2, 3};
+ v.emplace(v.begin(), v.back());
+ assert(v[0] == 3);
+ assert(is_contiguous_container_asan_correct(v));
+ }
+ {
+ std::vector<int, safe_allocator<int>> v;
+ v.reserve(4);
+ assert(is_contiguous_container_asan_correct(v));
+ v = {1, 2, 3};
+ v.emplace(v.begin(), v.back());
+ assert(v[0] == 3);
+ assert(is_contiguous_container_asan_correct(v));
+ }
+ {
+ std::vector<int> v;
+ v.reserve(8);
+ std::size_t old_capacity = v.capacity();
+ assert(old_capacity >= 8);
- v.resize(4); // keep the existing capacity
- assert(v.capacity() == old_capacity);
+ v.resize(4); // keep the existing capacity
+ assert(v.capacity() == old_capacity);
- v.emplace(v.cend(), 42);
- assert(v.size() == 5);
- assert(v.capacity() == old_capacity);
- assert(v[4] == 42);
- }
+ v.emplace(v.cend(), 42);
+ assert(v.size() == 5);
+ assert(v.capacity() == old_capacity);
+ assert(v[4] == 42);
+ }
- return true;
+ return true;
}
int main(int, char**) {
- tests();
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector/vector.modifiers/erase_iter.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.modifiers/erase_iter.pass.cpp
index f0157eb74b90f33..0c65bd1034bb812 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.modifiers/erase_iter.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.modifiers/erase_iter.pass.cpp
@@ -23,9 +23,9 @@
template <template <class> class Allocator, class T>
TEST_CONSTEXPR_CXX20 void tests() {
{
- T arr[] = {T(1), T(2), T(3), T(4), T(5)};
- using Vector = std::vector<T, Allocator<T> >;
- using Iterator = typename Vector::iterator;
+ T arr[] = {T(1), T(2), T(3), T(4), T(5)};
+ using Vector = std::vector<T, Allocator<T> >;
+ using Iterator = typename Vector::iterator;
{
Vector v(arr, arr + 5);
diff --git a/libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_initializer_list.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_initializer_list.pass.cpp
index 92584892001a6e7..12d189896df8dda 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_initializer_list.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_initializer_list.pass.cpp
@@ -54,8 +54,7 @@ void test_throwing() {
}
#endif // TEST_HAS_NO_EXCEPTIONS
-TEST_CONSTEXPR_CXX20 bool tests()
-{
+TEST_CONSTEXPR_CXX20 bool tests() {
{
std::vector<int> d(10, 1);
std::vector<int>::iterator i = d.insert(d.cbegin() + 2, {3, 4, 5, 6});
@@ -99,7 +98,7 @@ TEST_CONSTEXPR_CXX20 bool tests()
assert(d[13] == 1);
}
- return true;
+ return true;
}
int main(int, char**) {
diff --git a/libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_lvalue.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_lvalue.pass.cpp
index b5582df5bd2c4b7..93a3ce3918615d8 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_lvalue.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_lvalue.pass.cpp
@@ -20,124 +20,125 @@
#include "asan_testing.h"
TEST_CONSTEXPR_CXX20 bool test() {
+ {
+ std::vector<int> v(100);
+ const int lvalue = 1;
+ std::vector<int>::iterator i = v.insert(v.cbegin() + 10, lvalue);
+ assert(v.size() == 101);
+ assert(is_contiguous_container_asan_correct(v));
+ assert(i == v.begin() + 10);
+ int j;
+ for (j = 0; j < 10; ++j)
+ assert(v[j] == 0);
+ assert(v[j] == 1);
+ for (++j; j < 101; ++j)
+ assert(v[j] == 0);
+ }
+ {
+ const std::size_t n = 100;
+ std::vector<int> v(n);
+ v.reserve(n + 1);
+ const int lvalue = 1;
- {
- std::vector<int> v(100);
- const int lvalue = 1;
- std::vector<int>::iterator i = v.insert(v.cbegin() + 10, lvalue);
- assert(v.size() == 101);
- assert(is_contiguous_container_asan_correct(v));
- assert(i == v.begin() + 10);
- int j;
- for (j = 0; j < 10; ++j)
- assert(v[j] == 0);
- assert(v[j] == 1);
- for (++j; j < 101; ++j)
- assert(v[j] == 0);
- }
- {
- const std::size_t n = 100;
- std::vector<int> v(n);
- v.reserve(n + 1);
- const int lvalue = 1;
-
- // no reallocation expected
- std::vector<int>::iterator it = v.insert(v.cbegin() + n, lvalue);
+ // no reallocation expected
+ std::vector<int>::iterator it = v.insert(v.cbegin() + n, lvalue);
- assert(v.size() == n + 1);
- assert(is_contiguous_container_asan_correct(v));
- assert(it == v.begin() + n);
- for (std::size_t i = 0; i < n; ++i) {
- assert(v[i] == 0);
- }
- assert(v[n] == lvalue);
- }
- {
- std::vector<int> v(100);
- while(v.size() < v.capacity()) v.push_back(0); // force reallocation
- std::size_t sz = v.size();
- const int lvalue = 1;
- std::vector<int>::iterator i = v.insert(v.cbegin() + 10, lvalue);
- assert(v.size() == sz + 1);
- assert(is_contiguous_container_asan_correct(v));
- assert(i == v.begin() + 10);
- std::size_t j;
- for (j = 0; j < 10; ++j)
- assert(v[j] == 0);
- assert(v[j] == 1);
- for (++j; j < v.size(); ++j)
- assert(v[j] == 0);
- }
- {
- std::vector<int> v(100);
- while(v.size() < v.capacity()) v.push_back(0);
- v.pop_back(); v.pop_back(); // force no reallocation
- std::size_t sz = v.size();
- const int lvalue = 1;
- std::vector<int>::iterator i = v.insert(v.cbegin() + 10, lvalue);
- assert(v.size() == sz + 1);
- assert(is_contiguous_container_asan_correct(v));
- assert(i == v.begin() + 10);
- std::size_t j;
- for (j = 0; j < 10; ++j)
- assert(v[j] == 0);
- assert(v[j] == 1);
- for (++j; j < v.size(); ++j)
- assert(v[j] == 0);
- }
- {
- std::vector<int, limited_allocator<int, 300> > v(100);
- const int lvalue = 1;
- std::vector<int, limited_allocator<int, 300> >::iterator i = v.insert(v.cbegin() + 10, lvalue);
- assert(v.size() == 101);
- assert(is_contiguous_container_asan_correct(v));
- assert(i == v.begin() + 10);
- int j;
- for (j = 0; j < 10; ++j)
- assert(v[j] == 0);
- assert(v[j] == 1);
- for (++j; j < 101; ++j)
- assert(v[j] == 0);
+ assert(v.size() == n + 1);
+ assert(is_contiguous_container_asan_correct(v));
+ assert(it == v.begin() + n);
+ for (std::size_t i = 0; i < n; ++i) {
+ assert(v[i] == 0);
}
+ assert(v[n] == lvalue);
+ }
+ {
+ std::vector<int> v(100);
+ while (v.size() < v.capacity())
+ v.push_back(0); // force reallocation
+ std::size_t sz = v.size();
+ const int lvalue = 1;
+ std::vector<int>::iterator i = v.insert(v.cbegin() + 10, lvalue);
+ assert(v.size() == sz + 1);
+ assert(is_contiguous_container_asan_correct(v));
+ assert(i == v.begin() + 10);
+ std::size_t j;
+ for (j = 0; j < 10; ++j)
+ assert(v[j] == 0);
+ assert(v[j] == 1);
+ for (++j; j < v.size(); ++j)
+ assert(v[j] == 0);
+ }
+ {
+ std::vector<int> v(100);
+ while (v.size() < v.capacity())
+ v.push_back(0);
+ v.pop_back();
+ v.pop_back(); // force no reallocation
+ std::size_t sz = v.size();
+ const int lvalue = 1;
+ std::vector<int>::iterator i = v.insert(v.cbegin() + 10, lvalue);
+ assert(v.size() == sz + 1);
+ assert(is_contiguous_container_asan_correct(v));
+ assert(i == v.begin() + 10);
+ std::size_t j;
+ for (j = 0; j < 10; ++j)
+ assert(v[j] == 0);
+ assert(v[j] == 1);
+ for (++j; j < v.size(); ++j)
+ assert(v[j] == 0);
+ }
+ {
+ std::vector<int, limited_allocator<int, 300> > v(100);
+ const int lvalue = 1;
+ std::vector<int, limited_allocator<int, 300> >::iterator i = v.insert(v.cbegin() + 10, lvalue);
+ assert(v.size() == 101);
+ assert(is_contiguous_container_asan_correct(v));
+ assert(i == v.begin() + 10);
+ int j;
+ for (j = 0; j < 10; ++j)
+ assert(v[j] == 0);
+ assert(v[j] == 1);
+ for (++j; j < 101; ++j)
+ assert(v[j] == 0);
+ }
#if TEST_STD_VER >= 11
- {
- std::vector<int, min_allocator<int>> v(100);
- const int lvalue = 1;
- std::vector<int, min_allocator<int>>::iterator i = v.insert(v.cbegin() + 10, lvalue);
- assert(v.size() == 101);
- assert(is_contiguous_container_asan_correct(v));
- assert(i == v.begin() + 10);
- int j;
- for (j = 0; j < 10; ++j)
- assert(v[j] == 0);
- assert(v[j] == 1);
- for (++j; j < 101; ++j)
- assert(v[j] == 0);
- }
- {
- std::vector<int, safe_allocator<int>> v(100);
- const int lvalue = 1;
- std::vector<int, safe_allocator<int>>::iterator i = v.insert(v.cbegin() + 10, lvalue);
- assert(v.size() == 101);
- assert(is_contiguous_container_asan_correct(v));
- assert(i == v.begin() + 10);
- int j;
- for (j = 0; j < 10; ++j)
- assert(v[j] == 0);
- assert(v[j] == 1);
- for (++j; j < 101; ++j)
- assert(v[j] == 0);
- }
+ {
+ std::vector<int, min_allocator<int>> v(100);
+ const int lvalue = 1;
+ std::vector<int, min_allocator<int>>::iterator i = v.insert(v.cbegin() + 10, lvalue);
+ assert(v.size() == 101);
+ assert(is_contiguous_container_asan_correct(v));
+ assert(i == v.begin() + 10);
+ int j;
+ for (j = 0; j < 10; ++j)
+ assert(v[j] == 0);
+ assert(v[j] == 1);
+ for (++j; j < 101; ++j)
+ assert(v[j] == 0);
+ }
+ {
+ std::vector<int, safe_allocator<int>> v(100);
+ const int lvalue = 1;
+ std::vector<int, safe_allocator<int>>::iterator i = v.insert(v.cbegin() + 10, lvalue);
+ assert(v.size() == 101);
+ assert(is_contiguous_container_asan_correct(v));
+ assert(i == v.begin() + 10);
+ int j;
+ for (j = 0; j < 10; ++j)
+ assert(v[j] == 0);
+ assert(v[j] == 1);
+ for (++j; j < 101; ++j)
+ assert(v[j] == 0);
+ }
#endif
- return true;
+ return true;
}
-int main(int, char**)
-{
- test();
+int main(int, char**) {
+ test();
#if TEST_STD_VER > 17
- static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_rvalue.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_rvalue.pass.cpp
index 4619d7a7d1b6fa0..570e182cb66898a 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_rvalue.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_rvalue.pass.cpp
@@ -21,69 +21,67 @@
#include "min_allocator.h"
#include "asan_testing.h"
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- {
- std::vector<MoveOnly> v(100);
- std::vector<MoveOnly>::iterator i = v.insert(v.cbegin() + 10, MoveOnly(3));
- assert(v.size() == 101);
- assert(is_contiguous_container_asan_correct(v));
- assert(i == v.begin() + 10);
- int j;
- for (j = 0; j < 10; ++j)
- assert(v[j] == MoveOnly());
- assert(v[j] == MoveOnly(3));
- for (++j; j < 101; ++j)
- assert(v[j] == MoveOnly());
- }
- {
- std::vector<MoveOnly, limited_allocator<MoveOnly, 300> > v(100);
- std::vector<MoveOnly, limited_allocator<MoveOnly, 300> >::iterator i = v.insert(v.cbegin() + 10, MoveOnly(3));
- assert(v.size() == 101);
- assert(is_contiguous_container_asan_correct(v));
- assert(i == v.begin() + 10);
- int j;
- for (j = 0; j < 10; ++j)
- assert(v[j] == MoveOnly());
- assert(v[j] == MoveOnly(3));
- for (++j; j < 101; ++j)
- assert(v[j] == MoveOnly());
- }
- {
- std::vector<MoveOnly, min_allocator<MoveOnly> > v(100);
- std::vector<MoveOnly, min_allocator<MoveOnly> >::iterator i = v.insert(v.cbegin() + 10, MoveOnly(3));
- assert(v.size() == 101);
- assert(is_contiguous_container_asan_correct(v));
- assert(i == v.begin() + 10);
- int j;
- for (j = 0; j < 10; ++j)
- assert(v[j] == MoveOnly());
- assert(v[j] == MoveOnly(3));
- for (++j; j < 101; ++j)
- assert(v[j] == MoveOnly());
- }
- {
- std::vector<MoveOnly, safe_allocator<MoveOnly> > v(100);
- std::vector<MoveOnly, safe_allocator<MoveOnly> >::iterator i = v.insert(v.cbegin() + 10, MoveOnly(3));
- assert(v.size() == 101);
- assert(is_contiguous_container_asan_correct(v));
- assert(i == v.begin() + 10);
- int j;
- for (j = 0; j < 10; ++j)
- assert(v[j] == MoveOnly());
- assert(v[j] == MoveOnly(3));
- for (++j; j < 101; ++j)
- assert(v[j] == MoveOnly());
- }
+TEST_CONSTEXPR_CXX20 bool tests() {
+ {
+ std::vector<MoveOnly> v(100);
+ std::vector<MoveOnly>::iterator i = v.insert(v.cbegin() + 10, MoveOnly(3));
+ assert(v.size() == 101);
+ assert(is_contiguous_container_asan_correct(v));
+ assert(i == v.begin() + 10);
+ int j;
+ for (j = 0; j < 10; ++j)
+ assert(v[j] == MoveOnly());
+ assert(v[j] == MoveOnly(3));
+ for (++j; j < 101; ++j)
+ assert(v[j] == MoveOnly());
+ }
+ {
+ std::vector<MoveOnly, limited_allocator<MoveOnly, 300> > v(100);
+ std::vector<MoveOnly, limited_allocator<MoveOnly, 300> >::iterator i = v.insert(v.cbegin() + 10, MoveOnly(3));
+ assert(v.size() == 101);
+ assert(is_contiguous_container_asan_correct(v));
+ assert(i == v.begin() + 10);
+ int j;
+ for (j = 0; j < 10; ++j)
+ assert(v[j] == MoveOnly());
+ assert(v[j] == MoveOnly(3));
+ for (++j; j < 101; ++j)
+ assert(v[j] == MoveOnly());
+ }
+ {
+ std::vector<MoveOnly, min_allocator<MoveOnly> > v(100);
+ std::vector<MoveOnly, min_allocator<MoveOnly> >::iterator i = v.insert(v.cbegin() + 10, MoveOnly(3));
+ assert(v.size() == 101);
+ assert(is_contiguous_container_asan_correct(v));
+ assert(i == v.begin() + 10);
+ int j;
+ for (j = 0; j < 10; ++j)
+ assert(v[j] == MoveOnly());
+ assert(v[j] == MoveOnly(3));
+ for (++j; j < 101; ++j)
+ assert(v[j] == MoveOnly());
+ }
+ {
+ std::vector<MoveOnly, safe_allocator<MoveOnly> > v(100);
+ std::vector<MoveOnly, safe_allocator<MoveOnly> >::iterator i = v.insert(v.cbegin() + 10, MoveOnly(3));
+ assert(v.size() == 101);
+ assert(is_contiguous_container_asan_correct(v));
+ assert(i == v.begin() + 10);
+ int j;
+ for (j = 0; j < 10; ++j)
+ assert(v[j] == MoveOnly());
+ assert(v[j] == MoveOnly(3));
+ for (++j; j < 101; ++j)
+ assert(v[j] == MoveOnly());
+ }
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_size_value.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_size_value.pass.cpp
index 8325fcfd0670f29..8173285d4996b6b 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_size_value.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_size_value.pass.cpp
@@ -19,107 +19,106 @@
#include "min_allocator.h"
#include "asan_testing.h"
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- {
- std::vector<int> v(100);
- std::vector<int>::iterator i = v.insert(v.cbegin() + 10, 5, 1);
- assert(v.size() == 105);
- assert(is_contiguous_container_asan_correct(v));
- assert(i == v.begin() + 10);
- int j;
- for (j = 0; j < 10; ++j)
- assert(v[j] == 0);
- for (; j < 15; ++j)
- assert(v[j] == 1);
- for (++j; j < 105; ++j)
- assert(v[j] == 0);
- }
- {
- std::vector<int> v(100);
- while(v.size() < v.capacity()) v.push_back(0); // force reallocation
- std::size_t sz = v.size();
- std::vector<int>::iterator i = v.insert(v.cbegin() + 10, 5, 1);
- assert(v.size() == sz + 5);
- assert(is_contiguous_container_asan_correct(v));
- assert(i == v.begin() + 10);
- std::size_t j;
- for (j = 0; j < 10; ++j)
- assert(v[j] == 0);
- for (; j < 15; ++j)
- assert(v[j] == 1);
- for (++j; j < v.size(); ++j)
- assert(v[j] == 0);
- }
- {
- std::vector<int> v(100);
- v.reserve(128); // force no reallocation
- std::size_t sz = v.size();
- std::vector<int>::iterator i = v.insert(v.cbegin() + 10, 5, 1);
- assert(v.size() == sz + 5);
- assert(is_contiguous_container_asan_correct(v));
- assert(i == v.begin() + 10);
- std::size_t j;
- for (j = 0; j < 10; ++j)
- assert(v[j] == 0);
- for (; j < 15; ++j)
- assert(v[j] == 1);
- for (++j; j < v.size(); ++j)
- assert(v[j] == 0);
- }
- {
- std::vector<int, limited_allocator<int, 300> > v(100);
- std::vector<int, limited_allocator<int, 300> >::iterator i = v.insert(v.cbegin() + 10, 5, 1);
- assert(v.size() == 105);
- assert(is_contiguous_container_asan_correct(v));
- assert(i == v.begin() + 10);
- int j;
- for (j = 0; j < 10; ++j)
- assert(v[j] == 0);
- for (; j < 15; ++j)
- assert(v[j] == 1);
- for (++j; j < 105; ++j)
- assert(v[j] == 0);
- }
+TEST_CONSTEXPR_CXX20 bool tests() {
+ {
+ std::vector<int> v(100);
+ std::vector<int>::iterator i = v.insert(v.cbegin() + 10, 5, 1);
+ assert(v.size() == 105);
+ assert(is_contiguous_container_asan_correct(v));
+ assert(i == v.begin() + 10);
+ int j;
+ for (j = 0; j < 10; ++j)
+ assert(v[j] == 0);
+ for (; j < 15; ++j)
+ assert(v[j] == 1);
+ for (++j; j < 105; ++j)
+ assert(v[j] == 0);
+ }
+ {
+ std::vector<int> v(100);
+ while (v.size() < v.capacity())
+ v.push_back(0); // force reallocation
+ std::size_t sz = v.size();
+ std::vector<int>::iterator i = v.insert(v.cbegin() + 10, 5, 1);
+ assert(v.size() == sz + 5);
+ assert(is_contiguous_container_asan_correct(v));
+ assert(i == v.begin() + 10);
+ std::size_t j;
+ for (j = 0; j < 10; ++j)
+ assert(v[j] == 0);
+ for (; j < 15; ++j)
+ assert(v[j] == 1);
+ for (++j; j < v.size(); ++j)
+ assert(v[j] == 0);
+ }
+ {
+ std::vector<int> v(100);
+ v.reserve(128); // force no reallocation
+ std::size_t sz = v.size();
+ std::vector<int>::iterator i = v.insert(v.cbegin() + 10, 5, 1);
+ assert(v.size() == sz + 5);
+ assert(is_contiguous_container_asan_correct(v));
+ assert(i == v.begin() + 10);
+ std::size_t j;
+ for (j = 0; j < 10; ++j)
+ assert(v[j] == 0);
+ for (; j < 15; ++j)
+ assert(v[j] == 1);
+ for (++j; j < v.size(); ++j)
+ assert(v[j] == 0);
+ }
+ {
+ std::vector<int, limited_allocator<int, 300> > v(100);
+ std::vector<int, limited_allocator<int, 300> >::iterator i = v.insert(v.cbegin() + 10, 5, 1);
+ assert(v.size() == 105);
+ assert(is_contiguous_container_asan_correct(v));
+ assert(i == v.begin() + 10);
+ int j;
+ for (j = 0; j < 10; ++j)
+ assert(v[j] == 0);
+ for (; j < 15; ++j)
+ assert(v[j] == 1);
+ for (++j; j < 105; ++j)
+ assert(v[j] == 0);
+ }
#if TEST_STD_VER >= 11
- {
- std::vector<int, min_allocator<int>> v(100);
- std::vector<int, min_allocator<int>>::iterator i = v.insert(v.cbegin() + 10, 5, 1);
- assert(v.size() == 105);
- assert(is_contiguous_container_asan_correct(v));
- assert(i == v.begin() + 10);
- int j;
- for (j = 0; j < 10; ++j)
- assert(v[j] == 0);
- for (; j < 15; ++j)
- assert(v[j] == 1);
- for (++j; j < 105; ++j)
- assert(v[j] == 0);
- }
- {
- std::vector<int, safe_allocator<int>> v(100);
- std::vector<int, safe_allocator<int>>::iterator i = v.insert(v.cbegin() + 10, 5, 1);
- assert(v.size() == 105);
- assert(is_contiguous_container_asan_correct(v));
- assert(i == v.begin() + 10);
- int j;
- for (j = 0; j < 10; ++j)
- assert(v[j] == 0);
- for (; j < 15; ++j)
- assert(v[j] == 1);
- for (++j; j < 105; ++j)
- assert(v[j] == 0);
- }
+ {
+ std::vector<int, min_allocator<int>> v(100);
+ std::vector<int, min_allocator<int>>::iterator i = v.insert(v.cbegin() + 10, 5, 1);
+ assert(v.size() == 105);
+ assert(is_contiguous_container_asan_correct(v));
+ assert(i == v.begin() + 10);
+ int j;
+ for (j = 0; j < 10; ++j)
+ assert(v[j] == 0);
+ for (; j < 15; ++j)
+ assert(v[j] == 1);
+ for (++j; j < 105; ++j)
+ assert(v[j] == 0);
+ }
+ {
+ std::vector<int, safe_allocator<int>> v(100);
+ std::vector<int, safe_allocator<int>>::iterator i = v.insert(v.cbegin() + 10, 5, 1);
+ assert(v.size() == 105);
+ assert(is_contiguous_container_asan_correct(v));
+ assert(i == v.begin() + 10);
+ int j;
+ for (j = 0; j < 10; ++j)
+ assert(v[j] == 0);
+ for (; j < 15; ++j)
+ assert(v[j] == 1);
+ for (++j; j < 105; ++j)
+ assert(v[j] == 0);
+ }
#endif
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_range.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_range.pass.cpp
index 25ffc33aad424e6..ea0573df737510d 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_range.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_range.pass.cpp
@@ -34,9 +34,9 @@ constexpr bool test() {
});
test_sequence_insert_range_move_only<std::vector>();
- { // Vector may or may not need to reallocate because of the insertion -- make sure to test both cases.
+ { // Vector may or may not need to reallocate because of the insertion -- make sure to test both cases.
{ // Ensure reallocation happens.
- int in[] = {-1, -2, -3, -4, -5, -6, -7, -8, -9, -10};
+ int in[] = {-1, -2, -3, -4, -5, -6, -7, -8, -9, -10};
std::vector<int> v = {1, 2, 3, 4, 5, 6, 7, 8};
v.shrink_to_fit();
assert(v.capacity() < v.size() + std::ranges::size(in));
@@ -46,7 +46,7 @@ constexpr bool test() {
}
{ // Ensure no reallocation happens.
- int in[] = {-1, -2, -3, -4, -5, -6, -7, -8, -9, -10};
+ int in[] = {-1, -2, -3, -4, -5, -6, -7, -8, -9, -10};
std::vector<int> v = {1, 2, 3, 4, 5, 6, 7, 8};
v.reserve(v.size() + std::ranges::size(in));
assert(v.capacity() >= v.size() + std::ranges::size(in));
diff --git a/libcxx/test/std/containers/sequences/vector/vector.modifiers/pop_back.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.modifiers/pop_back.pass.cpp
index 9482920f0fe60b6..9717666079d8032 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.modifiers/pop_back.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.modifiers/pop_back.pass.cpp
@@ -17,47 +17,43 @@
#include "test_allocator.h"
#include "min_allocator.h"
-
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- {
- std::vector<int> c;
- c.push_back(1);
- assert(c.size() == 1);
- c.pop_back();
- assert(c.size() == 0);
-
- }
+TEST_CONSTEXPR_CXX20 bool tests() {
+ {
+ std::vector<int> c;
+ c.push_back(1);
+ assert(c.size() == 1);
+ c.pop_back();
+ assert(c.size() == 0);
+ }
#if TEST_STD_VER >= 11
- {
- std::vector<int, min_allocator<int>> c;
- c.push_back(1);
- assert(c.size() == 1);
- c.pop_back();
- assert(c.size() == 0);
- }
+ {
+ std::vector<int, min_allocator<int>> c;
+ c.push_back(1);
+ assert(c.size() == 1);
+ c.pop_back();
+ assert(c.size() == 0);
+ }
#endif
- { // LWG 526
- int arr[] = {0, 1, 2, 3, 4};
- int sz = 5;
- std::vector<int> c(arr, arr+sz);
- while (c.size() < c.capacity())
- c.push_back(sz++);
- c.push_back(c.front());
- assert(c.back() == 0);
- for (int i = 0; i < sz; ++i)
- assert(c[i] == i);
- }
-
- return true;
+ { // LWG 526
+ int arr[] = {0, 1, 2, 3, 4};
+ int sz = 5;
+ std::vector<int> c(arr, arr + sz);
+ while (c.size() < c.capacity())
+ c.push_back(sz++);
+ c.push_back(c.front());
+ assert(c.back() == 0);
+ for (int i = 0; i < sz; ++i)
+ assert(c[i] == i);
+ }
+
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector/vector.modifiers/push_back.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.modifiers/push_back.pass.cpp
index 2490fded523d6fe..1e77055abd6d369 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.modifiers/push_back.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.modifiers/push_back.pass.cpp
@@ -18,106 +18,104 @@
#include "min_allocator.h"
#include "asan_testing.h"
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- {
- std::vector<int> c;
- c.push_back(0);
- assert(c.size() == 1);
- assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
- assert(c[j] == j);
- c.push_back(1);
- assert(c.size() == 2);
- assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
- assert(c[j] == j);
- c.push_back(2);
- assert(c.size() == 3);
- assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
- assert(c[j] == j);
- c.push_back(3);
- assert(c.size() == 4);
- assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
- assert(c[j] == j);
- c.push_back(4);
- assert(c.size() == 5);
- assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
- assert(c[j] == j);
- }
- {
- // libc++ needs 15 because it grows by 2x (1 + 2 + 4 + 8).
- // Use 17 for implementations that dynamically allocate a container proxy
- // and grow by 1.5x (1 for proxy + 1 + 2 + 3 + 4 + 6).
- std::vector<int, limited_allocator<int, 17> > c;
- c.push_back(0);
- assert(c.size() == 1);
- assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
- assert(c[j] == j);
- c.push_back(1);
- assert(c.size() == 2);
- assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
- assert(c[j] == j);
- c.push_back(2);
- assert(c.size() == 3);
- assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
- assert(c[j] == j);
- c.push_back(3);
- assert(c.size() == 4);
- assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
- assert(c[j] == j);
- c.push_back(4);
- assert(c.size() == 5);
- assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
- assert(c[j] == j);
- }
+TEST_CONSTEXPR_CXX20 bool tests() {
+ {
+ std::vector<int> c;
+ c.push_back(0);
+ assert(c.size() == 1);
+ assert(is_contiguous_container_asan_correct(c));
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
+ assert(c[j] == j);
+ c.push_back(1);
+ assert(c.size() == 2);
+ assert(is_contiguous_container_asan_correct(c));
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
+ assert(c[j] == j);
+ c.push_back(2);
+ assert(c.size() == 3);
+ assert(is_contiguous_container_asan_correct(c));
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
+ assert(c[j] == j);
+ c.push_back(3);
+ assert(c.size() == 4);
+ assert(is_contiguous_container_asan_correct(c));
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
+ assert(c[j] == j);
+ c.push_back(4);
+ assert(c.size() == 5);
+ assert(is_contiguous_container_asan_correct(c));
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
+ assert(c[j] == j);
+ }
+ {
+ // libc++ needs 15 because it grows by 2x (1 + 2 + 4 + 8).
+ // Use 17 for implementations that dynamically allocate a container proxy
+ // and grow by 1.5x (1 for proxy + 1 + 2 + 3 + 4 + 6).
+ std::vector<int, limited_allocator<int, 17> > c;
+ c.push_back(0);
+ assert(c.size() == 1);
+ assert(is_contiguous_container_asan_correct(c));
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
+ assert(c[j] == j);
+ c.push_back(1);
+ assert(c.size() == 2);
+ assert(is_contiguous_container_asan_correct(c));
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
+ assert(c[j] == j);
+ c.push_back(2);
+ assert(c.size() == 3);
+ assert(is_contiguous_container_asan_correct(c));
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
+ assert(c[j] == j);
+ c.push_back(3);
+ assert(c.size() == 4);
+ assert(is_contiguous_container_asan_correct(c));
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
+ assert(c[j] == j);
+ c.push_back(4);
+ assert(c.size() == 5);
+ assert(is_contiguous_container_asan_correct(c));
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
+ assert(c[j] == j);
+ }
#if TEST_STD_VER >= 11
- {
- std::vector<int, min_allocator<int>> c;
- c.push_back(0);
- assert(c.size() == 1);
- assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
- assert(c[j] == j);
- c.push_back(1);
- assert(c.size() == 2);
- assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
- assert(c[j] == j);
- c.push_back(2);
- assert(c.size() == 3);
- assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
- assert(c[j] == j);
- c.push_back(3);
- assert(c.size() == 4);
- assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
- assert(c[j] == j);
- c.push_back(4);
- assert(c.size() == 5);
- assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
- assert(c[j] == j);
- }
+ {
+ std::vector<int, min_allocator<int>> c;
+ c.push_back(0);
+ assert(c.size() == 1);
+ assert(is_contiguous_container_asan_correct(c));
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
+ assert(c[j] == j);
+ c.push_back(1);
+ assert(c.size() == 2);
+ assert(is_contiguous_container_asan_correct(c));
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
+ assert(c[j] == j);
+ c.push_back(2);
+ assert(c.size() == 3);
+ assert(is_contiguous_container_asan_correct(c));
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
+ assert(c[j] == j);
+ c.push_back(3);
+ assert(c.size() == 4);
+ assert(is_contiguous_container_asan_correct(c));
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
+ assert(c[j] == j);
+ c.push_back(4);
+ assert(c.size() == 5);
+ assert(is_contiguous_container_asan_correct(c));
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
+ assert(c[j] == j);
+ }
#endif
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector/vector.modifiers/push_back_exception_safety.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.modifiers/push_back_exception_safety.pass.cpp
index 9e25611290cc645..cbdc55a700b7598 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.modifiers/push_back_exception_safety.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.modifiers/push_back_exception_safety.pass.cpp
@@ -20,18 +20,26 @@
static bool gCopyConstructorShouldThrow = false;
class CMyClass {
- public: CMyClass(int tag);
- public: CMyClass(const CMyClass& iOther);
- public: ~CMyClass();
-
- bool equal(const CMyClass &rhs) const
- { return fTag == rhs.fTag && fMagicValue == rhs.fMagicValue; }
- private:
- int fMagicValue;
- int fTag;
-
- private: static int kStartedConstructionMagicValue;
- private: static int kFinishedConstructionMagicValue;
+public:
+ CMyClass(int tag);
+
+public:
+ CMyClass(const CMyClass& iOther);
+
+public:
+ ~CMyClass();
+
+ bool equal(const CMyClass& rhs) const { return fTag == rhs.fTag && fMagicValue == rhs.fMagicValue; }
+
+private:
+ int fMagicValue;
+ int fTag;
+
+private:
+ static int kStartedConstructionMagicValue;
+
+private:
+ static int kFinishedConstructionMagicValue;
};
// Value for fMagicValue when the constructor has started running, but not yet finished
@@ -39,51 +47,45 @@ int CMyClass::kStartedConstructionMagicValue = 0;
// Value for fMagicValue when the constructor has finished running
int CMyClass::kFinishedConstructionMagicValue = 12345;
-CMyClass::CMyClass(int tag) :
- fMagicValue(kStartedConstructionMagicValue), fTag(tag)
-{
- // Signal that the constructor has finished running
- fMagicValue = kFinishedConstructionMagicValue;
+CMyClass::CMyClass(int tag) : fMagicValue(kStartedConstructionMagicValue), fTag(tag) {
+ // Signal that the constructor has finished running
+ fMagicValue = kFinishedConstructionMagicValue;
}
-CMyClass::CMyClass(const CMyClass& iOther) :
- fMagicValue(kStartedConstructionMagicValue), fTag(iOther.fTag)
-{
- // If requested, throw an exception _before_ setting fMagicValue to kFinishedConstructionMagicValue
- if (gCopyConstructorShouldThrow) {
- TEST_THROW(std::exception());
- }
- // Signal that the constructor has finished running
- fMagicValue = kFinishedConstructionMagicValue;
+CMyClass::CMyClass(const CMyClass& iOther) : fMagicValue(kStartedConstructionMagicValue), fTag(iOther.fTag) {
+ // If requested, throw an exception _before_ setting fMagicValue to kFinishedConstructionMagicValue
+ if (gCopyConstructorShouldThrow) {
+ TEST_THROW(std::exception());
+ }
+ // Signal that the constructor has finished running
+ fMagicValue = kFinishedConstructionMagicValue;
}
CMyClass::~CMyClass() {
- // Only instances for which the constructor has finished running should be destructed
- assert(fMagicValue == kFinishedConstructionMagicValue);
+ // Only instances for which the constructor has finished running should be destructed
+ assert(fMagicValue == kFinishedConstructionMagicValue);
}
-bool operator==(const CMyClass &lhs, const CMyClass &rhs) { return lhs.equal(rhs); }
+bool operator==(const CMyClass& lhs, const CMyClass& rhs) { return lhs.equal(rhs); }
-int main(int, char**)
-{
- CMyClass instance(42);
- std::vector<CMyClass> vec;
+int main(int, char**) {
+ CMyClass instance(42);
+ std::vector<CMyClass> vec;
- vec.push_back(instance);
- std::vector<CMyClass> vec2(vec);
- assert(is_contiguous_container_asan_correct(vec));
- assert(is_contiguous_container_asan_correct(vec2));
+ vec.push_back(instance);
+ std::vector<CMyClass> vec2(vec);
+ assert(is_contiguous_container_asan_correct(vec));
+ assert(is_contiguous_container_asan_correct(vec2));
#ifndef TEST_HAS_NO_EXCEPTIONS
- gCopyConstructorShouldThrow = true;
- try {
- vec.push_back(instance);
- assert(false);
- }
- catch (...) {
- assert(vec==vec2);
- assert(is_contiguous_container_asan_correct(vec));
- }
+ gCopyConstructorShouldThrow = true;
+ try {
+ vec.push_back(instance);
+ assert(false);
+ } catch (...) {
+ assert(vec == vec2);
+ assert(is_contiguous_container_asan_correct(vec));
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/sequences/vector/vector.modifiers/push_back_rvalue.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.modifiers/push_back_rvalue.pass.cpp
index 92b629b3cdb4f84..e97d5a9c448da0f 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.modifiers/push_back_rvalue.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.modifiers/push_back_rvalue.pass.cpp
@@ -21,104 +21,102 @@
#include "min_allocator.h"
#include "asan_testing.h"
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- {
- std::vector<MoveOnly> c;
- c.push_back(MoveOnly(0));
- assert(c.size() == 1);
- assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
- assert(c[j] == MoveOnly(j));
- c.push_back(MoveOnly(1));
- assert(c.size() == 2);
- assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
- assert(c[j] == MoveOnly(j));
- c.push_back(MoveOnly(2));
- assert(c.size() == 3);
- assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
- assert(c[j] == MoveOnly(j));
- c.push_back(MoveOnly(3));
- assert(c.size() == 4);
- assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
- assert(c[j] == MoveOnly(j));
- c.push_back(MoveOnly(4));
- assert(c.size() == 5);
- assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
- assert(c[j] == MoveOnly(j));
- }
- {
- // libc++ needs 15 because it grows by 2x (1 + 2 + 4 + 8).
- // Use 17 for implementations that dynamically allocate a container proxy
- // and grow by 1.5x (1 for proxy + 1 + 2 + 3 + 4 + 6).
- std::vector<MoveOnly, limited_allocator<MoveOnly, 17> > c;
- c.push_back(MoveOnly(0));
- assert(c.size() == 1);
- assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
- assert(c[j] == MoveOnly(j));
- c.push_back(MoveOnly(1));
- assert(c.size() == 2);
- assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
- assert(c[j] == MoveOnly(j));
- c.push_back(MoveOnly(2));
- assert(c.size() == 3);
- assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
- assert(c[j] == MoveOnly(j));
- c.push_back(MoveOnly(3));
- assert(c.size() == 4);
- assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
- assert(c[j] == MoveOnly(j));
- c.push_back(MoveOnly(4));
- assert(c.size() == 5);
- assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
- assert(c[j] == MoveOnly(j));
- }
- {
- std::vector<MoveOnly, min_allocator<MoveOnly> > c;
- c.push_back(MoveOnly(0));
- assert(c.size() == 1);
- assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
- assert(c[j] == MoveOnly(j));
- c.push_back(MoveOnly(1));
- assert(c.size() == 2);
- assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
- assert(c[j] == MoveOnly(j));
- c.push_back(MoveOnly(2));
- assert(c.size() == 3);
- assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
- assert(c[j] == MoveOnly(j));
- c.push_back(MoveOnly(3));
- assert(c.size() == 4);
- assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
- assert(c[j] == MoveOnly(j));
- c.push_back(MoveOnly(4));
- assert(c.size() == 5);
- assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
- assert(c[j] == MoveOnly(j));
- }
+TEST_CONSTEXPR_CXX20 bool tests() {
+ {
+ std::vector<MoveOnly> c;
+ c.push_back(MoveOnly(0));
+ assert(c.size() == 1);
+ assert(is_contiguous_container_asan_correct(c));
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
+ assert(c[j] == MoveOnly(j));
+ c.push_back(MoveOnly(1));
+ assert(c.size() == 2);
+ assert(is_contiguous_container_asan_correct(c));
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
+ assert(c[j] == MoveOnly(j));
+ c.push_back(MoveOnly(2));
+ assert(c.size() == 3);
+ assert(is_contiguous_container_asan_correct(c));
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
+ assert(c[j] == MoveOnly(j));
+ c.push_back(MoveOnly(3));
+ assert(c.size() == 4);
+ assert(is_contiguous_container_asan_correct(c));
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
+ assert(c[j] == MoveOnly(j));
+ c.push_back(MoveOnly(4));
+ assert(c.size() == 5);
+ assert(is_contiguous_container_asan_correct(c));
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
+ assert(c[j] == MoveOnly(j));
+ }
+ {
+ // libc++ needs 15 because it grows by 2x (1 + 2 + 4 + 8).
+ // Use 17 for implementations that dynamically allocate a container proxy
+ // and grow by 1.5x (1 for proxy + 1 + 2 + 3 + 4 + 6).
+ std::vector<MoveOnly, limited_allocator<MoveOnly, 17> > c;
+ c.push_back(MoveOnly(0));
+ assert(c.size() == 1);
+ assert(is_contiguous_container_asan_correct(c));
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
+ assert(c[j] == MoveOnly(j));
+ c.push_back(MoveOnly(1));
+ assert(c.size() == 2);
+ assert(is_contiguous_container_asan_correct(c));
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
+ assert(c[j] == MoveOnly(j));
+ c.push_back(MoveOnly(2));
+ assert(c.size() == 3);
+ assert(is_contiguous_container_asan_correct(c));
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
+ assert(c[j] == MoveOnly(j));
+ c.push_back(MoveOnly(3));
+ assert(c.size() == 4);
+ assert(is_contiguous_container_asan_correct(c));
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
+ assert(c[j] == MoveOnly(j));
+ c.push_back(MoveOnly(4));
+ assert(c.size() == 5);
+ assert(is_contiguous_container_asan_correct(c));
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
+ assert(c[j] == MoveOnly(j));
+ }
+ {
+ std::vector<MoveOnly, min_allocator<MoveOnly> > c;
+ c.push_back(MoveOnly(0));
+ assert(c.size() == 1);
+ assert(is_contiguous_container_asan_correct(c));
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
+ assert(c[j] == MoveOnly(j));
+ c.push_back(MoveOnly(1));
+ assert(c.size() == 2);
+ assert(is_contiguous_container_asan_correct(c));
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
+ assert(c[j] == MoveOnly(j));
+ c.push_back(MoveOnly(2));
+ assert(c.size() == 3);
+ assert(is_contiguous_container_asan_correct(c));
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
+ assert(c[j] == MoveOnly(j));
+ c.push_back(MoveOnly(3));
+ assert(c.size() == 4);
+ assert(is_contiguous_container_asan_correct(c));
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
+ assert(c[j] == MoveOnly(j));
+ c.push_back(MoveOnly(4));
+ assert(c.size() == 5);
+ assert(is_contiguous_container_asan_correct(c));
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
+ assert(c[j] == MoveOnly(j));
+ }
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector/vector.modifiers/resize_not_move_insertable.verify.cpp b/libcxx/test/std/containers/sequences/vector/vector.modifiers/resize_not_move_insertable.verify.cpp
index 8eb055283fdf4c8..acc0127ac73e2c0 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.modifiers/resize_not_move_insertable.verify.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.modifiers/resize_not_move_insertable.verify.cpp
@@ -19,12 +19,12 @@
template <int>
class BadUserNoCookie {
public:
- BadUserNoCookie() { }
+ BadUserNoCookie() {}
- BadUserNoCookie(BadUserNoCookie&&) = delete;
+ BadUserNoCookie(BadUserNoCookie&&) = delete;
BadUserNoCookie& operator=(BadUserNoCookie&&) = delete;
- BadUserNoCookie(const BadUserNoCookie&) = default;
+ BadUserNoCookie(const BadUserNoCookie&) = default;
BadUserNoCookie& operator=(const BadUserNoCookie&) = default;
};
@@ -35,7 +35,6 @@ int main(int, char**) {
// expected-error@* 0-2 {{call to deleted constructor}}
// expected-error@* 0-2 {{no matching function for call to '__construct_at'}}
{
-
std::vector<BadUserNoCookie<1> > x;
x.emplace_back();
}
diff --git a/libcxx/test/std/containers/sequences/vector/vector.special/swap.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.special/swap.pass.cpp
index 98aece64c80e7dc..0da2f820ab1d712 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.special/swap.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.special/swap.pass.cpp
@@ -94,105 +94,103 @@ TEST_CONSTEXPR_CXX20 void test_with_allocator() {
}
}
-TEST_CONSTEXPR_CXX20 bool tests()
-{
- {
- int a1[] = {1, 3, 7, 9, 10};
- int a2[] = {0, 2, 4, 5, 6, 8, 11};
- std::vector<int> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
- std::vector<int> c2(a2, a2+sizeof(a2)/sizeof(a2[0]));
- assert(is_contiguous_container_asan_correct(c1));
- assert(is_contiguous_container_asan_correct(c2));
- swap(c1, c2);
- assert(c1 == std::vector<int>(a2, a2+sizeof(a2)/sizeof(a2[0])));
- assert(c2 == std::vector<int>(a1, a1+sizeof(a1)/sizeof(a1[0])));
- assert(is_contiguous_container_asan_correct(c1));
- assert(is_contiguous_container_asan_correct(c2));
- }
- {
- int a1[] = {1, 3, 7, 9, 10};
- int a2[] = {0, 2, 4, 5, 6, 8, 11};
- std::vector<int> c1(a1, a1);
- std::vector<int> c2(a2, a2+sizeof(a2)/sizeof(a2[0]));
- assert(is_contiguous_container_asan_correct(c1));
- assert(is_contiguous_container_asan_correct(c2));
- swap(c1, c2);
- assert(c1 == std::vector<int>(a2, a2+sizeof(a2)/sizeof(a2[0])));
- assert(c2.empty());
- assert(std::distance(c2.begin(), c2.end()) == 0);
- assert(is_contiguous_container_asan_correct(c1));
- assert(is_contiguous_container_asan_correct(c2));
- }
- {
- int a1[] = {1, 3, 7, 9, 10};
- int a2[] = {0, 2, 4, 5, 6, 8, 11};
- std::vector<int> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
- std::vector<int> c2(a2, a2);
- assert(is_contiguous_container_asan_correct(c1));
- assert(is_contiguous_container_asan_correct(c2));
- swap(c1, c2);
- assert(c1.empty());
- assert(std::distance(c1.begin(), c1.end()) == 0);
- assert(c2 == std::vector<int>(a1, a1+sizeof(a1)/sizeof(a1[0])));
- assert(is_contiguous_container_asan_correct(c1));
- assert(is_contiguous_container_asan_correct(c2));
- }
- {
- int a1[] = {1, 3, 7, 9, 10};
- int a2[] = {0, 2, 4, 5, 6, 8, 11};
- std::vector<int> c1(a1, a1);
- std::vector<int> c2(a2, a2);
- assert(is_contiguous_container_asan_correct(c1));
- assert(is_contiguous_container_asan_correct(c2));
- swap(c1, c2);
- assert(c1.empty());
- assert(std::distance(c1.begin(), c1.end()) == 0);
- assert(c2.empty());
- assert(std::distance(c2.begin(), c2.end()) == 0);
- assert(is_contiguous_container_asan_correct(c1));
- assert(is_contiguous_container_asan_correct(c2));
- }
- {
- int a1[] = {1, 3, 7, 9, 10};
- int a2[] = {0, 2, 4, 5, 6, 8, 11};
- typedef test_allocator<int> A;
- std::vector<int, A> c1(a1, a1+sizeof(a1)/sizeof(a1[0]), A(1, 1));
- std::vector<int, A> c2(a2, a2+sizeof(a2)/sizeof(a2[0]), A(1, 2));
- swap(c1, c2);
- assert((c1 == std::vector<int, A>(a2, a2+sizeof(a2)/sizeof(a2[0]))));
- assert(c1.get_allocator().get_id() == 1);
- assert((c2 == std::vector<int, A>(a1, a1+sizeof(a1)/sizeof(a1[0]))));
- assert(c2.get_allocator().get_id() == 2);
- }
- {
- int a1[] = {1, 3, 7, 9, 10};
- int a2[] = {0, 2, 4, 5, 6, 8, 11};
- typedef other_allocator<int> A;
- std::vector<int, A> c1(a1, a1+sizeof(a1)/sizeof(a1[0]), A(1));
- std::vector<int, A> c2(a2, a2+sizeof(a2)/sizeof(a2[0]), A(2));
- assert(is_contiguous_container_asan_correct(c1));
- assert(is_contiguous_container_asan_correct(c2));
- swap(c1, c2);
- assert((c1 == std::vector<int, A>(a2, a2+sizeof(a2)/sizeof(a2[0]))));
- assert(c1.get_allocator() == A(2));
- assert((c2 == std::vector<int, A>(a1, a1+sizeof(a1)/sizeof(a1[0]))));
- assert(c2.get_allocator() == A(1));
- assert(is_contiguous_container_asan_correct(c1));
- assert(is_contiguous_container_asan_correct(c2));
- }
+TEST_CONSTEXPR_CXX20 bool tests() {
+ {
+ int a1[] = {1, 3, 7, 9, 10};
+ int a2[] = {0, 2, 4, 5, 6, 8, 11};
+ std::vector<int> c1(a1, a1 + sizeof(a1) / sizeof(a1[0]));
+ std::vector<int> c2(a2, a2 + sizeof(a2) / sizeof(a2[0]));
+ assert(is_contiguous_container_asan_correct(c1));
+ assert(is_contiguous_container_asan_correct(c2));
+ swap(c1, c2);
+ assert(c1 == std::vector<int>(a2, a2 + sizeof(a2) / sizeof(a2[0])));
+ assert(c2 == std::vector<int>(a1, a1 + sizeof(a1) / sizeof(a1[0])));
+ assert(is_contiguous_container_asan_correct(c1));
+ assert(is_contiguous_container_asan_correct(c2));
+ }
+ {
+ int a1[] = {1, 3, 7, 9, 10};
+ int a2[] = {0, 2, 4, 5, 6, 8, 11};
+ std::vector<int> c1(a1, a1);
+ std::vector<int> c2(a2, a2 + sizeof(a2) / sizeof(a2[0]));
+ assert(is_contiguous_container_asan_correct(c1));
+ assert(is_contiguous_container_asan_correct(c2));
+ swap(c1, c2);
+ assert(c1 == std::vector<int>(a2, a2 + sizeof(a2) / sizeof(a2[0])));
+ assert(c2.empty());
+ assert(std::distance(c2.begin(), c2.end()) == 0);
+ assert(is_contiguous_container_asan_correct(c1));
+ assert(is_contiguous_container_asan_correct(c2));
+ }
+ {
+ int a1[] = {1, 3, 7, 9, 10};
+ int a2[] = {0, 2, 4, 5, 6, 8, 11};
+ std::vector<int> c1(a1, a1 + sizeof(a1) / sizeof(a1[0]));
+ std::vector<int> c2(a2, a2);
+ assert(is_contiguous_container_asan_correct(c1));
+ assert(is_contiguous_container_asan_correct(c2));
+ swap(c1, c2);
+ assert(c1.empty());
+ assert(std::distance(c1.begin(), c1.end()) == 0);
+ assert(c2 == std::vector<int>(a1, a1 + sizeof(a1) / sizeof(a1[0])));
+ assert(is_contiguous_container_asan_correct(c1));
+ assert(is_contiguous_container_asan_correct(c2));
+ }
+ {
+ int a1[] = {1, 3, 7, 9, 10};
+ int a2[] = {0, 2, 4, 5, 6, 8, 11};
+ std::vector<int> c1(a1, a1);
+ std::vector<int> c2(a2, a2);
+ assert(is_contiguous_container_asan_correct(c1));
+ assert(is_contiguous_container_asan_correct(c2));
+ swap(c1, c2);
+ assert(c1.empty());
+ assert(std::distance(c1.begin(), c1.end()) == 0);
+ assert(c2.empty());
+ assert(std::distance(c2.begin(), c2.end()) == 0);
+ assert(is_contiguous_container_asan_correct(c1));
+ assert(is_contiguous_container_asan_correct(c2));
+ }
+ {
+ int a1[] = {1, 3, 7, 9, 10};
+ int a2[] = {0, 2, 4, 5, 6, 8, 11};
+ typedef test_allocator<int> A;
+ std::vector<int, A> c1(a1, a1 + sizeof(a1) / sizeof(a1[0]), A(1, 1));
+ std::vector<int, A> c2(a2, a2 + sizeof(a2) / sizeof(a2[0]), A(1, 2));
+ swap(c1, c2);
+ assert((c1 == std::vector<int, A>(a2, a2 + sizeof(a2) / sizeof(a2[0]))));
+ assert(c1.get_allocator().get_id() == 1);
+ assert((c2 == std::vector<int, A>(a1, a1 + sizeof(a1) / sizeof(a1[0]))));
+ assert(c2.get_allocator().get_id() == 2);
+ }
+ {
+ int a1[] = {1, 3, 7, 9, 10};
+ int a2[] = {0, 2, 4, 5, 6, 8, 11};
+ typedef other_allocator<int> A;
+ std::vector<int, A> c1(a1, a1 + sizeof(a1) / sizeof(a1[0]), A(1));
+ std::vector<int, A> c2(a2, a2 + sizeof(a2) / sizeof(a2[0]), A(2));
+ assert(is_contiguous_container_asan_correct(c1));
+ assert(is_contiguous_container_asan_correct(c2));
+ swap(c1, c2);
+ assert((c1 == std::vector<int, A>(a2, a2 + sizeof(a2) / sizeof(a2[0]))));
+ assert(c1.get_allocator() == A(2));
+ assert((c2 == std::vector<int, A>(a1, a1 + sizeof(a1) / sizeof(a1[0]))));
+ assert(c2.get_allocator() == A(1));
+ assert(is_contiguous_container_asan_correct(c1));
+ assert(is_contiguous_container_asan_correct(c2));
+ }
#if TEST_STD_VER >= 11
- test_with_allocator<min_allocator<int>>();
- test_with_allocator<safe_allocator<int>>();
+ test_with_allocator<min_allocator<int>>();
+ test_with_allocator<safe_allocator<int>>();
#endif
- return true;
+ return true;
}
-int main(int, char**)
-{
- tests();
+int main(int, char**) {
+ tests();
#if TEST_STD_VER > 17
- static_assert(tests());
+ static_assert(tests());
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector/vector.special/swap_noexcept.compile.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.special/swap_noexcept.compile.pass.cpp
index d38a00c789f8e37..48e083e42b15ff9 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.special/swap_noexcept.compile.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.special/swap_noexcept.compile.pass.cpp
@@ -29,62 +29,59 @@
#include "test_allocator.h"
template <class T>
-struct some_alloc
-{
- typedef T value_type;
+struct some_alloc {
+ typedef T value_type;
- some_alloc() {}
- some_alloc(const some_alloc&);
- void allocate(std::size_t);
- void deallocate(void*, unsigned) {}
+ some_alloc() {}
+ some_alloc(const some_alloc&);
+ void allocate(std::size_t);
+ void deallocate(void*, unsigned) {}
- typedef std::true_type propagate_on_container_swap;
+ typedef std::true_type propagate_on_container_swap;
};
template <class T>
-struct some_alloc2
-{
- typedef T value_type;
+struct some_alloc2 {
+ typedef T value_type;
- some_alloc2() {}
- some_alloc2(const some_alloc2&);
- void allocate(std::size_t);
- void deallocate(void*, unsigned) {}
+ some_alloc2() {}
+ some_alloc2(const some_alloc2&);
+ void allocate(std::size_t);
+ void deallocate(void*, unsigned) {}
- typedef std::false_type propagate_on_container_swap;
- typedef std::true_type is_always_equal;
+ typedef std::false_type propagate_on_container_swap;
+ typedef std::true_type is_always_equal;
};
-void test()
-{
- {
- typedef std::vector<MoveOnly> C;
- static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
+void test() {
+ {
+ typedef std::vector<MoveOnly> C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
#if defined(_LIBCPP_VERSION)
- {
- typedef std::vector<MoveOnly, test_allocator<MoveOnly>> C;
- static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
+ {
+ typedef std::vector<MoveOnly, test_allocator<MoveOnly>> C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
#endif
- {
- typedef std::vector<MoveOnly, other_allocator<MoveOnly>> C;
- static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- {
- typedef std::vector<MoveOnly, some_alloc<MoveOnly>> C;
+ {
+ typedef std::vector<MoveOnly, other_allocator<MoveOnly>> C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
+ {
+ typedef std::vector<MoveOnly, some_alloc<MoveOnly>> C;
#if TEST_STD_VER >= 14
- // In C++14, if POCS is set, swapping the allocator is required not to throw
- static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ // In C++14, if POCS is set, swapping the allocator is required not to throw
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
#else
- static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
#endif
- }
+ }
#if TEST_STD_VER >= 14
- {
- typedef std::vector<MoveOnly, some_alloc2<MoveOnly>> C;
- // If the allocators are always equal, then the swap can be noexcept
- static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
+ {
+ typedef std::vector<MoveOnly, some_alloc2<MoveOnly>> C;
+ // If the allocators are always equal, then the swap can be noexcept
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
#endif
}
diff --git a/libcxx/test/std/containers/set_allocator_requirement_test_templates.h b/libcxx/test/std/containers/set_allocator_requirement_test_templates.h
index ad05ee458e3cd78..9ab5c50e9012e7d 100644
--- a/libcxx/test/std/containers/set_allocator_requirement_test_templates.h
+++ b/libcxx/test/std/containers/set_allocator_requirement_test_templates.h
@@ -19,7 +19,6 @@
// emplace(...);
// emplace_hint(...);
-
#include <cassert>
#include <iterator>
@@ -27,10 +26,8 @@
#include "count_new.h"
#include "container_test_types.h"
-
template <class Container>
-void testSetInsert()
-{
+void testSetInsert() {
typedef typename Container::value_type ValueTp;
ConstructController* cc = getConstructController();
cc->reset();
@@ -89,7 +86,7 @@ void testSetInsert()
{
// Testing C::insert(std::initializer_list<ValueTp>)"
Container c;
- std::initializer_list<ValueTp> il = { ValueTp(1), ValueTp(2) };
+ std::initializer_list<ValueTp> il = {ValueTp(1), ValueTp(2)};
cc->expect<ValueTp const&>(2);
c.insert(il);
assert(!cc->unchecked());
@@ -101,7 +98,7 @@ void testSetInsert()
{
// Testing C::insert(Iter, Iter) for *Iter = value_type const&"
Container c;
- const ValueTp ValueList[] = { ValueTp(1), ValueTp(2), ValueTp(3) };
+ const ValueTp ValueList[] = {ValueTp(1), ValueTp(2), ValueTp(3)};
cc->expect<ValueTp const&>(3);
c.insert(std::begin(ValueList), std::end(ValueList));
assert(!cc->unchecked());
@@ -113,14 +110,13 @@ void testSetInsert()
{
// Testing C::insert(Iter, Iter) for *Iter = value_type&&"
Container c;
- ValueTp ValueList[] = { ValueTp(1), ValueTp(2) , ValueTp(3) };
+ ValueTp ValueList[] = {ValueTp(1), ValueTp(2), ValueTp(3)};
cc->expect<ValueTp&&>(3);
- c.insert(std::move_iterator<ValueTp*>(std::begin(ValueList)),
- std::move_iterator<ValueTp*>(std::end(ValueList)));
+ c.insert(std::move_iterator<ValueTp*>(std::begin(ValueList)), std::move_iterator<ValueTp*>(std::end(ValueList)));
assert(!cc->unchecked());
{
DisableAllocationGuard g;
- ValueTp ValueList2[] = { ValueTp(1), ValueTp(2) , ValueTp(3) };
+ ValueTp ValueList2[] = {ValueTp(1), ValueTp(2), ValueTp(3)};
c.insert(std::move_iterator<ValueTp*>(std::begin(ValueList2)),
std::move_iterator<ValueTp*>(std::end(ValueList2)));
}
@@ -128,7 +124,7 @@ void testSetInsert()
{
// Testing C::insert(Iter, Iter) for *Iter = value_type&"
Container c;
- ValueTp ValueList[] = { ValueTp(1), ValueTp(2) , ValueTp(3) };
+ ValueTp ValueList[] = {ValueTp(1), ValueTp(2), ValueTp(3)};
cc->expect<ValueTp const&>(3);
c.insert(std::begin(ValueList), std::end(ValueList));
assert(!cc->unchecked());
@@ -139,10 +135,8 @@ void testSetInsert()
}
}
-
template <class Container>
-void testSetEmplace()
-{
+void testSetEmplace() {
typedef typename Container::value_type ValueTp;
ConstructController* cc = getConstructController();
cc->reset();
@@ -200,10 +194,8 @@ void testSetEmplace()
}
}
-
template <class Container>
-void testSetEmplaceHint()
-{
+void testSetEmplaceHint() {
typedef typename Container::value_type ValueTp;
typedef Container C;
typedef typename C::iterator It;
@@ -279,10 +271,8 @@ void testSetEmplaceHint()
}
}
-
template <class Container>
-void testMultisetInsert()
-{
+void testMultisetInsert() {
typedef typename Container::value_type ValueTp;
ConstructController* cc = getConstructController();
cc->reset();
@@ -313,7 +303,7 @@ void testMultisetInsert()
{
// Testing C::insert(std::initializer_list<ValueTp>)"
Container c;
- std::initializer_list<ValueTp> il = { ValueTp(1), ValueTp(2) };
+ std::initializer_list<ValueTp> il = {ValueTp(1), ValueTp(2)};
cc->expect<ValueTp const&>(2);
c.insert(il);
assert(!cc->unchecked());
@@ -321,7 +311,7 @@ void testMultisetInsert()
{
// Testing C::insert(Iter, Iter) for *Iter = value_type const&"
Container c;
- const ValueTp ValueList[] = { ValueTp(1), ValueTp(2), ValueTp(3) };
+ const ValueTp ValueList[] = {ValueTp(1), ValueTp(2), ValueTp(3)};
cc->expect<ValueTp const&>(3);
c.insert(std::begin(ValueList), std::end(ValueList));
assert(!cc->unchecked());
@@ -329,26 +319,23 @@ void testMultisetInsert()
{
// Testing C::insert(Iter, Iter) for *Iter = value_type&&"
Container c;
- ValueTp ValueList[] = { ValueTp(1), ValueTp(2) , ValueTp(3) };
+ ValueTp ValueList[] = {ValueTp(1), ValueTp(2), ValueTp(3)};
cc->expect<ValueTp&&>(3);
- c.insert(std::move_iterator<ValueTp*>(std::begin(ValueList)),
- std::move_iterator<ValueTp*>(std::end(ValueList)));
+ c.insert(std::move_iterator<ValueTp*>(std::begin(ValueList)), std::move_iterator<ValueTp*>(std::end(ValueList)));
assert(!cc->unchecked());
}
{
// Testing C::insert(Iter, Iter) for *Iter = value_type&"
Container c;
- ValueTp ValueList[] = { ValueTp(1), ValueTp(2) , ValueTp(1) };
+ ValueTp ValueList[] = {ValueTp(1), ValueTp(2), ValueTp(1)};
cc->expect<ValueTp&>(3);
c.insert(std::begin(ValueList), std::end(ValueList));
assert(!cc->unchecked());
}
}
-
template <class Container>
-void testMultisetEmplace()
-{
+void testMultisetEmplace() {
typedef typename Container::value_type ValueTp;
ConstructController* cc = getConstructController();
cc->reset();
diff --git a/libcxx/test/std/containers/test_compare.h b/libcxx/test/std/containers/test_compare.h
index 1b4c4916b33745a..18e0b27dc954d60 100644
--- a/libcxx/test/std/containers/test_compare.h
+++ b/libcxx/test/std/containers/test_compare.h
@@ -10,27 +10,21 @@
#define TEST_COMPARE_H
template <class T>
-struct test_equal_to
-{
- int data_;
- explicit test_equal_to() : data_(0) {}
- explicit test_equal_to(int data) : data_(data) {}
- bool operator()(const T& a, const T& b) const
- { return a == b; }
- friend bool operator==(const test_equal_to& a, const test_equal_to& b)
- { return a.data_ == b.data_; }
+struct test_equal_to {
+ int data_;
+ explicit test_equal_to() : data_(0) {}
+ explicit test_equal_to(int data) : data_(data) {}
+ bool operator()(const T& a, const T& b) const { return a == b; }
+ friend bool operator==(const test_equal_to& a, const test_equal_to& b) { return a.data_ == b.data_; }
};
template <class T>
-struct test_less
-{
- int data_;
- explicit test_less() : data_(0) {}
- explicit test_less(int data) : data_(data) {}
- bool operator()(const T& a, const T& b) const
- { return a < b; }
- friend bool operator==(const test_less& a, const test_less& b)
- { return a.data_ == b.data_; }
+struct test_less {
+ int data_;
+ explicit test_less() : data_(0) {}
+ explicit test_less(int data) : data_(data) {}
+ bool operator()(const T& a, const T& b) const { return a < b; }
+ friend bool operator==(const test_less& a, const test_less& b) { return a.data_ == b.data_; }
};
#endif // TEST_COMPARE_H
diff --git a/libcxx/test/std/containers/test_hash.h b/libcxx/test/std/containers/test_hash.h
index 64195804a8d475b..99ed907a36bf2f2 100644
--- a/libcxx/test/std/containers/test_hash.h
+++ b/libcxx/test/std/containers/test_hash.h
@@ -13,17 +13,15 @@
#include <utility>
template <class T>
-class test_hash
-{
- int data_;
+class test_hash {
+ int data_;
+
public:
- explicit test_hash(int data = 0) : data_(data) {}
+ explicit test_hash(int data = 0) : data_(data) {}
- std::size_t operator()(const T& x) const
- {return std::hash<T>()(x);}
+ std::size_t operator()(const T& x) const { return std::hash<T>()(x); }
- bool operator==(const test_hash& c) const
- {return data_ == c.data_;}
+ bool operator==(const test_hash& c) const { return data_ == c.data_; }
};
#endif // TEST_HASH_H
diff --git a/libcxx/test/std/containers/unord/from_range_unordered_containers.h b/libcxx/test/std/containers/unord/from_range_unordered_containers.h
index 7eb2a07e499c71a..b8aa73383354d27 100644
--- a/libcxx/test/std/containers/unord/from_range_unordered_containers.h
+++ b/libcxx/test/std/containers/unord/from_range_unordered_containers.h
@@ -41,7 +41,7 @@
// : unordered-container(from_range, std::forward<R>(rg), n, hf, key_equal(), a) { } // C++23
template <class Container, class Range>
-concept HasFromRangeCtr = requires (Range&& range) {
+concept HasFromRangeCtr = requires(Range&& range) {
// (from_range, range)
Container(std::from_range, std::forward<Range>(range));
// (from_range, range, n)
@@ -49,15 +49,25 @@ concept HasFromRangeCtr = requires (Range&& range) {
// (from_range, range, n, hash)
Container(std::from_range, std::forward<Range>(range), 0, std::hash<typename Container::key_type>());
// (from_range, range, n, hash, equal)
- Container(std::from_range, std::forward<Range>(range), 0, std::hash<typename Container::key_type>(),
+ Container(std::from_range,
+ std::forward<Range>(range),
+ 0,
+ std::hash<typename Container::key_type>(),
std::equal_to<typename Container::key_type>());
// (from_range, range, n, hash, equal, alloc)
- Container(std::from_range, std::forward<Range>(range), 0, std::hash<typename Container::key_type>(),
- std::equal_to<typename Container::key_type>(), std::allocator<typename Container::value_type>());
+ Container(std::from_range,
+ std::forward<Range>(range),
+ 0,
+ std::hash<typename Container::key_type>(),
+ std::equal_to<typename Container::key_type>(),
+ std::allocator<typename Container::value_type>());
// (from_range, range, n, alloc)
Container(std::from_range, std::forward<Range>(range), 0, std::allocator<typename Container::value_type>());
// (from_range, range, n, hash, alloc)
- Container(std::from_range, std::forward<Range>(range), 0, std::hash<typename Container::key_type>(),
+ Container(std::from_range,
+ std::forward<Range>(range),
+ 0,
+ std::hash<typename Container::key_type>(),
std::allocator<typename Container::value_type>());
};
@@ -78,7 +88,7 @@ constexpr bool test_map_constraints() {
return true;
}
-template <template <class ...> class Container,
+template <template <class...> class Container,
class K,
class V,
class Iter,
@@ -88,7 +98,7 @@ template <template <class ...> class Container,
class Alloc,
class ValueType = std::pair<const K, V>>
void test_unordered_map_with_input(std::vector<ValueType>&& input) {
- using DefaultHash = std::hash<int>;
+ using DefaultHash = std::hash<int>;
using DefaultEqual = std::equal_to<int>;
auto validate = [](auto&& c) {
@@ -175,7 +185,7 @@ void test_unordered_map_with_input(std::vector<ValueType>&& input) {
}
}
-template <template <class ...> class Container,
+template <template <class...> class Container,
class K,
class V,
class Iter,
@@ -194,7 +204,7 @@ void test_unordered_map() {
test_with_input({{1, 2}});
}
-template <template <class ...> class Container>
+template <template <class...> class Container>
void test_unordered_map_move_only() {
std::pair<const int, MoveOnly> input[5];
std::ranges::subrange in(std::move_iterator{input}, std::move_iterator{input + 5});
@@ -202,17 +212,15 @@ void test_unordered_map_move_only() {
[[maybe_unused]] Container<int, MoveOnly> c(std::from_range, in);
}
-template <template <class ...> class Container>
+template <template <class...> class Container>
void test_map_exception_safety_throwing_copy() {
#if !defined(TEST_HAS_NO_EXCEPTIONS)
using K = int;
using V = ThrowingCopy<3>;
- V::throwing_enabled = false;
- std::pair<const K, V> in[5] = {
- {1, {}}, {2, {}}, {3, {}}, {4, {}}, {5, {}}
- };
- V::throwing_enabled = true;
+ V::throwing_enabled = false;
+ std::pair<const K, V> in[5] = {{1, {}}, {2, {}}, {3, {}}, {4, {}}, {5, {}}};
+ V::throwing_enabled = true;
V::reset();
try {
@@ -226,20 +234,18 @@ void test_map_exception_safety_throwing_copy() {
#endif
}
-template <template <class ...> class Container, class K, class V>
+template <template <class...> class Container, class K, class V>
void test_map_exception_safety_throwing_allocator() {
#if !defined(TEST_HAS_NO_EXCEPTIONS)
using ValueType = std::pair<const K, V>;
- ValueType in[] = {
- ValueType{K{1}, V{1}}
- };
+ ValueType in[] = {ValueType{K{1}, V{1}}};
try {
ThrowingAllocator<ValueType> alloc;
globalMemCounter.reset();
- Container<K, V, test_hash<K>, test_equal_to<K>, ThrowingAllocator<ValueType>>
- c(std::from_range, in, /*n=*/0, alloc);
+ Container<K, V, test_hash<K>, test_equal_to<K>, ThrowingAllocator<ValueType>> c(
+ std::from_range, in, /*n=*/0, alloc);
assert(false); // The constructor call should throw.
} catch (int) {
@@ -249,7 +255,7 @@ void test_map_exception_safety_throwing_allocator() {
}
template <class Container, class Range>
-concept SetHasFromRangeCtr = requires (Range&& range) {
+concept SetHasFromRangeCtr = requires(Range&& range) {
// (from_range, range)
Container(std::from_range, std::forward<Range>(range));
// (from_range, range, n)
@@ -257,15 +263,25 @@ concept SetHasFromRangeCtr = requires (Range&& range) {
// (from_range, range, n, hash)
Container(std::from_range, std::forward<Range>(range), 0, std::hash<typename Container::value_type>());
// (from_range, range, n, hash, equal)
- Container(std::from_range, std::forward<Range>(range), 0, std::hash<typename Container::value_type>(),
+ Container(std::from_range,
+ std::forward<Range>(range),
+ 0,
+ std::hash<typename Container::value_type>(),
std::equal_to<typename Container::value_type>());
// (from_range, range, n, hash, equal, alloc)
- Container(std::from_range, std::forward<Range>(range), 0, std::hash<typename Container::value_type>(),
- std::equal_to<typename Container::value_type>(), std::allocator<typename Container::value_type>());
+ Container(std::from_range,
+ std::forward<Range>(range),
+ 0,
+ std::hash<typename Container::value_type>(),
+ std::equal_to<typename Container::value_type>(),
+ std::allocator<typename Container::value_type>());
// (from_range, range, n, alloc)
Container(std::from_range, std::forward<Range>(range), 0, std::allocator<typename Container::value_type>());
// (from_range, range, n, hash, alloc)
- Container(std::from_range, std::forward<Range>(range), 0, std::hash<typename Container::value_type>(),
+ Container(std::from_range,
+ std::forward<Range>(range),
+ 0,
+ std::hash<typename Container::value_type>(),
std::allocator<typename Container::value_type>());
};
@@ -283,15 +299,9 @@ constexpr bool test_set_constraints() {
return true;
}
-template <template <class ...> class Container,
- class T,
- class Iter,
- class Sent,
- class Hash,
- class Equal,
- class Alloc>
+template <template <class...> class Container, class T, class Iter, class Sent, class Hash, class Equal, class Alloc>
void test_unordered_set_with_input(std::vector<T>&& input) {
- using DefaultHash = std::hash<int>;
+ using DefaultHash = std::hash<int>;
using DefaultEqual = std::equal_to<int>;
auto validate = [](auto&& c) {
@@ -378,13 +388,7 @@ void test_unordered_set_with_input(std::vector<T>&& input) {
}
}
-template <template <class ...> class Container,
- class T,
- class Iter,
- class Sent,
- class Hash,
- class Equal,
- class Alloc>
+template <template <class...> class Container, class T, class Iter, class Sent, class Hash, class Equal, class Alloc>
void test_unordered_set() {
auto test_with_input = &test_unordered_set_with_input<Container, T, Iter, Sent, Hash, Equal, Alloc>;
@@ -396,7 +400,7 @@ void test_unordered_set() {
test_with_input({5});
}
-template <template <class ...> class Container>
+template <template <class...> class Container>
void test_unordered_set_move_only() {
MoveOnly input[5];
std::ranges::subrange in(std::move_iterator{input}, std::move_iterator{input + 5});
@@ -404,7 +408,7 @@ void test_unordered_set_move_only() {
[[maybe_unused]] Container<MoveOnly> c(std::from_range, in);
}
-template <template <class ...> class Container>
+template <template <class...> class Container>
void test_set_exception_safety_throwing_copy() {
#if !defined(TEST_HAS_NO_EXCEPTIONS)
using T = ThrowingCopy<3>;
@@ -422,7 +426,7 @@ void test_set_exception_safety_throwing_copy() {
#endif
}
-template <template <class ...> class Container, class T>
+template <template <class...> class Container, class T>
void test_set_exception_safety_throwing_allocator() {
#if !defined(TEST_HAS_NO_EXCEPTIONS)
T in[] = {1, 2, 3};
diff --git a/libcxx/test/std/containers/unord/iterator_
diff erence_type.pass.cpp b/libcxx/test/std/containers/unord/iterator_
diff erence_type.pass.cpp
index fc5ccbee34f2255..b69127282f4b064 100644
--- a/libcxx/test/std/containers/unord/iterator_
diff erence_type.pass.cpp
+++ b/libcxx/test/std/containers/unord/iterator_
diff erence_type.pass.cpp
@@ -14,7 +14,6 @@
#include "min_allocator.h"
#include "test_allocator.h"
-
template <class Map, class ValueTp, class PtrT, class CPtrT>
void testUnorderedMap() {
typedef typename Map::
diff erence_type Diff;
@@ -48,13 +47,10 @@ void testUnorderedMap() {
}
}
-
template <class Set, class ValueTp, class CPtrT>
void testUnorderedSet() {
- static_assert((std::is_convertible<typename Set::iterator,
- typename Set::const_iterator>::value), "");
- static_assert((std::is_convertible<typename Set::local_iterator,
- typename Set::const_local_iterator>::value), "");
+ static_assert((std::is_convertible<typename Set::iterator, typename Set::const_iterator>::value), "");
+ static_assert((std::is_convertible<typename Set::local_iterator, typename Set::const_local_iterator>::value), "");
typedef typename Set::
diff erence_type Diff;
{
typedef typename Set::iterator It;
@@ -62,7 +58,6 @@ void testUnorderedSet() {
static_assert((std::is_same<typename It::reference, ValueTp const&>::value), "");
static_assert((std::is_same<typename It::pointer, CPtrT>::value), "");
static_assert((std::is_same<typename It::
diff erence_type, Diff>::value), "");
-
}
{
typedef typename Set::local_iterator It;
diff --git a/libcxx/test/std/containers/unord/unord.map/allocator_mismatch.verify.cpp b/libcxx/test/std/containers/unord/unord.map/allocator_mismatch.verify.cpp
index e57505d889f3737..189c44cec52fb3b 100644
--- a/libcxx/test/std/containers/unord/unord.map/allocator_mismatch.verify.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/allocator_mismatch.verify.cpp
@@ -12,4 +12,4 @@
#include <unordered_map>
std::unordered_map<int, int, std::hash<int>, std::less<int>, std::allocator<long> > m;
- // expected-error-re@*:* {{static assertion failed{{.*}}Allocator::value_type must be same type as value_type}}
+// expected-error-re@*:* {{static assertion failed{{.*}}Allocator::value_type must be same type as value_type}}
diff --git a/libcxx/test/std/containers/unord/unord.map/bucket.pass.cpp b/libcxx/test/std/containers/unord/unord.map/bucket.pass.cpp
index 14e5b2fe0ad36b3..a842828c7f64948 100644
--- a/libcxx/test/std/containers/unord/unord.map/bucket.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/bucket.pass.cpp
@@ -22,47 +22,48 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_map<int, std::string> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- const C c(std::begin(a), std::end(a));
- std::size_t bc = c.bucket_count();
- assert(bc >= 5);
- for (std::size_t i = 0; i < 13; ++i)
- LIBCPP_ASSERT(c.bucket(i) == i % bc);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_map<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ const C c(std::begin(a), std::end(a));
+ std::size_t bc = c.bucket_count();
+ assert(bc >= 5);
+ for (std::size_t i = 0; i < 13; ++i)
+ LIBCPP_ASSERT(c.bucket(i) == i % bc);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- const C c(std::begin(a), std::end(a));
- std::size_t bc = c.bucket_count();
- assert(bc >= 5);
- for (std::size_t i = 0; i < 13; ++i)
- LIBCPP_ASSERT(c.bucket(i) == i % bc);
- }
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ const C c(std::begin(a), std::end(a));
+ std::size_t bc = c.bucket_count();
+ assert(bc >= 5);
+ for (std::size_t i = 0; i < 13; ++i)
+ LIBCPP_ASSERT(c.bucket(i) == i % bc);
+ }
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/bucket_count.pass.cpp b/libcxx/test/std/containers/unord/unord.map/bucket_count.pass.cpp
index 6283408cef6f060..23ce82965571481 100644
--- a/libcxx/test/std/containers/unord/unord.map/bucket_count.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/bucket_count.pass.cpp
@@ -22,55 +22,60 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_map<int, std::string> C;
- const C c;
- LIBCPP_ASSERT(c.bucket_count() == 0);
- }
- {
- typedef std::unordered_map<int, std::string> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- const C c(std::begin(a), std::end(a));
- assert(c.bucket_count() >= 8);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_map<int, std::string> C;
+ const C c;
+ LIBCPP_ASSERT(c.bucket_count() == 0);
+ }
+ {
+ typedef std::unordered_map<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ const C c(std::begin(a), std::end(a));
+ assert(c.bucket_count() >= 8);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- const C c;
- LIBCPP_ASSERT(c.bucket_count() == 0);
- }
- {
- typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- const C c(std::begin(a), std::end(a));
- assert(c.bucket_count() >= 8);
- }
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ const C c;
+ LIBCPP_ASSERT(c.bucket_count() == 0);
+ }
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ const C c(std::begin(a), std::end(a));
+ assert(c.bucket_count() >= 8);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.map/bucket_size.pass.cpp b/libcxx/test/std/containers/unord/unord.map/bucket_size.pass.cpp
index 110ac5e45eec1d4..b1ad906d0540575 100644
--- a/libcxx/test/std/containers/unord/unord.map/bucket_size.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/bucket_size.pass.cpp
@@ -22,51 +22,52 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_map<int, std::string> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- const C c(std::begin(a), std::end(a));
- assert(c.bucket_count() >= 5);
- LIBCPP_ASSERT(c.bucket_size(0) == 0);
- LIBCPP_ASSERT(c.bucket_size(1) == 1);
- LIBCPP_ASSERT(c.bucket_size(2) == 1);
- LIBCPP_ASSERT(c.bucket_size(3) == 1);
- LIBCPP_ASSERT(c.bucket_size(4) == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_map<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ const C c(std::begin(a), std::end(a));
+ assert(c.bucket_count() >= 5);
+ LIBCPP_ASSERT(c.bucket_size(0) == 0);
+ LIBCPP_ASSERT(c.bucket_size(1) == 1);
+ LIBCPP_ASSERT(c.bucket_size(2) == 1);
+ LIBCPP_ASSERT(c.bucket_size(3) == 1);
+ LIBCPP_ASSERT(c.bucket_size(4) == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- const C c(std::begin(a), std::end(a));
- assert(c.bucket_count() >= 5);
- LIBCPP_ASSERT(c.bucket_size(0) == 0);
- LIBCPP_ASSERT(c.bucket_size(1) == 1);
- LIBCPP_ASSERT(c.bucket_size(2) == 1);
- LIBCPP_ASSERT(c.bucket_size(3) == 1);
- LIBCPP_ASSERT(c.bucket_size(4) == 1);
- }
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ const C c(std::begin(a), std::end(a));
+ assert(c.bucket_count() >= 5);
+ LIBCPP_ASSERT(c.bucket_size(0) == 0);
+ LIBCPP_ASSERT(c.bucket_size(1) == 1);
+ LIBCPP_ASSERT(c.bucket_size(2) == 1);
+ LIBCPP_ASSERT(c.bucket_size(3) == 1);
+ LIBCPP_ASSERT(c.bucket_size(4) == 1);
+ }
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/compare.pass.cpp b/libcxx/test/std/containers/unord/unord.map/compare.pass.cpp
index a8474f8f0bdc8cb..c122ca75ad238a6 100644
--- a/libcxx/test/std/containers/unord/unord.map/compare.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/compare.pass.cpp
@@ -21,8 +21,9 @@
#include "test_macros.h"
struct Key {
- template <typename T> Key(const T&) {}
- bool operator== (const Key&) const { return true; }
+ template <typename T>
+ Key(const T&) {}
+ bool operator==(const Key&) const { return true; }
};
template <>
@@ -30,16 +31,15 @@ struct std::hash<Key> {
std::size_t operator()(Key const&) const { return 0; }
};
-int main(int, char**)
-{
- typedef std::unordered_map<Key, int> MapT;
- typedef MapT::iterator Iter;
- MapT map;
- Iter it = map.find(Key(0));
- assert(it == map.end());
- std::pair<Iter, bool> result = map.insert(std::make_pair(Key(0), 42));
- assert(result.second);
- assert(result.first->second == 42);
+int main(int, char**) {
+ typedef std::unordered_map<Key, int> MapT;
+ typedef MapT::iterator Iter;
+ MapT map;
+ Iter it = map.find(Key(0));
+ assert(it == map.end());
+ std::pair<Iter, bool> result = map.insert(std::make_pair(Key(0), 42));
+ assert(result.second);
+ assert(result.first->second == 42);
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/contains.pass.cpp b/libcxx/test/std/containers/unord/unord.map/contains.pass.cpp
index e757517fc8d13fe..5fde843433f1f42 100644
--- a/libcxx/test/std/containers/unord/unord.map/contains.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/contains.pass.cpp
@@ -17,45 +17,44 @@
template <typename T, typename P, typename B, typename... Pairs>
void test(B bad, Pairs... args) {
- T map;
- P pairs[] = {args...};
+ T map;
+ P pairs[] = {args...};
- for (auto& p : pairs) map.insert(p);
- for (auto& p : pairs) assert(map.contains(p.first));
+ for (auto& p : pairs)
+ map.insert(p);
+ for (auto& p : pairs)
+ assert(map.contains(p.first));
- assert(!map.contains(bad));
+ assert(!map.contains(bad));
}
-struct E { int a = 1; double b = 1; char c = 1; };
-
-int main(int, char**)
-{
- {
- test<std::unordered_map<char, int>, std::pair<char, int> >(
- 'e', std::make_pair('a', 10), std::make_pair('b', 11),
- std::make_pair('c', 12), std::make_pair('d', 13));
-
- test<std::unordered_map<char, char>, std::pair<char, char> >(
- 'e', std::make_pair('a', 'a'), std::make_pair('b', 'a'),
- std::make_pair('c', 'a'), std::make_pair('d', 'b'));
-
- test<std::unordered_map<int, E>, std::pair<int, E> >(
- -1, std::make_pair(1, E{}), std::make_pair(2, E{}),
- std::make_pair(3, E{}), std::make_pair(4, E{}));
- }
- {
- test<std::unordered_multimap<char, int>, std::pair<char, int> >(
- 'e', std::make_pair('a', 10), std::make_pair('b', 11),
- std::make_pair('c', 12), std::make_pair('d', 13));
-
- test<std::unordered_multimap<char, char>, std::pair<char, char> >(
- 'e', std::make_pair('a', 'a'), std::make_pair('b', 'a'),
- std::make_pair('c', 'a'), std::make_pair('d', 'b'));
-
- test<std::unordered_multimap<int, E>, std::pair<int, E> >(
- -1, std::make_pair(1, E{}), std::make_pair(2, E{}),
- std::make_pair(3, E{}), std::make_pair(4, E{}));
- }
-
- return 0;
+struct E {
+ int a = 1;
+ double b = 1;
+ char c = 1;
+};
+
+int main(int, char**) {
+ {
+ test<std::unordered_map<char, int>, std::pair<char, int> >(
+ 'e', std::make_pair('a', 10), std::make_pair('b', 11), std::make_pair('c', 12), std::make_pair('d', 13));
+
+ test<std::unordered_map<char, char>, std::pair<char, char> >(
+ 'e', std::make_pair('a', 'a'), std::make_pair('b', 'a'), std::make_pair('c', 'a'), std::make_pair('d', 'b'));
+
+ test<std::unordered_map<int, E>, std::pair<int, E> >(
+ -1, std::make_pair(1, E{}), std::make_pair(2, E{}), std::make_pair(3, E{}), std::make_pair(4, E{}));
+ }
+ {
+ test<std::unordered_multimap<char, int>, std::pair<char, int> >(
+ 'e', std::make_pair('a', 10), std::make_pair('b', 11), std::make_pair('c', 12), std::make_pair('d', 13));
+
+ test<std::unordered_multimap<char, char>, std::pair<char, char> >(
+ 'e', std::make_pair('a', 'a'), std::make_pair('b', 'a'), std::make_pair('c', 'a'), std::make_pair('d', 'b'));
+
+ test<std::unordered_multimap<int, E>, std::pair<int, E> >(
+ -1, std::make_pair(1, E{}), std::make_pair(2, E{}), std::make_pair(3, E{}), std::make_pair(4, E{}));
+ }
+
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/contains.transparent.pass.cpp b/libcxx/test/std/containers/unord/unord.map/contains.transparent.pass.cpp
index b8742cdb4b6c4b4..a774995892e25a0 100644
--- a/libcxx/test/std/containers/unord/unord.map/contains.transparent.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/contains.transparent.pass.cpp
@@ -20,44 +20,43 @@
#include <unordered_map>
#include "test_transparent_unordered.h"
-int main(int, char**)
-{
- using key_type = StoredType<int>;
-
- {
- // Make sure conversions don't happen for transparent non-final hasher and key_equal
- using M = unord_map_type<std::unordered_map, transparent_hash, std::equal_to<>>;
- test_transparent_contains<M>({{1, 2}, {2, 3}});
- test_transparent_contains<const M>({{1, 2}, {2, 3}});
- }
-
- {
- // Make sure conversions don't happen for transparent final hasher and key_equal
- using M = unord_map_type<std::unordered_map, transparent_hash_final, transparent_equal_final>;
- test_transparent_contains<M>({{1, 2}, {2, 3}});
- test_transparent_contains<const M>({{1, 2}, {2, 3}});
- }
-
- {
- // Make sure conversions do happen for non-transparent hasher
- using M = unord_map_type<std::unordered_map, non_transparent_hash, std::equal_to<>>;
- test_non_transparent_contains<M>({{1, 2}, {2, 3}});
- test_non_transparent_contains<const M>({{1, 2}, {2, 3}});
- }
-
- {
- // Make sure conversions do happen for non-transparent key_equal
- using M = unord_map_type<std::unordered_map, transparent_hash, std::equal_to<key_type>>;
- test_non_transparent_contains<M>({{1, 2}, {2, 3}});
- test_non_transparent_contains<const M>({{1, 2}, {2, 3}});
- }
-
- {
- // Make sure conversions do happen for both non-transparent hasher and key_equal
- using M = unord_map_type<std::unordered_map, non_transparent_hash, std::equal_to<key_type>>;
- test_non_transparent_contains<M>({{1, 2}, {2, 3}});
- test_non_transparent_contains<const M>({{1, 2}, {2, 3}});
- }
-
- return 0;
+int main(int, char**) {
+ using key_type = StoredType<int>;
+
+ {
+ // Make sure conversions don't happen for transparent non-final hasher and key_equal
+ using M = unord_map_type<std::unordered_map, transparent_hash, std::equal_to<>>;
+ test_transparent_contains<M>({{1, 2}, {2, 3}});
+ test_transparent_contains<const M>({{1, 2}, {2, 3}});
+ }
+
+ {
+ // Make sure conversions don't happen for transparent final hasher and key_equal
+ using M = unord_map_type<std::unordered_map, transparent_hash_final, transparent_equal_final>;
+ test_transparent_contains<M>({{1, 2}, {2, 3}});
+ test_transparent_contains<const M>({{1, 2}, {2, 3}});
+ }
+
+ {
+ // Make sure conversions do happen for non-transparent hasher
+ using M = unord_map_type<std::unordered_map, non_transparent_hash, std::equal_to<>>;
+ test_non_transparent_contains<M>({{1, 2}, {2, 3}});
+ test_non_transparent_contains<const M>({{1, 2}, {2, 3}});
+ }
+
+ {
+ // Make sure conversions do happen for non-transparent key_equal
+ using M = unord_map_type<std::unordered_map, transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_contains<M>({{1, 2}, {2, 3}});
+ test_non_transparent_contains<const M>({{1, 2}, {2, 3}});
+ }
+
+ {
+ // Make sure conversions do happen for both non-transparent hasher and key_equal
+ using M = unord_map_type<std::unordered_map, non_transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_contains<M>({{1, 2}, {2, 3}});
+ test_non_transparent_contains<const M>({{1, 2}, {2, 3}});
+ }
+
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/count.pass.cpp b/libcxx/test/std/containers/unord/unord.map/count.pass.cpp
index a003208ab0256df..34bbbd6d2b2435e 100644
--- a/libcxx/test/std/containers/unord/unord.map/count.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/count.pass.cpp
@@ -22,46 +22,47 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_map<int, std::string> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- const C c(std::begin(a), std::end(a));
- assert(c.count(30) == 1);
- assert(c.count(5) == 0);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_map<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ const C c(std::begin(a), std::end(a));
+ assert(c.count(30) == 1);
+ assert(c.count(5) == 0);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- const C c(std::begin(a), std::end(a));
- assert(c.count(30) == 1);
- assert(c.count(5) == 0);
- }
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ const C c(std::begin(a), std::end(a));
+ assert(c.count(30) == 1);
+ assert(c.count(5) == 0);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.map/count.transparent.pass.cpp b/libcxx/test/std/containers/unord/unord.map/count.transparent.pass.cpp
index 1ae5a94d256a50e..ad7dafedfeb4847 100644
--- a/libcxx/test/std/containers/unord/unord.map/count.transparent.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/count.transparent.pass.cpp
@@ -21,44 +21,43 @@
#include "test_transparent_unordered.h"
-int main(int, char**)
-{
- using key_type = StoredType<int>;
-
- {
- // Make sure conversions don't happen for transparent non-final hasher and key_equal
- using M = unord_map_type<std::unordered_map, transparent_hash, std::equal_to<>>;
- test_transparent_count<M>({{1, 2}, {2, 3}});
- test_transparent_count<const M>({{1, 2}, {2, 3}});
- }
-
- {
- // Make sure conversions don't happen for transparent final hasher and key_equal
- using M = unord_map_type<std::unordered_map, transparent_hash_final, transparent_equal_final>;
- test_transparent_count<M>({{1, 2}, {2, 3}});
- test_transparent_count<const M>({{1, 2}, {2, 3}});
- }
-
- {
- // Make sure conversions do happen for non-transparent hasher
- using M = unord_map_type<std::unordered_map, non_transparent_hash, std::equal_to<>>;
- test_non_transparent_count<M>({{1, 2}, {2, 3}});
- test_non_transparent_count<const M>({{1, 2}, {2, 3}});
- }
-
- {
- // Make sure conversions do happen for non-transparent key_equal
- using M = unord_map_type<std::unordered_map, transparent_hash, std::equal_to<key_type>>;
- test_non_transparent_count<M>({{1, 2}, {2, 3}});
- test_non_transparent_count<const M>({{1, 2}, {2, 3}});
- }
-
- {
- // Make sure conversions do happen for both non-transparent hasher and key_equal
- using M = unord_map_type<std::unordered_map, non_transparent_hash, std::equal_to<key_type>>;
- test_non_transparent_count<M>({{1, 2}, {2, 3}});
- test_non_transparent_count<const M>({{1, 2}, {2, 3}});
- }
-
- return 0;
+int main(int, char**) {
+ using key_type = StoredType<int>;
+
+ {
+ // Make sure conversions don't happen for transparent non-final hasher and key_equal
+ using M = unord_map_type<std::unordered_map, transparent_hash, std::equal_to<>>;
+ test_transparent_count<M>({{1, 2}, {2, 3}});
+ test_transparent_count<const M>({{1, 2}, {2, 3}});
+ }
+
+ {
+ // Make sure conversions don't happen for transparent final hasher and key_equal
+ using M = unord_map_type<std::unordered_map, transparent_hash_final, transparent_equal_final>;
+ test_transparent_count<M>({{1, 2}, {2, 3}});
+ test_transparent_count<const M>({{1, 2}, {2, 3}});
+ }
+
+ {
+ // Make sure conversions do happen for non-transparent hasher
+ using M = unord_map_type<std::unordered_map, non_transparent_hash, std::equal_to<>>;
+ test_non_transparent_count<M>({{1, 2}, {2, 3}});
+ test_non_transparent_count<const M>({{1, 2}, {2, 3}});
+ }
+
+ {
+ // Make sure conversions do happen for non-transparent key_equal
+ using M = unord_map_type<std::unordered_map, transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_count<M>({{1, 2}, {2, 3}});
+ test_non_transparent_count<const M>({{1, 2}, {2, 3}});
+ }
+
+ {
+ // Make sure conversions do happen for both non-transparent hasher and key_equal
+ using M = unord_map_type<std::unordered_map, non_transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_count<M>({{1, 2}, {2, 3}});
+ test_non_transparent_count<const M>({{1, 2}, {2, 3}});
+ }
+
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/empty.pass.cpp b/libcxx/test/std/containers/unord/unord.map/empty.pass.cpp
index da6d48df2d57c83..bf2219f34a8116f 100644
--- a/libcxx/test/std/containers/unord/unord.map/empty.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/empty.pass.cpp
@@ -18,9 +18,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::unordered_map<int, double> M;
M m;
ASSERT_NOEXCEPT(m.empty());
@@ -29,10 +28,12 @@ int main(int, char**)
assert(!m.empty());
m.clear();
assert(m.empty());
- }
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_map<int, double, std::hash<int>, std::equal_to<int>, min_allocator<std::pair<const int, double>>> M;
+ {
+ typedef std::
+ unordered_map<int, double, std::hash<int>, std::equal_to<int>, min_allocator<std::pair<const int, double>>>
+ M;
M m;
ASSERT_NOEXCEPT(m.empty());
assert(m.empty());
@@ -40,7 +41,7 @@ int main(int, char**)
assert(!m.empty());
m.clear();
assert(m.empty());
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.map/empty.verify.cpp b/libcxx/test/std/containers/unord/unord.map/empty.verify.cpp
index ada96fdf89157d0..da8f23cf9da0d58 100644
--- a/libcxx/test/std/containers/unord/unord.map/empty.verify.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/empty.verify.cpp
@@ -17,6 +17,6 @@
#include <unordered_map>
void f() {
- std::unordered_map<int, int> c;
- c.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::unordered_map<int, int> c;
+ c.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}
diff --git a/libcxx/test/std/containers/unord/unord.map/eq.pass.cpp b/libcxx/test/std/containers/unord/unord.map/eq.pass.cpp
index 6fd22ab992ee38e..51c804c9292d186 100644
--- a/libcxx/test/std/containers/unord/unord.map/eq.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/eq.pass.cpp
@@ -28,173 +28,180 @@
#include "test_comparisons.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_map<int, std::string> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- const C c1(std::begin(a), std::end(a));
- const C c2;
- assert(testEquality(c1, c2, false));
- }
- {
- typedef std::unordered_map<int, std::string> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- const C c1(std::begin(a), std::end(a));
- const C c2 = c1;
- assert(testEquality(c1, c2, true));
- }
- {
- typedef std::unordered_map<int, std::string> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- C c1(std::begin(a), std::end(a));
- C c2 = c1;
- c2.rehash(30);
- assert(testEquality(c1, c2, true));
- c2.insert(P(90, "ninety"));
- assert(testEquality(c1, c2, false));
- c1.insert(P(90, "ninety"));
- assert(testEquality(c1, c2, true));
- }
- {
- typedef std::unordered_map<int, std::string> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- C c1(std::begin(a), std::end(a));
- C c2 = c1;
- assert(testEquality(c1, c2, true));
- c1.insert(P(90, "ninety"));
- c2.insert(P(100, "onehundred"));
- assert(testEquality(c1, c2, false));
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_map<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ const C c1(std::begin(a), std::end(a));
+ const C c2;
+ assert(testEquality(c1, c2, false));
+ }
+ {
+ typedef std::unordered_map<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ const C c1(std::begin(a), std::end(a));
+ const C c2 = c1;
+ assert(testEquality(c1, c2, true));
+ }
+ {
+ typedef std::unordered_map<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c1(std::begin(a), std::end(a));
+ C c2 = c1;
+ c2.rehash(30);
+ assert(testEquality(c1, c2, true));
+ c2.insert(P(90, "ninety"));
+ assert(testEquality(c1, c2, false));
+ c1.insert(P(90, "ninety"));
+ assert(testEquality(c1, c2, true));
+ }
+ {
+ typedef std::unordered_map<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c1(std::begin(a), std::end(a));
+ C c2 = c1;
+ assert(testEquality(c1, c2, true));
+ c1.insert(P(90, "ninety"));
+ c2.insert(P(100, "onehundred"));
+ assert(testEquality(c1, c2, false));
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- const C c1(std::begin(a), std::end(a));
- const C c2;
- assert(testEquality(c1, c2, false));
- }
- {
- typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- const C c1(std::begin(a), std::end(a));
- const C c2 = c1;
- assert(testEquality(c1, c2, true));
- }
- {
- typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- C c1(std::begin(a), std::end(a));
- C c2 = c1;
- c2.rehash(30);
- assert(testEquality(c1, c2, true));
- c2.insert(P(90, "ninety"));
- assert(testEquality(c1, c2, false));
- c1.insert(P(90, "ninety"));
- assert(testEquality(c1, c2, true));
- }
- {
- typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- C c1(std::begin(a), std::end(a));
- C c2 = c1;
- assert(testEquality(c1, c2, true));
- c1.insert(P(90, "ninety"));
- c2.insert(P(100, "onehundred"));
- assert(testEquality(c1, c2, false));
- }
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ const C c1(std::begin(a), std::end(a));
+ const C c2;
+ assert(testEquality(c1, c2, false));
+ }
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ const C c1(std::begin(a), std::end(a));
+ const C c2 = c1;
+ assert(testEquality(c1, c2, true));
+ }
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c1(std::begin(a), std::end(a));
+ C c2 = c1;
+ c2.rehash(30);
+ assert(testEquality(c1, c2, true));
+ c2.insert(P(90, "ninety"));
+ assert(testEquality(c1, c2, false));
+ c1.insert(P(90, "ninety"));
+ assert(testEquality(c1, c2, true));
+ }
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c1(std::begin(a), std::end(a));
+ C c2 = c1;
+ assert(testEquality(c1, c2, true));
+ c1.insert(P(90, "ninety"));
+ c2.insert(P(100, "onehundred"));
+ assert(testEquality(c1, c2, false));
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.map/equal_range.transparent.pass.cpp b/libcxx/test/std/containers/unord/unord.map/equal_range.transparent.pass.cpp
index 07b34f3110e3e61..5504a5a998f1bbe 100644
--- a/libcxx/test/std/containers/unord/unord.map/equal_range.transparent.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/equal_range.transparent.pass.cpp
@@ -21,44 +21,43 @@
#include "test_transparent_unordered.h"
-int main(int, char**)
-{
- using key_type = StoredType<int>;
-
- {
- // Make sure conversions don't happen for transparent non-final hasher and key_equal
- using M = unord_map_type<std::unordered_map, transparent_hash, std::equal_to<>>;
- test_transparent_equal_range<M>({{1, 2}, {2, 3}});
- test_transparent_equal_range<const M>({{1, 2}, {2, 3}});
- }
-
- {
- // Make sure conversions don't happen for transparent final hasher and key_equal
- using M = unord_map_type<std::unordered_map, transparent_hash_final, transparent_equal_final>;
- test_transparent_equal_range<M>({{1, 2}, {2, 3}});
- test_transparent_equal_range<const M>({{1, 2}, {2, 3}});
- }
-
- {
- // Make sure conversions do happen for non-transparent hasher
- using M = unord_map_type<std::unordered_map, non_transparent_hash, std::equal_to<>>;
- test_non_transparent_equal_range<M>({{1, 2}, {2, 3}});
- test_non_transparent_equal_range<const M>({{1, 2}, {2, 3}});
- }
-
- {
- // Make sure conversions do happen for non-transparent key_equal
- using M = unord_map_type<std::unordered_map, transparent_hash, std::equal_to<key_type>>;
- test_non_transparent_equal_range<M>({{1, 2}, {2, 3}});
- test_non_transparent_equal_range<const M>({{1, 2}, {2, 3}});
- }
-
- {
- // Make sure conversions do happen for both non-transparent hasher and key_equal
- using M = unord_map_type<std::unordered_map, non_transparent_hash, std::equal_to<key_type>>;
- test_non_transparent_equal_range<M>({{1, 2}, {2, 3}});
- test_non_transparent_equal_range<const M>({{1, 2}, {2, 3}});
- }
-
- return 0;
+int main(int, char**) {
+ using key_type = StoredType<int>;
+
+ {
+ // Make sure conversions don't happen for transparent non-final hasher and key_equal
+ using M = unord_map_type<std::unordered_map, transparent_hash, std::equal_to<>>;
+ test_transparent_equal_range<M>({{1, 2}, {2, 3}});
+ test_transparent_equal_range<const M>({{1, 2}, {2, 3}});
+ }
+
+ {
+ // Make sure conversions don't happen for transparent final hasher and key_equal
+ using M = unord_map_type<std::unordered_map, transparent_hash_final, transparent_equal_final>;
+ test_transparent_equal_range<M>({{1, 2}, {2, 3}});
+ test_transparent_equal_range<const M>({{1, 2}, {2, 3}});
+ }
+
+ {
+ // Make sure conversions do happen for non-transparent hasher
+ using M = unord_map_type<std::unordered_map, non_transparent_hash, std::equal_to<>>;
+ test_non_transparent_equal_range<M>({{1, 2}, {2, 3}});
+ test_non_transparent_equal_range<const M>({{1, 2}, {2, 3}});
+ }
+
+ {
+ // Make sure conversions do happen for non-transparent key_equal
+ using M = unord_map_type<std::unordered_map, transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_equal_range<M>({{1, 2}, {2, 3}});
+ test_non_transparent_equal_range<const M>({{1, 2}, {2, 3}});
+ }
+
+ {
+ // Make sure conversions do happen for both non-transparent hasher and key_equal
+ using M = unord_map_type<std::unordered_map, non_transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_equal_range<M>({{1, 2}, {2, 3}});
+ test_non_transparent_equal_range<const M>({{1, 2}, {2, 3}});
+ }
+
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/equal_range_const.pass.cpp b/libcxx/test/std/containers/unord/unord.map/equal_range_const.pass.cpp
index eb8beaec3db1444..c4c3925fea063ca 100644
--- a/libcxx/test/std/containers/unord/unord.map/equal_range_const.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/equal_range_const.pass.cpp
@@ -22,56 +22,57 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_map<int, std::string> C;
- typedef C::const_iterator I;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- const C c(std::begin(a), std::end(a));
- std::pair<I, I> r = c.equal_range(30);
- assert(std::distance(r.first, r.second) == 1);
- assert(r.first->first == 30);
- assert(r.first->second == "thirty");
- r = c.equal_range(5);
- assert(std::distance(r.first, r.second) == 0);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_map<int, std::string> C;
+ typedef C::const_iterator I;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ const C c(std::begin(a), std::end(a));
+ std::pair<I, I> r = c.equal_range(30);
+ assert(std::distance(r.first, r.second) == 1);
+ assert(r.first->first == 30);
+ assert(r.first->second == "thirty");
+ r = c.equal_range(5);
+ assert(std::distance(r.first, r.second) == 0);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef C::const_iterator I;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- const C c(std::begin(a), std::end(a));
- std::pair<I, I> r = c.equal_range(30);
- assert(std::distance(r.first, r.second) == 1);
- assert(r.first->first == 30);
- assert(r.first->second == "thirty");
- r = c.equal_range(5);
- assert(std::distance(r.first, r.second) == 0);
- }
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef C::const_iterator I;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ const C c(std::begin(a), std::end(a));
+ std::pair<I, I> r = c.equal_range(30);
+ assert(std::distance(r.first, r.second) == 1);
+ assert(r.first->first == 30);
+ assert(r.first->second == "thirty");
+ r = c.equal_range(5);
+ assert(std::distance(r.first, r.second) == 0);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.map/equal_range_non_const.pass.cpp b/libcxx/test/std/containers/unord/unord.map/equal_range_non_const.pass.cpp
index f0e268edfc71634..fc188f748edf9a2 100644
--- a/libcxx/test/std/containers/unord/unord.map/equal_range_non_const.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/equal_range_non_const.pass.cpp
@@ -22,56 +22,57 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_map<int, std::string> C;
- typedef C::iterator I;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- C c(std::begin(a), std::end(a));
- std::pair<I, I> r = c.equal_range(30);
- assert(std::distance(r.first, r.second) == 1);
- assert(r.first->first == 30);
- assert(r.first->second == "thirty");
- r = c.equal_range(5);
- assert(std::distance(r.first, r.second) == 0);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_map<int, std::string> C;
+ typedef C::iterator I;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c(std::begin(a), std::end(a));
+ std::pair<I, I> r = c.equal_range(30);
+ assert(std::distance(r.first, r.second) == 1);
+ assert(r.first->first == 30);
+ assert(r.first->second == "thirty");
+ r = c.equal_range(5);
+ assert(std::distance(r.first, r.second) == 0);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef C::iterator I;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- C c(std::begin(a), std::end(a));
- std::pair<I, I> r = c.equal_range(30);
- assert(std::distance(r.first, r.second) == 1);
- assert(r.first->first == 30);
- assert(r.first->second == "thirty");
- r = c.equal_range(5);
- assert(std::distance(r.first, r.second) == 0);
- }
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef C::iterator I;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c(std::begin(a), std::end(a));
+ std::pair<I, I> r = c.equal_range(30);
+ assert(std::distance(r.first, r.second) == 1);
+ assert(r.first->first == 30);
+ assert(r.first->second == "thirty");
+ r = c.equal_range(5);
+ assert(std::distance(r.first, r.second) == 0);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.map/erase_if.pass.cpp b/libcxx/test/std/containers/unord/unord.map/erase_if.pass.cpp
index 329ead0811944b0..f12ca7f9f268ce6 100644
--- a/libcxx/test/std/containers/unord/unord.map/erase_if.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/erase_if.pass.cpp
@@ -22,12 +22,11 @@
using Init = std::initializer_list<int>;
template <typename M>
-M make (Init vals)
-{
- M ret;
- for (int v : vals)
- ret[static_cast<typename M::key_type>(v)] = static_cast<typename M::mapped_type>(v + 10);
- return ret;
+M make(Init vals) {
+ M ret;
+ for (int v : vals)
+ ret[static_cast<typename M::key_type>(v)] = static_cast<typename M::mapped_type>(v + 10);
+ return ret;
}
template <typename M, typename Pred>
@@ -40,41 +39,39 @@ void test0(Init vals, Pred p, Init expected, std::size_t expected_erased_count)
}
template <typename S>
-void test()
-{
- auto is1 = [](auto v) { return v.first == 1;};
- auto is2 = [](auto v) { return v.first == 2;};
- auto is3 = [](auto v) { return v.first == 3;};
- auto is4 = [](auto v) { return v.first == 4;};
- auto True = [](auto) { return true; };
- auto False = [](auto) { return false; };
+void test() {
+ auto is1 = [](auto v) { return v.first == 1; };
+ auto is2 = [](auto v) { return v.first == 2; };
+ auto is3 = [](auto v) { return v.first == 3; };
+ auto is4 = [](auto v) { return v.first == 4; };
+ auto True = [](auto) { return true; };
+ auto False = [](auto) { return false; };
- test0<S>({}, is1, {}, 0);
+ test0<S>({}, is1, {}, 0);
- test0<S>({1}, is1, {}, 1);
- test0<S>({1}, is2, {1}, 0);
+ test0<S>({1}, is1, {}, 1);
+ test0<S>({1}, is2, {1}, 0);
- test0<S>({1, 2}, is1, {2}, 1);
- test0<S>({1, 2}, is2, {1}, 1);
- test0<S>({1, 2}, is3, {1, 2}, 0);
+ test0<S>({1, 2}, is1, {2}, 1);
+ test0<S>({1, 2}, is2, {1}, 1);
+ test0<S>({1, 2}, is3, {1, 2}, 0);
- test0<S>({1, 2, 3}, is1, {2, 3}, 1);
- test0<S>({1, 2, 3}, is2, {1, 3}, 1);
- test0<S>({1, 2, 3}, is3, {1, 2}, 1);
- test0<S>({1, 2, 3}, is4, {1, 2, 3}, 0);
+ test0<S>({1, 2, 3}, is1, {2, 3}, 1);
+ test0<S>({1, 2, 3}, is2, {1, 3}, 1);
+ test0<S>({1, 2, 3}, is3, {1, 2}, 1);
+ test0<S>({1, 2, 3}, is4, {1, 2, 3}, 0);
- test0<S>({1, 2, 3}, True, {}, 3);
- test0<S>({1, 2, 3}, False, {1, 2, 3}, 0);
+ test0<S>({1, 2, 3}, True, {}, 3);
+ test0<S>({1, 2, 3}, False, {1, 2, 3}, 0);
}
-int main(int, char**)
-{
- test<std::unordered_map<int, int>>();
- test<std::unordered_map<int, int, std::hash<int>, std::equal_to<int>, min_allocator<std::pair<const int, int>>>> ();
- test<std::unordered_map<int, int, std::hash<int>, std::equal_to<int>, test_allocator<std::pair<const int, int>>>> ();
+int main(int, char**) {
+ test<std::unordered_map<int, int>>();
+ test<std::unordered_map<int, int, std::hash<int>, std::equal_to<int>, min_allocator<std::pair<const int, int>>>>();
+ test<std::unordered_map<int, int, std::hash<int>, std::equal_to<int>, test_allocator<std::pair<const int, int>>>>();
- test<std::unordered_map<long, short>>();
- test<std::unordered_map<short, double>>();
+ test<std::unordered_map<long, short>>();
+ test<std::unordered_map<short, double>>();
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/find.transparent.pass.cpp b/libcxx/test/std/containers/unord/unord.map/find.transparent.pass.cpp
index 623b86f6ab5306f..e8d590dd392f6cb 100644
--- a/libcxx/test/std/containers/unord/unord.map/find.transparent.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/find.transparent.pass.cpp
@@ -21,44 +21,43 @@
#include "test_transparent_unordered.h"
-int main(int, char**)
-{
- using key_type = StoredType<int>;
-
- {
- // Make sure conversions don't happen for transparent non-final hasher and key_equal
- using M = unord_map_type<std::unordered_map, transparent_hash, std::equal_to<>>;
- test_transparent_find<M>({{1, 2}, {2, 3}});
- test_transparent_find<const M>({{1, 2}, {2, 3}});
- }
-
- {
- // Make sure conversions don't happen for transparent final hasher and key_equal
- using M = unord_map_type<std::unordered_map, transparent_hash_final, transparent_equal_final>;
- test_transparent_find<M>({{1, 2}, {2, 3}});
- test_transparent_find<const M>({{1, 2}, {2, 3}});
- }
-
- {
- // Make sure conversions do happen for non-transparent hasher
- using M = unord_map_type<std::unordered_map, non_transparent_hash, std::equal_to<>>;
- test_non_transparent_find<M>({{1, 2}, {2, 3}});
- test_non_transparent_find<const M>({{1, 2}, {2, 3}});
- }
-
- {
- // Make sure conversions do happen for non-transparent key_equal
- using M = unord_map_type<std::unordered_map, transparent_hash, std::equal_to<key_type>>;
- test_non_transparent_find<M>({{1, 2}, {2, 3}});
- test_non_transparent_find<const M>({{1, 2}, {2, 3}});
- }
-
- {
- // Make sure conversions do happen for both non-transparent hasher and key_equal
- using M = unord_map_type<std::unordered_map, non_transparent_hash, std::equal_to<key_type>>;
- test_non_transparent_find<M>({{1, 2}, {2, 3}});
- test_non_transparent_find<const M>({{1, 2}, {2, 3}});
- }
-
- return 0;
+int main(int, char**) {
+ using key_type = StoredType<int>;
+
+ {
+ // Make sure conversions don't happen for transparent non-final hasher and key_equal
+ using M = unord_map_type<std::unordered_map, transparent_hash, std::equal_to<>>;
+ test_transparent_find<M>({{1, 2}, {2, 3}});
+ test_transparent_find<const M>({{1, 2}, {2, 3}});
+ }
+
+ {
+ // Make sure conversions don't happen for transparent final hasher and key_equal
+ using M = unord_map_type<std::unordered_map, transparent_hash_final, transparent_equal_final>;
+ test_transparent_find<M>({{1, 2}, {2, 3}});
+ test_transparent_find<const M>({{1, 2}, {2, 3}});
+ }
+
+ {
+ // Make sure conversions do happen for non-transparent hasher
+ using M = unord_map_type<std::unordered_map, non_transparent_hash, std::equal_to<>>;
+ test_non_transparent_find<M>({{1, 2}, {2, 3}});
+ test_non_transparent_find<const M>({{1, 2}, {2, 3}});
+ }
+
+ {
+ // Make sure conversions do happen for non-transparent key_equal
+ using M = unord_map_type<std::unordered_map, transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_find<M>({{1, 2}, {2, 3}});
+ test_non_transparent_find<const M>({{1, 2}, {2, 3}});
+ }
+
+ {
+ // Make sure conversions do happen for both non-transparent hasher and key_equal
+ using M = unord_map_type<std::unordered_map, non_transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_find<M>({{1, 2}, {2, 3}});
+ test_non_transparent_find<const M>({{1, 2}, {2, 3}});
+ }
+
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/find_const.pass.cpp b/libcxx/test/std/containers/unord/unord.map/find_const.pass.cpp
index fa8417b72becdcb..5fed665cc75c7d5 100644
--- a/libcxx/test/std/containers/unord/unord.map/find_const.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/find_const.pass.cpp
@@ -22,52 +22,53 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_map<int, std::string> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- const C c(std::begin(a), std::end(a));
- C::const_iterator i = c.find(30);
- assert(i->first == 30);
- assert(i->second == "thirty");
- i = c.find(5);
- assert(i == c.cend());
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_map<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ const C c(std::begin(a), std::end(a));
+ C::const_iterator i = c.find(30);
+ assert(i->first == 30);
+ assert(i->second == "thirty");
+ i = c.find(5);
+ assert(i == c.cend());
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- const C c(std::begin(a), std::end(a));
- C::const_iterator i = c.find(30);
- assert(i->first == 30);
- assert(i->second == "thirty");
- i = c.find(5);
- assert(i == c.cend());
- }
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ const C c(std::begin(a), std::end(a));
+ C::const_iterator i = c.find(30);
+ assert(i->first == 30);
+ assert(i->second == "thirty");
+ i = c.find(5);
+ assert(i == c.cend());
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.map/find_non_const.pass.cpp b/libcxx/test/std/containers/unord/unord.map/find_non_const.pass.cpp
index 00c5605c2b49151..28b3a71f7b0db99 100644
--- a/libcxx/test/std/containers/unord/unord.map/find_non_const.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/find_non_const.pass.cpp
@@ -22,52 +22,53 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_map<int, std::string> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- C c(std::begin(a), std::end(a));
- C::iterator i = c.find(30);
- assert(i->first == 30);
- assert(i->second == "thirty");
- i = c.find(5);
- assert(i == c.end());
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_map<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c(std::begin(a), std::end(a));
+ C::iterator i = c.find(30);
+ assert(i->first == 30);
+ assert(i->second == "thirty");
+ i = c.find(5);
+ assert(i == c.end());
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- C c(std::begin(a), std::end(a));
- C::iterator i = c.find(30);
- assert(i->first == 30);
- assert(i->second == "thirty");
- i = c.find(5);
- assert(i == c.end());
- }
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c(std::begin(a), std::end(a));
+ C::iterator i = c.find(30);
+ assert(i->first == 30);
+ assert(i->second == "thirty");
+ i = c.find(5);
+ assert(i == c.end());
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.map/get_allocator.pass.cpp b/libcxx/test/std/containers/unord/unord.map/get_allocator.pass.cpp
index 64836abfff033a3..04d67cfaa9995e0 100644
--- a/libcxx/test/std/containers/unord/unord.map/get_allocator.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/get_allocator.pass.cpp
@@ -20,19 +20,18 @@
#include "test_macros.h"
int main(int, char**) {
- typedef std::pair<const int, std::string> ValueType;
- {
- std::allocator<ValueType> alloc;
- const std::unordered_map<int, std::string> m(alloc);
- assert(m.get_allocator() == alloc);
- }
- {
- other_allocator<ValueType> alloc(1);
- const std::unordered_map<int, std::string, std::hash<int>,
- std::equal_to<int>,
- other_allocator<ValueType> > m(alloc);
- assert(m.get_allocator() == alloc);
- }
+ typedef std::pair<const int, std::string> ValueType;
+ {
+ std::allocator<ValueType> alloc;
+ const std::unordered_map<int, std::string> m(alloc);
+ assert(m.get_allocator() == alloc);
+ }
+ {
+ other_allocator<ValueType> alloc(1);
+ const std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>, other_allocator<ValueType> > m(
+ alloc);
+ assert(m.get_allocator() == alloc);
+ }
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/incomplete_type.pass.cpp b/libcxx/test/std/containers/unord/unord.map/incomplete_type.pass.cpp
index cf2cc679f704cdb..4b4d14d3b04f4f7 100644
--- a/libcxx/test/std/containers/unord/unord.map/incomplete_type.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/incomplete_type.pass.cpp
@@ -19,22 +19,22 @@
template <class Tp>
struct MyHash {
MyHash() {}
- std::size_t operator()(Tp const&) const {return 42;}
+ std::size_t operator()(Tp const&) const { return 42; }
};
struct A {
- typedef std::unordered_map<A, A, MyHash<A> > Map;
- Map m;
- Map::iterator it;
- Map::const_iterator cit;
- Map::local_iterator lit;
- Map::const_local_iterator clit;
+ typedef std::unordered_map<A, A, MyHash<A> > Map;
+ Map m;
+ Map::iterator it;
+ Map::const_iterator cit;
+ Map::local_iterator lit;
+ Map::const_local_iterator clit;
};
inline bool operator==(A const& L, A const& R) { return &L == &R; }
int main(int, char**) {
- A a;
+ A a;
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/iterator.operators.addressof.compile.pass.cpp b/libcxx/test/std/containers/unord/unord.map/iterator.operators.addressof.compile.pass.cpp
index 856b78293a1077e..73ac37a98d1b916 100644
--- a/libcxx/test/std/containers/unord/unord.map/iterator.operators.addressof.compile.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/iterator.operators.addressof.compile.pass.cpp
@@ -33,14 +33,14 @@ void test() {
void test() {
{
- using I = std::unordered_map<operator_hijacker, operator_hijacker>::iterator;
+ using I = std::unordered_map<operator_hijacker, operator_hijacker>::iterator;
using CI = std::unordered_map<operator_hijacker, operator_hijacker>::const_iterator;
test<I, I>();
test<CI, I>();
test<CI, CI>();
}
{
- using IL = std::unordered_map<operator_hijacker, operator_hijacker>::local_iterator;
+ using IL = std::unordered_map<operator_hijacker, operator_hijacker>::local_iterator;
using CIL = std::unordered_map<operator_hijacker, operator_hijacker>::const_local_iterator;
test<IL, IL>();
test<CIL, IL>();
diff --git a/libcxx/test/std/containers/unord/unord.map/iterator_concept_conformance.compile.pass.cpp b/libcxx/test/std/containers/unord/unord.map/iterator_concept_conformance.compile.pass.cpp
index ff4b487e4aca447..4a184d4d772ad74 100644
--- a/libcxx/test/std/containers/unord/unord.map/iterator_concept_conformance.compile.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/iterator_concept_conformance.compile.pass.cpp
@@ -16,11 +16,11 @@
#include "test_macros.h"
-using iterator = std::unordered_map<int, int>::iterator;
-using const_iterator = std::unordered_map<int, int>::const_iterator;
-using local_iterator = std::unordered_map<int, int>::local_iterator;
+using iterator = std::unordered_map<int, int>::iterator;
+using const_iterator = std::unordered_map<int, int>::const_iterator;
+using local_iterator = std::unordered_map<int, int>::local_iterator;
using const_local_iterator = std::unordered_map<int, int>::const_local_iterator;
-using value_type = std::pair<const int, int>;
+using value_type = std::pair<const int, int>;
static_assert(std::forward_iterator<iterator>);
LIBCPP_STATIC_ASSERT(!std::bidirectional_iterator<iterator>);
diff --git a/libcxx/test/std/containers/unord/unord.map/iterators.pass.cpp b/libcxx/test/std/containers/unord/unord.map/iterators.pass.cpp
index 0b4e02e339f627e..5296273d0eeb776 100644
--- a/libcxx/test/std/containers/unord/unord.map/iterators.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/iterators.pass.cpp
@@ -27,104 +27,107 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_map<int, std::string> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 5);
- assert(c.size() == 4);
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- C::iterator i;
- }
- {
- typedef std::unordered_map<int, std::string> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- const C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 5);
- assert(c.size() == 4);
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- C::const_iterator i;
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_map<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 5);
+ assert(c.size() == 4);
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ C::iterator i;
+ }
+ {
+ typedef std::unordered_map<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ const C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 5);
+ assert(c.size() == 4);
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ C::const_iterator i;
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 5);
- assert(c.size() == 4);
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- C::iterator i;
- }
- {
- typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- const C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 5);
- assert(c.size() == 4);
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- C::const_iterator i;
- }
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 5);
+ assert(c.size() == 4);
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ C::iterator i;
+ }
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ const C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 5);
+ assert(c.size() == 4);
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ C::const_iterator i;
+ }
#endif
#if TEST_STD_VER > 11
- { // N3644 testing
- typedef std::unordered_map<int,double> C;
- C::iterator ii1{}, ii2{};
- C::iterator ii4 = ii1;
- C::const_iterator cii{};
- assert ( ii1 == ii2 );
- assert ( ii1 == ii4 );
+ { // N3644 testing
+ typedef std::unordered_map<int, double> C;
+ C::iterator ii1{}, ii2{};
+ C::iterator ii4 = ii1;
+ C::const_iterator cii{};
+ assert(ii1 == ii2);
+ assert(ii1 == ii4);
- assert (!(ii1 != ii2 ));
+ assert(!(ii1 != ii2));
- assert ( (ii1 == cii ));
- assert ( (cii == ii1 ));
- assert (!(ii1 != cii ));
- assert (!(cii != ii1 ));
- }
+ assert((ii1 == cii));
+ assert((cii == ii1));
+ assert(!(ii1 != cii));
+ assert(!(cii != ii1));
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.map/load_factor.pass.cpp b/libcxx/test/std/containers/unord/unord.map/load_factor.pass.cpp
index 6bb7f89f3a13ed0..12a4b777167d2b1 100644
--- a/libcxx/test/std/containers/unord/unord.map/load_factor.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/load_factor.pass.cpp
@@ -24,55 +24,60 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_map<int, std::string> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- const C c(std::begin(a), std::end(a));
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- }
- {
- typedef std::unordered_map<int, std::string> C;
- const C c;
- assert(c.load_factor() == 0);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_map<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ const C c(std::begin(a), std::end(a));
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ }
+ {
+ typedef std::unordered_map<int, std::string> C;
+ const C c;
+ assert(c.load_factor() == 0);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- const C c(std::begin(a), std::end(a));
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- }
- {
- typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- const C c;
- assert(c.load_factor() == 0);
- }
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ const C c(std::begin(a), std::end(a));
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ }
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ const C c;
+ assert(c.load_factor() == 0);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.map/local_iterators.pass.cpp b/libcxx/test/std/containers/unord/unord.map/local_iterators.pass.cpp
index 5da3a0b3d932c47..a976e3c5d84a78d 100644
--- a/libcxx/test/std/containers/unord/unord.map/local_iterators.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/local_iterators.pass.cpp
@@ -26,397 +26,404 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_map<int, std::string> C;
- typedef std::pair<int, std::string> P;
- typedef C::local_iterator I;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 5);
- C::size_type b = c.bucket(0);
- I i = c.begin(b);
- I j = c.end(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(1);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 1);
- assert(i->second == "one");
-
- b = c.bucket(2);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 2);
- assert(i->second == "two");
-
- b = c.bucket(3);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 3);
- assert(i->second == "three");
-
- b = c.bucket(4);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 4);
- assert(i->second == "four");
- }
- {
- typedef std::unordered_map<int, std::string> C;
- typedef std::pair<int, std::string> P;
- typedef C::const_local_iterator I;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- const C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 5);
- C::size_type b = c.bucket(0);
- I i = c.begin(b);
- I j = c.end(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(1);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 1);
- assert(i->second == "one");
-
- b = c.bucket(2);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 2);
- assert(i->second == "two");
-
- b = c.bucket(3);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 3);
- assert(i->second == "three");
-
- b = c.bucket(4);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 4);
- assert(i->second == "four");
- }
- {
- typedef std::unordered_map<int, std::string> C;
- typedef std::pair<int, std::string> P;
- typedef C::const_local_iterator I;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 5);
- C::size_type b = c.bucket(0);
- I i = c.cbegin(b);
- I j = c.cend(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(1);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 1);
- assert(i->second == "one");
-
- b = c.bucket(2);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 2);
- assert(i->second == "two");
-
- b = c.bucket(3);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 3);
- assert(i->second == "three");
-
- b = c.bucket(4);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 4);
- assert(i->second == "four");
- }
- {
- typedef std::unordered_map<int, std::string> C;
- typedef std::pair<int, std::string> P;
- typedef C::const_local_iterator I;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- const C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 5);
- C::size_type b = c.bucket(0);
- I i = c.cbegin(b);
- I j = c.cend(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(1);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 1);
- assert(i->second == "one");
-
- b = c.bucket(2);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 2);
- assert(i->second == "two");
-
- b = c.bucket(3);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 3);
- assert(i->second == "three");
-
- b = c.bucket(4);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 4);
- assert(i->second == "four");
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_map<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ typedef C::local_iterator I;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 5);
+ C::size_type b = c.bucket(0);
+ I i = c.begin(b);
+ I j = c.end(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 1);
+ assert(i->second == "one");
+
+ b = c.bucket(2);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 2);
+ assert(i->second == "two");
+
+ b = c.bucket(3);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 3);
+ assert(i->second == "three");
+
+ b = c.bucket(4);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 4);
+ assert(i->second == "four");
+ }
+ {
+ typedef std::unordered_map<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ typedef C::const_local_iterator I;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ const C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 5);
+ C::size_type b = c.bucket(0);
+ I i = c.begin(b);
+ I j = c.end(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 1);
+ assert(i->second == "one");
+
+ b = c.bucket(2);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 2);
+ assert(i->second == "two");
+
+ b = c.bucket(3);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 3);
+ assert(i->second == "three");
+
+ b = c.bucket(4);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 4);
+ assert(i->second == "four");
+ }
+ {
+ typedef std::unordered_map<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ typedef C::const_local_iterator I;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 5);
+ C::size_type b = c.bucket(0);
+ I i = c.cbegin(b);
+ I j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 1);
+ assert(i->second == "one");
+
+ b = c.bucket(2);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 2);
+ assert(i->second == "two");
+
+ b = c.bucket(3);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 3);
+ assert(i->second == "three");
+
+ b = c.bucket(4);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 4);
+ assert(i->second == "four");
+ }
+ {
+ typedef std::unordered_map<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ typedef C::const_local_iterator I;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ const C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 5);
+ C::size_type b = c.bucket(0);
+ I i = c.cbegin(b);
+ I j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 1);
+ assert(i->second == "one");
+
+ b = c.bucket(2);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 2);
+ assert(i->second == "two");
+
+ b = c.bucket(3);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 3);
+ assert(i->second == "three");
+
+ b = c.bucket(4);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 4);
+ assert(i->second == "four");
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- typedef C::local_iterator I;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 5);
- C::size_type b = c.bucket(0);
- I i = c.begin(b);
- I j = c.end(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(1);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 1);
- assert(i->second == "one");
-
- b = c.bucket(2);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 2);
- assert(i->second == "two");
-
- b = c.bucket(3);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 3);
- assert(i->second == "three");
-
- b = c.bucket(4);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 4);
- assert(i->second == "four");
- }
- {
- typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- typedef C::const_local_iterator I;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- const C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 5);
- C::size_type b = c.bucket(0);
- I i = c.begin(b);
- I j = c.end(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(1);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 1);
- assert(i->second == "one");
-
- b = c.bucket(2);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 2);
- assert(i->second == "two");
-
- b = c.bucket(3);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 3);
- assert(i->second == "three");
-
- b = c.bucket(4);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 4);
- assert(i->second == "four");
- }
- {
- typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- typedef C::const_local_iterator I;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 5);
- C::size_type b = c.bucket(0);
- I i = c.cbegin(b);
- I j = c.cend(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(1);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 1);
- assert(i->second == "one");
-
- b = c.bucket(2);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 2);
- assert(i->second == "two");
-
- b = c.bucket(3);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 3);
- assert(i->second == "three");
-
- b = c.bucket(4);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 4);
- assert(i->second == "four");
- }
- {
- typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- typedef C::const_local_iterator I;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- const C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 5);
- C::size_type b = c.bucket(0);
- I i = c.cbegin(b);
- I j = c.cend(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(1);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 1);
- assert(i->second == "one");
-
- b = c.bucket(2);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 2);
- assert(i->second == "two");
-
- b = c.bucket(3);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 3);
- assert(i->second == "three");
-
- b = c.bucket(4);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 4);
- assert(i->second == "four");
- }
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ typedef C::local_iterator I;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 5);
+ C::size_type b = c.bucket(0);
+ I i = c.begin(b);
+ I j = c.end(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 1);
+ assert(i->second == "one");
+
+ b = c.bucket(2);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 2);
+ assert(i->second == "two");
+
+ b = c.bucket(3);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 3);
+ assert(i->second == "three");
+
+ b = c.bucket(4);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 4);
+ assert(i->second == "four");
+ }
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ typedef C::const_local_iterator I;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ const C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 5);
+ C::size_type b = c.bucket(0);
+ I i = c.begin(b);
+ I j = c.end(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 1);
+ assert(i->second == "one");
+
+ b = c.bucket(2);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 2);
+ assert(i->second == "two");
+
+ b = c.bucket(3);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 3);
+ assert(i->second == "three");
+
+ b = c.bucket(4);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 4);
+ assert(i->second == "four");
+ }
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ typedef C::const_local_iterator I;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 5);
+ C::size_type b = c.bucket(0);
+ I i = c.cbegin(b);
+ I j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 1);
+ assert(i->second == "one");
+
+ b = c.bucket(2);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 2);
+ assert(i->second == "two");
+
+ b = c.bucket(3);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 3);
+ assert(i->second == "three");
+
+ b = c.bucket(4);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 4);
+ assert(i->second == "four");
+ }
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ typedef C::const_local_iterator I;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ const C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 5);
+ C::size_type b = c.bucket(0);
+ I i = c.cbegin(b);
+ I j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 1);
+ assert(i->second == "one");
+
+ b = c.bucket(2);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 2);
+ assert(i->second == "two");
+
+ b = c.bucket(3);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 3);
+ assert(i->second == "three");
+
+ b = c.bucket(4);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 4);
+ assert(i->second == "four");
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.map/max_bucket_count.pass.cpp b/libcxx/test/std/containers/unord/unord.map/max_bucket_count.pass.cpp
index eb8f3e9d2ed5d8f..b0fec10a3047b62 100644
--- a/libcxx/test/std/containers/unord/unord.map/max_bucket_count.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/max_bucket_count.pass.cpp
@@ -21,20 +21,23 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_map<int, std::string> C;
- const C c;
- assert(c.max_bucket_count() > 0);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_map<int, std::string> C;
+ const C c;
+ assert(c.max_bucket_count() > 0);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- const C c;
- assert(c.max_bucket_count() > 0);
- }
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ const C c;
+ assert(c.max_bucket_count() > 0);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.map/max_load_factor.pass.cpp b/libcxx/test/std/containers/unord/unord.map/max_load_factor.pass.cpp
index 070ba1e329bf22e..53e17478c5eef63 100644
--- a/libcxx/test/std/containers/unord/unord.map/max_load_factor.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/max_load_factor.pass.cpp
@@ -22,36 +22,43 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_map<int, std::string> C;
- const C c;
- assert(c.max_load_factor() == 1);
- }
- {
- typedef std::unordered_map<int, std::string> C;
- C c;
- assert(c.max_load_factor() == 1);
- c.max_load_factor(2.5);
- assert(c.max_load_factor() == 2.5);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_map<int, std::string> C;
+ const C c;
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef std::unordered_map<int, std::string> C;
+ C c;
+ assert(c.max_load_factor() == 1);
+ c.max_load_factor(2.5);
+ assert(c.max_load_factor() == 2.5);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- const C c;
- assert(c.max_load_factor() == 1);
- }
- {
- typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- C c;
- assert(c.max_load_factor() == 1);
- c.max_load_factor(2.5);
- assert(c.max_load_factor() == 2.5);
- }
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ const C c;
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ C c;
+ assert(c.max_load_factor() == 1);
+ c.max_load_factor(2.5);
+ assert(c.max_load_factor() == 2.5);
+ }
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/max_size.pass.cpp b/libcxx/test/std/containers/unord/unord.map/max_size.pass.cpp
index 33c009b67dffdc7..0c8453e27f7dd30 100644
--- a/libcxx/test/std/containers/unord/unord.map/max_size.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/max_size.pass.cpp
@@ -20,35 +20,30 @@
#include "test_allocator.h"
#include "test_macros.h"
-int main(int, char**)
-{
+int main(int, char**) {
typedef std::pair<const int, int> KV;
{
typedef limited_allocator<KV, 10> A;
- typedef std::unordered_map<int, int, std::hash<int>, std::equal_to<int>, A>
- C;
+ typedef std::unordered_map<int, int, std::hash<int>, std::equal_to<int>, A> C;
C c;
assert(c.max_size() <= 10);
LIBCPP_ASSERT(c.max_size() == 10);
}
{
typedef limited_allocator<KV, (std::size_t)-1> A;
- typedef std::unordered_map<int, int, std::hash<int>, std::equal_to<int>, A>
- C;
- const C::size_type max_dist =
- static_cast<C::size_type>(std::numeric_limits<C::
diff erence_type>::max());
+ typedef std::unordered_map<int, int, std::hash<int>, std::equal_to<int>, A> C;
+ const C::size_type max_dist = static_cast<C::size_type>(std::numeric_limits<C::
diff erence_type>::max());
C c;
assert(c.max_size() <= max_dist);
LIBCPP_ASSERT(c.max_size() == max_dist);
- }
- {
- typedef std::unordered_map<char, int> C;
- const C::size_type max_dist =
- static_cast<C::size_type>(std::numeric_limits<C::
diff erence_type>::max());
- C c;
- assert(c.max_size() <= max_dist);
- assert(c.max_size() <= alloc_max_size(c.get_allocator()));
- }
+ }
+ {
+ typedef std::unordered_map<char, int> C;
+ const C::size_type max_dist = static_cast<C::size_type>(std::numeric_limits<C::
diff erence_type>::max());
+ C c;
+ assert(c.max_size() <= max_dist);
+ assert(c.max_size() <= alloc_max_size(c.get_allocator()));
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/range_concept_conformance.compile.pass.cpp b/libcxx/test/std/containers/unord/unord.map/range_concept_conformance.compile.pass.cpp
index 765277ced87244f..0cf97326595850e 100644
--- a/libcxx/test/std/containers/unord/unord.map/range_concept_conformance.compile.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/range_concept_conformance.compile.pass.cpp
@@ -19,7 +19,6 @@
using range = std::unordered_map<int, int>;
-
static_assert(std::same_as<std::ranges::iterator_t<range>, range::iterator>);
static_assert(std::ranges::common_range<range>);
static_assert(std::ranges::forward_range<range>);
diff --git a/libcxx/test/std/containers/unord/unord.map/rehash.pass.cpp b/libcxx/test/std/containers/unord/unord.map/rehash.pass.cpp
index 737e40d6c41ccdd..5a05d37022421de 100644
--- a/libcxx/test/std/containers/unord/unord.map/rehash.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/rehash.pass.cpp
@@ -22,83 +22,82 @@
#include "min_allocator.h"
template <class C>
-void rehash_postcondition(const C& c, std::size_t n)
-{
- assert(c.bucket_count() >= c.size() / c.max_load_factor() && c.bucket_count() >= n);
+void rehash_postcondition(const C& c, std::size_t n) {
+ assert(c.bucket_count() >= c.size() / c.max_load_factor() && c.bucket_count() >= n);
}
template <class C>
-void test(const C& c)
-{
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
+void test(const C& c) {
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
}
-int main(int, char**)
-{
- {
- typedef std::unordered_map<int, std::string> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- test(c);
- assert(c.bucket_count() >= 5);
- c.rehash(3);
- rehash_postcondition(c, 3);
- LIBCPP_ASSERT(c.bucket_count() == 5);
- test(c);
- c.max_load_factor(2);
- c.rehash(3);
- rehash_postcondition(c, 3);
- LIBCPP_ASSERT(c.bucket_count() == 3);
- test(c);
- c.rehash(31);
- rehash_postcondition(c, 31);
- LIBCPP_ASSERT(c.bucket_count() == 31);
- test(c);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_map<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ test(c);
+ assert(c.bucket_count() >= 5);
+ c.rehash(3);
+ rehash_postcondition(c, 3);
+ LIBCPP_ASSERT(c.bucket_count() == 5);
+ test(c);
+ c.max_load_factor(2);
+ c.rehash(3);
+ rehash_postcondition(c, 3);
+ LIBCPP_ASSERT(c.bucket_count() == 3);
+ test(c);
+ c.rehash(31);
+ rehash_postcondition(c, 31);
+ LIBCPP_ASSERT(c.bucket_count() == 31);
+ test(c);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- test(c);
- assert(c.bucket_count() >= 5);
- c.rehash(3);
- rehash_postcondition(c, 3);
- LIBCPP_ASSERT(c.bucket_count() == 5);
- test(c);
- c.max_load_factor(2);
- c.rehash(3);
- rehash_postcondition(c, 3);
- LIBCPP_ASSERT(c.bucket_count() == 3);
- test(c);
- c.rehash(31);
- rehash_postcondition(c, 31);
- LIBCPP_ASSERT(c.bucket_count() == 31);
- test(c);
- }
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ test(c);
+ assert(c.bucket_count() >= 5);
+ c.rehash(3);
+ rehash_postcondition(c, 3);
+ LIBCPP_ASSERT(c.bucket_count() == 5);
+ test(c);
+ c.max_load_factor(2);
+ c.rehash(3);
+ rehash_postcondition(c, 3);
+ LIBCPP_ASSERT(c.bucket_count() == 3);
+ test(c);
+ c.rehash(31);
+ rehash_postcondition(c, 31);
+ LIBCPP_ASSERT(c.bucket_count() == 31);
+ test(c);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.map/reserve.pass.cpp b/libcxx/test/std/containers/unord/unord.map/reserve.pass.cpp
index 358da355263060e..ed56619d44d2b27 100644
--- a/libcxx/test/std/containers/unord/unord.map/reserve.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/reserve.pass.cpp
@@ -22,88 +22,86 @@
#include "min_allocator.h"
template <class C>
-void test(const C& c)
-{
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
+void test(const C& c) {
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
}
void reserve_invariant(std::size_t n) // LWG #2156
{
- for (std::size_t i = 0; i < n; ++i)
- {
- std::unordered_map<std::size_t, size_t> c;
- c.reserve(n);
- std::size_t buckets = c.bucket_count();
- for (std::size_t j = 0; j < i; ++j)
- {
- c[i] = i;
- assert(buckets == c.bucket_count());
- }
+ for (std::size_t i = 0; i < n; ++i) {
+ std::unordered_map<std::size_t, size_t> c;
+ c.reserve(n);
+ std::size_t buckets = c.bucket_count();
+ for (std::size_t j = 0; j < i; ++j) {
+ c[i] = i;
+ assert(buckets == c.bucket_count());
}
+ }
}
-int main(int, char**)
-{
- {
- typedef std::unordered_map<int, std::string> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- test(c);
- assert(c.bucket_count() >= 5);
- c.reserve(3);
- LIBCPP_ASSERT(c.bucket_count() == 5);
- test(c);
- c.max_load_factor(2);
- c.reserve(3);
- assert(c.bucket_count() >= 2);
- test(c);
- c.reserve(31);
- assert(c.bucket_count() >= 16);
- test(c);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_map<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ test(c);
+ assert(c.bucket_count() >= 5);
+ c.reserve(3);
+ LIBCPP_ASSERT(c.bucket_count() == 5);
+ test(c);
+ c.max_load_factor(2);
+ c.reserve(3);
+ assert(c.bucket_count() >= 2);
+ test(c);
+ c.reserve(31);
+ assert(c.bucket_count() >= 16);
+ test(c);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- test(c);
- assert(c.bucket_count() >= 5);
- c.reserve(3);
- LIBCPP_ASSERT(c.bucket_count() == 5);
- test(c);
- c.max_load_factor(2);
- c.reserve(3);
- assert(c.bucket_count() >= 2);
- test(c);
- c.reserve(31);
- assert(c.bucket_count() >= 16);
- test(c);
- }
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ test(c);
+ assert(c.bucket_count() >= 5);
+ c.reserve(3);
+ LIBCPP_ASSERT(c.bucket_count() == 5);
+ test(c);
+ c.max_load_factor(2);
+ c.reserve(3);
+ assert(c.bucket_count() >= 2);
+ test(c);
+ c.reserve(31);
+ assert(c.bucket_count() >= 16);
+ test(c);
+ }
#endif
- reserve_invariant(20);
+ reserve_invariant(20);
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/size.pass.cpp b/libcxx/test/std/containers/unord/unord.map/size.pass.cpp
index d4e7cb97f6491a6..aa160b2c51c4586 100644
--- a/libcxx/test/std/containers/unord/unord.map/size.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/size.pass.cpp
@@ -18,9 +18,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::unordered_map<int, double> M;
M m;
ASSERT_NOEXCEPT(m.size());
@@ -37,10 +36,12 @@ int main(int, char**)
assert(m.size() == 1);
m.erase(m.begin());
assert(m.size() == 0);
- }
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_map<int, double, std::hash<int>, std::equal_to<int>, min_allocator<std::pair<const int, double>>> M;
+ {
+ typedef std::
+ unordered_map<int, double, std::hash<int>, std::equal_to<int>, min_allocator<std::pair<const int, double>>>
+ M;
M m;
ASSERT_NOEXCEPT(m.size());
assert(m.size() == 0);
@@ -56,7 +57,7 @@ int main(int, char**)
assert(m.size() == 1);
m.erase(m.begin());
assert(m.size() == 0);
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.map/swap_member.pass.cpp b/libcxx/test/std/containers/unord/unord.map/swap_member.pass.cpp
index 955aa31a88ae3ab..d27c9b92938a21d 100644
--- a/libcxx/test/std/containers/unord/unord.map/swap_member.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/swap_member.pass.cpp
@@ -26,547 +26,534 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef test_allocator<std::pair<const int, std::string> > Alloc;
- typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
- C c1(0, Hash(1), Compare(1), Alloc(1, 1));
- C c2(0, Hash(2), Compare(2), Alloc(1, 2));
- c2.max_load_factor(2);
- c1.swap(c2);
-
- LIBCPP_ASSERT(c1.bucket_count() == 0);
- assert(c1.size() == 0);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator().get_id() == 1);
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- LIBCPP_ASSERT(c2.bucket_count() == 0);
- assert(c2.size() == 0);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator().get_id() == 2);
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef test_allocator<std::pair<const int, std::string> > Alloc;
- typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
- typedef std::pair<int, std::string> P;
- P a2[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- C c1(0, Hash(1), Compare(1), Alloc(1, 1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
- c2.max_load_factor(2);
- c1.swap(c2);
-
- assert(c1.bucket_count() >= 8);
- assert(c1.size() == 8);
- assert(c1.at(10) == "ten");
- assert(c1.at(20) == "twenty");
- assert(c1.at(30) == "thirty");
- assert(c1.at(40) == "forty");
- assert(c1.at(50) == "fifty");
- assert(c1.at(60) == "sixty");
- assert(c1.at(70) == "seventy");
- assert(c1.at(80) == "eighty");
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator().get_id() == 1);
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- LIBCPP_ASSERT(c2.bucket_count() == 0);
- assert(c2.size() == 0);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator().get_id() == 2);
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef test_allocator<std::pair<const int, std::string> > Alloc;
- typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
- typedef std::pair<int, std::string> P;
- P a1[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
- C c2(0, Hash(2), Compare(2), Alloc(1, 2));
- c2.max_load_factor(2);
- c1.swap(c2);
-
- LIBCPP_ASSERT(c1.bucket_count() == 0);
- assert(c1.size() == 0);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator().get_id() == 1);
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- assert(c2.bucket_count() >= 4);
- assert(c2.size() == 4);
- assert(c2.at(1) == "one");
- assert(c2.at(2) == "two");
- assert(c2.at(3) == "three");
- assert(c2.at(4) == "four");
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator().get_id() == 2);
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef test_allocator<std::pair<const int, std::string> > Alloc;
- typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
- typedef std::pair<int, std::string> P;
- P a1[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- P a2[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
- c2.max_load_factor(2);
- c1.swap(c2);
-
- assert(c1.bucket_count() >= 8);
- assert(c1.size() == 8);
- assert(c1.at(10) == "ten");
- assert(c1.at(20) == "twenty");
- assert(c1.at(30) == "thirty");
- assert(c1.at(40) == "forty");
- assert(c1.at(50) == "fifty");
- assert(c1.at(60) == "sixty");
- assert(c1.at(70) == "seventy");
- assert(c1.at(80) == "eighty");
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator().get_id() == 1);
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- assert(c2.bucket_count() >= 4);
- assert(c2.size() == 4);
- assert(c2.at(1) == "one");
- assert(c2.at(2) == "two");
- assert(c2.at(3) == "three");
- assert(c2.at(4) == "four");
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator().get_id() == 2);
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
-
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef other_allocator<std::pair<const int, std::string> > Alloc;
- typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
- C c1(0, Hash(1), Compare(1), Alloc(1));
- C c2(0, Hash(2), Compare(2), Alloc(2));
- c2.max_load_factor(2);
- c1.swap(c2);
-
- LIBCPP_ASSERT(c1.bucket_count() == 0);
- assert(c1.size() == 0);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(2));
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- LIBCPP_ASSERT(c2.bucket_count() == 0);
- assert(c2.size() == 0);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(1));
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef other_allocator<std::pair<const int, std::string> > Alloc;
- typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
- typedef std::pair<int, std::string> P;
- P a2[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- C c1(0, Hash(1), Compare(1), Alloc(1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
- c2.max_load_factor(2);
- c1.swap(c2);
-
- assert(c1.bucket_count() >= 8);
- assert(c1.size() == 8);
- assert(c1.at(10) == "ten");
- assert(c1.at(20) == "twenty");
- assert(c1.at(30) == "thirty");
- assert(c1.at(40) == "forty");
- assert(c1.at(50) == "fifty");
- assert(c1.at(60) == "sixty");
- assert(c1.at(70) == "seventy");
- assert(c1.at(80) == "eighty");
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(2));
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- LIBCPP_ASSERT(c2.bucket_count() == 0);
- assert(c2.size() == 0);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(1));
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef other_allocator<std::pair<const int, std::string> > Alloc;
- typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
- typedef std::pair<int, std::string> P;
- P a1[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
- C c2(0, Hash(2), Compare(2), Alloc(2));
- c2.max_load_factor(2);
- c1.swap(c2);
-
- LIBCPP_ASSERT(c1.bucket_count() == 0);
- assert(c1.size() == 0);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(2));
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- assert(c2.bucket_count() >= 4);
- assert(c2.size() == 4);
- assert(c2.at(1) == "one");
- assert(c2.at(2) == "two");
- assert(c2.at(3) == "three");
- assert(c2.at(4) == "four");
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(1));
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef other_allocator<std::pair<const int, std::string> > Alloc;
- typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
- typedef std::pair<int, std::string> P;
- P a1[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- P a2[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
- c2.max_load_factor(2);
- c1.swap(c2);
-
- assert(c1.bucket_count() >= 8);
- assert(c1.size() == 8);
- assert(c1.at(10) == "ten");
- assert(c1.at(20) == "twenty");
- assert(c1.at(30) == "thirty");
- assert(c1.at(40) == "forty");
- assert(c1.at(50) == "fifty");
- assert(c1.at(60) == "sixty");
- assert(c1.at(70) == "seventy");
- assert(c1.at(80) == "eighty");
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(2));
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- assert(c2.bucket_count() >= 4);
- assert(c2.size() == 4);
- assert(c2.at(1) == "one");
- assert(c2.at(2) == "two");
- assert(c2.at(3) == "three");
- assert(c2.at(4) == "four");
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(1));
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef test_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
+ C c1(0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(0, Hash(2), Compare(2), Alloc(1, 2));
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ LIBCPP_ASSERT(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ LIBCPP_ASSERT(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef test_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ P a2[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c1(0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ assert(c1.bucket_count() >= 8);
+ assert(c1.size() == 8);
+ assert(c1.at(10) == "ten");
+ assert(c1.at(20) == "twenty");
+ assert(c1.at(30) == "thirty");
+ assert(c1.at(40) == "forty");
+ assert(c1.at(50) == "fifty");
+ assert(c1.at(60) == "sixty");
+ assert(c1.at(70) == "seventy");
+ assert(c1.at(80) == "eighty");
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ LIBCPP_ASSERT(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef test_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ P a1[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(0, Hash(2), Compare(2), Alloc(1, 2));
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ LIBCPP_ASSERT(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 4);
+ assert(c2.size() == 4);
+ assert(c2.at(1) == "one");
+ assert(c2.at(2) == "two");
+ assert(c2.at(3) == "three");
+ assert(c2.at(4) == "four");
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef test_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ P a1[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ P a2[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ assert(c1.bucket_count() >= 8);
+ assert(c1.size() == 8);
+ assert(c1.at(10) == "ten");
+ assert(c1.at(20) == "twenty");
+ assert(c1.at(30) == "thirty");
+ assert(c1.at(40) == "forty");
+ assert(c1.at(50) == "fifty");
+ assert(c1.at(60) == "sixty");
+ assert(c1.at(70) == "seventy");
+ assert(c1.at(80) == "eighty");
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 4);
+ assert(c2.size() == 4);
+ assert(c2.at(1) == "one");
+ assert(c2.at(2) == "two");
+ assert(c2.at(3) == "three");
+ assert(c2.at(4) == "four");
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef other_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
+ C c1(0, Hash(1), Compare(1), Alloc(1));
+ C c2(0, Hash(2), Compare(2), Alloc(2));
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ LIBCPP_ASSERT(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc(2));
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ LIBCPP_ASSERT(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc(1));
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef other_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ P a2[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c1(0, Hash(1), Compare(1), Alloc(1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ assert(c1.bucket_count() >= 8);
+ assert(c1.size() == 8);
+ assert(c1.at(10) == "ten");
+ assert(c1.at(20) == "twenty");
+ assert(c1.at(30) == "thirty");
+ assert(c1.at(40) == "forty");
+ assert(c1.at(50) == "fifty");
+ assert(c1.at(60) == "sixty");
+ assert(c1.at(70) == "seventy");
+ assert(c1.at(80) == "eighty");
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc(2));
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ LIBCPP_ASSERT(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc(1));
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef other_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ P a1[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
+ C c2(0, Hash(2), Compare(2), Alloc(2));
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ LIBCPP_ASSERT(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc(2));
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 4);
+ assert(c2.size() == 4);
+ assert(c2.at(1) == "one");
+ assert(c2.at(2) == "two");
+ assert(c2.at(3) == "three");
+ assert(c2.at(4) == "four");
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc(1));
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef other_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ P a1[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ P a2[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ assert(c1.bucket_count() >= 8);
+ assert(c1.size() == 8);
+ assert(c1.at(10) == "ten");
+ assert(c1.at(20) == "twenty");
+ assert(c1.at(30) == "thirty");
+ assert(c1.at(40) == "forty");
+ assert(c1.at(50) == "fifty");
+ assert(c1.at(60) == "sixty");
+ assert(c1.at(70) == "seventy");
+ assert(c1.at(80) == "eighty");
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc(2));
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 4);
+ assert(c2.size() == 4);
+ assert(c2.at(1) == "one");
+ assert(c2.at(2) == "two");
+ assert(c2.at(3) == "three");
+ assert(c2.at(4) == "four");
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc(1));
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef min_allocator<std::pair<const int, std::string> > Alloc;
- typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
- C c1(0, Hash(1), Compare(1), Alloc());
- C c2(0, Hash(2), Compare(2), Alloc());
- c2.max_load_factor(2);
- c1.swap(c2);
-
- LIBCPP_ASSERT(c1.bucket_count() == 0);
- assert(c1.size() == 0);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- LIBCPP_ASSERT(c2.bucket_count() == 0);
- assert(c2.size() == 0);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef min_allocator<std::pair<const int, std::string> > Alloc;
- typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
- typedef std::pair<int, std::string> P;
- P a2[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- C c1(0, Hash(1), Compare(1), Alloc());
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
- c2.max_load_factor(2);
- c1.swap(c2);
-
- assert(c1.bucket_count() >= 8);
- assert(c1.size() == 8);
- assert(c1.at(10) == "ten");
- assert(c1.at(20) == "twenty");
- assert(c1.at(30) == "thirty");
- assert(c1.at(40) == "forty");
- assert(c1.at(50) == "fifty");
- assert(c1.at(60) == "sixty");
- assert(c1.at(70) == "seventy");
- assert(c1.at(80) == "eighty");
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- LIBCPP_ASSERT(c2.bucket_count() == 0);
- assert(c2.size() == 0);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef min_allocator<std::pair<const int, std::string> > Alloc;
- typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
- typedef std::pair<int, std::string> P;
- P a1[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
- C c2(0, Hash(2), Compare(2), Alloc());
- c2.max_load_factor(2);
- c1.swap(c2);
-
- LIBCPP_ASSERT(c1.bucket_count() == 0);
- assert(c1.size() == 0);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- assert(c2.bucket_count() >= 4);
- assert(c2.size() == 4);
- assert(c2.at(1) == "one");
- assert(c2.at(2) == "two");
- assert(c2.at(3) == "three");
- assert(c2.at(4) == "four");
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef min_allocator<std::pair<const int, std::string> > Alloc;
- typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
- typedef std::pair<int, std::string> P;
- P a1[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- P a2[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
- c2.max_load_factor(2);
- c1.swap(c2);
-
- assert(c1.bucket_count() >= 8);
- assert(c1.size() == 8);
- assert(c1.at(10) == "ten");
- assert(c1.at(20) == "twenty");
- assert(c1.at(30) == "thirty");
- assert(c1.at(40) == "forty");
- assert(c1.at(50) == "fifty");
- assert(c1.at(60) == "sixty");
- assert(c1.at(70) == "seventy");
- assert(c1.at(80) == "eighty");
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- assert(c2.bucket_count() >= 4);
- assert(c2.size() == 4);
- assert(c2.at(1) == "one");
- assert(c2.at(2) == "two");
- assert(c2.at(3) == "three");
- assert(c2.at(4) == "four");
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef min_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
+ C c1(0, Hash(1), Compare(1), Alloc());
+ C c2(0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ LIBCPP_ASSERT(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ LIBCPP_ASSERT(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef min_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ P a2[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c1(0, Hash(1), Compare(1), Alloc());
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ assert(c1.bucket_count() >= 8);
+ assert(c1.size() == 8);
+ assert(c1.at(10) == "ten");
+ assert(c1.at(20) == "twenty");
+ assert(c1.at(30) == "thirty");
+ assert(c1.at(40) == "forty");
+ assert(c1.at(50) == "fifty");
+ assert(c1.at(60) == "sixty");
+ assert(c1.at(70) == "seventy");
+ assert(c1.at(80) == "eighty");
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ LIBCPP_ASSERT(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef min_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ P a1[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
+ C c2(0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ LIBCPP_ASSERT(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 4);
+ assert(c2.size() == 4);
+ assert(c2.at(1) == "one");
+ assert(c2.at(2) == "two");
+ assert(c2.at(3) == "three");
+ assert(c2.at(4) == "four");
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef min_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ P a1[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ P a2[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ assert(c1.bucket_count() >= 8);
+ assert(c1.size() == 8);
+ assert(c1.at(10) == "ten");
+ assert(c1.at(20) == "twenty");
+ assert(c1.at(30) == "thirty");
+ assert(c1.at(40) == "forty");
+ assert(c1.at(50) == "fifty");
+ assert(c1.at(60) == "sixty");
+ assert(c1.at(70) == "seventy");
+ assert(c1.at(80) == "eighty");
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 4);
+ assert(c2.size() == 4);
+ assert(c2.at(1) == "one");
+ assert(c2.at(2) == "two");
+ assert(c2.at(3) == "three");
+ assert(c2.at(4) == "four");
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.map/types.pass.cpp b/libcxx/test/std/containers/unord/unord.map/types.pass.cpp
index 403a0c1599ada1f..c883d35f85ee661 100644
--- a/libcxx/test/std/containers/unord/unord.map/types.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/types.pass.cpp
@@ -33,41 +33,41 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_map<char, short> C;
- static_assert((std::is_same<C::key_type, char>::value), "");
- static_assert((std::is_same<C::mapped_type, short>::value), "");
- static_assert((std::is_same<C::hasher, std::hash<C::key_type> >::value), "");
- static_assert((std::is_same<C::key_equal, std::equal_to<C::key_type> >::value), "");
- static_assert((std::is_same<C::allocator_type, std::allocator<C::value_type> >::value), "");
- static_assert((std::is_same<C::value_type, std::pair<const C::key_type, C::mapped_type> >::value), "");
- static_assert((std::is_same<C::reference, C::value_type&>::value), "");
- static_assert((std::is_same<C::const_reference, const C::value_type&>::value), "");
- static_assert((std::is_same<C::pointer, C::value_type*>::value), "");
- static_assert((std::is_same<C::const_pointer, const C::value_type*>::value), "");
- static_assert((std::is_same<C::size_type, std::size_t>::value), "");
- static_assert((std::is_same<C::
diff erence_type, std::ptr
diff _t>::value), "");
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_map<char, short> C;
+ static_assert((std::is_same<C::key_type, char>::value), "");
+ static_assert((std::is_same<C::mapped_type, short>::value), "");
+ static_assert((std::is_same<C::hasher, std::hash<C::key_type> >::value), "");
+ static_assert((std::is_same<C::key_equal, std::equal_to<C::key_type> >::value), "");
+ static_assert((std::is_same<C::allocator_type, std::allocator<C::value_type> >::value), "");
+ static_assert((std::is_same<C::value_type, std::pair<const C::key_type, C::mapped_type> >::value), "");
+ static_assert((std::is_same<C::reference, C::value_type&>::value), "");
+ static_assert((std::is_same<C::const_reference, const C::value_type&>::value), "");
+ static_assert((std::is_same<C::pointer, C::value_type*>::value), "");
+ static_assert((std::is_same<C::const_pointer, const C::value_type*>::value), "");
+ static_assert((std::is_same<C::size_type, std::size_t>::value), "");
+ static_assert((std::is_same<C::
diff erence_type, std::ptr
diff _t>::value), "");
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_map<char, short, std::hash<char>, std::equal_to<char>,
- min_allocator<std::pair<const char, short>>> C;
- static_assert((std::is_same<C::key_type, char>::value), "");
- static_assert((std::is_same<C::mapped_type, short>::value), "");
- static_assert((std::is_same<C::hasher, std::hash<C::key_type> >::value), "");
- static_assert((std::is_same<C::key_equal, std::equal_to<C::key_type> >::value), "");
- static_assert((std::is_same<C::allocator_type, min_allocator<C::value_type> >::value), "");
- static_assert((std::is_same<C::value_type, std::pair<const C::key_type, C::mapped_type> >::value), "");
- static_assert((std::is_same<C::reference, C::value_type&>::value), "");
- static_assert((std::is_same<C::const_reference, const C::value_type&>::value), "");
- static_assert((std::is_same<C::pointer, min_pointer<C::value_type>>::value), "");
- static_assert((std::is_same<C::const_pointer, min_pointer<const C::value_type>>::value), "");
+ {
+ typedef std::
+ unordered_map<char, short, std::hash<char>, std::equal_to<char>, min_allocator<std::pair<const char, short>>>
+ C;
+ static_assert((std::is_same<C::key_type, char>::value), "");
+ static_assert((std::is_same<C::mapped_type, short>::value), "");
+ static_assert((std::is_same<C::hasher, std::hash<C::key_type> >::value), "");
+ static_assert((std::is_same<C::key_equal, std::equal_to<C::key_type> >::value), "");
+ static_assert((std::is_same<C::allocator_type, min_allocator<C::value_type> >::value), "");
+ static_assert((std::is_same<C::value_type, std::pair<const C::key_type, C::mapped_type> >::value), "");
+ static_assert((std::is_same<C::reference, C::value_type&>::value), "");
+ static_assert((std::is_same<C::const_reference, const C::value_type&>::value), "");
+ static_assert((std::is_same<C::pointer, min_pointer<C::value_type>>::value), "");
+ static_assert((std::is_same<C::const_pointer, min_pointer<const C::value_type>>::value), "");
// min_allocator doesn't have a size_type, so one gets synthesized
- static_assert((std::is_same<C::size_type, std::make_unsigned<C::
diff erence_type>::type>::value), "");
- static_assert((std::is_same<C::
diff erence_type, std::ptr
diff _t>::value), "");
- }
+ static_assert((std::is_same<C::size_type, std::make_unsigned<C::
diff erence_type>::type>::value), "");
+ static_assert((std::is_same<C::
diff erence_type, std::ptr
diff _t>::value), "");
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/allocator.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/allocator.pass.cpp
index af97adf739eb756..601471f364dbe9e 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/allocator.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/allocator.pass.cpp
@@ -24,107 +24,105 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_map<NotConstructible, NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- test_allocator<std::pair<const NotConstructible,
- NotConstructible> >
- > C;
- C c(test_allocator<std::pair<const NotConstructible, NotConstructible> >(10));
- LIBCPP_ASSERT(c.bucket_count() == 0);
- assert(c.hash_function() == test_hash<NotConstructible>());
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() ==
- (test_allocator<std::pair<const NotConstructible, NotConstructible> >(10)));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_map<NotConstructible,
+ NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ test_allocator<std::pair<const NotConstructible, NotConstructible> > >
+ C;
+ C c(test_allocator<std::pair<const NotConstructible, NotConstructible> >(10));
+ LIBCPP_ASSERT(c.bucket_count() == 0);
+ assert(c.hash_function() == test_hash<NotConstructible>());
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == (test_allocator<std::pair<const NotConstructible, NotConstructible> >(10)));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_map<NotConstructible, NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- min_allocator<std::pair<const NotConstructible,
- NotConstructible> >
- > C;
- C c(min_allocator<std::pair<const NotConstructible, NotConstructible> >{});
- LIBCPP_ASSERT(c.bucket_count() == 0);
- assert(c.hash_function() == test_hash<NotConstructible>());
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() ==
- (min_allocator<std::pair<const NotConstructible, NotConstructible> >()));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef explicit_allocator<std::pair<const NotConstructible, NotConstructible>> A;
- typedef std::unordered_map<NotConstructible, NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- A
- > C;
- C c(A{});
- LIBCPP_ASSERT(c.bucket_count() == 0);
- assert(c.hash_function() == test_hash<NotConstructible>());
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() == A{});
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
-#if TEST_STD_VER > 11
- {
- typedef NotConstructible T;
- typedef test_allocator<std::pair<const T, T>> A;
- typedef test_hash<T> HF;
- typedef test_equal_to<T> Comp;
- typedef std::unordered_map<T, T, HF, Comp, A> C;
+ {
+ typedef std::unordered_map<NotConstructible,
+ NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ min_allocator<std::pair<const NotConstructible, NotConstructible> > >
+ C;
+ C c(min_allocator<std::pair<const NotConstructible, NotConstructible> >{});
+ LIBCPP_ASSERT(c.bucket_count() == 0);
+ assert(c.hash_function() == test_hash<NotConstructible>());
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == (min_allocator<std::pair<const NotConstructible, NotConstructible> >()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef explicit_allocator<std::pair<const NotConstructible, NotConstructible>> A;
+ typedef std::unordered_map<NotConstructible,
+ NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ A >
+ C;
+ C c(A{});
+ LIBCPP_ASSERT(c.bucket_count() == 0);
+ assert(c.hash_function() == test_hash<NotConstructible>());
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == A{});
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+# if TEST_STD_VER > 11
+ {
+ typedef NotConstructible T;
+ typedef test_allocator<std::pair<const T, T>> A;
+ typedef test_hash<T> HF;
+ typedef test_equal_to<T> Comp;
+ typedef std::unordered_map<T, T, HF, Comp, A> C;
- A a(10);
- C c(2, a);
- LIBCPP_ASSERT(c.bucket_count() == 2);
- assert(c.hash_function() == HF());
- assert(c.key_eq() == Comp());
- assert(c.get_allocator() == a);
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef NotConstructible T;
- typedef test_allocator<std::pair<const T, T>> A;
- typedef test_hash<T> HF;
- typedef test_equal_to<T> Comp;
- typedef std::unordered_map<T, T, HF, Comp, A> C;
+ A a(10);
+ C c(2, a);
+ LIBCPP_ASSERT(c.bucket_count() == 2);
+ assert(c.hash_function() == HF());
+ assert(c.key_eq() == Comp());
+ assert(c.get_allocator() == a);
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef NotConstructible T;
+ typedef test_allocator<std::pair<const T, T>> A;
+ typedef test_hash<T> HF;
+ typedef test_equal_to<T> Comp;
+ typedef std::unordered_map<T, T, HF, Comp, A> C;
- A a(10);
- HF hf(12);
- C c(2, hf, a);
- LIBCPP_ASSERT(c.bucket_count() == 2);
- assert(c.hash_function() == hf);
- assert(!(c.hash_function() == HF()));
- assert(c.key_eq() == Comp());
- assert(c.get_allocator() == a);
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
-#endif
+ A a(10);
+ HF hf(12);
+ C c(2, hf, a);
+ LIBCPP_ASSERT(c.bucket_count() == 2);
+ assert(c.hash_function() == hf);
+ assert(!(c.hash_function() == HF()));
+ assert(c.key_eq() == Comp());
+ assert(c.get_allocator() == a);
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+# endif
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/assign_copy.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/assign_copy.pass.cpp
index d0b290d54ca2255..34dec07b03e08c3 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/assign_copy.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/assign_copy.pass.cpp
@@ -28,162 +28,115 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef test_allocator<std::pair<const int, std::string> > A;
- typedef std::unordered_map<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A(10)
- );
- C c(a, a + 2,
- 7,
- test_hash<int>(2),
- test_equal_to<int>(3),
- A(4)
- );
- c = c0;
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == A(4));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef std::unordered_map<int, std::string> C;
- typedef std::pair<const int, std::string> P;
- const P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- C *p = &c;
- c = *p;
- assert(c.size() == 4);
- assert(std::is_permutation(c.begin(), c.end(), a));
- }
- {
- typedef other_allocator<std::pair<const int, std::string> > A;
- typedef std::unordered_map<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A(10)
- );
- C c(a, a + 2,
- 7,
- test_hash<int>(2),
- test_equal_to<int>(3),
- A(4)
- );
- c = c0;
- assert(c.bucket_count() >= 5);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == A(10));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef test_allocator<std::pair<const int, std::string> > A;
+ typedef std::unordered_map<int, std::string, test_hash<int>, test_equal_to<int>, A > C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), A(10));
+ C c(a, a + 2, 7, test_hash<int>(2), test_equal_to<int>(3), A(4));
+ c = c0;
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == A(4));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef std::unordered_map<int, std::string> C;
+ typedef std::pair<const int, std::string> P;
+ const P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ C* p = &c;
+ c = *p;
+ assert(c.size() == 4);
+ assert(std::is_permutation(c.begin(), c.end(), a));
+ }
+ {
+ typedef other_allocator<std::pair<const int, std::string> > A;
+ typedef std::unordered_map<int, std::string, test_hash<int>, test_equal_to<int>, A > C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), A(10));
+ C c(a, a + 2, 7, test_hash<int>(2), test_equal_to<int>(3), A(4));
+ c = c0;
+ assert(c.bucket_count() >= 5);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == A(10));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef min_allocator<std::pair<const int, std::string> > A;
- typedef std::unordered_map<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A()
- );
- C c(a, a + 2,
- 7,
- test_hash<int>(2),
- test_equal_to<int>(3),
- A()
- );
- c = c0;
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == A());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+ {
+ typedef min_allocator<std::pair<const int, std::string> > A;
+ typedef std::unordered_map<int, std::string, test_hash<int>, test_equal_to<int>, A > C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), A());
+ C c(a, a + 2, 7, test_hash<int>(2), test_equal_to<int>(3), A());
+ c = c0;
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == A());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/assign_init.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/assign_init.pass.cpp
index 4aa56c4162f3705..ed3aa49fcddbe78 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/assign_init.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/assign_init.pass.cpp
@@ -28,72 +28,63 @@
#include "../../../test_hash.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::allocator<std::pair<const int, std::string> > A;
- typedef std::unordered_map<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- typedef std::pair<int, std::string> P;
- C c = {
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- c = {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- assert(c.bucket_count() >= 5);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef min_allocator<std::pair<const int, std::string> > A;
- typedef std::unordered_map<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- typedef std::pair<int, std::string> P;
- C c = {
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- c = {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- assert(c.bucket_count() >= 5);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::allocator<std::pair<const int, std::string> > A;
+ typedef std::unordered_map<int, std::string, test_hash<int>, test_equal_to<int>, A > C;
+ typedef std::pair<int, std::string> P;
+ C c = {
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ c = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ assert(c.bucket_count() >= 5);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef min_allocator<std::pair<const int, std::string> > A;
+ typedef std::unordered_map<int, std::string, test_hash<int>, test_equal_to<int>, A > C;
+ typedef std::pair<int, std::string> P;
+ C c = {
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ c = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ assert(c.bucket_count() >= 5);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/assign_move.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/assign_move.pass.cpp
index dc859e8fd067a68..39e0fd0feb26778 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/assign_move.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/assign_move.pass.cpp
@@ -29,197 +29,136 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef test_allocator<std::pair<const int, std::string> > A;
- typedef std::unordered_map<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A(10)
- );
- C c(a, a + 2,
- 7,
- test_hash<int>(2),
- test_equal_to<int>(3),
- A(4)
- );
- c = std::move(c0);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == A(4));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef test_allocator<std::pair<const int, std::string> > A;
- typedef std::unordered_map<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A(10)
- );
- C c(a, a + 2,
- 7,
- test_hash<int>(2),
- test_equal_to<int>(3),
- A(10)
- );
- C::iterator it0 = c0.begin();
- c = std::move(c0);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == A(10));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- assert(c0.size() == 0);
- assert(it0 == c.begin()); // Iterators remain valid
- }
- {
- typedef other_allocator<std::pair<const int, std::string> > A;
- typedef std::unordered_map<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A(10)
- );
- C c(a, a + 2,
- 7,
- test_hash<int>(2),
- test_equal_to<int>(3),
- A(4)
- );
- C::iterator it0 = c0.begin();
- c = std::move(c0);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == A(10));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- assert(c0.size() == 0);
- assert(it0 == c.begin()); // Iterators remain valid
- }
- {
- typedef min_allocator<std::pair<const int, std::string> > A;
- typedef std::unordered_map<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A()
- );
- C c(a, a + 2,
- 7,
- test_hash<int>(2),
- test_equal_to<int>(3),
- A()
- );
- C::iterator it0 = c0.begin();
- c = std::move(c0);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == A());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- assert(c0.size() == 0);
- assert(it0 == c.begin()); // Iterators remain valid
- }
+int main(int, char**) {
+ {
+ typedef test_allocator<std::pair<const int, std::string> > A;
+ typedef std::unordered_map<int, std::string, test_hash<int>, test_equal_to<int>, A > C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), A(10));
+ C c(a, a + 2, 7, test_hash<int>(2), test_equal_to<int>(3), A(4));
+ c = std::move(c0);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == A(4));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef test_allocator<std::pair<const int, std::string> > A;
+ typedef std::unordered_map<int, std::string, test_hash<int>, test_equal_to<int>, A > C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), A(10));
+ C c(a, a + 2, 7, test_hash<int>(2), test_equal_to<int>(3), A(10));
+ C::iterator it0 = c0.begin();
+ c = std::move(c0);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == A(10));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c0.size() == 0);
+ assert(it0 == c.begin()); // Iterators remain valid
+ }
+ {
+ typedef other_allocator<std::pair<const int, std::string> > A;
+ typedef std::unordered_map<int, std::string, test_hash<int>, test_equal_to<int>, A > C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), A(10));
+ C c(a, a + 2, 7, test_hash<int>(2), test_equal_to<int>(3), A(4));
+ C::iterator it0 = c0.begin();
+ c = std::move(c0);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == A(10));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c0.size() == 0);
+ assert(it0 == c.begin()); // Iterators remain valid
+ }
+ {
+ typedef min_allocator<std::pair<const int, std::string> > A;
+ typedef std::unordered_map<int, std::string, test_hash<int>, test_equal_to<int>, A > C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), A());
+ C c(a, a + 2, 7, test_hash<int>(2), test_equal_to<int>(3), A());
+ C::iterator it0 = c0.begin();
+ c = std::move(c0);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == A());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c0.size() == 0);
+ assert(it0 == c.begin()); // Iterators remain valid
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/compare_copy_constructible.compile.fail.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/compare_copy_constructible.compile.fail.cpp
index 22c0d088314ce0b..5591d7d66a3aca6 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/compare_copy_constructible.compile.fail.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/compare_copy_constructible.compile.fail.cpp
@@ -18,16 +18,16 @@
template <class T>
struct Comp {
- bool operator () (const T& lhs, const T& rhs) const { return lhs == rhs; }
+ bool operator()(const T& lhs, const T& rhs) const { return lhs == rhs; }
- Comp () {}
-private:
- Comp (const Comp &); // declared but not defined
- };
+ Comp() {}
+private:
+ Comp(const Comp&); // declared but not defined
+};
int main(int, char**) {
- std::unordered_map<int, int, std::hash<int>, Comp<int> > m;
+ std::unordered_map<int, int, std::hash<int>, Comp<int> > m;
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/copy.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/copy.pass.cpp
index 6dad15ef23deb18..793807babbdca7f 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/copy.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/copy.pass.cpp
@@ -27,126 +27,122 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_map<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- test_allocator<std::pair<const int, std::string> >(10)
- );
- C c = c0;
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() ==
- (test_allocator<std::pair<const int, std::string> >(10)));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ test_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a,
+ a + sizeof(a) / sizeof(a[0]),
+ 7,
+ test_hash<int>(8),
+ test_equal_to<int>(9),
+ test_allocator<std::pair<const int, std::string> >(10));
+ C c = c0;
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == (test_allocator<std::pair<const int, std::string> >(10)));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_map<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- other_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- other_allocator<std::pair<const int, std::string> >(10)
- );
- C c = c0;
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() ==
- (other_allocator<std::pair<const int, std::string> >(-2)));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef std::unordered_map<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- min_allocator<std::pair<const int, std::string> >()
- );
- C c = c0;
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() ==
- (min_allocator<std::pair<const int, std::string> >()));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ other_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a,
+ a + sizeof(a) / sizeof(a[0]),
+ 7,
+ test_hash<int>(8),
+ test_equal_to<int>(9),
+ other_allocator<std::pair<const int, std::string> >(10));
+ C c = c0;
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == (other_allocator<std::pair<const int, std::string> >(-2)));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ min_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a,
+ a + sizeof(a) / sizeof(a[0]),
+ 7,
+ test_hash<int>(8),
+ test_equal_to<int>(9),
+ min_allocator<std::pair<const int, std::string> >());
+ C c = c0;
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == (min_allocator<std::pair<const int, std::string> >()));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/copy_alloc.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/copy_alloc.pass.cpp
index 1d9cf9f5932e644..65c49f4fdcd0027 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/copy_alloc.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/copy_alloc.pass.cpp
@@ -27,126 +27,113 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_map<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- test_allocator<std::pair<const int, std::string> >(10)
- );
- C c(c0, test_allocator<std::pair<const int, std::string> >(5));
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() ==
- (test_allocator<std::pair<const int, std::string> >(5)));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ test_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a,
+ a + sizeof(a) / sizeof(a[0]),
+ 7,
+ test_hash<int>(8),
+ test_equal_to<int>(9),
+ test_allocator<std::pair<const int, std::string> >(10));
+ C c(c0, test_allocator<std::pair<const int, std::string> >(5));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == (test_allocator<std::pair<const int, std::string> >(5)));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_map<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- min_allocator<std::pair<const int, std::string> >()
- );
- C c(c0, min_allocator<std::pair<const int, std::string> >());
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() ==
- (min_allocator<std::pair<const int, std::string> >()));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef explicit_allocator<std::pair<const int, std::string>> A;
- typedef std::unordered_map<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A{}
- );
- C c(c0, A{});
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == A{});
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ min_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a,
+ a + sizeof(a) / sizeof(a[0]),
+ 7,
+ test_hash<int>(8),
+ test_equal_to<int>(9),
+ min_allocator<std::pair<const int, std::string> >());
+ C c(c0, min_allocator<std::pair<const int, std::string> >());
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == (min_allocator<std::pair<const int, std::string> >()));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef explicit_allocator<std::pair<const int, std::string>> A;
+ typedef std::unordered_map<int, std::string, test_hash<int>, test_equal_to<int>, A > C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), A{});
+ C c(c0, A{});
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == A{});
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/deduct.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/deduct.pass.cpp
index 873b77e06a8d858..b2ef6be5523a59d 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/deduct.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/deduct.pass.cpp
@@ -90,152 +90,168 @@
#include "deduction_guides_sfinae_checks.h"
#include "test_allocator.h"
-using P = std::pair<int, long>;
+using P = std::pair<int, long>;
using PC = std::pair<const int, long>;
-int main(int, char**)
-{
- const PC expected_m[] = { {1,1}, {2,2}, {3,1}, {INT_MAX,1} };
+int main(int, char**) {
+ const PC expected_m[] = {{1, 1}, {2, 2}, {3, 1}, {INT_MAX, 1}};
- {
- const P arr[] = { {1,1}, {2,2}, {1,1}, {INT_MAX,1}, {3,1} };
+ {
+ const P arr[] = {{1, 1}, {2, 2}, {1, 1}, {INT_MAX, 1}, {3, 1}};
std::unordered_map m(std::begin(arr), std::end(arr));
ASSERT_SAME_TYPE(decltype(m), std::unordered_map<int, long>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
- }
+ }
- {
- const P arr[] = { {1,1}, {2,2}, {1,1}, {INT_MAX,1}, {3,1} };
+ {
+ const P arr[] = {{1, 1}, {2, 2}, {1, 1}, {INT_MAX, 1}, {3, 1}};
std::unordered_map m(std::begin(arr), std::end(arr), 42);
ASSERT_SAME_TYPE(decltype(m), std::unordered_map<int, long>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
- }
+ }
- {
- const P arr[] = { {1,1}, {2,2}, {1,1}, {INT_MAX,1}, {3,1} };
+ {
+ const P arr[] = {{1, 1}, {2, 2}, {1, 1}, {INT_MAX, 1}, {3, 1}};
std::unordered_map m(std::begin(arr), std::end(arr), 42, std::hash<long long>());
ASSERT_SAME_TYPE(decltype(m), std::unordered_map<int, long, std::hash<long long>, std::equal_to<int>>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
- }
+ }
- {
- const P arr[] = { {1,1}, {2,2}, {1,1}, {INT_MAX,1}, {3,1} };
+ {
+ const P arr[] = {{1, 1}, {2, 2}, {1, 1}, {INT_MAX, 1}, {3, 1}};
std::unordered_map m(std::begin(arr), std::end(arr), 42, std::hash<long long>(), std::equal_to<>());
ASSERT_SAME_TYPE(decltype(m), std::unordered_map<int, long, std::hash<long long>, std::equal_to<>>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
- }
-
- {
- const P arr[] = { {1,1}, {2,2}, {1,1}, {INT_MAX,1}, {3,1} };
- std::unordered_map m(std::begin(arr), std::end(arr), 42, std::hash<long long>(), std::equal_to<>(), test_allocator<PC>(0, 41));
- ASSERT_SAME_TYPE(decltype(m), std::unordered_map<int, long, std::hash<long long>, std::equal_to<>, test_allocator<PC>>);
+ }
+
+ {
+ const P arr[] = {{1, 1}, {2, 2}, {1, 1}, {INT_MAX, 1}, {3, 1}};
+ std::unordered_map m(
+ std::begin(arr), std::end(arr), 42, std::hash<long long>(), std::equal_to<>(), test_allocator<PC>(0, 41));
+ ASSERT_SAME_TYPE(
+ decltype(m), std::unordered_map<int, long, std::hash<long long>, std::equal_to<>, test_allocator<PC>>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
assert(m.get_allocator().get_id() == 41);
- }
+ }
- {
+ {
std::unordered_map<int, long> source;
std::unordered_map m(source);
ASSERT_SAME_TYPE(decltype(m), decltype(source));
assert(m.size() == 0);
- }
+ }
- {
+ {
std::unordered_map<int, long> source;
- std::unordered_map m{source}; // braces instead of parens
+ std::unordered_map m{source}; // braces instead of parens
ASSERT_SAME_TYPE(decltype(m), decltype(source));
assert(m.size() == 0);
- }
+ }
- {
+ {
std::unordered_map<int, long, std::hash<long long>, std::equal_to<>, test_allocator<PC>> source;
test_allocator<PC> a(0, 42);
std::unordered_map m(source, a);
ASSERT_SAME_TYPE(decltype(m), decltype(source));
assert(m.get_allocator().get_id() == 42);
assert(m.size() == 0);
- }
+ }
- {
+ {
std::unordered_map<int, long, std::hash<long long>, std::equal_to<>, test_allocator<PC>> source;
test_allocator<PC> a(0, 43);
- std::unordered_map m{source, a}; // braces instead of parens
+ std::unordered_map m{source, a}; // braces instead of parens
ASSERT_SAME_TYPE(decltype(m), decltype(source));
assert(m.get_allocator().get_id() == 43);
assert(m.size() == 0);
- }
+ }
- {
- std::unordered_map m { P{1,1L}, P{2,2L}, P{1,1L}, P{INT_MAX,1L}, P{3,1L} };
+ {
+ std::unordered_map m{P{1, 1L}, P{2, 2L}, P{1, 1L}, P{INT_MAX, 1L}, P{3, 1L}};
ASSERT_SAME_TYPE(decltype(m), std::unordered_map<int, long>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
- }
+ }
- {
- std::unordered_map m({ P{1,1L}, P{2,2L}, P{1,1L}, P{INT_MAX,1L}, P{3,1L} }, 42);
+ {
+ std::unordered_map m({P{1, 1L}, P{2, 2L}, P{1, 1L}, P{INT_MAX, 1L}, P{3, 1L}}, 42);
ASSERT_SAME_TYPE(decltype(m), std::unordered_map<int, long>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
- }
+ }
- {
- std::unordered_map m({ P{1,1L}, P{2,2L}, P{1,1L}, P{INT_MAX,1L}, P{3,1L} }, 42, std::hash<long long>());
+ {
+ std::unordered_map m({P{1, 1L}, P{2, 2L}, P{1, 1L}, P{INT_MAX, 1L}, P{3, 1L}}, 42, std::hash<long long>());
ASSERT_SAME_TYPE(decltype(m), std::unordered_map<int, long, std::hash<long long>>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
- }
+ }
- {
- std::unordered_map m({ P{1,1L}, P{2,2L}, P{1,1L}, P{INT_MAX,1L}, P{3,1L} }, 42, std::hash<long long>(), std::equal_to<>());
+ {
+ std::unordered_map m(
+ {P{1, 1L}, P{2, 2L}, P{1, 1L}, P{INT_MAX, 1L}, P{3, 1L}}, 42, std::hash<long long>(), std::equal_to<>());
ASSERT_SAME_TYPE(decltype(m), std::unordered_map<int, long, std::hash<long long>, std::equal_to<>>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
- }
-
- {
- std::unordered_map m({ P{1,1L}, P{2,2L}, P{1,1L}, P{INT_MAX,1L}, P{3,1L} }, 42, std::hash<long long>(), std::equal_to<>(), test_allocator<PC>(0, 44));
- ASSERT_SAME_TYPE(decltype(m), std::unordered_map<int, long, std::hash<long long>, std::equal_to<>, test_allocator<PC>>);
+ }
+
+ {
+ std::unordered_map m(
+ {P{1, 1L}, P{2, 2L}, P{1, 1L}, P{INT_MAX, 1L}, P{3, 1L}},
+ 42,
+ std::hash<long long>(),
+ std::equal_to<>(),
+ test_allocator<PC>(0, 44));
+ ASSERT_SAME_TYPE(
+ decltype(m), std::unordered_map<int, long, std::hash<long long>, std::equal_to<>, test_allocator<PC>>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
assert(m.get_allocator().get_id() == 44);
- }
+ }
- {
- const P arr[] = { {1,1}, {2,2}, {1,1}, {INT_MAX,1}, {3,1} };
+ {
+ const P arr[] = {{1, 1}, {2, 2}, {1, 1}, {INT_MAX, 1}, {3, 1}};
std::unordered_map m(std::begin(arr), std::end(arr), 42, test_allocator<PC>(0, 45));
- ASSERT_SAME_TYPE(decltype(m), std::unordered_map<int, long, std::hash<int>, std::equal_to<int>, test_allocator<PC>>);
+ ASSERT_SAME_TYPE(
+ decltype(m), std::unordered_map<int, long, std::hash<int>, std::equal_to<int>, test_allocator<PC>>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
assert(m.get_allocator().get_id() == 45);
- }
+ }
- {
- const P arr[] = { {1,1}, {2,2}, {1,1}, {INT_MAX,1}, {3,1} };
+ {
+ const P arr[] = {{1, 1}, {2, 2}, {1, 1}, {INT_MAX, 1}, {3, 1}};
std::unordered_map m(std::begin(arr), std::end(arr), 42, std::hash<long long>(), test_allocator<PC>(0, 46));
- ASSERT_SAME_TYPE(decltype(m), std::unordered_map<int, long, std::hash<long long>, std::equal_to<int>, test_allocator<PC>>);
+ ASSERT_SAME_TYPE(
+ decltype(m), std::unordered_map<int, long, std::hash<long long>, std::equal_to<int>, test_allocator<PC>>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
assert(m.get_allocator().get_id() == 46);
- }
+ }
- {
- std::unordered_map m({ P{1,1L}, P{2,2L}, P{1,1L}, P{INT_MAX,1L}, P{3,1L} }, 42, test_allocator<PC>(0, 47));
- ASSERT_SAME_TYPE(decltype(m), std::unordered_map<int, long, std::hash<int>, std::equal_to<int>, test_allocator<PC>>);
+ {
+ std::unordered_map m({P{1, 1L}, P{2, 2L}, P{1, 1L}, P{INT_MAX, 1L}, P{3, 1L}}, 42, test_allocator<PC>(0, 47));
+ ASSERT_SAME_TYPE(
+ decltype(m), std::unordered_map<int, long, std::hash<int>, std::equal_to<int>, test_allocator<PC>>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
assert(m.get_allocator().get_id() == 47);
- }
-
- {
- std::unordered_map m({ P{1,1L}, P{2,2L}, P{1,1L}, P{INT_MAX,1L}, P{3,1L} }, 42, std::hash<long long>(), test_allocator<PC>(0, 48));
- ASSERT_SAME_TYPE(decltype(m), std::unordered_map<int, long, std::hash<long long>, std::equal_to<int>, test_allocator<PC>>);
+ }
+
+ {
+ std::unordered_map m(
+ {P{1, 1L}, P{2, 2L}, P{1, 1L}, P{INT_MAX, 1L}, P{3, 1L}},
+ 42,
+ std::hash<long long>(),
+ test_allocator<PC>(0, 48));
+ ASSERT_SAME_TYPE(
+ decltype(m), std::unordered_map<int, long, std::hash<long long>, std::equal_to<int>, test_allocator<PC>>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
assert(m.get_allocator().get_id() == 48);
- }
+ }
- {
+ {
// Examples from LWG3025
std::unordered_map m{std::pair{1, 1}, {2, 2}, {3, 3}};
ASSERT_SAME_TYPE(decltype(m), std::unordered_map<int, int>);
std::unordered_map m2{m.begin(), m.end()};
ASSERT_SAME_TYPE(decltype(m2), std::unordered_map<int, int>);
- }
+ }
- {
+ {
// Examples from LWG3531
std::unordered_map m1{{std::pair{1, 2}, {3, 4}}, 0};
ASSERT_SAME_TYPE(decltype(m1), std::unordered_map<int, int>);
@@ -243,61 +259,61 @@ int main(int, char**)
using value_type = std::pair<const int, int>;
std::unordered_map m2{{value_type{1, 2}, {3, 4}}, 0};
ASSERT_SAME_TYPE(decltype(m2), std::unordered_map<int, int>);
- }
+ }
#if TEST_STD_VER >= 23
- {
- using Range = std::array<P, 0>;
- using Pred = test_equal_to<int>;
- using DefaultPred = std::equal_to<int>;
- using Hash = test_hash<int>;
- using DefaultHash = std::hash<int>;
- using Alloc = test_allocator<PC>;
-
- { // (from_range, range)
- std::unordered_map c(std::from_range, Range());
- static_assert(std::is_same_v<decltype(c), std::unordered_map<int, long>>);
- }
-
- { // (from_range, range, n)
- std::unordered_map c(std::from_range, Range(), std::size_t());
- static_assert(std::is_same_v<decltype(c), std::unordered_map<int, long>>);
- }
-
- { // (from_range, range, n, hash)
- std::unordered_map c(std::from_range, Range(), std::size_t(), Hash());
- static_assert(std::is_same_v<decltype(c), std::unordered_map<int, long, Hash>>);
- }
-
- { // (from_range, range, n, hash, pred)
- std::unordered_map c(std::from_range, Range(), std::size_t(), Hash(), Pred());
- static_assert(std::is_same_v<decltype(c), std::unordered_map<int, long, Hash, Pred>>);
- }
-
- { // (from_range, range, n, hash, pred, alloc)
- std::unordered_map c(std::from_range, Range(), std::size_t(), Hash(), Pred(), Alloc());
- static_assert(std::is_same_v<decltype(c), std::unordered_map<int, long, Hash, Pred, Alloc>>);
- }
-
- { // (from_range, range, n, alloc)
- std::unordered_map c(std::from_range, Range(), std::size_t(), Alloc());
- static_assert(std::is_same_v<decltype(c), std::unordered_map<int, long, DefaultHash, DefaultPred, Alloc>>);
- }
-
- // TODO(LWG 2713): uncomment this test once the constructor is added.
- { // (from_range, range, alloc)
- //std::unordered_map c(std::from_range, Range(), Alloc());
- //static_assert(std::is_same_v<decltype(c), std::unordered_map<int, long, DefaultHash, DefaultPred, Alloc>>);
- }
-
- { // (from_range, range, n, hash, alloc)
- std::unordered_map c(std::from_range, Range(), std::size_t(), Hash(), Alloc());
- static_assert(std::is_same_v<decltype(c), std::unordered_map<int, long, Hash, DefaultPred, Alloc>>);
- }
+ {
+ using Range = std::array<P, 0>;
+ using Pred = test_equal_to<int>;
+ using DefaultPred = std::equal_to<int>;
+ using Hash = test_hash<int>;
+ using DefaultHash = std::hash<int>;
+ using Alloc = test_allocator<PC>;
+
+ { // (from_range, range)
+ std::unordered_map c(std::from_range, Range());
+ static_assert(std::is_same_v<decltype(c), std::unordered_map<int, long>>);
+ }
+
+ { // (from_range, range, n)
+ std::unordered_map c(std::from_range, Range(), std::size_t());
+ static_assert(std::is_same_v<decltype(c), std::unordered_map<int, long>>);
+ }
+
+ { // (from_range, range, n, hash)
+ std::unordered_map c(std::from_range, Range(), std::size_t(), Hash());
+ static_assert(std::is_same_v<decltype(c), std::unordered_map<int, long, Hash>>);
+ }
+
+ { // (from_range, range, n, hash, pred)
+ std::unordered_map c(std::from_range, Range(), std::size_t(), Hash(), Pred());
+ static_assert(std::is_same_v<decltype(c), std::unordered_map<int, long, Hash, Pred>>);
+ }
+
+ { // (from_range, range, n, hash, pred, alloc)
+ std::unordered_map c(std::from_range, Range(), std::size_t(), Hash(), Pred(), Alloc());
+ static_assert(std::is_same_v<decltype(c), std::unordered_map<int, long, Hash, Pred, Alloc>>);
+ }
+
+ { // (from_range, range, n, alloc)
+ std::unordered_map c(std::from_range, Range(), std::size_t(), Alloc());
+ static_assert(std::is_same_v<decltype(c), std::unordered_map<int, long, DefaultHash, DefaultPred, Alloc>>);
+ }
+
+ // TODO(LWG 2713): uncomment this test once the constructor is added.
+ { // (from_range, range, alloc)
+ //std::unordered_map c(std::from_range, Range(), Alloc());
+ //static_assert(std::is_same_v<decltype(c), std::unordered_map<int, long, DefaultHash, DefaultPred, Alloc>>);
+ }
+
+ { // (from_range, range, n, hash, alloc)
+ std::unordered_map c(std::from_range, Range(), std::size_t(), Hash(), Alloc());
+ static_assert(std::is_same_v<decltype(c), std::unordered_map<int, long, Hash, DefaultPred, Alloc>>);
}
+ }
#endif
- UnorderedContainerDeductionGuidesSfinaeAway<std::unordered_map, std::unordered_map<int, long>>();
+ UnorderedContainerDeductionGuidesSfinaeAway<std::unordered_map, std::unordered_map<int, long>>();
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/deduct.verify.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/deduct.verify.cpp
index dc0ffd26813d92d..5bb2b28fa09f53e 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/deduct.verify.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/deduct.verify.cpp
@@ -59,47 +59,48 @@
#include <functional>
#include <unordered_map>
-int main(int, char**)
-{
- using P = std::pair<const int, int>;
- {
- // cannot deduce Key from nothing
- std::unordered_map m; // expected-error-re{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_map'}}
- }
- {
- // cannot deduce Key from just (Size)
- std::unordered_map m(42); // expected-error-re{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_map'}}
- }
- {
- // cannot deduce Key from just (Size, Hash)
- std::unordered_map m(42, std::hash<int>());
- // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_map'}}
- }
- {
- // cannot deduce Key from just (Size, Hash, Pred)
- std::unordered_map m(42, std::hash<int>(), std::equal_to<int>());
- // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_map'}}
- }
- {
- // cannot deduce Key from just (Size, Hash, Pred, Allocator)
- std::unordered_map m(42, std::hash<int>(), std::equal_to<int>(), std::allocator<P>());
- // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_map'}}
- }
- {
- // cannot deduce Key from just (Allocator)
- std::unordered_map m(std::allocator<P>{});
- // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_map'}}
- }
- {
- // cannot deduce Key from just (Size, Allocator)
- std::unordered_map m(42, std::allocator<P>());
- // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_map'}}
- }
- {
- // cannot deduce Key from just (Size, Hash, Allocator)
- std::unordered_map m(42, std::hash<int>(), std::allocator<P>());
- // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_map'}}
- }
+int main(int, char**) {
+ using P = std::pair<const int, int>;
+ {
+ // cannot deduce Key from nothing
+ std::unordered_map m;
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_map'}}
+ }
+ {
+ // cannot deduce Key from just (Size)
+ std::unordered_map m(42);
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_map'}}
+ }
+ {
+ // cannot deduce Key from just (Size, Hash)
+ std::unordered_map m(42, std::hash<int>());
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_map'}}
+ }
+ {
+ // cannot deduce Key from just (Size, Hash, Pred)
+ std::unordered_map m(42, std::hash<int>(), std::equal_to<int>());
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_map'}}
+ }
+ {
+ // cannot deduce Key from just (Size, Hash, Pred, Allocator)
+ std::unordered_map m(42, std::hash<int>(), std::equal_to<int>(), std::allocator<P>());
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_map'}}
+ }
+ {
+ // cannot deduce Key from just (Allocator)
+ std::unordered_map m(std::allocator<P>{});
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_map'}}
+ }
+ {
+ // cannot deduce Key from just (Size, Allocator)
+ std::unordered_map m(42, std::allocator<P>());
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_map'}}
+ }
+ {
+ // cannot deduce Key from just (Size, Hash, Allocator)
+ std::unordered_map m(42, std::hash<int>(), std::allocator<P>());
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_map'}}
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/deduct_const.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/deduct_const.pass.cpp
index 547eef02961f8e1..75e55256bc25f4a 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/deduct_const.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/deduct_const.pass.cpp
@@ -64,109 +64,123 @@
#include "test_allocator.h"
-using P = std::pair<int, long>;
+using P = std::pair<int, long>;
using PC = std::pair<const int, long>;
-int main(int, char**)
-{
- const PC expected_m[] = { {1,1L}, {2,2L}, {3,1L}, {INT_MAX,1L} };
+int main(int, char**) {
+ const PC expected_m[] = {{1, 1L}, {2, 2L}, {3, 1L}, {INT_MAX, 1L}};
- {
- const PC arr[] = { {1,1L}, {2,2L}, {1,1L}, {INT_MAX,1L}, {3,1L} };
+ {
+ const PC arr[] = {{1, 1L}, {2, 2L}, {1, 1L}, {INT_MAX, 1L}, {3, 1L}};
std::unordered_map m(std::begin(arr), std::end(arr));
ASSERT_SAME_TYPE(decltype(m), std::unordered_map<int, long>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
- }
+ }
- {
- const PC arr[] = { {1,1L}, {2,2L}, {1,1L}, {INT_MAX,1L}, {3,1L} };
+ {
+ const PC arr[] = {{1, 1L}, {2, 2L}, {1, 1L}, {INT_MAX, 1L}, {3, 1L}};
std::unordered_map m(std::begin(arr), std::end(arr), 42);
ASSERT_SAME_TYPE(decltype(m), std::unordered_map<int, long>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
- }
+ }
- {
- const PC arr[] = { {1,1L}, {2,2L}, {1,1L}, {INT_MAX,1L}, {3,1L} };
+ {
+ const PC arr[] = {{1, 1L}, {2, 2L}, {1, 1L}, {INT_MAX, 1L}, {3, 1L}};
std::unordered_map m(std::begin(arr), std::end(arr), 42, std::hash<short>());
ASSERT_SAME_TYPE(decltype(m), std::unordered_map<int, long, std::hash<short>, std::equal_to<int>>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
- }
+ }
- {
- const PC arr[] = { {1,1L}, {2,2L}, {1,1L}, {INT_MAX,1L}, {3,1L} };
+ {
+ const PC arr[] = {{1, 1L}, {2, 2L}, {1, 1L}, {INT_MAX, 1L}, {3, 1L}};
std::unordered_map m(std::begin(arr), std::end(arr), 42, std::hash<short>(), std::equal_to<>());
ASSERT_SAME_TYPE(decltype(m), std::unordered_map<int, long, std::hash<short>, std::equal_to<>>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
- }
+ }
- {
- const PC arr[] = { {1,1L}, {2,2L}, {1,1L}, {INT_MAX,1L}, {3,1L} };
- std::unordered_map m(std::begin(arr), std::end(arr), 42, std::hash<short>(), std::equal_to<>(), test_allocator<PC>(0, 41));
+ {
+ const PC arr[] = {{1, 1L}, {2, 2L}, {1, 1L}, {INT_MAX, 1L}, {3, 1L}};
+ std::unordered_map m(
+ std::begin(arr), std::end(arr), 42, std::hash<short>(), std::equal_to<>(), test_allocator<PC>(0, 41));
ASSERT_SAME_TYPE(decltype(m), std::unordered_map<int, long, std::hash<short>, std::equal_to<>, test_allocator<PC>>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
assert(m.get_allocator().get_id() == 41);
- }
+ }
- {
- std::unordered_map m { PC{1,1L}, PC{2,2L}, PC{1,1L}, PC{INT_MAX,1L}, PC{3,1L} };
+ {
+ std::unordered_map m{PC{1, 1L}, PC{2, 2L}, PC{1, 1L}, PC{INT_MAX, 1L}, PC{3, 1L}};
ASSERT_SAME_TYPE(decltype(m), std::unordered_map<int, long>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
- }
+ }
- {
- std::unordered_map m({ PC{1,1L}, PC{2,2L}, PC{1,1L}, PC{INT_MAX,1L}, PC{3,1L} }, 42);
+ {
+ std::unordered_map m({PC{1, 1L}, PC{2, 2L}, PC{1, 1L}, PC{INT_MAX, 1L}, PC{3, 1L}}, 42);
ASSERT_SAME_TYPE(decltype(m), std::unordered_map<int, long>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
- }
+ }
- {
- std::unordered_map m({ PC{1,1L}, PC{2,2L}, PC{1,1L}, PC{INT_MAX,1L}, PC{3,1L} }, 42, std::hash<short>());
+ {
+ std::unordered_map m({PC{1, 1L}, PC{2, 2L}, PC{1, 1L}, PC{INT_MAX, 1L}, PC{3, 1L}}, 42, std::hash<short>());
ASSERT_SAME_TYPE(decltype(m), std::unordered_map<int, long, std::hash<short>>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
- }
+ }
- {
- std::unordered_map m({ PC{1,1L}, PC{2,2L}, PC{1,1L}, PC{INT_MAX,1L}, PC{3,1L} }, 42, std::hash<short>(), std::equal_to<>());
+ {
+ std::unordered_map m(
+ {PC{1, 1L}, PC{2, 2L}, PC{1, 1L}, PC{INT_MAX, 1L}, PC{3, 1L}}, 42, std::hash<short>(), std::equal_to<>());
ASSERT_SAME_TYPE(decltype(m), std::unordered_map<int, long, std::hash<short>, std::equal_to<>>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
- }
-
- {
- std::unordered_map m({ PC{1,1L}, PC{2,2L}, PC{1,1L}, PC{INT_MAX,1L}, PC{3,1L} }, 42, std::hash<short>(), std::equal_to<>(), test_allocator<PC>(0, 44));
+ }
+
+ {
+ std::unordered_map m(
+ {PC{1, 1L}, PC{2, 2L}, PC{1, 1L}, PC{INT_MAX, 1L}, PC{3, 1L}},
+ 42,
+ std::hash<short>(),
+ std::equal_to<>(),
+ test_allocator<PC>(0, 44));
ASSERT_SAME_TYPE(decltype(m), std::unordered_map<int, long, std::hash<short>, std::equal_to<>, test_allocator<PC>>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
assert(m.get_allocator().get_id() == 44);
- }
+ }
- {
- const PC arr[] = { {1,1}, {2,2}, {1,1}, {INT_MAX,1}, {3,1} };
+ {
+ const PC arr[] = {{1, 1}, {2, 2}, {1, 1}, {INT_MAX, 1}, {3, 1}};
std::unordered_map m(std::begin(arr), std::end(arr), 42, test_allocator<PC>(0, 45));
- ASSERT_SAME_TYPE(decltype(m), std::unordered_map<int, long, std::hash<int>, std::equal_to<int>, test_allocator<PC>>);
+ ASSERT_SAME_TYPE(
+ decltype(m), std::unordered_map<int, long, std::hash<int>, std::equal_to<int>, test_allocator<PC>>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
assert(m.get_allocator().get_id() == 45);
- }
+ }
- {
- const PC arr[] = { {1,1}, {2,2}, {1,1}, {INT_MAX,1}, {3,1} };
+ {
+ const PC arr[] = {{1, 1}, {2, 2}, {1, 1}, {INT_MAX, 1}, {3, 1}};
std::unordered_map m(std::begin(arr), std::end(arr), 42, std::hash<short>(), test_allocator<PC>(0, 46));
- ASSERT_SAME_TYPE(decltype(m), std::unordered_map<int, long, std::hash<short>, std::equal_to<int>, test_allocator<PC>>);
+ ASSERT_SAME_TYPE(
+ decltype(m), std::unordered_map<int, long, std::hash<short>, std::equal_to<int>, test_allocator<PC>>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
assert(m.get_allocator().get_id() == 46);
- }
+ }
- {
- std::unordered_map m({ PC{1,1L}, PC{2,2L}, PC{1,1L}, PC{INT_MAX,1L}, PC{3,1L} }, 42, test_allocator<PC>(0, 47));
- ASSERT_SAME_TYPE(decltype(m), std::unordered_map<int, long, std::hash<int>, std::equal_to<int>, test_allocator<PC>>);
+ {
+ std::unordered_map m({PC{1, 1L}, PC{2, 2L}, PC{1, 1L}, PC{INT_MAX, 1L}, PC{3, 1L}}, 42, test_allocator<PC>(0, 47));
+ ASSERT_SAME_TYPE(
+ decltype(m), std::unordered_map<int, long, std::hash<int>, std::equal_to<int>, test_allocator<PC>>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
assert(m.get_allocator().get_id() == 47);
- }
-
- {
- std::unordered_map m({ PC{1,1L}, PC{2,2L}, PC{1,1L}, PC{INT_MAX,1L}, PC{3,1L} }, 42, std::hash<short>(), test_allocator<PC>(0, 48));
- ASSERT_SAME_TYPE(decltype(m), std::unordered_map<int, long, std::hash<short>, std::equal_to<int>, test_allocator<PC>>);
+ }
+
+ {
+ std::unordered_map m(
+ {PC{1, 1L}, PC{2, 2L}, PC{1, 1L}, PC{INT_MAX, 1L}, PC{3, 1L}},
+ 42,
+ std::hash<short>(),
+ test_allocator<PC>(0, 48));
+ ASSERT_SAME_TYPE(
+ decltype(m), std::unordered_map<int, long, std::hash<short>, std::equal_to<int>, test_allocator<PC>>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
assert(m.get_allocator().get_id() == 48);
- }
+ }
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/default.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/default.pass.cpp
index a4bdb52be307eab..7ce5cc401347dd4 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/default.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/default.pass.cpp
@@ -24,89 +24,87 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_map<NotConstructible, NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- test_allocator<std::pair<const NotConstructible,
- NotConstructible> >
- > C;
- C c;
- LIBCPP_ASSERT(c.bucket_count() == 0);
- assert(c.hash_function() == test_hash<NotConstructible>());
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() ==
- (test_allocator<std::pair<const NotConstructible, NotConstructible> >()));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_map<NotConstructible,
+ NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ test_allocator<std::pair<const NotConstructible, NotConstructible> > >
+ C;
+ C c;
+ LIBCPP_ASSERT(c.bucket_count() == 0);
+ assert(c.hash_function() == test_hash<NotConstructible>());
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == (test_allocator<std::pair<const NotConstructible, NotConstructible> >()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
+ {
+ typedef std::unordered_map<NotConstructible,
+ NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ min_allocator<std::pair<const NotConstructible, NotConstructible> > >
+ C;
+ C c;
+ LIBCPP_ASSERT(c.bucket_count() == 0);
+ assert(c.hash_function() == test_hash<NotConstructible>());
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == (min_allocator<std::pair<const NotConstructible, NotConstructible> >()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef explicit_allocator<std::pair<const NotConstructible, NotConstructible>> A;
+ typedef std::unordered_map<NotConstructible,
+ NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ A >
+ C;
{
- typedef std::unordered_map<NotConstructible, NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- min_allocator<std::pair<const NotConstructible,
- NotConstructible> >
- > C;
- C c;
- LIBCPP_ASSERT(c.bucket_count() == 0);
- assert(c.hash_function() == test_hash<NotConstructible>());
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() ==
- (min_allocator<std::pair<const NotConstructible, NotConstructible> >()));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef explicit_allocator<std::pair<const NotConstructible, NotConstructible>> A;
- typedef std::unordered_map<NotConstructible, NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- A
- > C;
- {
- C c;
- LIBCPP_ASSERT(c.bucket_count() == 0);
- assert(c.hash_function() == test_hash<NotConstructible>());
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() == A());
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
- {
- A a;
- C c(a);
- LIBCPP_ASSERT(c.bucket_count() == 0);
- assert(c.hash_function() == test_hash<NotConstructible>());
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() == a);
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+ C c;
+ LIBCPP_ASSERT(c.bucket_count() == 0);
+ assert(c.hash_function() == test_hash<NotConstructible>());
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == A());
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
}
{
- std::unordered_map<int, int> c = {};
- LIBCPP_ASSERT(c.bucket_count() == 0);
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
+ A a;
+ C c(a);
+ LIBCPP_ASSERT(c.bucket_count() == 0);
+ assert(c.hash_function() == test_hash<NotConstructible>());
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == a);
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
}
+ }
+ {
+ std::unordered_map<int, int> c = {};
+ LIBCPP_ASSERT(c.bucket_count() == 0);
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/default_noexcept.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/default_noexcept.pass.cpp
index 2fff7fdbac6e45d..f41d18a6c622c75 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/default_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/default_noexcept.pass.cpp
@@ -27,51 +27,55 @@
#include "../../../test_hash.h"
template <class T>
-struct some_comp
-{
- typedef T value_type;
- some_comp();
- some_comp(const some_comp&);
- bool operator()(const T&, const T&) const { return false; }
+struct some_comp {
+ typedef T value_type;
+ some_comp();
+ some_comp(const some_comp&);
+ bool operator()(const T&, const T&) const { return false; }
};
template <class T>
-struct some_hash
-{
- typedef T value_type;
- some_hash();
- some_hash(const some_hash&);
+struct some_hash {
+ typedef T value_type;
+ some_hash();
+ some_hash(const some_hash&);
- std::size_t operator()(T const&) const;
+ std::size_t operator()(T const&) const;
};
-int main(int, char**)
-{
+int main(int, char**) {
#if defined(_LIBCPP_VERSION)
- {
- typedef std::unordered_map<MoveOnly, MoveOnly> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
- }
- {
- typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, test_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
- }
+ {
+ typedef std::unordered_map<MoveOnly, MoveOnly> C;
+ static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ }
+ {
+ typedef std::unordered_map<MoveOnly,
+ MoveOnly,
+ std::hash<MoveOnly>,
+ std::equal_to<MoveOnly>,
+ test_allocator<std::pair<const MoveOnly, MoveOnly>>>
+ C;
+ static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ }
#endif // _LIBCPP_VERSION
- {
- typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, other_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
- static_assert(!std::is_nothrow_default_constructible<C>::value, "");
- }
- {
- typedef std::unordered_map<MoveOnly, MoveOnly, some_hash<MoveOnly>> C;
- static_assert(!std::is_nothrow_default_constructible<C>::value, "");
- }
- {
- typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>,
- some_comp<MoveOnly>> C;
- static_assert(!std::is_nothrow_default_constructible<C>::value, "");
- }
+ {
+ typedef std::unordered_map<MoveOnly,
+ MoveOnly,
+ std::hash<MoveOnly>,
+ std::equal_to<MoveOnly>,
+ other_allocator<std::pair<const MoveOnly, MoveOnly>>>
+ C;
+ static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+ }
+ {
+ typedef std::unordered_map<MoveOnly, MoveOnly, some_hash<MoveOnly>> C;
+ static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+ }
+ {
+ typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>, some_comp<MoveOnly>> C;
+ static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/dtor_noexcept.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/dtor_noexcept.pass.cpp
index 0775b2842a73e29..5797599b1f9e4c4 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/dtor_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/dtor_noexcept.pass.cpp
@@ -20,50 +20,54 @@
#include "test_allocator.h"
template <class T>
-struct some_comp
-{
- typedef T value_type;
- ~some_comp() noexcept(false);
- bool operator()(const T&, const T&) const { return false; }
+struct some_comp {
+ typedef T value_type;
+ ~some_comp() noexcept(false);
+ bool operator()(const T&, const T&) const { return false; }
};
template <class T>
-struct some_hash
-{
- typedef T value_type;
- some_hash();
- some_hash(const some_hash&);
- ~some_hash() noexcept(false);
+struct some_hash {
+ typedef T value_type;
+ some_hash();
+ some_hash(const some_hash&);
+ ~some_hash() noexcept(false);
- std::size_t operator()(T const&) const;
+ std::size_t operator()(T const&) const;
};
-int main(int, char**)
-{
- {
- typedef std::unordered_map<MoveOnly, MoveOnly> C;
- static_assert(std::is_nothrow_destructible<C>::value, "");
- }
- {
- typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, test_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
- static_assert(std::is_nothrow_destructible<C>::value, "");
- }
- {
- typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, other_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
- static_assert(std::is_nothrow_destructible<C>::value, "");
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_map<MoveOnly, MoveOnly> C;
+ static_assert(std::is_nothrow_destructible<C>::value, "");
+ }
+ {
+ typedef std::unordered_map<MoveOnly,
+ MoveOnly,
+ std::hash<MoveOnly>,
+ std::equal_to<MoveOnly>,
+ test_allocator<std::pair<const MoveOnly, MoveOnly>>>
+ C;
+ static_assert(std::is_nothrow_destructible<C>::value, "");
+ }
+ {
+ typedef std::unordered_map<MoveOnly,
+ MoveOnly,
+ std::hash<MoveOnly>,
+ std::equal_to<MoveOnly>,
+ other_allocator<std::pair<const MoveOnly, MoveOnly>>>
+ C;
+ static_assert(std::is_nothrow_destructible<C>::value, "");
+ }
#if defined(_LIBCPP_VERSION)
- {
- typedef std::unordered_map<MoveOnly, MoveOnly, some_hash<MoveOnly>> C;
- static_assert(!std::is_nothrow_destructible<C>::value, "");
- }
- {
- typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>,
- some_comp<MoveOnly>> C;
- static_assert(!std::is_nothrow_destructible<C>::value, "");
- }
+ {
+ typedef std::unordered_map<MoveOnly, MoveOnly, some_hash<MoveOnly>> C;
+ static_assert(!std::is_nothrow_destructible<C>::value, "");
+ }
+ {
+ typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>, some_comp<MoveOnly>> C;
+ static_assert(!std::is_nothrow_destructible<C>::value, "");
+ }
#endif // _LIBCPP_VERSION
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/from_range.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/from_range.pass.cpp
index f48057c12f31c17..f38990a14626ea0 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/from_range.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/from_range.pass.cpp
@@ -30,13 +30,9 @@
void test_duplicates() {
using T = std::pair<const int, char>;
- std::array input = {
- T{1, 'a'}, T{2, 'a'}, T{3, 'a'}, T{3, 'b'}, T{3, 'c'}, T{2, 'b'}, T{4, 'a'}
- };
- std::array expected = {
- T{1, 'a'}, T{2, 'a'}, T{3, 'a'}, T{4, 'a'}
- };
- auto c = std::unordered_map<int, char>(std::from_range, input);
+ std::array input = {T{1, 'a'}, T{2, 'a'}, T{3, 'a'}, T{3, 'b'}, T{3, 'c'}, T{2, 'b'}, T{4, 'a'}};
+ std::array expected = {T{1, 'a'}, T{2, 'a'}, T{3, 'a'}, T{4, 'a'}};
+ auto c = std::unordered_map<int, char>(std::from_range, input);
assert(std::ranges::is_permutation(expected, c));
}
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/hash_copy_constructible.compile.fail.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/hash_copy_constructible.compile.fail.cpp
index 589314a13cdcd80..b5db5a477f42d81 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/hash_copy_constructible.compile.fail.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/hash_copy_constructible.compile.fail.cpp
@@ -18,16 +18,16 @@
template <class T>
struct Hash {
- std::size_t operator () (const T& lhs) const { return 0; }
+ std::size_t operator()(const T& lhs) const { return 0; }
+
+ Hash() {}
- Hash () {}
private:
- Hash (const Hash &); // declared but not defined
+ Hash(const Hash&); // declared but not defined
};
-
int main(int, char**) {
- std::unordered_map<int, int, Hash<int> > m;
+ std::unordered_map<int, int, Hash<int> > m;
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/init.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/init.pass.cpp
index f20ba84d7799aed..203248404c2354d 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/init.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/init.pass.cpp
@@ -29,135 +29,141 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_map<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- C c = {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- assert(c.bucket_count() >= 5);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(c.hash_function() == test_hash<int>());
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() ==
- (test_allocator<std::pair<const int, std::string> >()));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef std::unordered_map<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- C c = {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- assert(c.bucket_count() >= 5);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(c.hash_function() == test_hash<int>());
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() ==
- (min_allocator<std::pair<const int, std::string> >()));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ test_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ C c = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ assert(c.bucket_count() >= 5);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<int>());
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == (test_allocator<std::pair<const int, std::string> >()));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ min_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ C c = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ assert(c.bucket_count() >= 5);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<int>());
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == (min_allocator<std::pair<const int, std::string> >()));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER > 11
- {
- typedef std::pair<int, std::string> P;
- typedef test_allocator<std::pair<const int, std::string>> A;
- typedef test_hash<int> HF;
- typedef test_equal_to<int> Comp;
- typedef std::unordered_map<int, std::string, HF, Comp, A> C;
+ {
+ typedef std::pair<int, std::string> P;
+ typedef test_allocator<std::pair<const int, std::string>> A;
+ typedef test_hash<int> HF;
+ typedef test_equal_to<int> Comp;
+ typedef std::unordered_map<int, std::string, HF, Comp, A> C;
- A a(42);
- C c ( {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- }, 12, a);
- assert(c.bucket_count() >= 12);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(c.hash_function() == test_hash<int>());
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() == a);
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef std::pair<int, std::string> P;
- typedef test_allocator<std::pair<const int, std::string>> A;
- typedef test_hash<int> HF;
- typedef test_equal_to<int> Comp;
- typedef std::unordered_map<int, std::string, HF, Comp, A> C;
+ A a(42);
+ C c(
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ },
+ 12,
+ a);
+ assert(c.bucket_count() >= 12);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<int>());
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == a);
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef std::pair<int, std::string> P;
+ typedef test_allocator<std::pair<const int, std::string>> A;
+ typedef test_hash<int> HF;
+ typedef test_equal_to<int> Comp;
+ typedef std::unordered_map<int, std::string, HF, Comp, A> C;
- HF hf(42);
- A a(43);
- C c ( {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- }, 12, hf, a);
- assert(c.bucket_count() >= 12);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(c.hash_function() == hf);
- assert(!(c.hash_function() == test_hash<int>()));
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() == a);
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+ HF hf(42);
+ A a(43);
+ C c(
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ },
+ 12,
+ hf,
+ a);
+ assert(c.bucket_count() >= 12);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == hf);
+ assert(!(c.hash_function() == test_hash<int>()));
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == a);
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#endif // TEST_STD_VER > 11
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/init_size.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/init_size.pass.cpp
index dc26c81c369ccf2..73c706a5b281c53 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/init_size.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/init_size.pass.cpp
@@ -29,74 +29,73 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_map<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- C c({
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- },
- 7
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(c.hash_function() == test_hash<int>());
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() ==
- (test_allocator<std::pair<const int, std::string> >()));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef std::unordered_map<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- C c({
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- },
- 7
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(c.hash_function() == test_hash<int>());
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() ==
- (min_allocator<std::pair<const int, std::string> >()));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ test_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ C c(
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ },
+ 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<int>());
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == (test_allocator<std::pair<const int, std::string> >()));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ min_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ C c(
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ },
+ 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<int>());
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == (min_allocator<std::pair<const int, std::string> >()));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_allocator.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_allocator.pass.cpp
index 7e25ba298d21cd3..e29ecea3279713a 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_allocator.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_allocator.pass.cpp
@@ -32,45 +32,41 @@
template <class Allocator>
void test(const Allocator& alloc) {
- typedef std::unordered_map<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- Allocator
- > C;
- typedef std::pair<int, std::string> P;
+ typedef std::unordered_map<int, std::string, test_hash<int>, test_equal_to<int>, Allocator > C;
+ typedef std::pair<int, std::string> P;
- C c({
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- },
- 7,
- alloc);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(c.hash_function() == test_hash<int>());
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() == alloc);
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
+ C c(
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ },
+ 7,
+ alloc);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<int>());
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == alloc);
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
}
-int main(int, char**)
-{
- typedef std::pair<const int, std::string> P;
+int main(int, char**) {
+ typedef std::pair<const int, std::string> P;
- test(test_allocator<P>(10));
- test(min_allocator<P>());
- test(explicit_allocator<P>());
+ test(test_allocator<P>(10));
+ test(min_allocator<P>());
+ test(explicit_allocator<P>());
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash.pass.cpp
index 319af0e0e39b389..5ae90df90e3d0a7 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash.pass.cpp
@@ -29,76 +29,75 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_map<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- C c({
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- },
- 7,
- test_hash<int>(8)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() ==
- (test_allocator<std::pair<const int, std::string> >()));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef std::unordered_map<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- C c({
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- },
- 7,
- test_hash<int>(8)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() ==
- (min_allocator<std::pair<const int, std::string> >()));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ test_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ C c(
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ },
+ 7,
+ test_hash<int>(8));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == (test_allocator<std::pair<const int, std::string> >()));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ min_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ C c(
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ },
+ 7,
+ test_hash<int>(8));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == (min_allocator<std::pair<const int, std::string> >()));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_allocator.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_allocator.pass.cpp
index 70a631dbaef86c6..c2adf98c7eaca23 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_allocator.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_allocator.pass.cpp
@@ -33,46 +33,42 @@
template <class Allocator>
void test(const Allocator& alloc) {
- typedef std::unordered_map<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- Allocator
- > C;
- typedef std::pair<int, std::string> P;
+ typedef std::unordered_map<int, std::string, test_hash<int>, test_equal_to<int>, Allocator > C;
+ typedef std::pair<int, std::string> P;
- C c({
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- },
- 7,
- test_hash<int>(5),
- alloc);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(c.hash_function() == test_hash<int>(5));
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() == alloc);
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
+ C c(
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ },
+ 7,
+ test_hash<int>(5),
+ alloc);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<int>(5));
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == alloc);
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
}
-int main(int, char**)
-{
- typedef std::pair<const int, std::string> P;
+int main(int, char**) {
+ typedef std::pair<const int, std::string> P;
- test(test_allocator<P>(10));
- test(min_allocator<P>());
- test(explicit_allocator<P>());
+ test(test_allocator<P>(10));
+ test(min_allocator<P>());
+ test(explicit_allocator<P>());
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal.pass.cpp
index 20098ba04e0a76a..fa84a89dd328e7f 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal.pass.cpp
@@ -30,78 +30,77 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_map<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- C c({
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- },
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() ==
- (test_allocator<std::pair<const int, std::string> >()));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef std::unordered_map<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- C c({
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- },
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() ==
- (min_allocator<std::pair<const int, std::string> >()));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ test_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ C c(
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ },
+ 7,
+ test_hash<int>(8),
+ test_equal_to<int>(9));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == (test_allocator<std::pair<const int, std::string> >()));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ min_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ C c(
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ },
+ 7,
+ test_hash<int>(8),
+ test_equal_to<int>(9));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == (min_allocator<std::pair<const int, std::string> >()));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal_allocator.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal_allocator.pass.cpp
index f235ae0cd55bdea..e9ba444d4f8cf7c 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal_allocator.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal_allocator.pass.cpp
@@ -30,116 +30,111 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_map<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- C c({
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- },
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- test_allocator<std::pair<const int, std::string> >(10)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() ==
- (test_allocator<std::pair<const int, std::string> >(10)));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef std::unordered_map<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- C c({
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- },
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- min_allocator<std::pair<const int, std::string> >()
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() ==
- (min_allocator<std::pair<const int, std::string> >()));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef explicit_allocator<std::pair<const int, std::string>> A;
- typedef std::unordered_map<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- typedef std::pair<int, std::string> P;
- C c({
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- },
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A{}
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == A{});
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ test_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ C c(
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ },
+ 7,
+ test_hash<int>(8),
+ test_equal_to<int>(9),
+ test_allocator<std::pair<const int, std::string> >(10));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == (test_allocator<std::pair<const int, std::string> >(10)));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ min_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ C c(
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ },
+ 7,
+ test_hash<int>(8),
+ test_equal_to<int>(9),
+ min_allocator<std::pair<const int, std::string> >());
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == (min_allocator<std::pair<const int, std::string> >()));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef explicit_allocator<std::pair<const int, std::string>> A;
+ typedef std::unordered_map<int, std::string, test_hash<int>, test_equal_to<int>, A > C;
+ typedef std::pair<int, std::string> P;
+ C c(
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ },
+ 7,
+ test_hash<int>(8),
+ test_equal_to<int>(9),
+ A{});
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == A{});
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/iter_iter.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/iter_iter.pass.cpp
index 120826f02e9373b..da49abaf8b5b0cd 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/iter_iter.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/iter_iter.pass.cpp
@@ -30,144 +30,139 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_map<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])));
- assert(c.bucket_count() >= 5);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(c.hash_function() == test_hash<int>());
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() ==
- (test_allocator<std::pair<const int, std::string> >()));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ test_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])));
+ assert(c.bucket_count() >= 5);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<int>());
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == (test_allocator<std::pair<const int, std::string> >()));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_map<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])));
- assert(c.bucket_count() >= 5);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(c.hash_function() == test_hash<int>());
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() ==
- (min_allocator<std::pair<const int, std::string> >()));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
-#if TEST_STD_VER > 11
- {
- typedef std::pair<int, std::string> P;
- typedef test_allocator<std::pair<const int, std::string>> A;
- typedef test_hash<int> HF;
- typedef test_equal_to<int> Comp;
- typedef std::unordered_map<int, std::string, HF, Comp, A> C;
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ min_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])));
+ assert(c.bucket_count() >= 5);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<int>());
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == (min_allocator<std::pair<const int, std::string> >()));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+# if TEST_STD_VER > 11
+ {
+ typedef std::pair<int, std::string> P;
+ typedef test_allocator<std::pair<const int, std::string>> A;
+ typedef test_hash<int> HF;
+ typedef test_equal_to<int> Comp;
+ typedef std::unordered_map<int, std::string, HF, Comp, A> C;
- P arr[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(cpp17_input_iterator<P*>(arr), cpp17_input_iterator<P*>(arr + sizeof(arr)/sizeof(arr[0])), 14);
- assert(c.bucket_count() >= 14);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(c.hash_function() == HF());
- assert(c.key_eq() == Comp());
- assert(c.get_allocator() == A());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef std::pair<int, std::string> P;
- typedef test_allocator<std::pair<const int, std::string>> A;
- typedef test_hash<int> HF;
- typedef test_equal_to<int> Comp;
- typedef std::unordered_map<int, std::string, HF, Comp, A> C;
+ P arr[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(cpp17_input_iterator<P*>(arr), cpp17_input_iterator<P*>(arr + sizeof(arr) / sizeof(arr[0])), 14);
+ assert(c.bucket_count() >= 14);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == HF());
+ assert(c.key_eq() == Comp());
+ assert(c.get_allocator() == A());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef std::pair<int, std::string> P;
+ typedef test_allocator<std::pair<const int, std::string>> A;
+ typedef test_hash<int> HF;
+ typedef test_equal_to<int> Comp;
+ typedef std::unordered_map<int, std::string, HF, Comp, A> C;
- P arr[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- HF hf(42);
- A a(43);
- C c(cpp17_input_iterator<P*>(arr), cpp17_input_iterator<P*>(arr + sizeof(arr)/sizeof(arr[0])), 14, hf, a);
- assert(c.bucket_count() >= 14);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(c.hash_function() == hf);
- assert(!(c.hash_function() == HF()));
- assert(c.key_eq() == Comp());
- assert(c.get_allocator() == a);
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
-#endif
+ P arr[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ HF hf(42);
+ A a(43);
+ C c(cpp17_input_iterator<P*>(arr), cpp17_input_iterator<P*>(arr + sizeof(arr) / sizeof(arr[0])), 14, hf, a);
+ assert(c.bucket_count() >= 14);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == hf);
+ assert(!(c.hash_function() == HF()));
+ assert(c.key_eq() == Comp());
+ assert(c.get_allocator() == a);
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+# endif
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/iter_iter_size.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/iter_iter_size.pass.cpp
index f06feda28078cc9..91a3b9ef6652002 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/iter_iter_size.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/iter_iter_size.pass.cpp
@@ -30,79 +30,72 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_map<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
- 10
- );
- LIBCPP_ASSERT(c.bucket_count() == 11);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(c.hash_function() == test_hash<int>());
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() ==
- (test_allocator<std::pair<const int, std::string> >()));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ test_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])), 10);
+ LIBCPP_ASSERT(c.bucket_count() == 11);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<int>());
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == (test_allocator<std::pair<const int, std::string> >()));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_map<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
- 10
- );
- LIBCPP_ASSERT(c.bucket_count() == 11);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(c.hash_function() == test_hash<int>());
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() ==
- (min_allocator<std::pair<const int, std::string> >()));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ min_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])), 10);
+ LIBCPP_ASSERT(c.bucket_count() == 11);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<int>());
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == (min_allocator<std::pair<const int, std::string> >()));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/iter_iter_size_allocator.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/iter_iter_size_allocator.pass.cpp
index 11ca33816e679c6..1039e1d92be7907 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/iter_iter_size_allocator.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/iter_iter_size_allocator.pass.cpp
@@ -33,49 +33,40 @@
#include "min_allocator.h"
template <class Allocator>
-void test(const Allocator& alloc)
-{
- typedef std::unordered_map<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- Allocator
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
+void test(const Allocator& alloc) {
+ typedef std::unordered_map<int, std::string, test_hash<int>, test_equal_to<int>, Allocator > C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
- C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])),
- 7,
- alloc);
+ C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])), 7, alloc);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(c.hash_function() == test_hash<int>());
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() == alloc);
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<int>());
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == alloc);
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
}
-int main(int, char**)
-{
- typedef std::pair<const int, std::string> P;
- test(test_allocator<P>(10));
- test(min_allocator<P>());
- test(explicit_allocator<P>());
+int main(int, char**) {
+ typedef std::pair<const int, std::string> P;
+ test(test_allocator<P>(10));
+ test(min_allocator<P>());
+ test(explicit_allocator<P>());
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/iter_iter_size_hash.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/iter_iter_size_hash.pass.cpp
index 75ae4cd12124394..f0a3358e80aaad5 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/iter_iter_size_hash.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/iter_iter_size_hash.pass.cpp
@@ -31,81 +31,72 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_map<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
- 7,
- test_hash<int>(8)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() ==
- (test_allocator<std::pair<const int, std::string> >()));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ test_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])), 7, test_hash<int>(8));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == (test_allocator<std::pair<const int, std::string> >()));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_map<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
- 7,
- test_hash<int>(8)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() ==
- (min_allocator<std::pair<const int, std::string> >()));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ min_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])), 7, test_hash<int>(8));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == (min_allocator<std::pair<const int, std::string> >()));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/iter_iter_size_hash_allocator.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/iter_iter_size_hash_allocator.pass.cpp
index 3a18bdf0dda742d..b6e06df9c8fe2c0 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/iter_iter_size_hash_allocator.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/iter_iter_size_hash_allocator.pass.cpp
@@ -34,50 +34,40 @@
#include "min_allocator.h"
template <class Allocator>
-void test(const Allocator& alloc)
-{
- typedef std::unordered_map<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- Allocator
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
+void test(const Allocator& alloc) {
+ typedef std::unordered_map<int, std::string, test_hash<int>, test_equal_to<int>, Allocator > C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
- C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])),
- 7,
- test_hash<int>(5),
- alloc);
+ C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])), 7, test_hash<int>(5), alloc);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(c.hash_function() == test_hash<int>(5));
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() == alloc);
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<int>(5));
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == alloc);
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
}
-int main(int, char**)
-{
- typedef std::pair<const int, std::string> P;
- test(test_allocator<P>(10));
- test(min_allocator<P>());
- test(explicit_allocator<P>());
+int main(int, char**) {
+ typedef std::pair<const int, std::string> P;
+ test(test_allocator<P>(10));
+ test(min_allocator<P>());
+ test(explicit_allocator<P>());
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/iter_iter_size_hash_equal.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/iter_iter_size_hash_equal.pass.cpp
index 25cfaae1a889190..7976e403410007f 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/iter_iter_size_hash_equal.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/iter_iter_size_hash_equal.pass.cpp
@@ -31,83 +31,80 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_map<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() ==
- (test_allocator<std::pair<const int, std::string> >()));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ test_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(cpp17_input_iterator<P*>(a),
+ cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])),
+ 7,
+ test_hash<int>(8),
+ test_equal_to<int>(9));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == (test_allocator<std::pair<const int, std::string> >()));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_map<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() ==
- (min_allocator<std::pair<const int, std::string> >()));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ min_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(cpp17_input_iterator<P*>(a),
+ cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])),
+ 7,
+ test_hash<int>(8),
+ test_equal_to<int>(9));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == (min_allocator<std::pair<const int, std::string> >()));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/iter_iter_size_hash_equal_allocator.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/iter_iter_size_hash_equal_allocator.pass.cpp
index 8abdd0dab566da8..2660d2013a0e39e 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/iter_iter_size_hash_equal_allocator.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/iter_iter_size_hash_equal_allocator.pass.cpp
@@ -32,123 +32,115 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_map<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- test_allocator<std::pair<const int, std::string> >(10)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() ==
- (test_allocator<std::pair<const int, std::string> >(10)));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ test_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(cpp17_input_iterator<P*>(a),
+ cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])),
+ 7,
+ test_hash<int>(8),
+ test_equal_to<int>(9),
+ test_allocator<std::pair<const int, std::string> >(10));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == (test_allocator<std::pair<const int, std::string> >(10)));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_map<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- min_allocator<std::pair<const int, std::string> >()
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() ==
- (min_allocator<std::pair<const int, std::string> >()));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef explicit_allocator<std::pair<const int, std::string>> A;
- typedef std::unordered_map<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A{}
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == A{});
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ min_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(cpp17_input_iterator<P*>(a),
+ cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])),
+ 7,
+ test_hash<int>(8),
+ test_equal_to<int>(9),
+ min_allocator<std::pair<const int, std::string> >());
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == (min_allocator<std::pair<const int, std::string> >()));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef explicit_allocator<std::pair<const int, std::string>> A;
+ typedef std::unordered_map<int, std::string, test_hash<int>, test_equal_to<int>, A > C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(cpp17_input_iterator<P*>(a),
+ cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])),
+ 7,
+ test_hash<int>(8),
+ test_equal_to<int>(9),
+ A{});
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == A{});
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/move.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/move.pass.cpp
index 336cdfb8d215aef..2a2a3531716ed9c 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/move.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/move.pass.cpp
@@ -29,150 +29,139 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_map<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<std::pair<const int, std::string> >
- > C;
- C c0(7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- test_allocator<std::pair<const int, std::string> >(10)
- );
- C::iterator it0 = c0.begin();
- C c = std::move(c0);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 0);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() ==
- (test_allocator<std::pair<const int, std::string> >(10)));
- assert(c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- assert(it0 == c.begin()); // Iterators remain valid
+int main(int, char**) {
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ test_allocator<std::pair<const int, std::string> > >
+ C;
+ C c0(7, test_hash<int>(8), test_equal_to<int>(9), test_allocator<std::pair<const int, std::string> >(10));
+ C::iterator it0 = c0.begin();
+ C c = std::move(c0);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 0);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == (test_allocator<std::pair<const int, std::string> >(10)));
+ assert(c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ assert(it0 == c.begin()); // Iterators remain valid
- assert(c0.empty());
- }
- {
- typedef std::unordered_map<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- test_allocator<std::pair<const int, std::string> >(10)
- );
- C::iterator it0 = c0.begin();
- C c = std::move(c0);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() ==
- (test_allocator<std::pair<const int, std::string> >(10)));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- assert(it0 == c.begin()); // Iterators remain valid
+ assert(c0.empty());
+ }
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ test_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a,
+ a + sizeof(a) / sizeof(a[0]),
+ 7,
+ test_hash<int>(8),
+ test_equal_to<int>(9),
+ test_allocator<std::pair<const int, std::string> >(10));
+ C::iterator it0 = c0.begin();
+ C c = std::move(c0);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == (test_allocator<std::pair<const int, std::string> >(10)));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(it0 == c.begin()); // Iterators remain valid
- assert(c0.empty());
- }
- {
- typedef std::unordered_map<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<std::pair<const int, std::string> >
- > C;
- C c0(7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- min_allocator<std::pair<const int, std::string> >()
- );
- C::iterator it0 = c0.begin();
- C c = std::move(c0);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 0);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() ==
- (min_allocator<std::pair<const int, std::string> >()));
- assert(c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- assert(it0 == c.begin()); // Iterators remain valid
+ assert(c0.empty());
+ }
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ min_allocator<std::pair<const int, std::string> > >
+ C;
+ C c0(7, test_hash<int>(8), test_equal_to<int>(9), min_allocator<std::pair<const int, std::string> >());
+ C::iterator it0 = c0.begin();
+ C c = std::move(c0);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 0);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == (min_allocator<std::pair<const int, std::string> >()));
+ assert(c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ assert(it0 == c.begin()); // Iterators remain valid
- assert(c0.empty());
- }
- {
- typedef std::unordered_map<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- min_allocator<std::pair<const int, std::string> >()
- );
- C::iterator it0 = c0.begin();
- C c = std::move(c0);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() ==
- (min_allocator<std::pair<const int, std::string> >()));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- assert(it0 == c.begin()); // Iterators remain valid
+ assert(c0.empty());
+ }
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ min_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a,
+ a + sizeof(a) / sizeof(a[0]),
+ 7,
+ test_hash<int>(8),
+ test_equal_to<int>(9),
+ min_allocator<std::pair<const int, std::string> >());
+ C::iterator it0 = c0.begin();
+ C c = std::move(c0);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == (min_allocator<std::pair<const int, std::string> >()));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(it0 == c.begin()); // Iterators remain valid
- assert(c0.empty());
- }
+ assert(c0.empty());
+ }
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/move_alloc.addressof.compile.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/move_alloc.addressof.compile.pass.cpp
index 1fec0ee5d0f4b76..90c69b3855fabc3 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/move_alloc.addressof.compile.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/move_alloc.addressof.compile.pass.cpp
@@ -28,8 +28,12 @@
void test() {
using A = test_allocator<std::pair<const operator_hijacker, operator_hijacker>>;
- using C = std::unordered_map<operator_hijacker, operator_hijacker, std::hash<operator_hijacker>,
- std::equal_to<operator_hijacker>, A>;
+ using C =
+ std::unordered_map<operator_hijacker,
+ operator_hijacker,
+ std::hash<operator_hijacker>,
+ std::equal_to<operator_hijacker>,
+ A>;
C mo;
C m(std::move(mo), A());
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/move_alloc.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/move_alloc.pass.cpp
index 89f2716f9cd2c0b..154b11f3da9f4c6 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/move_alloc.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/move_alloc.pass.cpp
@@ -29,172 +29,131 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::pair<int, std::string> P;
- typedef test_allocator<std::pair<const int, std::string>> A;
- typedef std::unordered_map<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A(10)
- );
- C c(std::move(c0), A(12));
- assert(c.bucket_count() >= 5);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == A(12));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
+int main(int, char**) {
+ {
+ typedef std::pair<int, std::string> P;
+ typedef test_allocator<std::pair<const int, std::string>> A;
+ typedef std::unordered_map<int, std::string, test_hash<int>, test_equal_to<int>, A > C;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), A(10));
+ C c(std::move(c0), A(12));
+ assert(c.bucket_count() >= 5);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == A(12));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
- assert(c0.empty());
- }
- {
- typedef std::pair<int, std::string> P;
- typedef test_allocator<std::pair<const int, std::string>> A;
- typedef std::unordered_map<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A(10)
- );
- C c(std::move(c0), A(10));
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == A(10));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
+ assert(c0.empty());
+ }
+ {
+ typedef std::pair<int, std::string> P;
+ typedef test_allocator<std::pair<const int, std::string>> A;
+ typedef std::unordered_map<int, std::string, test_hash<int>, test_equal_to<int>, A > C;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), A(10));
+ C c(std::move(c0), A(10));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == A(10));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
- assert(c0.empty());
- }
- {
- typedef std::pair<int, std::string> P;
- typedef min_allocator<std::pair<const int, std::string>> A;
- typedef std::unordered_map<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A()
- );
- C c(std::move(c0), A());
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == A());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
+ assert(c0.empty());
+ }
+ {
+ typedef std::pair<int, std::string> P;
+ typedef min_allocator<std::pair<const int, std::string>> A;
+ typedef std::unordered_map<int, std::string, test_hash<int>, test_equal_to<int>, A > C;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), A());
+ C c(std::move(c0), A());
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == A());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
- assert(c0.empty());
- }
- {
- typedef std::pair<int, std::string> P;
- typedef explicit_allocator<std::pair<const int, std::string>> A;
- typedef std::unordered_map<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A{}
- );
- C c(std::move(c0), A{});
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == A{});
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
+ assert(c0.empty());
+ }
+ {
+ typedef std::pair<int, std::string> P;
+ typedef explicit_allocator<std::pair<const int, std::string>> A;
+ typedef std::unordered_map<int, std::string, test_hash<int>, test_equal_to<int>, A > C;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), A{});
+ C c(std::move(c0), A{});
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == A{});
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
- assert(c0.empty());
- }
+ assert(c0.empty());
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/move_noexcept.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/move_noexcept.pass.cpp
index 8458627e7548102..82b510db2fa2692 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/move_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/move_noexcept.pass.cpp
@@ -24,50 +24,54 @@
#include "test_allocator.h"
template <class T>
-struct some_comp
-{
- typedef T value_type;
- some_comp(const some_comp&);
- bool operator()(const T&, const T&) const { return false; }
+struct some_comp {
+ typedef T value_type;
+ some_comp(const some_comp&);
+ bool operator()(const T&, const T&) const { return false; }
};
template <class T>
-struct some_hash
-{
- typedef T value_type;
- some_hash();
- some_hash(const some_hash&);
+struct some_hash {
+ typedef T value_type;
+ some_hash();
+ some_hash(const some_hash&);
- std::size_t operator()(T const&) const;
+ std::size_t operator()(T const&) const;
};
-int main(int, char**)
-{
+int main(int, char**) {
#if defined(_LIBCPP_VERSION)
- {
- typedef std::unordered_map<MoveOnly, MoveOnly> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
- }
- {
- typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, test_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
- }
- {
- typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, other_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
- }
+ {
+ typedef std::unordered_map<MoveOnly, MoveOnly> C;
+ static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ }
+ {
+ typedef std::unordered_map<MoveOnly,
+ MoveOnly,
+ std::hash<MoveOnly>,
+ std::equal_to<MoveOnly>,
+ test_allocator<std::pair<const MoveOnly, MoveOnly>>>
+ C;
+ static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ }
+ {
+ typedef std::unordered_map<MoveOnly,
+ MoveOnly,
+ std::hash<MoveOnly>,
+ std::equal_to<MoveOnly>,
+ other_allocator<std::pair<const MoveOnly, MoveOnly>>>
+ C;
+ static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ }
#endif // _LIBCPP_VERSION
- {
- typedef std::unordered_map<MoveOnly, MoveOnly, some_hash<MoveOnly>> C;
- static_assert(!std::is_nothrow_move_constructible<C>::value, "");
- }
- {
- typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>,
- some_comp<MoveOnly>> C;
- static_assert(!std::is_nothrow_move_constructible<C>::value, "");
- }
+ {
+ typedef std::unordered_map<MoveOnly, MoveOnly, some_hash<MoveOnly>> C;
+ static_assert(!std::is_nothrow_move_constructible<C>::value, "");
+ }
+ {
+ typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>, some_comp<MoveOnly>> C;
+ static_assert(!std::is_nothrow_move_constructible<C>::value, "");
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/size.compile.fail.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/size.compile.fail.cpp
index 371987d6e2d2a3a..a203f7ba3c22454 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/size.compile.fail.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/size.compile.fail.cpp
@@ -24,47 +24,44 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_map<NotConstructible, NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- test_allocator<std::pair<const NotConstructible,
- NotConstructible> >
- > C;
- C c = 7;
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.hash_function() == test_hash<NotConstructible>());
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() ==
- (test_allocator<std::pair<const NotConstructible, NotConstructible> >()));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_map<NotConstructible,
+ NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ test_allocator<std::pair<const NotConstructible, NotConstructible> > >
+ C;
+ C c = 7;
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<NotConstructible>());
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == (test_allocator<std::pair<const NotConstructible, NotConstructible> >()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_map<NotConstructible, NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- min_allocator<std::pair<const NotConstructible,
- NotConstructible> >
- > C;
- C c = 7;
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.hash_function() == test_hash<NotConstructible>());
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() ==
- (min_allocator<std::pair<const NotConstructible, NotConstructible> >()));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+ {
+ typedef std::unordered_map<NotConstructible,
+ NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ min_allocator<std::pair<const NotConstructible, NotConstructible> > >
+ C;
+ C c = 7;
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<NotConstructible>());
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == (min_allocator<std::pair<const NotConstructible, NotConstructible> >()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/size.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/size.pass.cpp
index 7328b954021abf2..f7f7ca54a9a2a3f 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/size.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/size.pass.cpp
@@ -24,47 +24,44 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_map<NotConstructible, NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- test_allocator<std::pair<const NotConstructible,
- NotConstructible> >
- > C;
- C c(7);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.hash_function() == test_hash<NotConstructible>());
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() ==
- (test_allocator<std::pair<const NotConstructible, NotConstructible> >()));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_map<NotConstructible,
+ NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ test_allocator<std::pair<const NotConstructible, NotConstructible> > >
+ C;
+ C c(7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<NotConstructible>());
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == (test_allocator<std::pair<const NotConstructible, NotConstructible> >()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_map<NotConstructible, NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- min_allocator<std::pair<const NotConstructible,
- NotConstructible> >
- > C;
- C c(7);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.hash_function() == test_hash<NotConstructible>());
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() ==
- (min_allocator<std::pair<const NotConstructible, NotConstructible> >()));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+ {
+ typedef std::unordered_map<NotConstructible,
+ NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ min_allocator<std::pair<const NotConstructible, NotConstructible> > >
+ C;
+ C c(7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<NotConstructible>());
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == (min_allocator<std::pair<const NotConstructible, NotConstructible> >()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/size_allocator.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/size_allocator.pass.cpp
index fcc896014fa50b8..450fb7b5e40d451 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/size_allocator.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/size_allocator.pass.cpp
@@ -29,31 +29,31 @@
template <class Allocator>
void test(const Allocator& alloc) {
- typedef std::unordered_map<NotConstructible, NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- Allocator
- > C;
-
- C c(7, alloc);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.hash_function() == test_hash<NotConstructible>());
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() == alloc);
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
+ typedef std::unordered_map<NotConstructible,
+ NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ Allocator >
+ C;
+
+ C c(7, alloc);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<NotConstructible>());
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == alloc);
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
}
-int main(int, char**)
-{
- typedef std::pair<const NotConstructible, NotConstructible> V;
+int main(int, char**) {
+ typedef std::pair<const NotConstructible, NotConstructible> V;
- test(test_allocator<V>(10));
- test(min_allocator<V>());
- test(explicit_allocator<V>());
+ test(test_allocator<V>(10));
+ test(min_allocator<V>());
+ test(explicit_allocator<V>());
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/size_hash.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/size_hash.pass.cpp
index ee0cf5dc4ebe419..1b78599b087d48b 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/size_hash.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/size_hash.pass.cpp
@@ -24,51 +24,44 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_map<NotConstructible, NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- test_allocator<std::pair<const NotConstructible,
- NotConstructible> >
- > C;
- C c(7,
- test_hash<NotConstructible>(8)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.hash_function() == test_hash<NotConstructible>(8));
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() ==
- (test_allocator<std::pair<const NotConstructible, NotConstructible> >()));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_map<NotConstructible,
+ NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ test_allocator<std::pair<const NotConstructible, NotConstructible> > >
+ C;
+ C c(7, test_hash<NotConstructible>(8));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<NotConstructible>(8));
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == (test_allocator<std::pair<const NotConstructible, NotConstructible> >()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_map<NotConstructible, NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- min_allocator<std::pair<const NotConstructible,
- NotConstructible> >
- > C;
- C c(7,
- test_hash<NotConstructible>(8)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.hash_function() == test_hash<NotConstructible>(8));
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() ==
- (min_allocator<std::pair<const NotConstructible, NotConstructible> >()));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+ {
+ typedef std::unordered_map<NotConstructible,
+ NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ min_allocator<std::pair<const NotConstructible, NotConstructible> > >
+ C;
+ C c(7, test_hash<NotConstructible>(8));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<NotConstructible>(8));
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == (min_allocator<std::pair<const NotConstructible, NotConstructible> >()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/size_hash_allocator.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/size_hash_allocator.pass.cpp
index 219d1466c55e128..a9f73f3f45fe214 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/size_hash_allocator.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/size_hash_allocator.pass.cpp
@@ -29,31 +29,31 @@
template <class Allocator>
void test(const Allocator& alloc) {
- typedef std::unordered_map<NotConstructible, NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- Allocator
- > C;
-
- C c(7, test_hash<NotConstructible>(8), alloc);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.hash_function() == test_hash<NotConstructible>(8));
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() == alloc);
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
+ typedef std::unordered_map<NotConstructible,
+ NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ Allocator >
+ C;
+
+ C c(7, test_hash<NotConstructible>(8), alloc);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<NotConstructible>(8));
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == alloc);
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
}
-int main(int, char**)
-{
- typedef std::pair<const NotConstructible, NotConstructible> V;
+int main(int, char**) {
+ typedef std::pair<const NotConstructible, NotConstructible> V;
- test(test_allocator<V>(10));
- test(min_allocator<V>());
- test(explicit_allocator<V>());
+ test(test_allocator<V>(10));
+ test(min_allocator<V>());
+ test(explicit_allocator<V>());
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/size_hash_equal.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/size_hash_equal.pass.cpp
index 1c81b0e4af2cc4a..5410be404c88a5a 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/size_hash_equal.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/size_hash_equal.pass.cpp
@@ -24,53 +24,44 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_map<NotConstructible, NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- test_allocator<std::pair<const NotConstructible,
- NotConstructible> >
- > C;
- C c(7,
- test_hash<NotConstructible>(8),
- test_equal_to<NotConstructible>(9)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.hash_function() == test_hash<NotConstructible>(8));
- assert(c.key_eq() == test_equal_to<NotConstructible>(9));
- assert(c.get_allocator() ==
- (test_allocator<std::pair<const NotConstructible, NotConstructible> >()));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_map<NotConstructible,
+ NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ test_allocator<std::pair<const NotConstructible, NotConstructible> > >
+ C;
+ C c(7, test_hash<NotConstructible>(8), test_equal_to<NotConstructible>(9));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<NotConstructible>(8));
+ assert(c.key_eq() == test_equal_to<NotConstructible>(9));
+ assert(c.get_allocator() == (test_allocator<std::pair<const NotConstructible, NotConstructible> >()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_map<NotConstructible, NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- min_allocator<std::pair<const NotConstructible,
- NotConstructible> >
- > C;
- C c(7,
- test_hash<NotConstructible>(8),
- test_equal_to<NotConstructible>(9)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.hash_function() == test_hash<NotConstructible>(8));
- assert(c.key_eq() == test_equal_to<NotConstructible>(9));
- assert(c.get_allocator() ==
- (min_allocator<std::pair<const NotConstructible, NotConstructible> >()));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+ {
+ typedef std::unordered_map<NotConstructible,
+ NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ min_allocator<std::pair<const NotConstructible, NotConstructible> > >
+ C;
+ C c(7, test_hash<NotConstructible>(8), test_equal_to<NotConstructible>(9));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<NotConstructible>(8));
+ assert(c.key_eq() == test_equal_to<NotConstructible>(9));
+ assert(c.get_allocator() == (min_allocator<std::pair<const NotConstructible, NotConstructible> >()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/size_hash_equal_allocator.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/size_hash_equal_allocator.pass.cpp
index 3a329c9962ce499..324aa0cddb77e3b 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/size_hash_equal_allocator.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/size_hash_equal_allocator.pass.cpp
@@ -24,77 +24,69 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_map<NotConstructible, NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- test_allocator<std::pair<const NotConstructible,
- NotConstructible> >
- > C;
- C c(7,
- test_hash<NotConstructible>(8),
- test_equal_to<NotConstructible>(9),
- test_allocator<std::pair<const NotConstructible, NotConstructible> >(10)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.hash_function() == test_hash<NotConstructible>(8));
- assert(c.key_eq() == test_equal_to<NotConstructible>(9));
- assert(c.get_allocator() ==
- (test_allocator<std::pair<const NotConstructible, NotConstructible> >(10)));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_map<NotConstructible,
+ NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ test_allocator<std::pair<const NotConstructible, NotConstructible> > >
+ C;
+ C c(7,
+ test_hash<NotConstructible>(8),
+ test_equal_to<NotConstructible>(9),
+ test_allocator<std::pair<const NotConstructible, NotConstructible> >(10));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<NotConstructible>(8));
+ assert(c.key_eq() == test_equal_to<NotConstructible>(9));
+ assert(c.get_allocator() == (test_allocator<std::pair<const NotConstructible, NotConstructible> >(10)));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_map<NotConstructible, NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- min_allocator<std::pair<const NotConstructible,
- NotConstructible> >
- > C;
- C c(7,
- test_hash<NotConstructible>(8),
- test_equal_to<NotConstructible>(9),
- min_allocator<std::pair<const NotConstructible, NotConstructible> >()
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.hash_function() == test_hash<NotConstructible>(8));
- assert(c.key_eq() == test_equal_to<NotConstructible>(9));
- assert(c.get_allocator() ==
- (min_allocator<std::pair<const NotConstructible, NotConstructible> >()));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef explicit_allocator<std::pair<const NotConstructible, NotConstructible> > A;
- typedef std::unordered_map<NotConstructible, NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- A
- > C;
- C c(7,
- test_hash<NotConstructible>(8),
- test_equal_to<NotConstructible>(9),
- A{}
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.hash_function() == test_hash<NotConstructible>(8));
- assert(c.key_eq() == test_equal_to<NotConstructible>(9));
- assert(c.get_allocator() == A{});
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+ {
+ typedef std::unordered_map<NotConstructible,
+ NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ min_allocator<std::pair<const NotConstructible, NotConstructible> > >
+ C;
+ C c(7,
+ test_hash<NotConstructible>(8),
+ test_equal_to<NotConstructible>(9),
+ min_allocator<std::pair<const NotConstructible, NotConstructible> >());
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<NotConstructible>(8));
+ assert(c.key_eq() == test_equal_to<NotConstructible>(9));
+ assert(c.get_allocator() == (min_allocator<std::pair<const NotConstructible, NotConstructible> >()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef explicit_allocator<std::pair<const NotConstructible, NotConstructible> > A;
+ typedef std::unordered_map<NotConstructible,
+ NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ A >
+ C;
+ C c(7, test_hash<NotConstructible>(8), test_equal_to<NotConstructible>(9), A{});
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<NotConstructible>(8));
+ assert(c.key_eq() == test_equal_to<NotConstructible>(9));
+ assert(c.get_allocator() == A{});
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.elem/at.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.elem/at.pass.cpp
index fe6ef8bc7e85cad..a08cba29086f1b8 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.elem/at.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.elem/at.pass.cpp
@@ -24,121 +24,112 @@
#include "min_allocator.h"
#include "test_macros.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_map<int, std::string> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.size() == 4);
- c.at(1) = "ONE";
- assert(c.at(1) == "ONE");
+int main(int, char**) {
+ {
+ typedef std::unordered_map<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.size() == 4);
+ c.at(1) = "ONE";
+ assert(c.at(1) == "ONE");
#ifndef TEST_HAS_NO_EXCEPTIONS
- try
- {
- c.at(11) = "eleven";
- assert(false);
- }
- catch (std::out_of_range&)
- {
- }
- assert(c.size() == 4);
-#endif
+ try {
+ c.at(11) = "eleven";
+ assert(false);
+ } catch (std::out_of_range&) {
}
- {
- typedef std::unordered_map<int, std::string> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- const C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.size() == 4);
- assert(c.at(1) == "one");
-#ifndef TEST_HAS_NO_EXCEPTIONS
- try
- {
- TEST_IGNORE_NODISCARD c.at(11);
- assert(false);
- }
- catch (std::out_of_range&)
- {
- }
- assert(c.size() == 4);
+ assert(c.size() == 4);
#endif
- }
-#if TEST_STD_VER >= 11
- {
- typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.size() == 4);
- c.at(1) = "ONE";
- assert(c.at(1) == "ONE");
+ }
+ {
+ typedef std::unordered_map<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ const C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
#ifndef TEST_HAS_NO_EXCEPTIONS
- try
- {
- c.at(11) = "eleven";
- assert(false);
- }
- catch (std::out_of_range&)
- {
- }
- assert(c.size() == 4);
-#endif
+ try {
+ TEST_IGNORE_NODISCARD c.at(11);
+ assert(false);
+ } catch (std::out_of_range&) {
}
- {
- typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- const C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.size() == 4);
- assert(c.at(1) == "one");
-#ifndef TEST_HAS_NO_EXCEPTIONS
- try
- {
- TEST_IGNORE_NODISCARD c.at(11);
- assert(false);
- }
- catch (std::out_of_range&)
- {
- }
- assert(c.size() == 4);
+ assert(c.size() == 4);
#endif
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.size() == 4);
+ c.at(1) = "ONE";
+ assert(c.at(1) == "ONE");
+# ifndef TEST_HAS_NO_EXCEPTIONS
+ try {
+ c.at(11) = "eleven";
+ assert(false);
+ } catch (std::out_of_range&) {
+ }
+ assert(c.size() == 4);
+# endif
+ }
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ const C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+# ifndef TEST_HAS_NO_EXCEPTIONS
+ try {
+ TEST_IGNORE_NODISCARD c.at(11);
+ assert(false);
+ } catch (std::out_of_range&) {
}
+ assert(c.size() == 4);
+# endif
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.elem/index.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.elem/index.pass.cpp
index 9ca0edb076731a4..a9f9fb7ae84f8f1 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.elem/index.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.elem/index.pass.cpp
@@ -25,139 +25,142 @@
#include "count_new.h"
#if TEST_STD_VER >= 11
-#include "container_test_types.h"
+# include "container_test_types.h"
#endif
-int main(int, char**)
-{
- {
- typedef std::unordered_map<int, std::string> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.size() == 4);
- c[1] = "ONE";
- assert(c.at(1) == "ONE");
- c[11] = "eleven";
- assert(c.size() == 5);
- assert(c.at(11) == "eleven");
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_map<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.size() == 4);
+ c[1] = "ONE";
+ assert(c.at(1) == "ONE");
+ c[11] = "eleven";
+ assert(c.size() == 5);
+ assert(c.at(11) == "eleven");
+ }
#if TEST_STD_VER >= 11
+ {
+ typedef std::unordered_map<MoveOnly, std::string> C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.size() == 4);
+ c[1] = "ONE";
+ assert(c.at(1) == "ONE");
+ c[11] = "eleven";
+ assert(c.size() == 5);
+ assert(c.at(11) == "eleven");
+ }
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.size() == 4);
+ c[1] = "ONE";
+ assert(c.at(1) == "ONE");
+ c[11] = "eleven";
+ assert(c.size() == 5);
+ assert(c.at(11) == "eleven");
+ }
+
+ {
+ typedef std::unordered_map<MoveOnly,
+ std::string,
+ std::hash<MoveOnly>,
+ std::equal_to<MoveOnly>,
+ min_allocator<std::pair<const MoveOnly, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.size() == 4);
+ c[1] = "ONE";
+ assert(c.at(1) == "ONE");
+ c[11] = "eleven";
+ assert(c.size() == 5);
+ assert(c.at(11) == "eleven");
+ }
+ {
+ using Container = TCT::unordered_map<>;
+ using Key = Container::key_type;
+ using MappedType = Container::mapped_type;
+ ConstructController* cc = getConstructController();
+ cc->reset();
{
- typedef std::unordered_map<MoveOnly, std::string> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.size() == 4);
- c[1] = "ONE";
- assert(c.at(1) == "ONE");
- c[11] = "eleven";
- assert(c.size() == 5);
- assert(c.at(11) == "eleven");
- }
- {
- typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.size() == 4);
- c[1] = "ONE";
- assert(c.at(1) == "ONE");
- c[11] = "eleven";
- assert(c.size() == 5);
- assert(c.at(11) == "eleven");
+ Container c;
+ const Key k(1);
+ cc->expect<std::piecewise_construct_t const&, std::tuple<Key const&>&&, std::tuple<>&&>();
+ MappedType& mref = c[k];
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ MappedType& mref2 = c[k];
+ assert(&mref == &mref2);
+ }
}
-
{
- typedef std::unordered_map<MoveOnly, std::string, std::hash<MoveOnly>, std::equal_to<MoveOnly>,
- min_allocator<std::pair<const MoveOnly, std::string>>> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.size() == 4);
- c[1] = "ONE";
- assert(c.at(1) == "ONE");
- c[11] = "eleven";
- assert(c.size() == 5);
- assert(c.at(11) == "eleven");
+ Container c;
+ Key k(1);
+ cc->expect<std::piecewise_construct_t const&, std::tuple<Key const&>&&, std::tuple<>&&>();
+ MappedType& mref = c[k];
+ assert(!cc->unchecked());
+ {
+ DisableAllocationGuard g;
+ MappedType& mref2 = c[k];
+ assert(&mref == &mref2);
+ }
}
{
- using Container = TCT::unordered_map<>;
- using Key = Container::key_type;
- using MappedType = Container::mapped_type;
- ConstructController* cc = getConstructController();
- cc->reset();
- {
- Container c;
- const Key k(1);
- cc->expect<std::piecewise_construct_t const&, std::tuple<Key const&>&&, std::tuple<>&&>();
- MappedType& mref = c[k];
- assert(!cc->unchecked());
- {
- DisableAllocationGuard g;
- MappedType& mref2 = c[k];
- assert(&mref == &mref2);
- }
- }
- {
- Container c;
- Key k(1);
- cc->expect<std::piecewise_construct_t const&, std::tuple<Key const&>&&, std::tuple<>&&>();
- MappedType& mref = c[k];
- assert(!cc->unchecked());
- {
- DisableAllocationGuard g;
- MappedType& mref2 = c[k];
- assert(&mref == &mref2);
- }
- }
- {
- Container c;
- Key k(1);
- cc->expect<std::piecewise_construct_t const&, std::tuple<Key &&>&&, std::tuple<>&&>();
- MappedType& mref = c[std::move(k)];
- assert(!cc->unchecked());
- {
- Key k2(1);
- DisableAllocationGuard g;
- MappedType& mref2 = c[std::move(k2)];
- assert(&mref == &mref2);
- }
- }
+ Container c;
+ Key k(1);
+ cc->expect<std::piecewise_construct_t const&, std::tuple<Key&&>&&, std::tuple<>&&>();
+ MappedType& mref = c[std::move(k)];
+ assert(!cc->unchecked());
+ {
+ Key k2(1);
+ DisableAllocationGuard g;
+ MappedType& mref2 = c[std::move(k2)];
+ assert(&mref == &mref2);
+ }
}
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.elem/index_tuple.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.elem/index_tuple.pass.cpp
index 78b5fbd36fe39c1..ac7bf641253330d 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.elem/index_tuple.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.elem/index_tuple.pass.cpp
@@ -23,12 +23,12 @@
#include <unordered_map>
struct my_hash {
- std::size_t operator()(const std::tuple<int, int>&) const { return 0; }
+ std::size_t operator()(const std::tuple<int, int>&) const { return 0; }
};
int main(int, char**) {
- std::unordered_map<std::tuple<int, int>, std::size_t, my_hash> m;
- m[std::make_tuple(2, 3)] = 7;
+ std::unordered_map<std::tuple<int, int>, std::size_t, my_hash> m;
+ m[std::make_tuple(2, 3)] = 7;
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/clear.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/clear.pass.cpp
index 64fe72ecdacdbce..9d2f23a2d789a6d 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/clear.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/clear.pass.cpp
@@ -21,44 +21,45 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_map<int, std::string> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- ASSERT_NOEXCEPT(c.clear());
- c.clear();
- assert(c.size() == 0);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_map<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ ASSERT_NOEXCEPT(c.clear());
+ c.clear();
+ assert(c.size() == 0);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- ASSERT_NOEXCEPT(c.clear());
- c.clear();
- assert(c.size() == 0);
- }
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ ASSERT_NOEXCEPT(c.clear());
+ c.clear();
+ assert(c.size() == 0);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/emplace.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/emplace.pass.cpp
index 11bbaf039b5383b..5615088fe30cc0f 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/emplace.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/emplace.pass.cpp
@@ -24,57 +24,56 @@
#include "../../../Emplaceable.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_map<int, Emplaceable> C;
- typedef std::pair<C::iterator, bool> R;
- C c;
- R r = c.emplace(std::piecewise_construct, std::forward_as_tuple(3),
- std::forward_as_tuple());
- assert(r.second);
- assert(c.size() == 1);
- assert(r.first->first == 3);
- assert(r.first->second == Emplaceable());
+int main(int, char**) {
+ {
+ typedef std::unordered_map<int, Emplaceable> C;
+ typedef std::pair<C::iterator, bool> R;
+ C c;
+ R r = c.emplace(std::piecewise_construct, std::forward_as_tuple(3), std::forward_as_tuple());
+ assert(r.second);
+ assert(c.size() == 1);
+ assert(r.first->first == 3);
+ assert(r.first->second == Emplaceable());
- r = c.emplace(std::pair<const int, Emplaceable>(4, Emplaceable(5, 6)));
- assert(r.second);
- assert(c.size() == 2);
- assert(r.first->first == 4);
- assert(r.first->second == Emplaceable(5, 6));
+ r = c.emplace(std::pair<const int, Emplaceable>(4, Emplaceable(5, 6)));
+ assert(r.second);
+ assert(c.size() == 2);
+ assert(r.first->first == 4);
+ assert(r.first->second == Emplaceable(5, 6));
- r = c.emplace(std::piecewise_construct, std::forward_as_tuple(5),
- std::forward_as_tuple(6, 7));
- assert(r.second);
- assert(c.size() == 3);
- assert(r.first->first == 5);
- assert(r.first->second == Emplaceable(6, 7));
- }
- {
- typedef std::unordered_map<int, Emplaceable, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, Emplaceable>>> C;
- typedef std::pair<C::iterator, bool> R;
- C c;
- R r = c.emplace(std::piecewise_construct, std::forward_as_tuple(3),
- std::forward_as_tuple());
- assert(r.second);
- assert(c.size() == 1);
- assert(r.first->first == 3);
- assert(r.first->second == Emplaceable());
+ r = c.emplace(std::piecewise_construct, std::forward_as_tuple(5), std::forward_as_tuple(6, 7));
+ assert(r.second);
+ assert(c.size() == 3);
+ assert(r.first->first == 5);
+ assert(r.first->second == Emplaceable(6, 7));
+ }
+ {
+ typedef std::unordered_map<int,
+ Emplaceable,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, Emplaceable>>>
+ C;
+ typedef std::pair<C::iterator, bool> R;
+ C c;
+ R r = c.emplace(std::piecewise_construct, std::forward_as_tuple(3), std::forward_as_tuple());
+ assert(r.second);
+ assert(c.size() == 1);
+ assert(r.first->first == 3);
+ assert(r.first->second == Emplaceable());
- r = c.emplace(std::pair<const int, Emplaceable>(4, Emplaceable(5, 6)));
- assert(r.second);
- assert(c.size() == 2);
- assert(r.first->first == 4);
- assert(r.first->second == Emplaceable(5, 6));
+ r = c.emplace(std::pair<const int, Emplaceable>(4, Emplaceable(5, 6)));
+ assert(r.second);
+ assert(c.size() == 2);
+ assert(r.first->first == 4);
+ assert(r.first->second == Emplaceable(5, 6));
- r = c.emplace(std::piecewise_construct, std::forward_as_tuple(5),
- std::forward_as_tuple(6, 7));
- assert(r.second);
- assert(c.size() == 3);
- assert(r.first->first == 5);
- assert(r.first->second == Emplaceable(6, 7));
- }
+ r = c.emplace(std::piecewise_construct, std::forward_as_tuple(5), std::forward_as_tuple(6, 7));
+ assert(r.second);
+ assert(c.size() == 3);
+ assert(r.first->first == 5);
+ assert(r.first->second == Emplaceable(6, 7));
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/emplace_hint.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/emplace_hint.pass.cpp
index 4277a1bec2a5016..3e41213d1f2e338 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/emplace_hint.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/emplace_hint.pass.cpp
@@ -17,7 +17,6 @@
// template <class... Args>
// iterator emplace_hint(const_iterator p, Args&&... args);
-
#include <unordered_map>
#include <cassert>
@@ -25,53 +24,52 @@
#include "../../../Emplaceable.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_map<int, Emplaceable> C;
- typedef C::iterator R;
- C c;
- C::const_iterator e = c.end();
- R r = c.emplace_hint(e, std::piecewise_construct, std::forward_as_tuple(3),
- std::forward_as_tuple());
- assert(c.size() == 1);
- assert(r->first == 3);
- assert(r->second == Emplaceable());
+int main(int, char**) {
+ {
+ typedef std::unordered_map<int, Emplaceable> C;
+ typedef C::iterator R;
+ C c;
+ C::const_iterator e = c.end();
+ R r = c.emplace_hint(e, std::piecewise_construct, std::forward_as_tuple(3), std::forward_as_tuple());
+ assert(c.size() == 1);
+ assert(r->first == 3);
+ assert(r->second == Emplaceable());
- r = c.emplace_hint(c.end(), std::pair<const int, Emplaceable>(4, Emplaceable(5, 6)));
- assert(c.size() == 2);
- assert(r->first == 4);
- assert(r->second == Emplaceable(5, 6));
+ r = c.emplace_hint(c.end(), std::pair<const int, Emplaceable>(4, Emplaceable(5, 6)));
+ assert(c.size() == 2);
+ assert(r->first == 4);
+ assert(r->second == Emplaceable(5, 6));
- r = c.emplace_hint(c.end(), std::piecewise_construct, std::forward_as_tuple(5),
- std::forward_as_tuple(6, 7));
- assert(c.size() == 3);
- assert(r->first == 5);
- assert(r->second == Emplaceable(6, 7));
- }
- {
- typedef std::unordered_map<int, Emplaceable, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, Emplaceable>>> C;
- typedef C::iterator R;
- C c;
- C::const_iterator e = c.end();
- R r = c.emplace_hint(e, std::piecewise_construct, std::forward_as_tuple(3),
- std::forward_as_tuple());
- assert(c.size() == 1);
- assert(r->first == 3);
- assert(r->second == Emplaceable());
+ r = c.emplace_hint(c.end(), std::piecewise_construct, std::forward_as_tuple(5), std::forward_as_tuple(6, 7));
+ assert(c.size() == 3);
+ assert(r->first == 5);
+ assert(r->second == Emplaceable(6, 7));
+ }
+ {
+ typedef std::unordered_map<int,
+ Emplaceable,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, Emplaceable>>>
+ C;
+ typedef C::iterator R;
+ C c;
+ C::const_iterator e = c.end();
+ R r = c.emplace_hint(e, std::piecewise_construct, std::forward_as_tuple(3), std::forward_as_tuple());
+ assert(c.size() == 1);
+ assert(r->first == 3);
+ assert(r->second == Emplaceable());
- r = c.emplace_hint(c.end(), std::pair<const int, Emplaceable>(4, Emplaceable(5, 6)));
- assert(c.size() == 2);
- assert(r->first == 4);
- assert(r->second == Emplaceable(5, 6));
+ r = c.emplace_hint(c.end(), std::pair<const int, Emplaceable>(4, Emplaceable(5, 6)));
+ assert(c.size() == 2);
+ assert(r->first == 4);
+ assert(r->second == Emplaceable(5, 6));
- r = c.emplace_hint(c.end(), std::piecewise_construct, std::forward_as_tuple(5),
- std::forward_as_tuple(6, 7));
- assert(c.size() == 3);
- assert(r->first == 5);
- assert(r->second == Emplaceable(6, 7));
- }
+ r = c.emplace_hint(c.end(), std::piecewise_construct, std::forward_as_tuple(5), std::forward_as_tuple(6, 7));
+ assert(c.size() == 3);
+ assert(r->first == 5);
+ assert(r->second == Emplaceable(6, 7));
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/erase_const_iter.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/erase_const_iter.pass.cpp
index 42cc9d14083780b..f6ab2411789f07c 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/erase_const_iter.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/erase_const_iter.pass.cpp
@@ -21,73 +21,75 @@
#include "test_macros.h"
#include "min_allocator.h"
-struct TemplateConstructor
-{
- template<typename T>
- TemplateConstructor (const T&) {}
+struct TemplateConstructor {
+ template <typename T>
+ TemplateConstructor(const T&) {}
};
bool operator==(const TemplateConstructor&, const TemplateConstructor&) { return false; }
-struct Hash { std::size_t operator() (const TemplateConstructor &) const { return 0; } };
+struct Hash {
+ std::size_t operator()(const TemplateConstructor&) const { return 0; }
+};
-int main(int, char**)
-{
- {
- typedef std::unordered_map<int, std::string> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- C::const_iterator i = c.find(2);
- c.erase(i);
- assert(c.size() == 3);
- assert(c.at(1) == "one");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_map<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ C::const_iterator i = c.find(2);
+ c.erase(i);
+ assert(c.size() == 3);
+ assert(c.at(1) == "one");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- C::const_iterator i = c.find(2);
- c.erase(i);
- assert(c.size() == 3);
- assert(c.at(1) == "one");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- }
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ C::const_iterator i = c.find(2);
+ c.erase(i);
+ assert(c.size() == 3);
+ assert(c.at(1) == "one");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ }
#endif
#if TEST_STD_VER >= 14
- {
+ {
// This is LWG #2059
- typedef TemplateConstructor T;
- typedef std::unordered_map<T, int, Hash> C;
- typedef C::iterator I;
+ typedef TemplateConstructor T;
+ typedef std::unordered_map<T, int, Hash> C;
+ typedef C::iterator I;
- C m;
- T a{0};
- I it = m.find(a);
- if (it != m.end())
- m.erase(it);
- }
+ C m;
+ T a{0};
+ I it = m.find(a);
+ if (it != m.end())
+ m.erase(it);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/erase_key.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/erase_key.pass.cpp
index 305d149a583749e..e78c48ce5ccfd58 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/erase_key.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/erase_key.pass.cpp
@@ -23,156 +23,156 @@
#if TEST_STD_VER >= 11
template <typename Unordered>
-bool only_deletions ( const Unordered &whole, const Unordered &part ) {
- typename Unordered::const_iterator w = whole.begin();
- typename Unordered::const_iterator p = part.begin();
+bool only_deletions(const Unordered& whole, const Unordered& part) {
+ typename Unordered::const_iterator w = whole.begin();
+ typename Unordered::const_iterator p = part.begin();
- while ( w != whole.end () && p != part.end()) {
- if ( *w == *p )
- p++;
- w++;
- }
+ while (w != whole.end() && p != part.end()) {
+ if (*w == *p)
+ p++;
+ w++;
+ }
- return p == part.end();
+ return p == part.end();
}
#endif
-
-int main(int, char**)
-{
- {
- typedef std::unordered_map<int, std::string> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.erase(5) == 0);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
-
- assert(c.erase(2) == 1);
- assert(c.size() == 3);
- assert(c.at(1) == "one");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
-
- assert(c.erase(2) == 0);
- assert(c.size() == 3);
- assert(c.at(1) == "one");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
-
- assert(c.erase(4) == 1);
- assert(c.size() == 2);
- assert(c.at(1) == "one");
- assert(c.at(3) == "three");
-
- assert(c.erase(4) == 0);
- assert(c.size() == 2);
- assert(c.at(1) == "one");
- assert(c.at(3) == "three");
-
- assert(c.erase(1) == 1);
- assert(c.size() == 1);
- assert(c.at(3) == "three");
-
- assert(c.erase(1) == 0);
- assert(c.size() == 1);
- assert(c.at(3) == "three");
-
- assert(c.erase(3) == 1);
- assert(c.size() == 0);
-
- assert(c.erase(3) == 0);
- assert(c.size() == 0);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_map<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.erase(5) == 0);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+
+ assert(c.erase(2) == 1);
+ assert(c.size() == 3);
+ assert(c.at(1) == "one");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+
+ assert(c.erase(2) == 0);
+ assert(c.size() == 3);
+ assert(c.at(1) == "one");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+
+ assert(c.erase(4) == 1);
+ assert(c.size() == 2);
+ assert(c.at(1) == "one");
+ assert(c.at(3) == "three");
+
+ assert(c.erase(4) == 0);
+ assert(c.size() == 2);
+ assert(c.at(1) == "one");
+ assert(c.at(3) == "three");
+
+ assert(c.erase(1) == 1);
+ assert(c.size() == 1);
+ assert(c.at(3) == "three");
+
+ assert(c.erase(1) == 0);
+ assert(c.size() == 1);
+ assert(c.at(3) == "three");
+
+ assert(c.erase(3) == 1);
+ assert(c.size() == 0);
+
+ assert(c.erase(3) == 0);
+ assert(c.size() == 0);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.erase(5) == 0);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
-
- assert(c.erase(2) == 1);
- assert(c.size() == 3);
- assert(c.at(1) == "one");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
-
- assert(c.erase(2) == 0);
- assert(c.size() == 3);
- assert(c.at(1) == "one");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
-
- assert(c.erase(4) == 1);
- assert(c.size() == 2);
- assert(c.at(1) == "one");
- assert(c.at(3) == "three");
-
- assert(c.erase(4) == 0);
- assert(c.size() == 2);
- assert(c.at(1) == "one");
- assert(c.at(3) == "three");
-
- assert(c.erase(1) == 1);
- assert(c.size() == 1);
- assert(c.at(3) == "three");
-
- assert(c.erase(1) == 0);
- assert(c.size() == 1);
- assert(c.at(3) == "three");
-
- assert(c.erase(3) == 1);
- assert(c.size() == 0);
-
- assert(c.erase(3) == 0);
- assert(c.size() == 0);
- }
- {
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.erase(5) == 0);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+
+ assert(c.erase(2) == 1);
+ assert(c.size() == 3);
+ assert(c.at(1) == "one");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+
+ assert(c.erase(2) == 0);
+ assert(c.size() == 3);
+ assert(c.at(1) == "one");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+
+ assert(c.erase(4) == 1);
+ assert(c.size() == 2);
+ assert(c.at(1) == "one");
+ assert(c.at(3) == "three");
+
+ assert(c.erase(4) == 0);
+ assert(c.size() == 2);
+ assert(c.at(1) == "one");
+ assert(c.at(3) == "three");
+
+ assert(c.erase(1) == 1);
+ assert(c.size() == 1);
+ assert(c.at(3) == "three");
+
+ assert(c.erase(1) == 0);
+ assert(c.size() == 1);
+ assert(c.at(3) == "three");
+
+ assert(c.erase(3) == 1);
+ assert(c.size() == 0);
+
+ assert(c.erase(3) == 0);
+ assert(c.size() == 0);
+ }
+ {
typedef std::unordered_map<int, int> C;
C m, m2;
- for ( int i = 0; i < 10; ++i ) {
- m[i] = i;
- m2[i] = i;
- }
+ for (int i = 0; i < 10; ++i) {
+ m[i] = i;
+ m2[i] = i;
+ }
C::iterator i = m2.begin();
- int ctr = 0;
+ int ctr = 0;
while (i != m2.end()) {
- if (ctr++ % 2 == 0)
- m2.erase(i++);
- else
- ++i;
- }
-
- assert (only_deletions (m, m2));
+ if (ctr++ % 2 == 0)
+ m2.erase(i++);
+ else
+ ++i;
}
+
+ assert(only_deletions(m, m2));
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/erase_range.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/erase_range.pass.cpp
index f6baeec9ff1c41a..532413437f6beef 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/erase_range.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/erase_range.pass.cpp
@@ -22,80 +22,81 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_map<int, std::string> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- C::const_iterator i = c.find(2);
- C::const_iterator j = std::next(i, 1);
- C::iterator k = c.erase(i, i);
- assert(k == i);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
+int main(int, char**) {
+ {
+ typedef std::unordered_map<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ C::const_iterator i = c.find(2);
+ C::const_iterator j = std::next(i, 1);
+ C::iterator k = c.erase(i, i);
+ assert(k == i);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
- k = c.erase(i, j);
- assert(c.size() == 3);
- assert(k == j);
- assert(c.at(1) == "one");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
+ k = c.erase(i, j);
+ assert(c.size() == 3);
+ assert(k == j);
+ assert(c.at(1) == "one");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
- k = c.erase(c.cbegin(), c.cend());
- assert(k == c.cend());
- assert(c.size() == 0);
- assert(k == c.end());
- }
+ k = c.erase(c.cbegin(), c.cend());
+ assert(k == c.cend());
+ assert(c.size() == 0);
+ assert(k == c.end());
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- C::const_iterator i = c.find(2);
- C::const_iterator j = std::next(i, 1);
- C::iterator k = c.erase(i, i);
- assert(k == i);
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ C::const_iterator i = c.find(2);
+ C::const_iterator j = std::next(i, 1);
+ C::iterator k = c.erase(i, i);
+ assert(k == i);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
- k = c.erase(i, j);
- assert(c.size() == 3);
- assert(k == j);
- assert(c.at(1) == "one");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
+ k = c.erase(i, j);
+ assert(c.size() == 3);
+ assert(k == j);
+ assert(c.at(1) == "one");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
- k = c.erase(c.cbegin(), c.cend());
- assert(k == c.cend());
- assert(c.size() == 0);
- assert(k == c.end());
- }
+ k = c.erase(c.cbegin(), c.cend());
+ assert(k == c.cend());
+ assert(c.size() == 0);
+ assert(k == c.end());
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/extract_iterator.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/extract_iterator.pass.cpp
index ac241c07d972d86..811d3eb085ffcaf 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/extract_iterator.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/extract_iterator.pass.cpp
@@ -20,50 +20,45 @@
#include "Counter.h"
template <class Container>
-void test(Container& c)
-{
- std::size_t sz = c.size();
+void test(Container& c) {
+ std::size_t sz = c.size();
- auto some_key = c.cbegin()->first;
+ auto some_key = c.cbegin()->first;
- for (auto first = c.cbegin(); first != c.cend();)
- {
- auto key_value = first->first;
- typename Container::node_type t = c.extract(first++);
- --sz;
- assert(t.key() == key_value);
- t.key() = some_key;
- assert(t.key() == some_key);
- assert(t.get_allocator() == c.get_allocator());
- assert(sz == c.size());
- }
+ for (auto first = c.cbegin(); first != c.cend();) {
+ auto key_value = first->first;
+ typename Container::node_type t = c.extract(first++);
+ --sz;
+ assert(t.key() == key_value);
+ t.key() = some_key;
+ assert(t.key() == some_key);
+ assert(t.get_allocator() == c.get_allocator());
+ assert(sz == c.size());
+ }
- assert(c.size() == 0);
+ assert(c.size() == 0);
}
-int main(int, char**)
-{
- {
- using map_type = std::unordered_map<int, int>;
- map_type m = {{1,1}, {2,2}, {3,3}, {4,4}, {5,5}, {6,6}};
- test(m);
- }
+int main(int, char**) {
+ {
+ using map_type = std::unordered_map<int, int>;
+ map_type m = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}};
+ test(m);
+ }
- {
- std::unordered_map<Counter<int>, Counter<int>> m =
- {{1,1}, {2,2}, {3,3}, {4,4}, {5,5}, {6,6}};
- assert(Counter_base::gConstructed == 12);
- test(m);
- assert(Counter_base::gConstructed == 0);
- }
+ {
+ std::unordered_map<Counter<int>, Counter<int>> m = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}};
+ assert(Counter_base::gConstructed == 12);
+ test(m);
+ assert(Counter_base::gConstructed == 0);
+ }
- {
- using min_alloc_map =
- std::unordered_map<int, int, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, int>>>;
- min_alloc_map m = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}};
- test(m);
- }
+ {
+ using min_alloc_map =
+ std::unordered_map<int, int, std::hash<int>, std::equal_to<int>, min_allocator<std::pair<const int, int>>>;
+ min_alloc_map m = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}};
+ test(m);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/extract_key.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/extract_key.pass.cpp
index 78721db16e0be19..60f3310797b3d20 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/extract_key.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/extract_key.pass.cpp
@@ -22,59 +22,53 @@
#include "Counter.h"
template <class Container, class KeyTypeIter>
-void test(Container& c, KeyTypeIter first, KeyTypeIter last)
-{
- std::size_t sz = c.size();
- assert((std::size_t)std::distance(first, last) == sz);
+void test(Container& c, KeyTypeIter first, KeyTypeIter last) {
+ std::size_t sz = c.size();
+ assert((std::size_t)std::distance(first, last) == sz);
- for (KeyTypeIter copy = first; copy != last; ++copy)
- {
- typename Container::node_type t = c.extract(*copy);
- assert(!t.empty());
- --sz;
- assert(t.key() == *copy);
- t.key() = *first; // We should be able to mutate key.
- assert(t.key() == *first);
- assert(t.get_allocator() == c.get_allocator());
- assert(sz == c.size());
- }
+ for (KeyTypeIter copy = first; copy != last; ++copy) {
+ typename Container::node_type t = c.extract(*copy);
+ assert(!t.empty());
+ --sz;
+ assert(t.key() == *copy);
+ t.key() = *first; // We should be able to mutate key.
+ assert(t.key() == *first);
+ assert(t.get_allocator() == c.get_allocator());
+ assert(sz == c.size());
+ }
- assert(c.size() == 0);
+ assert(c.size() == 0);
- for (KeyTypeIter copy = first; copy != last; ++copy)
- {
- typename Container::node_type t = c.extract(*copy);
- assert(t.empty());
- }
+ for (KeyTypeIter copy = first; copy != last; ++copy) {
+ typename Container::node_type t = c.extract(*copy);
+ assert(t.empty());
+ }
}
-int main(int, char**)
-{
- {
- std::unordered_map<int, int> m = {{1,1}, {2,2}, {3,3}, {4,4}, {5,5}, {6,6}};
- int keys[] = {1, 2, 3, 4, 5, 6};
- test(m, std::begin(keys), std::end(keys));
- }
+int main(int, char**) {
+ {
+ std::unordered_map<int, int> m = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}};
+ int keys[] = {1, 2, 3, 4, 5, 6};
+ test(m, std::begin(keys), std::end(keys));
+ }
+ {
+ std::unordered_map<Counter<int>, Counter<int>> m = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}};
{
- std::unordered_map<Counter<int>, Counter<int>> m =
- {{1,1}, {2,2}, {3,3}, {4,4}, {5,5}, {6,6}};
- {
- Counter<int> keys[] = {1, 2, 3, 4, 5, 6};
- assert(Counter_base::gConstructed == 12+6);
- test(m, std::begin(keys), std::end(keys));
- }
- assert(Counter_base::gConstructed == 0);
+ Counter<int> keys[] = {1, 2, 3, 4, 5, 6};
+ assert(Counter_base::gConstructed == 12 + 6);
+ test(m, std::begin(keys), std::end(keys));
}
+ assert(Counter_base::gConstructed == 0);
+ }
- {
- using min_alloc_map =
- std::unordered_map<int, int, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, int>>>;
- min_alloc_map m = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}};
- int keys[] = {1, 2, 3, 4, 5, 6};
- test(m, std::begin(keys), std::end(keys));
- }
+ {
+ using min_alloc_map =
+ std::unordered_map<int, int, std::hash<int>, std::equal_to<int>, min_allocator<std::pair<const int, int>>>;
+ min_alloc_map m = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}};
+ int keys[] = {1, 2, 3, 4, 5, 6};
+ test(m, std::begin(keys), std::end(keys));
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_and_emplace_allocator_requirements.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_and_emplace_allocator_requirements.pass.cpp
index a28a866b4309b83..a504d953a26ddfc 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_and_emplace_allocator_requirements.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_and_emplace_allocator_requirements.pass.cpp
@@ -15,15 +15,13 @@
// UNSUPPORTED: c++03
-
#include <unordered_map>
#include "test_macros.h"
#include "container_test_types.h"
#include "../../../map_allocator_requirement_test_templates.h"
-int main(int, char**)
-{
+int main(int, char**) {
testMapInsert<TCT::unordered_map<> >();
testMapInsertHint<TCT::unordered_map<> >();
testMapEmplace<TCT::unordered_map<> >();
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_const_lvalue.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_const_lvalue.pass.cpp
index eb505218fdd1d46..03f214f239e2233 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_const_lvalue.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_const_lvalue.pass.cpp
@@ -20,63 +20,64 @@
#include "test_macros.h"
#include "min_allocator.h"
-
template <class Container>
-void do_insert_cv_test()
-{
- typedef Container M;
- typedef std::pair<typename M::iterator, bool> R;
- typedef typename M::value_type VT;
- M m;
+void do_insert_cv_test() {
+ typedef Container M;
+ typedef std::pair<typename M::iterator, bool> R;
+ typedef typename M::value_type VT;
+ M m;
- const VT v1(2.5, 2);
- R r = m.insert(v1);
- assert(r.second);
- assert(m.size() == 1);
- assert(r.first->first == 2.5);
- assert(r.first->second == 2);
+ const VT v1(2.5, 2);
+ R r = m.insert(v1);
+ assert(r.second);
+ assert(m.size() == 1);
+ assert(r.first->first == 2.5);
+ assert(r.first->second == 2);
- const VT v2(2.5, 3);
- r = m.insert(v2);
- assert(!r.second);
- assert(m.size() == 1);
- assert(r.first->first == 2.5);
- assert(r.first->second == 2);
+ const VT v2(2.5, 3);
+ r = m.insert(v2);
+ assert(!r.second);
+ assert(m.size() == 1);
+ assert(r.first->first == 2.5);
+ assert(r.first->second == 2);
- const VT v3(1.5, 1);
- r = m.insert(v3);
- assert(r.second);
- assert(m.size() == 2);
- assert(r.first->first == 1.5);
- assert(r.first->second == 1);
+ const VT v3(1.5, 1);
+ r = m.insert(v3);
+ assert(r.second);
+ assert(m.size() == 2);
+ assert(r.first->first == 1.5);
+ assert(r.first->second == 1);
- const VT v4(3.5, 3);
- r = m.insert(v4);
- assert(r.second);
- assert(m.size() == 3);
- assert(r.first->first == 3.5);
- assert(r.first->second == 3);
+ const VT v4(3.5, 3);
+ r = m.insert(v4);
+ assert(r.second);
+ assert(m.size() == 3);
+ assert(r.first->first == 3.5);
+ assert(r.first->second == 3);
- const VT v5(3.5, 4);
- r = m.insert(v5);
- assert(!r.second);
- assert(m.size() == 3);
- assert(r.first->first == 3.5);
- assert(r.first->second == 3);
+ const VT v5(3.5, 4);
+ r = m.insert(v5);
+ assert(!r.second);
+ assert(m.size() == 3);
+ assert(r.first->first == 3.5);
+ assert(r.first->second == 3);
}
-int main(int, char**)
-{
- {
- typedef std::unordered_map<double, int> M;
- do_insert_cv_test<M>();
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_map<double, int> M;
+ do_insert_cv_test<M>();
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_map<double, int, std::hash<double>, std::equal_to<double>,
- min_allocator<std::pair<const double, int>>> M;
- do_insert_cv_test<M>();
- }
+ {
+ typedef std::unordered_map<double,
+ int,
+ std::hash<double>,
+ std::equal_to<double>,
+ min_allocator<std::pair<const double, int>>>
+ M;
+ do_insert_cv_test<M>();
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_hint_const_lvalue.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_hint_const_lvalue.pass.cpp
index 208d4827d72e333..d2280d7daed762c 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_hint_const_lvalue.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_hint_const_lvalue.pass.cpp
@@ -20,50 +20,52 @@
#include "test_macros.h"
#include "min_allocator.h"
-template<class Container>
-void do_insert_hint_const_lvalue_test()
-{
- typedef Container C;
- typedef typename C::iterator R;
- typedef typename C::value_type VT;
- C c;
- typename C::const_iterator e = c.end();
- const VT v1(3.5, 3);
- R r = c.insert(e, v1);
- assert(c.size() == 1);
- assert(r->first == 3.5);
- assert(r->second == 3);
+template <class Container>
+void do_insert_hint_const_lvalue_test() {
+ typedef Container C;
+ typedef typename C::iterator R;
+ typedef typename C::value_type VT;
+ C c;
+ typename C::const_iterator e = c.end();
+ const VT v1(3.5, 3);
+ R r = c.insert(e, v1);
+ assert(c.size() == 1);
+ assert(r->first == 3.5);
+ assert(r->second == 3);
- const VT v2(3.5, 4);
- r = c.insert(r, v2);
- assert(c.size() == 1);
- assert(r->first == 3.5);
- assert(r->second == 3);
+ const VT v2(3.5, 4);
+ r = c.insert(r, v2);
+ assert(c.size() == 1);
+ assert(r->first == 3.5);
+ assert(r->second == 3);
- const VT v3(4.5, 4);
- r = c.insert(c.end(), v3);
- assert(c.size() == 2);
- assert(r->first == 4.5);
- assert(r->second == 4);
+ const VT v3(4.5, 4);
+ r = c.insert(c.end(), v3);
+ assert(c.size() == 2);
+ assert(r->first == 4.5);
+ assert(r->second == 4);
- const VT v4(5.5, 4);
- r = c.insert(c.end(), v4);
- assert(c.size() == 3);
- assert(r->first == 5.5);
- assert(r->second == 4);
+ const VT v4(5.5, 4);
+ r = c.insert(c.end(), v4);
+ assert(c.size() == 3);
+ assert(r->first == 5.5);
+ assert(r->second == 4);
}
-int main(int, char**)
-{
- do_insert_hint_const_lvalue_test<std::unordered_map<double, int> >();
+int main(int, char**) {
+ do_insert_hint_const_lvalue_test<std::unordered_map<double, int> >();
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_map<double, int, std::hash<double>, std::equal_to<double>,
- min_allocator<std::pair<const double, int>>> C;
+ {
+ typedef std::unordered_map<double,
+ int,
+ std::hash<double>,
+ std::equal_to<double>,
+ min_allocator<std::pair<const double, int>>>
+ C;
- do_insert_hint_const_lvalue_test<C>();
- }
+ do_insert_hint_const_lvalue_test<C>();
+ }
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_hint_rvalue.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_hint_rvalue.pass.cpp
index 44ed22791ffbbfc..30b6bf6bdc9ef8d 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_hint_rvalue.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_hint_rvalue.pass.cpp
@@ -25,139 +25,146 @@
#include "MoveOnly.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_map<double, int> C;
- typedef C::iterator R;
- typedef std::pair<double, short> P;
- C c;
- C::const_iterator e = c.end();
- R r = c.insert(e, P(3.5, static_cast<short>(3)));
- assert(c.size() == 1);
- assert(r->first == 3.5);
- assert(r->second == 3);
-
- r = c.insert(r, P(3.5, static_cast<short>(4)));
- assert(c.size() == 1);
- assert(r->first == 3.5);
- assert(r->second == 3);
-
- r = c.insert(c.end(), P(4.5, static_cast<short>(4)));
- assert(c.size() == 2);
- assert(r->first == 4.5);
- assert(r->second == 4);
-
- r = c.insert(c.end(), P(5.5, static_cast<short>(4)));
- assert(c.size() == 3);
- assert(r->first == 5.5);
- assert(r->second == 4);
- }
- {
- typedef std::unordered_map<MoveOnly, MoveOnly> C;
- typedef C::iterator R;
- typedef std::pair<MoveOnly, MoveOnly> P;
- C c;
- C::const_iterator e = c.end();
- R r = c.insert(e, P(3, 3));
- assert(c.size() == 1);
- assert(r->first == 3);
- assert(r->second == 3);
-
- r = c.insert(r, P(3, 4));
- assert(c.size() == 1);
- assert(r->first == 3);
- assert(r->second == 3);
-
- r = c.insert(c.end(), P(4, 4));
- assert(c.size() == 2);
- assert(r->first == 4);
- assert(r->second == 4);
-
- r = c.insert(c.end(), P(5, 4));
- assert(c.size() == 3);
- assert(r->first == 5);
- assert(r->second == 4);
- }
- {
- typedef std::unordered_map<double, int, std::hash<double>, std::equal_to<double>,
- min_allocator<std::pair<const double, int>>> C;
- typedef C::iterator R;
- typedef std::pair<double, short> P;
- C c;
- C::const_iterator e = c.end();
- R r = c.insert(e, P(3.5, static_cast<short>(3)));
- assert(c.size() == 1);
- assert(r->first == 3.5);
- assert(r->second == 3);
-
- r = c.insert(r, P(3.5, static_cast<short>(4)));
- assert(c.size() == 1);
- assert(r->first == 3.5);
- assert(r->second == 3);
-
- r = c.insert(c.end(), P(4.5, static_cast<short>(4)));
- assert(c.size() == 2);
- assert(r->first == 4.5);
- assert(r->second == 4);
-
- r = c.insert(c.end(), P(5.5, static_cast<short>(4)));
- assert(c.size() == 3);
- assert(r->first == 5.5);
- assert(r->second == 4);
- }
- {
- typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>, std::equal_to<MoveOnly>,
- min_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
- typedef C::iterator R;
- typedef std::pair<MoveOnly, MoveOnly> P;
- C c;
- C::const_iterator e = c.end();
- R r = c.insert(e, P(3, 3));
- assert(c.size() == 1);
- assert(r->first == 3);
- assert(r->second == 3);
-
- r = c.insert(r, P(3, 4));
- assert(c.size() == 1);
- assert(r->first == 3);
- assert(r->second == 3);
-
- r = c.insert(c.end(), P(4, 4));
- assert(c.size() == 2);
- assert(r->first == 4);
- assert(r->second == 4);
-
- r = c.insert(c.end(), P(5, 4));
- assert(c.size() == 3);
- assert(r->first == 5);
- assert(r->second == 4);
- }
- {
- typedef std::unordered_map<double, MoveOnly> C;
- typedef C::iterator R;
- C c;
- C::const_iterator e = c.end();
- R r = c.insert(e, {3.5, 3});
- assert(c.size() == 1);
- assert(r->first == 3.5);
- assert(r->second == 3);
-
- r = c.insert(r, {3.5, 4});
- assert(c.size() == 1);
- assert(r->first == 3.5);
- assert(r->second == 3);
-
- r = c.insert(c.end(), {4.5, 4});
- assert(c.size() == 2);
- assert(r->first == 4.5);
- assert(r->second == 4);
-
- r = c.insert(c.end(), {5.5, 4});
- assert(c.size() == 3);
- assert(r->first == 5.5);
- assert(r->second == 4);
- }
-
- return 0;
+int main(int, char**) {
+ {
+ typedef std::unordered_map<double, int> C;
+ typedef C::iterator R;
+ typedef std::pair<double, short> P;
+ C c;
+ C::const_iterator e = c.end();
+ R r = c.insert(e, P(3.5, static_cast<short>(3)));
+ assert(c.size() == 1);
+ assert(r->first == 3.5);
+ assert(r->second == 3);
+
+ r = c.insert(r, P(3.5, static_cast<short>(4)));
+ assert(c.size() == 1);
+ assert(r->first == 3.5);
+ assert(r->second == 3);
+
+ r = c.insert(c.end(), P(4.5, static_cast<short>(4)));
+ assert(c.size() == 2);
+ assert(r->first == 4.5);
+ assert(r->second == 4);
+
+ r = c.insert(c.end(), P(5.5, static_cast<short>(4)));
+ assert(c.size() == 3);
+ assert(r->first == 5.5);
+ assert(r->second == 4);
+ }
+ {
+ typedef std::unordered_map<MoveOnly, MoveOnly> C;
+ typedef C::iterator R;
+ typedef std::pair<MoveOnly, MoveOnly> P;
+ C c;
+ C::const_iterator e = c.end();
+ R r = c.insert(e, P(3, 3));
+ assert(c.size() == 1);
+ assert(r->first == 3);
+ assert(r->second == 3);
+
+ r = c.insert(r, P(3, 4));
+ assert(c.size() == 1);
+ assert(r->first == 3);
+ assert(r->second == 3);
+
+ r = c.insert(c.end(), P(4, 4));
+ assert(c.size() == 2);
+ assert(r->first == 4);
+ assert(r->second == 4);
+
+ r = c.insert(c.end(), P(5, 4));
+ assert(c.size() == 3);
+ assert(r->first == 5);
+ assert(r->second == 4);
+ }
+ {
+ typedef std::unordered_map<double,
+ int,
+ std::hash<double>,
+ std::equal_to<double>,
+ min_allocator<std::pair<const double, int>>>
+ C;
+ typedef C::iterator R;
+ typedef std::pair<double, short> P;
+ C c;
+ C::const_iterator e = c.end();
+ R r = c.insert(e, P(3.5, static_cast<short>(3)));
+ assert(c.size() == 1);
+ assert(r->first == 3.5);
+ assert(r->second == 3);
+
+ r = c.insert(r, P(3.5, static_cast<short>(4)));
+ assert(c.size() == 1);
+ assert(r->first == 3.5);
+ assert(r->second == 3);
+
+ r = c.insert(c.end(), P(4.5, static_cast<short>(4)));
+ assert(c.size() == 2);
+ assert(r->first == 4.5);
+ assert(r->second == 4);
+
+ r = c.insert(c.end(), P(5.5, static_cast<short>(4)));
+ assert(c.size() == 3);
+ assert(r->first == 5.5);
+ assert(r->second == 4);
+ }
+ {
+ typedef std::unordered_map<MoveOnly,
+ MoveOnly,
+ std::hash<MoveOnly>,
+ std::equal_to<MoveOnly>,
+ min_allocator<std::pair<const MoveOnly, MoveOnly>>>
+ C;
+ typedef C::iterator R;
+ typedef std::pair<MoveOnly, MoveOnly> P;
+ C c;
+ C::const_iterator e = c.end();
+ R r = c.insert(e, P(3, 3));
+ assert(c.size() == 1);
+ assert(r->first == 3);
+ assert(r->second == 3);
+
+ r = c.insert(r, P(3, 4));
+ assert(c.size() == 1);
+ assert(r->first == 3);
+ assert(r->second == 3);
+
+ r = c.insert(c.end(), P(4, 4));
+ assert(c.size() == 2);
+ assert(r->first == 4);
+ assert(r->second == 4);
+
+ r = c.insert(c.end(), P(5, 4));
+ assert(c.size() == 3);
+ assert(r->first == 5);
+ assert(r->second == 4);
+ }
+ {
+ typedef std::unordered_map<double, MoveOnly> C;
+ typedef C::iterator R;
+ C c;
+ C::const_iterator e = c.end();
+ R r = c.insert(e, {3.5, 3});
+ assert(c.size() == 1);
+ assert(r->first == 3.5);
+ assert(r->second == 3);
+
+ r = c.insert(r, {3.5, 4});
+ assert(c.size() == 1);
+ assert(r->first == 3.5);
+ assert(r->second == 3);
+
+ r = c.insert(c.end(), {4.5, 4});
+ assert(c.size() == 2);
+ assert(r->first == 4.5);
+ assert(r->second == 4);
+
+ r = c.insert(c.end(), {5.5, 4});
+ assert(c.size() == 3);
+ assert(r->first == 5.5);
+ assert(r->second == 4);
+ }
+
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_init.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_init.pass.cpp
index dcdad5605e9c7a2..9699df4b74d269e 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_init.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_init.pass.cpp
@@ -24,49 +24,48 @@
#include "test_iterators.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_map<int, std::string> C;
- typedef std::pair<int, std::string> P;
- C c;
- c.insert(
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- }
- );
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- }
- {
- typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- C c;
- c.insert(
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- }
- );
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_map<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ C c;
+ c.insert({
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ });
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ }
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ C c;
+ c.insert({
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ });
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_iter_iter.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_iter_iter.pass.cpp
index 342ff584f64500f..414631c8b763858 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_iter_iter.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_iter_iter.pass.cpp
@@ -23,50 +23,51 @@
#include "test_iterators.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_map<int, std::string> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c;
- c.insert(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])));
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_map<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c;
+ c.insert(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])));
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c;
- c.insert(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])));
- assert(c.size() == 4);
- assert(c.at(1) == "one");
- assert(c.at(2) == "two");
- assert(c.at(3) == "three");
- assert(c.at(4) == "four");
- }
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c;
+ c.insert(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])));
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_node_type.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_node_type.pass.cpp
index 7188774466969eb..c2920128e5b965d 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_node_type.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_node_type.pass.cpp
@@ -42,70 +42,64 @@ void verify_insert_return_type(T&& t) {
template <class Container>
typename Container::node_type
-node_factory(typename Container::key_type const& key,
- typename Container::mapped_type const& mapped)
-{
- static Container c;
- auto p = c.insert({key, mapped});
- assert(p.second);
- return c.extract(p.first);
+node_factory(typename Container::key_type const& key, typename Container::mapped_type const& mapped) {
+ static Container c;
+ auto p = c.insert({key, mapped});
+ assert(p.second);
+ return c.extract(p.first);
}
template <class Container>
-void test(Container& c)
-{
- auto* nf = &node_factory<Container>;
-
- for (int i = 0; i != 10; ++i)
- {
- typename Container::node_type node = nf(i, i + 1);
- assert(!node.empty());
- typename Container::insert_return_type irt = c.insert(std::move(node));
- assert(node.empty());
- assert(irt.inserted);
- assert(irt.node.empty());
- assert(irt.position->first == i && irt.position->second == i + 1);
- verify_insert_return_type<Container>(irt);
- }
-
- assert(c.size() == 10);
-
- { // Insert empty node.
- typename Container::node_type def;
- auto irt = c.insert(std::move(def));
- assert(def.empty());
- assert(!irt.inserted);
- assert(irt.node.empty());
- assert(irt.position == c.end());
- verify_insert_return_type<Container>(irt);
- }
-
- { // Insert duplicate node.
- typename Container::node_type dupl = nf(0, 42);
- auto irt = c.insert(std::move(dupl));
- assert(dupl.empty());
- assert(!irt.inserted);
- assert(!irt.node.empty());
- assert(irt.position == c.find(0));
- assert(irt.node.key() == 0 && irt.node.mapped() == 42);
- verify_insert_return_type<Container>(irt);
- }
-
- assert(c.size() == 10);
-
- for (int i = 0; i != 10; ++i)
- {
- assert(c.count(i) == 1);
- assert(c[i] == i + 1);
- }
+void test(Container& c) {
+ auto* nf = &node_factory<Container>;
+
+ for (int i = 0; i != 10; ++i) {
+ typename Container::node_type node = nf(i, i + 1);
+ assert(!node.empty());
+ typename Container::insert_return_type irt = c.insert(std::move(node));
+ assert(node.empty());
+ assert(irt.inserted);
+ assert(irt.node.empty());
+ assert(irt.position->first == i && irt.position->second == i + 1);
+ verify_insert_return_type<Container>(irt);
+ }
+
+ assert(c.size() == 10);
+
+ { // Insert empty node.
+ typename Container::node_type def;
+ auto irt = c.insert(std::move(def));
+ assert(def.empty());
+ assert(!irt.inserted);
+ assert(irt.node.empty());
+ assert(irt.position == c.end());
+ verify_insert_return_type<Container>(irt);
+ }
+
+ { // Insert duplicate node.
+ typename Container::node_type dupl = nf(0, 42);
+ auto irt = c.insert(std::move(dupl));
+ assert(dupl.empty());
+ assert(!irt.inserted);
+ assert(!irt.node.empty());
+ assert(irt.position == c.find(0));
+ assert(irt.node.key() == 0 && irt.node.mapped() == 42);
+ verify_insert_return_type<Container>(irt);
+ }
+
+ assert(c.size() == 10);
+
+ for (int i = 0; i != 10; ++i) {
+ assert(c.count(i) == 1);
+ assert(c[i] == i + 1);
+ }
}
-int main(int, char**)
-{
- std::unordered_map<int, int> m;
- test(m);
- std::unordered_map<int, int, std::hash<int>, std::equal_to<int>, min_allocator<std::pair<const int, int>>> m2;
- test(m2);
+int main(int, char**) {
+ std::unordered_map<int, int> m;
+ test(m);
+ std::unordered_map<int, int, std::hash<int>, std::equal_to<int>, min_allocator<std::pair<const int, int>>> m2;
+ test(m2);
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_node_type_hint.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_node_type_hint.pass.cpp
index 8677810187fb0e8..16f664ac89ff694 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_node_type_hint.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_node_type_hint.pass.cpp
@@ -20,47 +20,41 @@
template <class Container>
typename Container::node_type
-node_factory(typename Container::key_type const& key,
- typename Container::mapped_type const& mapped)
-{
- static Container c;
- auto p = c.insert({key, mapped});
- assert(p.second);
- return c.extract(p.first);
+node_factory(typename Container::key_type const& key, typename Container::mapped_type const& mapped) {
+ static Container c;
+ auto p = c.insert({key, mapped});
+ assert(p.second);
+ return c.extract(p.first);
}
template <class Container>
-void test(Container& c)
-{
- auto* nf = &node_factory<Container>;
-
- for (int i = 0; i != 10; ++i)
- {
- typename Container::node_type node = nf(i, i + 1);
- assert(!node.empty());
- std::size_t prev = c.size();
- auto it = c.insert(c.end(), std::move(node));
- assert(node.empty());
- assert(prev + 1 == c.size());
- assert(it->first == i);
- assert(it->second == i + 1);
- }
-
- assert(c.size() == 10);
-
- for (int i = 0; i != 10; ++i)
- {
- assert(c.count(i) == 1);
- assert(c[i] == i + 1);
- }
+void test(Container& c) {
+ auto* nf = &node_factory<Container>;
+
+ for (int i = 0; i != 10; ++i) {
+ typename Container::node_type node = nf(i, i + 1);
+ assert(!node.empty());
+ std::size_t prev = c.size();
+ auto it = c.insert(c.end(), std::move(node));
+ assert(node.empty());
+ assert(prev + 1 == c.size());
+ assert(it->first == i);
+ assert(it->second == i + 1);
+ }
+
+ assert(c.size() == 10);
+
+ for (int i = 0; i != 10; ++i) {
+ assert(c.count(i) == 1);
+ assert(c[i] == i + 1);
+ }
}
-int main(int, char**)
-{
- std::unordered_map<int, int> m;
- test(m);
- std::unordered_map<int, int, std::hash<int>, std::equal_to<int>, min_allocator<std::pair<const int, int>>> m2;
- test(m2);
+int main(int, char**) {
+ std::unordered_map<int, int> m;
+ test(m);
+ std::unordered_map<int, int, std::hash<int>, std::equal_to<int>, min_allocator<std::pair<const int, int>>> m2;
+ test(m2);
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_or_assign.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_or_assign.pass.cpp
index 6ba28c00675bcdb..b8bfd6cbc0f3cf1 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_or_assign.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_or_assign.pass.cpp
@@ -28,34 +28,34 @@
#include "test_macros.h"
+class Moveable {
+ Moveable(const Moveable&);
+ Moveable& operator=(const Moveable&);
-class Moveable
-{
- Moveable(const Moveable&);
- Moveable& operator=(const Moveable&);
+ int int_;
+ double double_;
- int int_;
- double double_;
public:
- Moveable() : int_(0), double_(0) {}
- Moveable(int i, double d) : int_(i), double_(d) {}
- Moveable(Moveable&& x)
- : int_(x.int_), double_(x.double_)
- {x.int_ = -1; x.double_ = -1;}
- Moveable& operator=(Moveable&& x)
- {int_ = x.int_; x.int_ = -1;
- double_ = x.double_; x.double_ = -1;
- return *this;
- }
-
- bool operator==(const Moveable& x) const
- {return int_ == x.int_ && double_ == x.double_;}
- bool operator<(const Moveable& x) const
- {return int_ < x.int_ || (int_ == x.int_ && double_ < x.double_);}
- std::size_t hash () const { return std::hash<int>()(int_) + std::hash<double>()(double_); }
-
- int get() const {return int_;}
- bool moved() const {return int_ == -1;}
+ Moveable() : int_(0), double_(0) {}
+ Moveable(int i, double d) : int_(i), double_(d) {}
+ Moveable(Moveable&& x) : int_(x.int_), double_(x.double_) {
+ x.int_ = -1;
+ x.double_ = -1;
+ }
+ Moveable& operator=(Moveable&& x) {
+ int_ = x.int_;
+ x.int_ = -1;
+ double_ = x.double_;
+ x.double_ = -1;
+ return *this;
+ }
+
+ bool operator==(const Moveable& x) const { return int_ == x.int_ && double_ == x.double_; }
+ bool operator<(const Moveable& x) const { return int_ < x.int_ || (int_ == x.int_ && double_ < x.double_); }
+ std::size_t hash() const { return std::hash<int>()(int_) + std::hash<double>()(double_); }
+
+ int get() const { return int_; }
+ bool moved() const { return int_ == -1; }
};
template <>
@@ -63,133 +63,129 @@ struct std::hash<Moveable> {
std::size_t operator()(const Moveable& m) const { return m.hash(); }
};
-int main(int, char**)
-{
-
- { // pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj);
- typedef std::unordered_map<int, Moveable> M;
- typedef std::pair<M::iterator, bool> R;
- M m;
- R r;
- for (int i = 0; i < 20; i += 2)
- m.emplace ( i, Moveable(i, (double) i));
- assert(m.size() == 10);
-
- for (int i=0; i < 20; i += 2)
- {
- Moveable mv(i+1, i+1);
- r = m.insert_or_assign(i, std::move(mv));
- assert(m.size() == 10);
- assert(!r.second); // was not inserted
- assert(mv.moved()); // was moved from
- assert(r.first->first == i); // key
- assert(r.first->second.get() == i+1); // value
- }
-
- Moveable mv1(5, 5.0);
- r = m.insert_or_assign(-1, std::move(mv1));
- assert(m.size() == 11);
- assert(r.second); // was inserted
- assert(mv1.moved()); // was moved from
- assert(r.first->first == -1); // key
- assert(r.first->second.get() == 5); // value
-
- Moveable mv2(9, 9.0);
- r = m.insert_or_assign(3, std::move(mv2));
- assert(m.size() == 12);
- assert(r.second); // was inserted
- assert(mv2.moved()); // was moved from
- assert(r.first->first == 3); // key
- assert(r.first->second.get() == 9); // value
-
- Moveable mv3(-1, 5.0);
- r = m.insert_or_assign(117, std::move(mv3));
- assert(m.size() == 13);
- assert(r.second); // was inserted
- assert(mv3.moved()); // was moved from
- assert(r.first->first == 117); // key
- assert(r.first->second.get() == -1); // value
- }
- { // pair<iterator, bool> insert_or_assign(key_type&& k, M&& obj);
- typedef std::unordered_map<Moveable, Moveable> M;
- typedef std::pair<M::iterator, bool> R;
- M m;
- R r;
- for (int i = 0; i < 20; i += 2)
- m.emplace ( Moveable(i, (double) i), Moveable(i+1, (double) i+1));
- assert(m.size() == 10);
-
- Moveable mvkey1(2, 2.0);
- Moveable mv1(4, 4.0);
- r = m.insert_or_assign(std::move(mvkey1), std::move(mv1));
- assert(m.size() == 10);
- assert(!r.second); // was not inserted
- assert(!mvkey1.moved()); // was not moved from
- assert(mv1.moved()); // was moved from
- assert(r.first->first == mvkey1); // key
- assert(r.first->second.get() == 4); // value
-
- Moveable mvkey2(3, 3.0);
- Moveable mv2(5, 5.0);
- r = m.try_emplace(std::move(mvkey2), std::move(mv2));
- assert(m.size() == 11);
- assert(r.second); // was inserted
- assert(mv2.moved()); // was moved from
- assert(mvkey2.moved()); // was moved from
- assert(r.first->first.get() == 3); // key
- assert(r.first->second.get() == 5); // value
- }
- { // iterator insert_or_assign(const_iterator hint, const key_type& k, M&& obj);
- typedef std::unordered_map<int, Moveable> M;
- M m;
- M::iterator r;
- for (int i = 0; i < 20; i += 2)
- m.emplace ( i, Moveable(i, (double) i));
- assert(m.size() == 10);
- M::const_iterator it = m.find(2);
-
- Moveable mv1(3, 3.0);
- r = m.insert_or_assign(it, 2, std::move(mv1));
- assert(m.size() == 10);
- assert(mv1.moved()); // was moved from
- assert(r->first == 2); // key
- assert(r->second.get() == 3); // value
-
- Moveable mv2(5, 5.0);
- r = m.insert_or_assign(it, 3, std::move(mv2));
- assert(m.size() == 11);
- assert(mv2.moved()); // was moved from
- assert(r->first == 3); // key
- assert(r->second.get() == 5); // value
- }
- { // iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj);
- typedef std::unordered_map<Moveable, Moveable> M;
- M m;
- M::iterator r;
- for (int i = 0; i < 20; i += 2)
- m.emplace ( Moveable(i, (double) i), Moveable(i+1, (double) i+1));
- assert(m.size() == 10);
- M::const_iterator it = std::next(m.cbegin());
-
- Moveable mvkey1(2, 2.0);
- Moveable mv1(4, 4.0);
- r = m.insert_or_assign(it, std::move(mvkey1), std::move(mv1));
- assert(m.size() == 10);
- assert(mv1.moved()); // was moved from
- assert(!mvkey1.moved()); // was not moved from
- assert(r->first == mvkey1); // key
- assert(r->second.get() == 4); // value
-
- Moveable mvkey2(3, 3.0);
- Moveable mv2(5, 5.0);
- r = m.insert_or_assign(it, std::move(mvkey2), std::move(mv2));
- assert(m.size() == 11);
- assert(mv2.moved()); // was moved from
- assert(mvkey2.moved()); // was moved from
- assert(r->first.get() == 3); // key
- assert(r->second.get() == 5); // value
+int main(int, char**) {
+ { // pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj);
+ typedef std::unordered_map<int, Moveable> M;
+ typedef std::pair<M::iterator, bool> R;
+ M m;
+ R r;
+ for (int i = 0; i < 20; i += 2)
+ m.emplace(i, Moveable(i, (double)i));
+ assert(m.size() == 10);
+
+ for (int i = 0; i < 20; i += 2) {
+ Moveable mv(i + 1, i + 1);
+ r = m.insert_or_assign(i, std::move(mv));
+ assert(m.size() == 10);
+ assert(!r.second); // was not inserted
+ assert(mv.moved()); // was moved from
+ assert(r.first->first == i); // key
+ assert(r.first->second.get() == i + 1); // value
}
+ Moveable mv1(5, 5.0);
+ r = m.insert_or_assign(-1, std::move(mv1));
+ assert(m.size() == 11);
+ assert(r.second); // was inserted
+ assert(mv1.moved()); // was moved from
+ assert(r.first->first == -1); // key
+ assert(r.first->second.get() == 5); // value
+
+ Moveable mv2(9, 9.0);
+ r = m.insert_or_assign(3, std::move(mv2));
+ assert(m.size() == 12);
+ assert(r.second); // was inserted
+ assert(mv2.moved()); // was moved from
+ assert(r.first->first == 3); // key
+ assert(r.first->second.get() == 9); // value
+
+ Moveable mv3(-1, 5.0);
+ r = m.insert_or_assign(117, std::move(mv3));
+ assert(m.size() == 13);
+ assert(r.second); // was inserted
+ assert(mv3.moved()); // was moved from
+ assert(r.first->first == 117); // key
+ assert(r.first->second.get() == -1); // value
+ }
+ { // pair<iterator, bool> insert_or_assign(key_type&& k, M&& obj);
+ typedef std::unordered_map<Moveable, Moveable> M;
+ typedef std::pair<M::iterator, bool> R;
+ M m;
+ R r;
+ for (int i = 0; i < 20; i += 2)
+ m.emplace(Moveable(i, (double)i), Moveable(i + 1, (double)i + 1));
+ assert(m.size() == 10);
+
+ Moveable mvkey1(2, 2.0);
+ Moveable mv1(4, 4.0);
+ r = m.insert_or_assign(std::move(mvkey1), std::move(mv1));
+ assert(m.size() == 10);
+ assert(!r.second); // was not inserted
+ assert(!mvkey1.moved()); // was not moved from
+ assert(mv1.moved()); // was moved from
+ assert(r.first->first == mvkey1); // key
+ assert(r.first->second.get() == 4); // value
+
+ Moveable mvkey2(3, 3.0);
+ Moveable mv2(5, 5.0);
+ r = m.try_emplace(std::move(mvkey2), std::move(mv2));
+ assert(m.size() == 11);
+ assert(r.second); // was inserted
+ assert(mv2.moved()); // was moved from
+ assert(mvkey2.moved()); // was moved from
+ assert(r.first->first.get() == 3); // key
+ assert(r.first->second.get() == 5); // value
+ }
+ { // iterator insert_or_assign(const_iterator hint, const key_type& k, M&& obj);
+ typedef std::unordered_map<int, Moveable> M;
+ M m;
+ M::iterator r;
+ for (int i = 0; i < 20; i += 2)
+ m.emplace(i, Moveable(i, (double)i));
+ assert(m.size() == 10);
+ M::const_iterator it = m.find(2);
+
+ Moveable mv1(3, 3.0);
+ r = m.insert_or_assign(it, 2, std::move(mv1));
+ assert(m.size() == 10);
+ assert(mv1.moved()); // was moved from
+ assert(r->first == 2); // key
+ assert(r->second.get() == 3); // value
+
+ Moveable mv2(5, 5.0);
+ r = m.insert_or_assign(it, 3, std::move(mv2));
+ assert(m.size() == 11);
+ assert(mv2.moved()); // was moved from
+ assert(r->first == 3); // key
+ assert(r->second.get() == 5); // value
+ }
+ { // iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj);
+ typedef std::unordered_map<Moveable, Moveable> M;
+ M m;
+ M::iterator r;
+ for (int i = 0; i < 20; i += 2)
+ m.emplace(Moveable(i, (double)i), Moveable(i + 1, (double)i + 1));
+ assert(m.size() == 10);
+ M::const_iterator it = std::next(m.cbegin());
+
+ Moveable mvkey1(2, 2.0);
+ Moveable mv1(4, 4.0);
+ r = m.insert_or_assign(it, std::move(mvkey1), std::move(mv1));
+ assert(m.size() == 10);
+ assert(mv1.moved()); // was moved from
+ assert(!mvkey1.moved()); // was not moved from
+ assert(r->first == mvkey1); // key
+ assert(r->second.get() == 4); // value
+
+ Moveable mvkey2(3, 3.0);
+ Moveable mv2(5, 5.0);
+ r = m.insert_or_assign(it, std::move(mvkey2), std::move(mv2));
+ assert(m.size() == 11);
+ assert(mv2.moved()); // was moved from
+ assert(mvkey2.moved()); // was moved from
+ assert(r->first.get() == 3); // key
+ assert(r->second.get() == 5); // value
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_range.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_range.pass.cpp
index d1c90c4ed48539b..98c8e78a543947a 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_range.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_range.pass.cpp
@@ -23,10 +23,13 @@
int main(int, char**) {
// Note: we want to use a pair with non-const elements for input (an assignable type is a lot more convenient) but
// have to use the exact `value_type` of the map (that is, `pair<const K, V>`) for the allocator.
- using Pair = std::pair<int, char>;
+ using Pair = std::pair<int, char>;
using ConstPair = std::pair<const int, char>;
for_all_iterators_and_allocators<ConstPair, const Pair*>([]<class Iter, class Sent, class Alloc>() {
- test_map_set_insert_range<std::unordered_map<int, char, test_hash<int>, test_equal_to<int>, Alloc>, Pair, Iter, Sent>();
+ test_map_set_insert_range<std::unordered_map<int, char, test_hash<int>, test_equal_to<int>, Alloc>,
+ Pair,
+ Iter,
+ Sent>();
});
static_assert(test_map_constraints_insert_range<std::unordered_map, int, int, char, double>());
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_rvalue.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_rvalue.pass.cpp
index 94f0d9b9140274b..b9659b00937a51d 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_rvalue.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_rvalue.pass.cpp
@@ -25,154 +25,161 @@
#include "MoveOnly.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_map<double, int> C;
- typedef std::pair<C::iterator, bool> R;
- typedef std::pair<double, short> P;
- C c;
- R r = c.insert(P(3.5, static_cast<short>(3)));
- assert(r.second);
- assert(c.size() == 1);
- assert(r.first->first == 3.5);
- assert(r.first->second == 3);
-
- r = c.insert(P(3.5, static_cast<short>(4)));
- assert(!r.second);
- assert(c.size() == 1);
- assert(r.first->first == 3.5);
- assert(r.first->second == 3);
-
- r = c.insert(P(4.5, static_cast<short>(4)));
- assert(r.second);
- assert(c.size() == 2);
- assert(r.first->first == 4.5);
- assert(r.first->second == 4);
-
- r = c.insert(P(5.5, static_cast<short>(4)));
- assert(r.second);
- assert(c.size() == 3);
- assert(r.first->first == 5.5);
- assert(r.first->second == 4);
- }
- {
- typedef std::unordered_map<MoveOnly, MoveOnly> C;
- typedef std::pair<C::iterator, bool> R;
- typedef std::pair<MoveOnly, MoveOnly> P;
- C c;
- R r = c.insert(P(3, 3));
- assert(r.second);
- assert(c.size() == 1);
- assert(r.first->first == 3);
- assert(r.first->second == 3);
-
- r = c.insert(P(3, 4));
- assert(!r.second);
- assert(c.size() == 1);
- assert(r.first->first == 3);
- assert(r.first->second == 3);
-
- r = c.insert(P(4, 4));
- assert(r.second);
- assert(c.size() == 2);
- assert(r.first->first == 4);
- assert(r.first->second == 4);
-
- r = c.insert(P(5, 4));
- assert(r.second);
- assert(c.size() == 3);
- assert(r.first->first == 5);
- assert(r.first->second == 4);
- }
- {
- typedef std::unordered_map<double, int, std::hash<double>, std::equal_to<double>,
- min_allocator<std::pair<const double, int>>> C;
- typedef std::pair<C::iterator, bool> R;
- typedef std::pair<double, short> P;
- C c;
- R r = c.insert(P(3.5, static_cast<short>(3)));
- assert(r.second);
- assert(c.size() == 1);
- assert(r.first->first == 3.5);
- assert(r.first->second == 3);
-
- r = c.insert(P(3.5, static_cast<short>(4)));
- assert(!r.second);
- assert(c.size() == 1);
- assert(r.first->first == 3.5);
- assert(r.first->second == 3);
-
- r = c.insert(P(4.5, static_cast<short>(4)));
- assert(r.second);
- assert(c.size() == 2);
- assert(r.first->first == 4.5);
- assert(r.first->second == 4);
-
- r = c.insert(P(5.5, static_cast<short>(4)));
- assert(r.second);
- assert(c.size() == 3);
- assert(r.first->first == 5.5);
- assert(r.first->second == 4);
- }
- {
- typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>, std::equal_to<MoveOnly>,
- min_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
- typedef std::pair<C::iterator, bool> R;
- typedef std::pair<MoveOnly, MoveOnly> P;
- C c;
- R r = c.insert(P(3, 3));
- assert(r.second);
- assert(c.size() == 1);
- assert(r.first->first == 3);
- assert(r.first->second == 3);
-
- r = c.insert(P(3, 4));
- assert(!r.second);
- assert(c.size() == 1);
- assert(r.first->first == 3);
- assert(r.first->second == 3);
-
- r = c.insert(P(4, 4));
- assert(r.second);
- assert(c.size() == 2);
- assert(r.first->first == 4);
- assert(r.first->second == 4);
-
- r = c.insert(P(5, 4));
- assert(r.second);
- assert(c.size() == 3);
- assert(r.first->first == 5);
- assert(r.first->second == 4);
- }
- {
- typedef std::unordered_map<double, MoveOnly> C;
- typedef std::pair<C::iterator, bool> R;
- C c;
- R r = c.insert({3.5, 3});
- assert(r.second);
- assert(c.size() == 1);
- assert(r.first->first == 3.5);
- assert(r.first->second == 3);
-
- r = c.insert({3.5, 4});
- assert(!r.second);
- assert(c.size() == 1);
- assert(r.first->first == 3.5);
- assert(r.first->second == 3);
-
- r = c.insert({4.5, 4});
- assert(r.second);
- assert(c.size() == 2);
- assert(r.first->first == 4.5);
- assert(r.first->second == 4);
-
- r = c.insert({5.5, 4});
- assert(r.second);
- assert(c.size() == 3);
- assert(r.first->first == 5.5);
- assert(r.first->second == 4);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_map<double, int> C;
+ typedef std::pair<C::iterator, bool> R;
+ typedef std::pair<double, short> P;
+ C c;
+ R r = c.insert(P(3.5, static_cast<short>(3)));
+ assert(r.second);
+ assert(c.size() == 1);
+ assert(r.first->first == 3.5);
+ assert(r.first->second == 3);
+
+ r = c.insert(P(3.5, static_cast<short>(4)));
+ assert(!r.second);
+ assert(c.size() == 1);
+ assert(r.first->first == 3.5);
+ assert(r.first->second == 3);
+
+ r = c.insert(P(4.5, static_cast<short>(4)));
+ assert(r.second);
+ assert(c.size() == 2);
+ assert(r.first->first == 4.5);
+ assert(r.first->second == 4);
+
+ r = c.insert(P(5.5, static_cast<short>(4)));
+ assert(r.second);
+ assert(c.size() == 3);
+ assert(r.first->first == 5.5);
+ assert(r.first->second == 4);
+ }
+ {
+ typedef std::unordered_map<MoveOnly, MoveOnly> C;
+ typedef std::pair<C::iterator, bool> R;
+ typedef std::pair<MoveOnly, MoveOnly> P;
+ C c;
+ R r = c.insert(P(3, 3));
+ assert(r.second);
+ assert(c.size() == 1);
+ assert(r.first->first == 3);
+ assert(r.first->second == 3);
+
+ r = c.insert(P(3, 4));
+ assert(!r.second);
+ assert(c.size() == 1);
+ assert(r.first->first == 3);
+ assert(r.first->second == 3);
+
+ r = c.insert(P(4, 4));
+ assert(r.second);
+ assert(c.size() == 2);
+ assert(r.first->first == 4);
+ assert(r.first->second == 4);
+
+ r = c.insert(P(5, 4));
+ assert(r.second);
+ assert(c.size() == 3);
+ assert(r.first->first == 5);
+ assert(r.first->second == 4);
+ }
+ {
+ typedef std::unordered_map<double,
+ int,
+ std::hash<double>,
+ std::equal_to<double>,
+ min_allocator<std::pair<const double, int>>>
+ C;
+ typedef std::pair<C::iterator, bool> R;
+ typedef std::pair<double, short> P;
+ C c;
+ R r = c.insert(P(3.5, static_cast<short>(3)));
+ assert(r.second);
+ assert(c.size() == 1);
+ assert(r.first->first == 3.5);
+ assert(r.first->second == 3);
+
+ r = c.insert(P(3.5, static_cast<short>(4)));
+ assert(!r.second);
+ assert(c.size() == 1);
+ assert(r.first->first == 3.5);
+ assert(r.first->second == 3);
+
+ r = c.insert(P(4.5, static_cast<short>(4)));
+ assert(r.second);
+ assert(c.size() == 2);
+ assert(r.first->first == 4.5);
+ assert(r.first->second == 4);
+
+ r = c.insert(P(5.5, static_cast<short>(4)));
+ assert(r.second);
+ assert(c.size() == 3);
+ assert(r.first->first == 5.5);
+ assert(r.first->second == 4);
+ }
+ {
+ typedef std::unordered_map<MoveOnly,
+ MoveOnly,
+ std::hash<MoveOnly>,
+ std::equal_to<MoveOnly>,
+ min_allocator<std::pair<const MoveOnly, MoveOnly>>>
+ C;
+ typedef std::pair<C::iterator, bool> R;
+ typedef std::pair<MoveOnly, MoveOnly> P;
+ C c;
+ R r = c.insert(P(3, 3));
+ assert(r.second);
+ assert(c.size() == 1);
+ assert(r.first->first == 3);
+ assert(r.first->second == 3);
+
+ r = c.insert(P(3, 4));
+ assert(!r.second);
+ assert(c.size() == 1);
+ assert(r.first->first == 3);
+ assert(r.first->second == 3);
+
+ r = c.insert(P(4, 4));
+ assert(r.second);
+ assert(c.size() == 2);
+ assert(r.first->first == 4);
+ assert(r.first->second == 4);
+
+ r = c.insert(P(5, 4));
+ assert(r.second);
+ assert(c.size() == 3);
+ assert(r.first->first == 5);
+ assert(r.first->second == 4);
+ }
+ {
+ typedef std::unordered_map<double, MoveOnly> C;
+ typedef std::pair<C::iterator, bool> R;
+ C c;
+ R r = c.insert({3.5, 3});
+ assert(r.second);
+ assert(c.size() == 1);
+ assert(r.first->first == 3.5);
+ assert(r.first->second == 3);
+
+ r = c.insert({3.5, 4});
+ assert(!r.second);
+ assert(c.size() == 1);
+ assert(r.first->first == 3.5);
+ assert(r.first->second == 3);
+
+ r = c.insert({4.5, 4});
+ assert(r.second);
+ assert(c.size() == 2);
+ assert(r.first->first == 4.5);
+ assert(r.first->second == 4);
+
+ r = c.insert({5.5, 4});
+ assert(r.second);
+ assert(c.size() == 3);
+ assert(r.first->first == 5.5);
+ assert(r.first->second == 4);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/merge.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/merge.pass.cpp
index e5c29b13dcf1227..12095bffe40a773 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/merge.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/merge.pass.cpp
@@ -27,131 +27,116 @@
#include "Counter.h"
template <class Map>
-bool map_equal(const Map& map, Map other)
-{
- return map == other;
+bool map_equal(const Map& map, Map other) {
+ return map == other;
}
#ifndef TEST_HAS_NO_EXCEPTIONS
template <class T>
-struct throw_hasher
-{
- bool& should_throw_;
+struct throw_hasher {
+ bool& should_throw_;
- throw_hasher(bool& should_throw) : should_throw_(should_throw) {}
+ throw_hasher(bool& should_throw) : should_throw_(should_throw) {}
- std::size_t operator()(const T& p) const
- {
- if (should_throw_)
- throw 0;
- return std::hash<T>()(p);
- }
+ std::size_t operator()(const T& p) const {
+ if (should_throw_)
+ throw 0;
+ return std::hash<T>()(p);
+ }
};
#endif
-int main(int, char**)
-{
- {
- std::unordered_map<int, int> src{{1, 0}, {3, 0}, {5, 0}};
- std::unordered_map<int, int> dst{{2, 0}, {4, 0}, {5, 0}};
- dst.merge(src);
- assert(map_equal(src, {{5,0}}));
- assert(map_equal(dst, {{1, 0}, {2, 0}, {3, 0}, {4, 0}, {5, 0}}));
- }
+int main(int, char**) {
+ {
+ std::unordered_map<int, int> src{{1, 0}, {3, 0}, {5, 0}};
+ std::unordered_map<int, int> dst{{2, 0}, {4, 0}, {5, 0}};
+ dst.merge(src);
+ assert(map_equal(src, {{5, 0}}));
+ assert(map_equal(dst, {{1, 0}, {2, 0}, {3, 0}, {4, 0}, {5, 0}}));
+ }
#ifndef TEST_HAS_NO_EXCEPTIONS
- {
- bool do_throw = false;
- typedef std::unordered_map<Counter<int>, int, throw_hasher<Counter<int>>> map_type;
- map_type src({{1, 0}, {3, 0}, {5, 0}}, 0, throw_hasher<Counter<int>>(do_throw));
- map_type dst({{2, 0}, {4, 0}, {5, 0}}, 0, throw_hasher<Counter<int>>(do_throw));
-
- assert(Counter_base::gConstructed == 6);
-
- do_throw = true;
- try
- {
- dst.merge(src);
- }
- catch (int)
- {
- do_throw = false;
- }
- assert(!do_throw);
- assert(map_equal(src, map_type({{1, 0}, {3, 0}, {5, 0}}, 0, throw_hasher<Counter<int>>(do_throw))));
- assert(map_equal(dst, map_type({{2, 0}, {4, 0}, {5, 0}}, 0, throw_hasher<Counter<int>>(do_throw))));
+ {
+ bool do_throw = false;
+ typedef std::unordered_map<Counter<int>, int, throw_hasher<Counter<int>>> map_type;
+ map_type src({{1, 0}, {3, 0}, {5, 0}}, 0, throw_hasher<Counter<int>>(do_throw));
+ map_type dst({{2, 0}, {4, 0}, {5, 0}}, 0, throw_hasher<Counter<int>>(do_throw));
+
+ assert(Counter_base::gConstructed == 6);
+
+ do_throw = true;
+ try {
+ dst.merge(src);
+ } catch (int) {
+ do_throw = false;
}
+ assert(!do_throw);
+ assert(map_equal(src, map_type({{1, 0}, {3, 0}, {5, 0}}, 0, throw_hasher<Counter<int>>(do_throw))));
+ assert(map_equal(dst, map_type({{2, 0}, {4, 0}, {5, 0}}, 0, throw_hasher<Counter<int>>(do_throw))));
+ }
#endif
- assert(Counter_base::gConstructed == 0);
- struct equal
- {
- equal() = default;
-
- bool operator()(const Counter<int>& lhs, const Counter<int>& rhs) const
- {
- return lhs == rhs;
- }
- };
- struct hasher
- {
- hasher() = default;
- std::size_t operator()(const Counter<int>& p) const
- {
- return std::hash<Counter<int>>()(p);
- }
- };
- {
- typedef std::unordered_map<Counter<int>, int, std::hash<Counter<int>>, std::equal_to<Counter<int>>> first_map_type;
- typedef std::unordered_map<Counter<int>, int, hasher, equal> second_map_type;
- typedef std::unordered_multimap<Counter<int>, int, hasher, equal> third_map_type;
+ assert(Counter_base::gConstructed == 0);
+ struct equal {
+ equal() = default;
+
+ bool operator()(const Counter<int>& lhs, const Counter<int>& rhs) const { return lhs == rhs; }
+ };
+ struct hasher {
+ hasher() = default;
+ std::size_t operator()(const Counter<int>& p) const { return std::hash<Counter<int>>()(p); }
+ };
+ {
+ typedef std::unordered_map<Counter<int>, int, std::hash<Counter<int>>, std::equal_to<Counter<int>>> first_map_type;
+ typedef std::unordered_map<Counter<int>, int, hasher, equal> second_map_type;
+ typedef std::unordered_multimap<Counter<int>, int, hasher, equal> third_map_type;
- {
- first_map_type first{{1, 0}, {2, 0}, {3, 0}};
- second_map_type second{{2, 0}, {3, 0}, {4, 0}};
- third_map_type third{{1, 0}, {3, 0}};
+ {
+ first_map_type first{{1, 0}, {2, 0}, {3, 0}};
+ second_map_type second{{2, 0}, {3, 0}, {4, 0}};
+ third_map_type third{{1, 0}, {3, 0}};
- assert(Counter_base::gConstructed == 8);
+ assert(Counter_base::gConstructed == 8);
- first.merge(second);
- first.merge(third);
+ first.merge(second);
+ first.merge(third);
- assert(map_equal(first, {{1, 0}, {2, 0}, {3, 0}, {4, 0}}));
- assert(map_equal(second, {{2, 0}, {3, 0}}));
- assert(map_equal(third, {{1, 0}, {3, 0}}));
+ assert(map_equal(first, {{1, 0}, {2, 0}, {3, 0}, {4, 0}}));
+ assert(map_equal(second, {{2, 0}, {3, 0}}));
+ assert(map_equal(third, {{1, 0}, {3, 0}}));
- assert(Counter_base::gConstructed == 8);
- }
- assert(Counter_base::gConstructed == 0);
- {
- first_map_type first{{1, 0}, {2, 0}, {3, 0}};
- second_map_type second{{2, 0}, {3, 0}, {4, 0}};
- third_map_type third{{1, 0}, {3, 0}};
+ assert(Counter_base::gConstructed == 8);
+ }
+ assert(Counter_base::gConstructed == 0);
+ {
+ first_map_type first{{1, 0}, {2, 0}, {3, 0}};
+ second_map_type second{{2, 0}, {3, 0}, {4, 0}};
+ third_map_type third{{1, 0}, {3, 0}};
- assert(Counter_base::gConstructed == 8);
+ assert(Counter_base::gConstructed == 8);
- first.merge(std::move(second));
- first.merge(std::move(third));
+ first.merge(std::move(second));
+ first.merge(std::move(third));
- assert(map_equal(first, {{1, 0}, {2, 0}, {3, 0}, {4, 0}}));
- assert(map_equal(second, {{2, 0}, {3, 0}}));
- assert(map_equal(third, {{1, 0}, {3, 0}}));
+ assert(map_equal(first, {{1, 0}, {2, 0}, {3, 0}, {4, 0}}));
+ assert(map_equal(second, {{2, 0}, {3, 0}}));
+ assert(map_equal(third, {{1, 0}, {3, 0}}));
- assert(Counter_base::gConstructed == 8);
- }
- assert(Counter_base::gConstructed == 0);
+ assert(Counter_base::gConstructed == 8);
+ }
+ assert(Counter_base::gConstructed == 0);
+ }
+ {
+ std::unordered_map<int, int> first;
+ {
+ std::unordered_map<int, int> second;
+ first.merge(second);
+ first.merge(std::move(second));
}
{
- std::unordered_map<int, int> first;
- {
- std::unordered_map<int, int> second;
- first.merge(second);
- first.merge(std::move(second));
- }
- {
- std::unordered_multimap<int, int> second;
- first.merge(second);
- first.merge(std::move(second));
- }
+ std::unordered_multimap<int, int> second;
+ first.merge(second);
+ first.merge(std::move(second));
}
- return 0;
+ }
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/try.emplace.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/try.emplace.pass.cpp
index 15cf8bc59eba913..a7d76d310e5be44 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/try.emplace.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/try.emplace.pass.cpp
@@ -28,33 +28,34 @@
#include "test_macros.h"
-class Moveable
-{
- Moveable(const Moveable&);
- Moveable& operator=(const Moveable&);
+class Moveable {
+ Moveable(const Moveable&);
+ Moveable& operator=(const Moveable&);
+
+ int int_;
+ double double_;
- int int_;
- double double_;
public:
- Moveable() : int_(0), double_(0) {}
- Moveable(int i, double d) : int_(i), double_(d) {}
- Moveable(Moveable&& x)
- : int_(x.int_), double_(x.double_)
- {x.int_ = -1; x.double_ = -1;}
- Moveable& operator=(Moveable&& x)
- {int_ = x.int_; x.int_ = -1;
- double_ = x.double_; x.double_ = -1;
- return *this;
- }
-
- bool operator==(const Moveable& x) const
- {return int_ == x.int_ && double_ == x.double_;}
- bool operator<(const Moveable& x) const
- {return int_ < x.int_ || (int_ == x.int_ && double_ < x.double_);}
- std::size_t hash () const { return std::hash<int>()(int_) + std::hash<double>()(double_); }
-
- int get() const {return int_;}
- bool moved() const {return int_ == -1;}
+ Moveable() : int_(0), double_(0) {}
+ Moveable(int i, double d) : int_(i), double_(d) {}
+ Moveable(Moveable&& x) : int_(x.int_), double_(x.double_) {
+ x.int_ = -1;
+ x.double_ = -1;
+ }
+ Moveable& operator=(Moveable&& x) {
+ int_ = x.int_;
+ x.int_ = -1;
+ double_ = x.double_;
+ x.double_ = -1;
+ return *this;
+ }
+
+ bool operator==(const Moveable& x) const { return int_ == x.int_ && double_ == x.double_; }
+ bool operator<(const Moveable& x) const { return int_ < x.int_ || (int_ == x.int_ && double_ < x.double_); }
+ std::size_t hash() const { return std::hash<int>()(int_) + std::hash<double>()(double_); }
+
+ int get() const { return int_; }
+ bool moved() const { return int_ == -1; }
};
template <>
@@ -62,131 +63,127 @@ struct std::hash<Moveable> {
std::size_t operator()(const Moveable& m) const { return m.hash(); }
};
-int main(int, char**)
-{
-
- { // pair<iterator, bool> try_emplace(const key_type& k, Args&&... args);
- typedef std::unordered_map<int, Moveable> M;
- typedef std::pair<M::iterator, bool> R;
- M m;
- R r;
- for (int i = 0; i < 20; i += 2)
- m.emplace (i, Moveable(i, (double) i));
- assert(m.size() == 10);
-
- Moveable mv1(3, 3.0);
- for (int i=0; i < 20; i += 2)
- {
- r = m.try_emplace(i, std::move(mv1));
- assert(m.size() == 10);
- assert(!r.second); // was not inserted
- assert(!mv1.moved()); // was not moved from
- assert(r.first->first == i); // key
- }
-
- r = m.try_emplace(-1, std::move(mv1));
- assert(m.size() == 11);
- assert(r.second); // was inserted
- assert(mv1.moved()); // was moved from
- assert(r.first->first == -1); // key
- assert(r.first->second.get() == 3); // value
-
- Moveable mv2(5, 3.0);
- r = m.try_emplace(5, std::move(mv2));
- assert(m.size() == 12);
- assert(r.second); // was inserted
- assert(mv2.moved()); // was moved from
- assert(r.first->first == 5); // key
- assert(r.first->second.get() == 5); // value
-
- Moveable mv3(-1, 3.0);
- r = m.try_emplace(117, std::move(mv2));
- assert(m.size() == 13);
- assert(r.second); // was inserted
- assert(mv2.moved()); // was moved from
- assert(r.first->first == 117); // key
- assert(r.first->second.get() == -1); // value
- }
-
- { // pair<iterator, bool> try_emplace(key_type&& k, Args&&... args);
- typedef std::unordered_map<Moveable, Moveable> M;
- typedef std::pair<M::iterator, bool> R;
- M m;
- R r;
- for (int i = 0; i < 20; i += 2)
- m.emplace ( Moveable(i, (double) i), Moveable(i+1, (double) i+1));
- assert(m.size() == 10);
-
- Moveable mvkey1(2, 2.0);
- Moveable mv1(4, 4.0);
- r = m.try_emplace(std::move(mvkey1), std::move(mv1));
- assert(m.size() == 10);
- assert(!r.second); // was not inserted
- assert(!mv1.moved()); // was not moved from
- assert(!mvkey1.moved()); // was not moved from
- assert(r.first->first == mvkey1); // key
-
- Moveable mvkey2(3, 3.0);
- r = m.try_emplace(std::move(mvkey2), std::move(mv1));
- assert(m.size() == 11);
- assert(r.second); // was inserted
- assert(mv1.moved()); // was moved from
- assert(mvkey2.moved()); // was moved from
- assert(r.first->first.get() == 3); // key
- assert(r.first->second.get() == 4); // value
+int main(int, char**) {
+ { // pair<iterator, bool> try_emplace(const key_type& k, Args&&... args);
+ typedef std::unordered_map<int, Moveable> M;
+ typedef std::pair<M::iterator, bool> R;
+ M m;
+ R r;
+ for (int i = 0; i < 20; i += 2)
+ m.emplace(i, Moveable(i, (double)i));
+ assert(m.size() == 10);
+
+ Moveable mv1(3, 3.0);
+ for (int i = 0; i < 20; i += 2) {
+ r = m.try_emplace(i, std::move(mv1));
+ assert(m.size() == 10);
+ assert(!r.second); // was not inserted
+ assert(!mv1.moved()); // was not moved from
+ assert(r.first->first == i); // key
}
- { // iterator try_emplace(const_iterator hint, const key_type& k, Args&&... args);
- typedef std::unordered_map<int, Moveable> M;
- M m;
- M::iterator r;
- for (int i = 0; i < 20; i += 2)
- m.try_emplace ( i, Moveable(i, (double) i));
- assert(m.size() == 10);
- M::const_iterator it = m.find(2);
-
- Moveable mv1(3, 3.0);
- for (int i=0; i < 20; i += 2)
- {
- r = m.try_emplace(it, i, std::move(mv1));
- assert(m.size() == 10);
- assert(!mv1.moved()); // was not moved from
- assert(r->first == i); // key
- assert(r->second.get() == i); // value
- }
-
- r = m.try_emplace(it, 3, std::move(mv1));
- assert(m.size() == 11);
- assert(mv1.moved()); // was moved from
- assert(r->first == 3); // key
- assert(r->second.get() == 3); // value
+ r = m.try_emplace(-1, std::move(mv1));
+ assert(m.size() == 11);
+ assert(r.second); // was inserted
+ assert(mv1.moved()); // was moved from
+ assert(r.first->first == -1); // key
+ assert(r.first->second.get() == 3); // value
+
+ Moveable mv2(5, 3.0);
+ r = m.try_emplace(5, std::move(mv2));
+ assert(m.size() == 12);
+ assert(r.second); // was inserted
+ assert(mv2.moved()); // was moved from
+ assert(r.first->first == 5); // key
+ assert(r.first->second.get() == 5); // value
+
+ Moveable mv3(-1, 3.0);
+ r = m.try_emplace(117, std::move(mv2));
+ assert(m.size() == 13);
+ assert(r.second); // was inserted
+ assert(mv2.moved()); // was moved from
+ assert(r.first->first == 117); // key
+ assert(r.first->second.get() == -1); // value
+ }
+
+ { // pair<iterator, bool> try_emplace(key_type&& k, Args&&... args);
+ typedef std::unordered_map<Moveable, Moveable> M;
+ typedef std::pair<M::iterator, bool> R;
+ M m;
+ R r;
+ for (int i = 0; i < 20; i += 2)
+ m.emplace(Moveable(i, (double)i), Moveable(i + 1, (double)i + 1));
+ assert(m.size() == 10);
+
+ Moveable mvkey1(2, 2.0);
+ Moveable mv1(4, 4.0);
+ r = m.try_emplace(std::move(mvkey1), std::move(mv1));
+ assert(m.size() == 10);
+ assert(!r.second); // was not inserted
+ assert(!mv1.moved()); // was not moved from
+ assert(!mvkey1.moved()); // was not moved from
+ assert(r.first->first == mvkey1); // key
+
+ Moveable mvkey2(3, 3.0);
+ r = m.try_emplace(std::move(mvkey2), std::move(mv1));
+ assert(m.size() == 11);
+ assert(r.second); // was inserted
+ assert(mv1.moved()); // was moved from
+ assert(mvkey2.moved()); // was moved from
+ assert(r.first->first.get() == 3); // key
+ assert(r.first->second.get() == 4); // value
+ }
+
+ { // iterator try_emplace(const_iterator hint, const key_type& k, Args&&... args);
+ typedef std::unordered_map<int, Moveable> M;
+ M m;
+ M::iterator r;
+ for (int i = 0; i < 20; i += 2)
+ m.try_emplace(i, Moveable(i, (double)i));
+ assert(m.size() == 10);
+ M::const_iterator it = m.find(2);
+
+ Moveable mv1(3, 3.0);
+ for (int i = 0; i < 20; i += 2) {
+ r = m.try_emplace(it, i, std::move(mv1));
+ assert(m.size() == 10);
+ assert(!mv1.moved()); // was not moved from
+ assert(r->first == i); // key
+ assert(r->second.get() == i); // value
}
- { // iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args);
- typedef std::unordered_map<Moveable, Moveable> M;
- M m;
- M::iterator r;
- for ( int i = 0; i < 20; i += 2 )
- m.emplace ( Moveable(i, (double) i), Moveable(i+1, (double) i+1));
- assert(m.size() == 10);
- M::const_iterator it = std::next(m.cbegin());
-
- Moveable mvkey1(2, 2.0);
- Moveable mv1(4, 4.0);
- r = m.try_emplace(it, std::move(mvkey1), std::move(mv1));
- assert(m.size() == 10);
- assert(!mv1.moved()); // was not moved from
- assert(!mvkey1.moved()); // was not moved from
- assert(r->first == mvkey1); // key
-
- Moveable mvkey2(3, 3.0);
- r = m.try_emplace(it, std::move(mvkey2), std::move(mv1));
- assert(m.size() == 11);
- assert(mv1.moved()); // was moved from
- assert(mvkey2.moved()); // was moved from
- assert(r->first.get() == 3); // key
- assert(r->second.get() == 4); // value
- }
+ r = m.try_emplace(it, 3, std::move(mv1));
+ assert(m.size() == 11);
+ assert(mv1.moved()); // was moved from
+ assert(r->first == 3); // key
+ assert(r->second.get() == 3); // value
+ }
+
+ { // iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args);
+ typedef std::unordered_map<Moveable, Moveable> M;
+ M m;
+ M::iterator r;
+ for (int i = 0; i < 20; i += 2)
+ m.emplace(Moveable(i, (double)i), Moveable(i + 1, (double)i + 1));
+ assert(m.size() == 10);
+ M::const_iterator it = std::next(m.cbegin());
+
+ Moveable mvkey1(2, 2.0);
+ Moveable mv1(4, 4.0);
+ r = m.try_emplace(it, std::move(mvkey1), std::move(mv1));
+ assert(m.size() == 10);
+ assert(!mv1.moved()); // was not moved from
+ assert(!mvkey1.moved()); // was not moved from
+ assert(r->first == mvkey1); // key
+
+ Moveable mvkey2(3, 3.0);
+ r = m.try_emplace(it, std::move(mvkey2), std::move(mv1));
+ assert(m.size() == 11);
+ assert(mv1.moved()); // was moved from
+ assert(mvkey2.moved()); // was moved from
+ assert(r->first.get() == 3); // key
+ assert(r->second.get() == 4); // value
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.swap/swap_noexcept.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.swap/swap_noexcept.pass.cpp
index 44f8cf57703ae86..4dc9a5d37d50b9e 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.swap/swap_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.swap/swap_noexcept.pass.cpp
@@ -33,23 +33,21 @@
#include "test_allocator.h"
template <class T>
-struct some_comp
-{
- typedef T value_type;
+struct some_comp {
+ typedef T value_type;
- some_comp() {}
- some_comp(const some_comp&) {}
- bool operator()(const T&, const T&) const { return false; }
+ some_comp() {}
+ some_comp(const some_comp&) {}
+ bool operator()(const T&, const T&) const { return false; }
};
template <class T>
-struct some_comp2
-{
- typedef T value_type;
+struct some_comp2 {
+ typedef T value_type;
- some_comp2() {}
- some_comp2(const some_comp2&) {}
- bool operator()(const T&, const T&) const { return false; }
+ some_comp2() {}
+ some_comp2(const some_comp2&) {}
+ bool operator()(const T&, const T&) const { return false; }
};
#if TEST_STD_VER >= 14
@@ -58,21 +56,19 @@ void swap(some_comp2<T>&, some_comp2<T>&) noexcept {}
#endif
template <class T>
-struct some_hash
-{
- typedef T value_type;
- some_hash() {}
- some_hash(const some_hash&);
- std::size_t operator()(T const&) const;
+struct some_hash {
+ typedef T value_type;
+ some_hash() {}
+ some_hash(const some_hash&);
+ std::size_t operator()(T const&) const;
};
template <class T>
-struct some_hash2
-{
- typedef T value_type;
- some_hash2() {}
- some_hash2(const some_hash2&);
- std::size_t operator()(T const&) const;
+struct some_hash2 {
+ typedef T value_type;
+ some_hash2() {}
+ some_hash2(const some_hash2&);
+ std::size_t operator()(T const&) const;
};
#if TEST_STD_VER >= 14
@@ -81,112 +77,108 @@ void swap(some_hash2<T>&, some_hash2<T>&) noexcept {}
#endif
template <class T>
-struct some_alloc
-{
- typedef T value_type;
+struct some_alloc {
+ typedef T value_type;
- some_alloc() {}
- some_alloc(const some_alloc&);
- void deallocate(void*, unsigned) {}
+ some_alloc() {}
+ some_alloc(const some_alloc&);
+ void deallocate(void*, unsigned) {}
- typedef std::true_type propagate_on_container_swap;
+ typedef std::true_type propagate_on_container_swap;
};
template <class T>
-struct some_alloc2
-{
- typedef T value_type;
+struct some_alloc2 {
+ typedef T value_type;
- some_alloc2() {}
- some_alloc2(const some_alloc2&);
- void deallocate(void*, unsigned) {}
+ some_alloc2() {}
+ some_alloc2(const some_alloc2&);
+ void deallocate(void*, unsigned) {}
- typedef std::false_type propagate_on_container_swap;
- typedef std::true_type is_always_equal;
+ typedef std::false_type propagate_on_container_swap;
+ typedef std::true_type is_always_equal;
};
template <class T>
-struct some_alloc3
-{
- typedef T value_type;
+struct some_alloc3 {
+ typedef T value_type;
- some_alloc3() {}
- some_alloc3(const some_alloc3&);
- void deallocate(void*, unsigned) {}
+ some_alloc3() {}
+ some_alloc3(const some_alloc3&);
+ void deallocate(void*, unsigned) {}
- typedef std::false_type propagate_on_container_swap;
- typedef std::false_type is_always_equal;
+ typedef std::false_type propagate_on_container_swap;
+ typedef std::false_type is_always_equal;
};
-
-int main(int, char**)
-{
- typedef std::pair<const MoveOnly, MoveOnly> MapType;
- {
- typedef std::unordered_map<MoveOnly, MoveOnly> C;
- static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
+int main(int, char**) {
+ typedef std::pair<const MoveOnly, MoveOnly> MapType;
+ {
+ typedef std::unordered_map<MoveOnly, MoveOnly> C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
#if defined(_LIBCPP_VERSION)
- {
- typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, test_allocator<MapType>> C;
- static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- {
- typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, other_allocator<MapType>> C;
- static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
+ {
+ typedef std::
+ unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>, std::equal_to<MoveOnly>, test_allocator<MapType>>
+ C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
+ {
+ typedef std::
+ unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>, std::equal_to<MoveOnly>, other_allocator<MapType>>
+ C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
#endif // _LIBCPP_VERSION
- {
- typedef std::unordered_map<MoveOnly, MoveOnly, some_hash<MoveOnly>> C;
- static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- {
- typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>,
- some_comp<MoveOnly>> C;
- static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
+ {
+ typedef std::unordered_map<MoveOnly, MoveOnly, some_hash<MoveOnly>> C;
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
+ {
+ typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>, some_comp<MoveOnly>> C;
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
#if TEST_STD_VER >= 14
- { // POCS allocator, throwable swap for hash, throwable swap for comp
- typedef std::unordered_map<MoveOnly, MoveOnly, some_hash<MoveOnly>, some_comp <MoveOnly>, some_alloc <MapType>> C;
+ { // POCS allocator, throwable swap for hash, throwable swap for comp
+ typedef std::unordered_map<MoveOnly, MoveOnly, some_hash<MoveOnly>, some_comp<MoveOnly>, some_alloc<MapType>> C;
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- { // always equal allocator, throwable swap for hash, throwable swap for comp
- typedef std::unordered_map<MoveOnly, MoveOnly, some_hash<MoveOnly>, some_comp <MoveOnly>, some_alloc2<MapType>> C;
+ }
+ { // always equal allocator, throwable swap for hash, throwable swap for comp
+ typedef std::unordered_map<MoveOnly, MoveOnly, some_hash<MoveOnly>, some_comp<MoveOnly>, some_alloc2<MapType>> C;
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- { // POCS allocator, throwable swap for hash, nothrow swap for comp
- typedef std::unordered_map<MoveOnly, MoveOnly, some_hash<MoveOnly>, some_comp2<MoveOnly>, some_alloc <MapType>> C;
+ }
+ { // POCS allocator, throwable swap for hash, nothrow swap for comp
+ typedef std::unordered_map<MoveOnly, MoveOnly, some_hash<MoveOnly>, some_comp2<MoveOnly>, some_alloc<MapType>> C;
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- { // always equal allocator, throwable swap for hash, nothrow swap for comp
+ }
+ { // always equal allocator, throwable swap for hash, nothrow swap for comp
typedef std::unordered_map<MoveOnly, MoveOnly, some_hash<MoveOnly>, some_comp2<MoveOnly>, some_alloc2<MapType>> C;
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- { // POCS allocator, nothrow swap for hash, throwable swap for comp
- typedef std::unordered_map<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp <MoveOnly>, some_alloc <MapType>> C;
+ }
+ { // POCS allocator, nothrow swap for hash, throwable swap for comp
+ typedef std::unordered_map<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp<MoveOnly>, some_alloc<MapType>> C;
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- { // always equal allocator, nothrow swap for hash, throwable swap for comp
- typedef std::unordered_map<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp <MoveOnly>, some_alloc2<MapType>> C;
+ }
+ { // always equal allocator, nothrow swap for hash, throwable swap for comp
+ typedef std::unordered_map<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp<MoveOnly>, some_alloc2<MapType>> C;
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- { // POCS allocator, nothrow swap for hash, nothrow swap for comp
- typedef std::unordered_map<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc <MapType>> C;
- static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- { // always equal allocator, nothrow swap for hash, nothrow swap for comp
+ }
+ { // POCS allocator, nothrow swap for hash, nothrow swap for comp
+ typedef std::unordered_map<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc<MapType>> C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
+ { // always equal allocator, nothrow swap for hash, nothrow swap for comp
typedef std::unordered_map<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc2<MapType>> C;
- static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
-#if defined(_LIBCPP_VERSION)
- { // NOT always equal allocator, nothrow swap for hash, nothrow swap for comp
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
+# if defined(_LIBCPP_VERSION)
+ { // NOT always equal allocator, nothrow swap for hash, nothrow swap for comp
typedef std::unordered_map<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc3<MapType>> C;
- static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
-#endif // _LIBCPP_VERSION
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
+# endif // _LIBCPP_VERSION
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.swap/swap_non_member.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.swap/swap_non_member.pass.cpp
index 2b83a7462b75af6..149a0b040a2df44 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.swap/swap_non_member.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.swap/swap_non_member.pass.cpp
@@ -25,555 +25,542 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef test_allocator<std::pair<const int, std::string> > Alloc;
- typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
- C c1(0, Hash(1), Compare(1), Alloc(1, 1));
- C c2(0, Hash(2), Compare(2), Alloc(1, 2));
- c2.max_load_factor(2);
- swap(c1, c2);
-
- LIBCPP_ASSERT(c1.bucket_count() == 0);
- assert(c1.size() == 0);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator().get_id() == 1);
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- LIBCPP_ASSERT(c2.bucket_count() == 0);
- assert(c2.size() == 0);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator().get_id() == 2);
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef test_allocator<std::pair<const int, std::string> > Alloc;
- typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
- typedef std::pair<int, std::string> P;
- P a2[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- C c1(0, Hash(1), Compare(1), Alloc(1, 1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
- c2.max_load_factor(2);
- C::iterator it2 = c2.begin();
- swap(c1, c2);
-
- assert(c1.bucket_count() >= 8);
- assert(c1.size() == 8);
- assert(c1.at(10) == "ten");
- assert(c1.at(20) == "twenty");
- assert(c1.at(30) == "thirty");
- assert(c1.at(40) == "forty");
- assert(c1.at(50) == "fifty");
- assert(c1.at(60) == "sixty");
- assert(c1.at(70) == "seventy");
- assert(c1.at(80) == "eighty");
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator().get_id() == 1);
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
- assert(it2 == c1.begin()); // Iterators are not invalidated
-
- LIBCPP_ASSERT(c2.bucket_count() == 0);
- assert(c2.size() == 0);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator().get_id() == 2);
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef test_allocator<std::pair<const int, std::string> > Alloc;
- typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
- typedef std::pair<int, std::string> P;
- P a1[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
- C c2(0, Hash(2), Compare(2), Alloc(1, 2));
- c2.max_load_factor(2);
- C::iterator it1 = c1.begin();
- swap(c1, c2);
-
- LIBCPP_ASSERT(c1.bucket_count() == 0);
- assert(c1.size() == 0);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator().get_id() == 1);
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- assert(c2.bucket_count() >= 4);
- assert(c2.size() == 4);
- assert(c2.at(1) == "one");
- assert(c2.at(2) == "two");
- assert(c2.at(3) == "three");
- assert(c2.at(4) == "four");
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator().get_id() == 2);
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- assert(it1 == c2.begin()); // Iterators are not invalidated
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef test_allocator<std::pair<const int, std::string> > Alloc;
- typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
- typedef std::pair<int, std::string> P;
- P a1[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- P a2[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
- c2.max_load_factor(2);
- C::iterator it1 = c1.begin();
- C::iterator it2 = c2.begin();
- swap(c1, c2);
-
- assert(c1.bucket_count() >= 8);
- assert(c1.size() == 8);
- assert(c1.at(10) == "ten");
- assert(c1.at(20) == "twenty");
- assert(c1.at(30) == "thirty");
- assert(c1.at(40) == "forty");
- assert(c1.at(50) == "fifty");
- assert(c1.at(60) == "sixty");
- assert(c1.at(70) == "seventy");
- assert(c1.at(80) == "eighty");
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator().get_id() == 1);
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
- assert(it2 == c1.begin()); // Iterators are not invalidated
-
- assert(c2.bucket_count() >= 4);
- assert(c2.size() == 4);
- assert(c2.at(1) == "one");
- assert(c2.at(2) == "two");
- assert(c2.at(3) == "three");
- assert(c2.at(4) == "four");
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator().get_id() == 2);
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- assert(it1 == c2.begin()); // Iterators are not invalidated
- }
-
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef other_allocator<std::pair<const int, std::string> > Alloc;
- typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
- C c1(0, Hash(1), Compare(1), Alloc(1));
- C c2(0, Hash(2), Compare(2), Alloc(2));
- c2.max_load_factor(2);
- swap(c1, c2);
-
- LIBCPP_ASSERT(c1.bucket_count() == 0);
- assert(c1.size() == 0);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(2));
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- LIBCPP_ASSERT(c2.bucket_count() == 0);
- assert(c2.size() == 0);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(1));
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef other_allocator<std::pair<const int, std::string> > Alloc;
- typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
- typedef std::pair<int, std::string> P;
- P a2[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- C c1(0, Hash(1), Compare(1), Alloc(1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
- c2.max_load_factor(2);
- swap(c1, c2);
-
- assert(c1.bucket_count() >= 8);
- assert(c1.size() == 8);
- assert(c1.at(10) == "ten");
- assert(c1.at(20) == "twenty");
- assert(c1.at(30) == "thirty");
- assert(c1.at(40) == "forty");
- assert(c1.at(50) == "fifty");
- assert(c1.at(60) == "sixty");
- assert(c1.at(70) == "seventy");
- assert(c1.at(80) == "eighty");
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(2));
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- LIBCPP_ASSERT(c2.bucket_count() == 0);
- assert(c2.size() == 0);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(1));
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef other_allocator<std::pair<const int, std::string> > Alloc;
- typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
- typedef std::pair<int, std::string> P;
- P a1[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
- C c2(0, Hash(2), Compare(2), Alloc(2));
- c2.max_load_factor(2);
- swap(c1, c2);
-
- LIBCPP_ASSERT(c1.bucket_count() == 0);
- assert(c1.size() == 0);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(2));
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- assert(c2.bucket_count() >= 4);
- assert(c2.size() == 4);
- assert(c2.at(1) == "one");
- assert(c2.at(2) == "two");
- assert(c2.at(3) == "three");
- assert(c2.at(4) == "four");
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(1));
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef other_allocator<std::pair<const int, std::string> > Alloc;
- typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
- typedef std::pair<int, std::string> P;
- P a1[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- P a2[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
- c2.max_load_factor(2);
- swap(c1, c2);
-
- assert(c1.bucket_count() >= 8);
- assert(c1.size() == 8);
- assert(c1.at(10) == "ten");
- assert(c1.at(20) == "twenty");
- assert(c1.at(30) == "thirty");
- assert(c1.at(40) == "forty");
- assert(c1.at(50) == "fifty");
- assert(c1.at(60) == "sixty");
- assert(c1.at(70) == "seventy");
- assert(c1.at(80) == "eighty");
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(2));
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- assert(c2.bucket_count() >= 4);
- assert(c2.size() == 4);
- assert(c2.at(1) == "one");
- assert(c2.at(2) == "two");
- assert(c2.at(3) == "three");
- assert(c2.at(4) == "four");
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(1));
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef test_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
+ C c1(0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(0, Hash(2), Compare(2), Alloc(1, 2));
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ LIBCPP_ASSERT(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ LIBCPP_ASSERT(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef test_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ P a2[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c1(0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
+ c2.max_load_factor(2);
+ C::iterator it2 = c2.begin();
+ swap(c1, c2);
+
+ assert(c1.bucket_count() >= 8);
+ assert(c1.size() == 8);
+ assert(c1.at(10) == "ten");
+ assert(c1.at(20) == "twenty");
+ assert(c1.at(30) == "thirty");
+ assert(c1.at(40) == "forty");
+ assert(c1.at(50) == "fifty");
+ assert(c1.at(60) == "sixty");
+ assert(c1.at(70) == "seventy");
+ assert(c1.at(80) == "eighty");
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+ assert(it2 == c1.begin()); // Iterators are not invalidated
+
+ LIBCPP_ASSERT(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef test_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ P a1[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(0, Hash(2), Compare(2), Alloc(1, 2));
+ c2.max_load_factor(2);
+ C::iterator it1 = c1.begin();
+ swap(c1, c2);
+
+ LIBCPP_ASSERT(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 4);
+ assert(c2.size() == 4);
+ assert(c2.at(1) == "one");
+ assert(c2.at(2) == "two");
+ assert(c2.at(3) == "three");
+ assert(c2.at(4) == "four");
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ assert(it1 == c2.begin()); // Iterators are not invalidated
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef test_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ P a1[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ P a2[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
+ c2.max_load_factor(2);
+ C::iterator it1 = c1.begin();
+ C::iterator it2 = c2.begin();
+ swap(c1, c2);
+
+ assert(c1.bucket_count() >= 8);
+ assert(c1.size() == 8);
+ assert(c1.at(10) == "ten");
+ assert(c1.at(20) == "twenty");
+ assert(c1.at(30) == "thirty");
+ assert(c1.at(40) == "forty");
+ assert(c1.at(50) == "fifty");
+ assert(c1.at(60) == "sixty");
+ assert(c1.at(70) == "seventy");
+ assert(c1.at(80) == "eighty");
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+ assert(it2 == c1.begin()); // Iterators are not invalidated
+
+ assert(c2.bucket_count() >= 4);
+ assert(c2.size() == 4);
+ assert(c2.at(1) == "one");
+ assert(c2.at(2) == "two");
+ assert(c2.at(3) == "three");
+ assert(c2.at(4) == "four");
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ assert(it1 == c2.begin()); // Iterators are not invalidated
+ }
+
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef other_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
+ C c1(0, Hash(1), Compare(1), Alloc(1));
+ C c2(0, Hash(2), Compare(2), Alloc(2));
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ LIBCPP_ASSERT(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc(2));
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ LIBCPP_ASSERT(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc(1));
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef other_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ P a2[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c1(0, Hash(1), Compare(1), Alloc(1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ assert(c1.bucket_count() >= 8);
+ assert(c1.size() == 8);
+ assert(c1.at(10) == "ten");
+ assert(c1.at(20) == "twenty");
+ assert(c1.at(30) == "thirty");
+ assert(c1.at(40) == "forty");
+ assert(c1.at(50) == "fifty");
+ assert(c1.at(60) == "sixty");
+ assert(c1.at(70) == "seventy");
+ assert(c1.at(80) == "eighty");
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc(2));
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ LIBCPP_ASSERT(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc(1));
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef other_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ P a1[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
+ C c2(0, Hash(2), Compare(2), Alloc(2));
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ LIBCPP_ASSERT(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc(2));
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 4);
+ assert(c2.size() == 4);
+ assert(c2.at(1) == "one");
+ assert(c2.at(2) == "two");
+ assert(c2.at(3) == "three");
+ assert(c2.at(4) == "four");
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc(1));
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef other_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ P a1[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ P a2[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ assert(c1.bucket_count() >= 8);
+ assert(c1.size() == 8);
+ assert(c1.at(10) == "ten");
+ assert(c1.at(20) == "twenty");
+ assert(c1.at(30) == "thirty");
+ assert(c1.at(40) == "forty");
+ assert(c1.at(50) == "fifty");
+ assert(c1.at(60) == "sixty");
+ assert(c1.at(70) == "seventy");
+ assert(c1.at(80) == "eighty");
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc(2));
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 4);
+ assert(c2.size() == 4);
+ assert(c2.at(1) == "one");
+ assert(c2.at(2) == "two");
+ assert(c2.at(3) == "three");
+ assert(c2.at(4) == "four");
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc(1));
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef min_allocator<std::pair<const int, std::string> > Alloc;
- typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
- C c1(0, Hash(1), Compare(1), Alloc());
- C c2(0, Hash(2), Compare(2), Alloc());
- c2.max_load_factor(2);
- swap(c1, c2);
-
- LIBCPP_ASSERT(c1.bucket_count() == 0);
- assert(c1.size() == 0);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- LIBCPP_ASSERT(c2.bucket_count() == 0);
- assert(c2.size() == 0);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef min_allocator<std::pair<const int, std::string> > Alloc;
- typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
- typedef std::pair<int, std::string> P;
- P a2[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- C c1(0, Hash(1), Compare(1), Alloc());
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
- c2.max_load_factor(2);
- swap(c1, c2);
-
- assert(c1.bucket_count() >= 8);
- assert(c1.size() == 8);
- assert(c1.at(10) == "ten");
- assert(c1.at(20) == "twenty");
- assert(c1.at(30) == "thirty");
- assert(c1.at(40) == "forty");
- assert(c1.at(50) == "fifty");
- assert(c1.at(60) == "sixty");
- assert(c1.at(70) == "seventy");
- assert(c1.at(80) == "eighty");
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- LIBCPP_ASSERT(c2.bucket_count() == 0);
- assert(c2.size() == 0);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef min_allocator<std::pair<const int, std::string> > Alloc;
- typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
- typedef std::pair<int, std::string> P;
- P a1[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
- C c2(0, Hash(2), Compare(2), Alloc());
- c2.max_load_factor(2);
- swap(c1, c2);
-
- LIBCPP_ASSERT(c1.bucket_count() == 0);
- assert(c1.size() == 0);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- assert(c2.bucket_count() >= 4);
- assert(c2.size() == 4);
- assert(c2.at(1) == "one");
- assert(c2.at(2) == "two");
- assert(c2.at(3) == "three");
- assert(c2.at(4) == "four");
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef min_allocator<std::pair<const int, std::string> > Alloc;
- typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
- typedef std::pair<int, std::string> P;
- P a1[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- P a2[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
- c2.max_load_factor(2);
- swap(c1, c2);
-
- assert(c1.bucket_count() >= 8);
- assert(c1.size() == 8);
- assert(c1.at(10) == "ten");
- assert(c1.at(20) == "twenty");
- assert(c1.at(30) == "thirty");
- assert(c1.at(40) == "forty");
- assert(c1.at(50) == "fifty");
- assert(c1.at(60) == "sixty");
- assert(c1.at(70) == "seventy");
- assert(c1.at(80) == "eighty");
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- assert(c2.bucket_count() >= 4);
- assert(c2.size() == 4);
- assert(c2.at(1) == "one");
- assert(c2.at(2) == "two");
- assert(c2.at(3) == "three");
- assert(c2.at(4) == "four");
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef min_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
+ C c1(0, Hash(1), Compare(1), Alloc());
+ C c2(0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ LIBCPP_ASSERT(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ LIBCPP_ASSERT(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef min_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ P a2[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c1(0, Hash(1), Compare(1), Alloc());
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ assert(c1.bucket_count() >= 8);
+ assert(c1.size() == 8);
+ assert(c1.at(10) == "ten");
+ assert(c1.at(20) == "twenty");
+ assert(c1.at(30) == "thirty");
+ assert(c1.at(40) == "forty");
+ assert(c1.at(50) == "fifty");
+ assert(c1.at(60) == "sixty");
+ assert(c1.at(70) == "seventy");
+ assert(c1.at(80) == "eighty");
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ LIBCPP_ASSERT(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef min_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ P a1[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
+ C c2(0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ LIBCPP_ASSERT(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 4);
+ assert(c2.size() == 4);
+ assert(c2.at(1) == "one");
+ assert(c2.at(2) == "two");
+ assert(c2.at(3) == "three");
+ assert(c2.at(4) == "four");
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef min_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ P a1[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ P a2[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ assert(c1.bucket_count() >= 8);
+ assert(c1.size() == 8);
+ assert(c1.at(10) == "ten");
+ assert(c1.at(20) == "twenty");
+ assert(c1.at(30) == "thirty");
+ assert(c1.at(40) == "forty");
+ assert(c1.at(50) == "fifty");
+ assert(c1.at(60) == "sixty");
+ assert(c1.at(70) == "seventy");
+ assert(c1.at(80) == "eighty");
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 4);
+ assert(c2.size() == 4);
+ assert(c2.at(1) == "one");
+ assert(c2.at(2) == "two");
+ assert(c2.at(3) == "three");
+ assert(c2.at(4) == "four");
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multimap/allocator_mismatch.verify.cpp b/libcxx/test/std/containers/unord/unord.multimap/allocator_mismatch.verify.cpp
index 546ddc3dd110883..d4bf7b6ca2a03eb 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/allocator_mismatch.verify.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/allocator_mismatch.verify.cpp
@@ -12,4 +12,4 @@
#include <unordered_map>
std::unordered_multimap<int, int, std::hash<int>, std::less<int>, std::allocator<long> > m;
- // expected-error-re@*:* {{static assertion failed{{.*}}Allocator::value_type must be same type as value_type}}
+// expected-error-re@*:* {{static assertion failed{{.*}}Allocator::value_type must be same type as value_type}}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/bucket.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/bucket.pass.cpp
index 034408740315ac2..b4a640da529539b 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/bucket.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/bucket.pass.cpp
@@ -22,47 +22,48 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multimap<int, std::string> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- const C c(std::begin(a), std::end(a));
- std::size_t bc = c.bucket_count();
- assert(bc >= 7);
- for (std::size_t i = 0; i < 13; ++i)
- LIBCPP_ASSERT(c.bucket(i) == i % bc);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ const C c(std::begin(a), std::end(a));
+ std::size_t bc = c.bucket_count();
+ assert(bc >= 7);
+ for (std::size_t i = 0; i < 13; ++i)
+ LIBCPP_ASSERT(c.bucket(i) == i % bc);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- const C c(std::begin(a), std::end(a));
- std::size_t bc = c.bucket_count();
- assert(bc >= 7);
- for (std::size_t i = 0; i < 13; ++i)
- LIBCPP_ASSERT(c.bucket(i) == i % bc);
- }
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ const C c(std::begin(a), std::end(a));
+ std::size_t bc = c.bucket_count();
+ assert(bc >= 7);
+ for (std::size_t i = 0; i < 13; ++i)
+ LIBCPP_ASSERT(c.bucket(i) == i % bc);
+ }
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/bucket_count.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/bucket_count.pass.cpp
index 3515dbc93ca4593..8368214d5375a87 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/bucket_count.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/bucket_count.pass.cpp
@@ -21,30 +21,28 @@
#include "test_macros.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multimap<int, std::string> C;
- const C c;
- LIBCPP_ASSERT(c.bucket_count() == 0);
- }
- {
- typedef std::unordered_multimap<int, std::string> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- const C c(std::begin(a), std::end(a));
- assert(c.bucket_count() >= 8);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<int, std::string> C;
+ const C c;
+ LIBCPP_ASSERT(c.bucket_count() == 0);
+ }
+ {
+ typedef std::unordered_multimap<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ const C c(std::begin(a), std::end(a));
+ assert(c.bucket_count() >= 8);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/bucket_size.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/bucket_size.pass.cpp
index 1659fef9d462c27..ee80e34660b2e4a 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/bucket_size.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/bucket_size.pass.cpp
@@ -22,55 +22,56 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multimap<int, std::string> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- const C c(std::begin(a), std::end(a));
- assert(c.bucket_count() >= 7);
- LIBCPP_ASSERT(c.bucket_size(0) == 0);
- LIBCPP_ASSERT(c.bucket_size(1) == 2);
- LIBCPP_ASSERT(c.bucket_size(2) == 2);
- LIBCPP_ASSERT(c.bucket_size(3) == 1);
- LIBCPP_ASSERT(c.bucket_size(4) == 1);
- LIBCPP_ASSERT(c.bucket_size(5) == 0);
- LIBCPP_ASSERT(c.bucket_size(6) == 0);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ const C c(std::begin(a), std::end(a));
+ assert(c.bucket_count() >= 7);
+ LIBCPP_ASSERT(c.bucket_size(0) == 0);
+ LIBCPP_ASSERT(c.bucket_size(1) == 2);
+ LIBCPP_ASSERT(c.bucket_size(2) == 2);
+ LIBCPP_ASSERT(c.bucket_size(3) == 1);
+ LIBCPP_ASSERT(c.bucket_size(4) == 1);
+ LIBCPP_ASSERT(c.bucket_size(5) == 0);
+ LIBCPP_ASSERT(c.bucket_size(6) == 0);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- const C c(std::begin(a), std::end(a));
- assert(c.bucket_count() >= 7);
- LIBCPP_ASSERT(c.bucket_size(0) == 0);
- LIBCPP_ASSERT(c.bucket_size(1) == 2);
- LIBCPP_ASSERT(c.bucket_size(2) == 2);
- LIBCPP_ASSERT(c.bucket_size(3) == 1);
- LIBCPP_ASSERT(c.bucket_size(4) == 1);
- LIBCPP_ASSERT(c.bucket_size(5) == 0);
- LIBCPP_ASSERT(c.bucket_size(6) == 0);
- }
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ const C c(std::begin(a), std::end(a));
+ assert(c.bucket_count() >= 7);
+ LIBCPP_ASSERT(c.bucket_size(0) == 0);
+ LIBCPP_ASSERT(c.bucket_size(1) == 2);
+ LIBCPP_ASSERT(c.bucket_size(2) == 2);
+ LIBCPP_ASSERT(c.bucket_size(3) == 1);
+ LIBCPP_ASSERT(c.bucket_size(4) == 1);
+ LIBCPP_ASSERT(c.bucket_size(5) == 0);
+ LIBCPP_ASSERT(c.bucket_size(6) == 0);
+ }
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/contains.transparent.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/contains.transparent.pass.cpp
index 9ebf4f2aa5df963..7132bf79ba24df4 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/contains.transparent.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/contains.transparent.pass.cpp
@@ -20,44 +20,43 @@
#include <unordered_map>
#include "test_transparent_unordered.h"
-int main(int, char**)
-{
- using key_type = StoredType<int>;
-
- {
- // Make sure conversions don't happen for transparent non-final hasher and key_equal
- using M = unord_map_type<std::unordered_multimap, transparent_hash, std::equal_to<>>;
- test_transparent_contains<M>({{1, 2}, {1, 3}, {2, 3}});
- test_transparent_contains<const M>({{1, 2}, {1, 3}, {2, 3}});
- }
-
- {
- // Make sure conversions don't happen for transparent final hasher and key_equal
- using M = unord_map_type<std::unordered_multimap, transparent_hash_final, transparent_equal_final>;
- test_transparent_contains<M>({{1, 2}, {1, 3}, {2, 3}});
- test_transparent_contains<const M>({{1, 2}, {1, 3}, {2, 3}});
- }
-
- {
- // Make sure conversions do happen for non-transparent hasher
- using M = unord_map_type<std::unordered_multimap, non_transparent_hash, std::equal_to<>>;
- test_non_transparent_contains<M>({{1, 2}, {1, 3}, {2, 3}});
- test_non_transparent_contains<const M>({{1, 2}, {1, 3}, {2, 3}});
- }
-
- {
- // Make sure conversions do happen for non-transparent key_equal
- using M = unord_map_type<std::unordered_multimap, transparent_hash, std::equal_to<key_type>>;
- test_non_transparent_contains<M>({{1, 2}, {1, 3}, {2, 3}});
- test_non_transparent_contains<const M>({{1, 2}, {1, 3}, {2, 3}});
- }
-
- {
- // Make sure conversions do happen for both non-transparent hasher and key_equal
- using M = unord_map_type<std::unordered_multimap, non_transparent_hash, std::equal_to<key_type>>;
- test_non_transparent_contains<M>({{1, 2}, {1, 3}, {2, 3}});
- test_non_transparent_contains<const M>({{1, 2}, {1, 3}, {2, 3}});
- }
-
- return 0;
+int main(int, char**) {
+ using key_type = StoredType<int>;
+
+ {
+ // Make sure conversions don't happen for transparent non-final hasher and key_equal
+ using M = unord_map_type<std::unordered_multimap, transparent_hash, std::equal_to<>>;
+ test_transparent_contains<M>({{1, 2}, {1, 3}, {2, 3}});
+ test_transparent_contains<const M>({{1, 2}, {1, 3}, {2, 3}});
+ }
+
+ {
+ // Make sure conversions don't happen for transparent final hasher and key_equal
+ using M = unord_map_type<std::unordered_multimap, transparent_hash_final, transparent_equal_final>;
+ test_transparent_contains<M>({{1, 2}, {1, 3}, {2, 3}});
+ test_transparent_contains<const M>({{1, 2}, {1, 3}, {2, 3}});
+ }
+
+ {
+ // Make sure conversions do happen for non-transparent hasher
+ using M = unord_map_type<std::unordered_multimap, non_transparent_hash, std::equal_to<>>;
+ test_non_transparent_contains<M>({{1, 2}, {1, 3}, {2, 3}});
+ test_non_transparent_contains<const M>({{1, 2}, {1, 3}, {2, 3}});
+ }
+
+ {
+ // Make sure conversions do happen for non-transparent key_equal
+ using M = unord_map_type<std::unordered_multimap, transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_contains<M>({{1, 2}, {1, 3}, {2, 3}});
+ test_non_transparent_contains<const M>({{1, 2}, {1, 3}, {2, 3}});
+ }
+
+ {
+ // Make sure conversions do happen for both non-transparent hasher and key_equal
+ using M = unord_map_type<std::unordered_multimap, non_transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_contains<M>({{1, 2}, {1, 3}, {2, 3}});
+ test_non_transparent_contains<const M>({{1, 2}, {1, 3}, {2, 3}});
+ }
+
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/count.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/count.pass.cpp
index 4ece25665295527..e2eead5093293f9 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/count.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/count.pass.cpp
@@ -22,52 +22,53 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multimap<int, std::string> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(50, "fiftyA"),
- P(50, "fiftyB"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- const C c(std::begin(a), std::end(a));
- assert(c.count(30) == 1);
- assert(c.count(50) == 3);
- assert(c.count(5) == 0);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(50, "fiftyA"),
+ P(50, "fiftyB"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ const C c(std::begin(a), std::end(a));
+ assert(c.count(30) == 1);
+ assert(c.count(50) == 3);
+ assert(c.count(5) == 0);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(50, "fiftyA"),
- P(50, "fiftyB"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- const C c(std::begin(a), std::end(a));
- assert(c.count(30) == 1);
- assert(c.count(50) == 3);
- assert(c.count(5) == 0);
- }
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(50, "fiftyA"),
+ P(50, "fiftyB"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ const C c(std::begin(a), std::end(a));
+ assert(c.count(30) == 1);
+ assert(c.count(50) == 3);
+ assert(c.count(5) == 0);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multimap/count.transparent.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/count.transparent.pass.cpp
index b9755cfdeaaf20c..9e394c6b08e758c 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/count.transparent.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/count.transparent.pass.cpp
@@ -21,44 +21,43 @@
#include "test_transparent_unordered.h"
-int main(int, char**)
-{
- using key_type = StoredType<int>;
-
- {
- // Make sure conversions don't happen for transparent non-final hasher and key_equal
- using M = unord_map_type<std::unordered_multimap, transparent_hash, std::equal_to<>>;
- test_transparent_count<M>({{1, 2}, {1, 3}, {2, 3}});
- test_transparent_count<const M>({{1, 2}, {1, 3}, {2, 3}});
- }
-
- {
- // Make sure conversions don't happen for transparent final hasher and key_equal
- using M = unord_map_type<std::unordered_multimap, transparent_hash_final, transparent_equal_final>;
- test_transparent_count<M>({{1, 2}, {1, 3}, {2, 3}});
- test_transparent_count<const M>({{1, 2}, {1, 3}, {2, 3}});
- }
-
- {
- // Make sure conversions do happen for non-transparent hasher
- using M = unord_map_type<std::unordered_multimap, non_transparent_hash, std::equal_to<>>;
- test_non_transparent_count<M>({{1, 2}, {1, 3}, {2, 3}});
- test_non_transparent_count<const M>({{1, 2}, {1, 3}, {2, 3}});
- }
-
- {
- // Make sure conversions do happen for non-transparent key_equal
- using M = unord_map_type<std::unordered_multimap, transparent_hash, std::equal_to<key_type>>;
- test_non_transparent_count<M>({{1, 2}, {1, 3}, {2, 3}});
- test_non_transparent_count<const M>({{1, 2}, {1, 3}, {2, 3}});
- }
-
- {
- // Make sure conversions do happen for both non-transparent hasher and key_equal
- using M = unord_map_type<std::unordered_multimap, non_transparent_hash, std::equal_to<key_type>>;
- test_non_transparent_count<M>({{1, 2}, {1, 3}, {2, 3}});
- test_non_transparent_count<const M>({{1, 2}, {1, 3}, {2, 3}});
- }
-
- return 0;
+int main(int, char**) {
+ using key_type = StoredType<int>;
+
+ {
+ // Make sure conversions don't happen for transparent non-final hasher and key_equal
+ using M = unord_map_type<std::unordered_multimap, transparent_hash, std::equal_to<>>;
+ test_transparent_count<M>({{1, 2}, {1, 3}, {2, 3}});
+ test_transparent_count<const M>({{1, 2}, {1, 3}, {2, 3}});
+ }
+
+ {
+ // Make sure conversions don't happen for transparent final hasher and key_equal
+ using M = unord_map_type<std::unordered_multimap, transparent_hash_final, transparent_equal_final>;
+ test_transparent_count<M>({{1, 2}, {1, 3}, {2, 3}});
+ test_transparent_count<const M>({{1, 2}, {1, 3}, {2, 3}});
+ }
+
+ {
+ // Make sure conversions do happen for non-transparent hasher
+ using M = unord_map_type<std::unordered_multimap, non_transparent_hash, std::equal_to<>>;
+ test_non_transparent_count<M>({{1, 2}, {1, 3}, {2, 3}});
+ test_non_transparent_count<const M>({{1, 2}, {1, 3}, {2, 3}});
+ }
+
+ {
+ // Make sure conversions do happen for non-transparent key_equal
+ using M = unord_map_type<std::unordered_multimap, transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_count<M>({{1, 2}, {1, 3}, {2, 3}});
+ test_non_transparent_count<const M>({{1, 2}, {1, 3}, {2, 3}});
+ }
+
+ {
+ // Make sure conversions do happen for both non-transparent hasher and key_equal
+ using M = unord_map_type<std::unordered_multimap, non_transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_count<M>({{1, 2}, {1, 3}, {2, 3}});
+ test_non_transparent_count<const M>({{1, 2}, {1, 3}, {2, 3}});
+ }
+
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/empty.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/empty.pass.cpp
index 6189b7f0e3dedcd..8769d11dcaa81bc 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/empty.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/empty.pass.cpp
@@ -18,9 +18,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::unordered_multimap<int, double> M;
M m;
ASSERT_NOEXCEPT(m.empty());
@@ -29,10 +28,12 @@ int main(int, char**)
assert(!m.empty());
m.clear();
assert(m.empty());
- }
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multimap<int, double, std::hash<int>, std::equal_to<int>, min_allocator<std::pair<const int, double>>> M;
+ {
+ typedef std::
+ unordered_multimap<int, double, std::hash<int>, std::equal_to<int>, min_allocator<std::pair<const int, double>>>
+ M;
M m;
ASSERT_NOEXCEPT(m.empty());
assert(m.empty());
@@ -40,7 +41,7 @@ int main(int, char**)
assert(!m.empty());
m.clear();
assert(m.empty());
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multimap/empty.verify.cpp b/libcxx/test/std/containers/unord/unord.multimap/empty.verify.cpp
index 999d43fb63bc066..21775acd5acda6a 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/empty.verify.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/empty.verify.cpp
@@ -17,6 +17,6 @@
#include <unordered_map>
void f() {
- std::unordered_multimap<int, int> c;
- c.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::unordered_multimap<int, int> c;
+ c.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/eq.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/eq.pass.cpp
index 083fff13b3812fb..06d86b5e02662b4 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/eq.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/eq.pass.cpp
@@ -28,223 +28,230 @@
#include "test_comparisons.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multimap<int, std::string> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(20, "twenty 2"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(50, "fifty 2"),
- P(50, "fifty 3"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- const C c1(std::begin(a), std::end(a));
- const C c2;
- assert(testEquality(c1, c2, false));
- }
- {
- typedef std::unordered_multimap<int, std::string> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(20, "twenty 2"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(50, "fifty 2"),
- P(50, "fifty 3"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- const C c1(std::begin(a), std::end(a));
- const C c2 = c1;
- assert(testEquality(c1, c2, true));
- }
- {
- typedef std::unordered_multimap<int, std::string> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(20, "twenty 2"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(50, "fifty 2"),
- P(50, "fifty 3"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- C c1(std::begin(a), std::end(a));
- C c2 = c1;
- c2.rehash(30);
- assert(testEquality(c1, c2, true));
- c2.insert(P(90, "ninety"));
- assert(testEquality(c1, c2, false));
- c1.insert(P(90, "ninety"));
- assert(testEquality(c1, c2, true));
- }
- {
- typedef std::unordered_multimap<int, std::string> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(20, "twenty 2"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(50, "fifty 2"),
- P(50, "fifty 3"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- C c1(std::begin(a), std::end(a));
- C c2 = c1;
- assert(testEquality(c1, c2, true));
- c1.insert(P(70, "seventy 2"));
- c2.insert(P(80, "eighty 2"));
- assert(testEquality(c1, c2, false));
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(20, "twenty 2"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(50, "fifty 2"),
+ P(50, "fifty 3"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ const C c1(std::begin(a), std::end(a));
+ const C c2;
+ assert(testEquality(c1, c2, false));
+ }
+ {
+ typedef std::unordered_multimap<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(20, "twenty 2"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(50, "fifty 2"),
+ P(50, "fifty 3"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ const C c1(std::begin(a), std::end(a));
+ const C c2 = c1;
+ assert(testEquality(c1, c2, true));
+ }
+ {
+ typedef std::unordered_multimap<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(20, "twenty 2"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(50, "fifty 2"),
+ P(50, "fifty 3"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c1(std::begin(a), std::end(a));
+ C c2 = c1;
+ c2.rehash(30);
+ assert(testEquality(c1, c2, true));
+ c2.insert(P(90, "ninety"));
+ assert(testEquality(c1, c2, false));
+ c1.insert(P(90, "ninety"));
+ assert(testEquality(c1, c2, true));
+ }
+ {
+ typedef std::unordered_multimap<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(20, "twenty 2"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(50, "fifty 2"),
+ P(50, "fifty 3"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c1(std::begin(a), std::end(a));
+ C c2 = c1;
+ assert(testEquality(c1, c2, true));
+ c1.insert(P(70, "seventy 2"));
+ c2.insert(P(80, "eighty 2"));
+ assert(testEquality(c1, c2, false));
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(20, "twenty 2"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(50, "fifty 2"),
- P(50, "fifty 3"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- const C c1(std::begin(a), std::end(a));
- const C c2;
- assert(testEquality(c1, c2, false));
- }
- {
- typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(20, "twenty 2"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(50, "fifty 2"),
- P(50, "fifty 3"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- const C c1(std::begin(a), std::end(a));
- const C c2 = c1;
- assert(testEquality(c1, c2, true));
- }
- {
- typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(20, "twenty 2"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(50, "fifty 2"),
- P(50, "fifty 3"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- C c1(std::begin(a), std::end(a));
- C c2 = c1;
- c2.rehash(30);
- assert(testEquality(c1, c2, true));
- c2.insert(P(90, "ninety"));
- assert(testEquality(c1, c2, false));
- c1.insert(P(90, "ninety"));
- assert(testEquality(c1, c2, true));
- }
- {
- typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(20, "twenty 2"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(50, "fifty 2"),
- P(50, "fifty 3"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- C c1(std::begin(a), std::end(a));
- C c2 = c1;
- assert(testEquality(c1, c2, true));
- c1.insert(P(70, "seventy 2"));
- c2.insert(P(80, "eighty 2"));
- assert(testEquality(c1, c2, false));
- }
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(20, "twenty 2"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(50, "fifty 2"),
+ P(50, "fifty 3"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ const C c1(std::begin(a), std::end(a));
+ const C c2;
+ assert(testEquality(c1, c2, false));
+ }
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(20, "twenty 2"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(50, "fifty 2"),
+ P(50, "fifty 3"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ const C c1(std::begin(a), std::end(a));
+ const C c2 = c1;
+ assert(testEquality(c1, c2, true));
+ }
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(20, "twenty 2"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(50, "fifty 2"),
+ P(50, "fifty 3"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c1(std::begin(a), std::end(a));
+ C c2 = c1;
+ c2.rehash(30);
+ assert(testEquality(c1, c2, true));
+ c2.insert(P(90, "ninety"));
+ assert(testEquality(c1, c2, false));
+ c1.insert(P(90, "ninety"));
+ assert(testEquality(c1, c2, true));
+ }
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(20, "twenty 2"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(50, "fifty 2"),
+ P(50, "fifty 3"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c1(std::begin(a), std::end(a));
+ C c2 = c1;
+ assert(testEquality(c1, c2, true));
+ c1.insert(P(70, "seventy 2"));
+ c2.insert(P(80, "eighty 2"));
+ assert(testEquality(c1, c2, false));
+ }
#endif
- // Make sure we take into account the number of times that a key repeats into equality.
- {
- typedef std::pair<int, char> P;
- P a[] = {P(1, 'a'), P(1, 'b'), P(1, 'd'), P(2, 'b')};
- P b[] = {P(1, 'a'), P(1, 'b'), P(1, 'b'), P(1, 'd'), P(2, 'b')};
+ // Make sure we take into account the number of times that a key repeats into equality.
+ {
+ typedef std::pair<int, char> P;
+ P a[] = {P(1, 'a'), P(1, 'b'), P(1, 'd'), P(2, 'b')};
+ P b[] = {P(1, 'a'), P(1, 'b'), P(1, 'b'), P(1, 'd'), P(2, 'b')};
- std::unordered_multimap<int, char> c1(std::begin(a), std::end(a));
- std::unordered_multimap<int, char> c2(std::begin(b), std::end(b));
- assert(testEquality(c1, c2, false));
- }
+ std::unordered_multimap<int, char> c1(std::begin(a), std::end(a));
+ std::unordered_multimap<int, char> c2(std::begin(b), std::end(b));
+ assert(testEquality(c1, c2, false));
+ }
- // Make sure we incorporate the values into the equality of the maps.
- // If we were to compare only the keys (including how many time each key repeats),
- // the following test would fail cause only the values
diff er.
- {
- typedef std::pair<int, char> P;
- P a[] = {P(1, 'a'), P(1, 'b'), P(1, 'd'), P(2, 'b')};
- P b[] = {P(1, 'a'), P(1, 'b'), P(1, 'E'), P(2, 'b')};
- // ^
diff erent here
+ // Make sure we incorporate the values into the equality of the maps.
+ // If we were to compare only the keys (including how many time each key repeats),
+ // the following test would fail cause only the values
diff er.
+ {
+ typedef std::pair<int, char> P;
+ P a[] = {P(1, 'a'), P(1, 'b'), P(1, 'd'), P(2, 'b')};
+ P b[] = {P(1, 'a'), P(1, 'b'), P(1, 'E'), P(2, 'b')};
+ // ^
diff erent here
- std::unordered_multimap<int, char> c1(std::begin(a), std::end(a));
- std::unordered_multimap<int, char> c2(std::begin(b), std::end(b));
- assert(testEquality(c1, c2, false));
- }
+ std::unordered_multimap<int, char> c1(std::begin(a), std::end(a));
+ std::unordered_multimap<int, char> c2(std::begin(b), std::end(b));
+ assert(testEquality(c1, c2, false));
+ }
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/equal_range.transparent.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/equal_range.transparent.pass.cpp
index 85248e59d780e1c..2f47e8d62581786 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/equal_range.transparent.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/equal_range.transparent.pass.cpp
@@ -21,44 +21,43 @@
#include "test_transparent_unordered.h"
-int main(int, char**)
-{
- using key_type = StoredType<int>;
-
- {
- // Make sure conversions don't happen for transparent non-final hasher and key_equal
- using M = unord_map_type<std::unordered_multimap, transparent_hash, std::equal_to<>>;
- test_transparent_equal_range<M>({{1, 2}, {1, 3}, {2, 3}});
- test_transparent_equal_range<const M>({{1, 2}, {1, 3}, {2, 3}});
- }
-
- {
- // Make sure conversions don't happen for transparent final hasher and key_equal
- using M = unord_map_type<std::unordered_multimap, transparent_hash_final, transparent_equal_final>;
- test_transparent_equal_range<M>({{1, 2}, {1, 3}, {2, 3}});
- test_transparent_equal_range<const M>({{1, 2}, {1, 3}, {2, 3}});
- }
-
- {
- // Make sure conversions do happen for non-transparent hasher
- using M = unord_map_type<std::unordered_multimap, non_transparent_hash, std::equal_to<>>;
- test_non_transparent_equal_range<M>({{1, 2}, {1, 3}, {2, 3}});
- test_non_transparent_equal_range<const M>({{1, 2}, {1, 3}, {2, 3}});
- }
-
- {
- // Make sure conversions do happen for non-transparent key_equal
- using M = unord_map_type<std::unordered_multimap, transparent_hash, std::equal_to<key_type>>;
- test_non_transparent_equal_range<M>({{1, 2}, {1, 3}, {2, 3}});
- test_non_transparent_equal_range<const M>({{1, 2}, {1, 3}, {2, 3}});
- }
-
- {
- // Make sure conversions do happen for both non-transparent hasher and key_equal
- using M = unord_map_type<std::unordered_multimap, non_transparent_hash, std::equal_to<key_type>>;
- test_non_transparent_equal_range<M>({{1, 2}, {1, 3}, {2, 3}});
- test_non_transparent_equal_range<const M>({{1, 2}, {1, 3}, {2, 3}});
- }
-
- return 0;
+int main(int, char**) {
+ using key_type = StoredType<int>;
+
+ {
+ // Make sure conversions don't happen for transparent non-final hasher and key_equal
+ using M = unord_map_type<std::unordered_multimap, transparent_hash, std::equal_to<>>;
+ test_transparent_equal_range<M>({{1, 2}, {1, 3}, {2, 3}});
+ test_transparent_equal_range<const M>({{1, 2}, {1, 3}, {2, 3}});
+ }
+
+ {
+ // Make sure conversions don't happen for transparent final hasher and key_equal
+ using M = unord_map_type<std::unordered_multimap, transparent_hash_final, transparent_equal_final>;
+ test_transparent_equal_range<M>({{1, 2}, {1, 3}, {2, 3}});
+ test_transparent_equal_range<const M>({{1, 2}, {1, 3}, {2, 3}});
+ }
+
+ {
+ // Make sure conversions do happen for non-transparent hasher
+ using M = unord_map_type<std::unordered_multimap, non_transparent_hash, std::equal_to<>>;
+ test_non_transparent_equal_range<M>({{1, 2}, {1, 3}, {2, 3}});
+ test_non_transparent_equal_range<const M>({{1, 2}, {1, 3}, {2, 3}});
+ }
+
+ {
+ // Make sure conversions do happen for non-transparent key_equal
+ using M = unord_map_type<std::unordered_multimap, transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_equal_range<M>({{1, 2}, {1, 3}, {2, 3}});
+ test_non_transparent_equal_range<const M>({{1, 2}, {1, 3}, {2, 3}});
+ }
+
+ {
+ // Make sure conversions do happen for both non-transparent hasher and key_equal
+ using M = unord_map_type<std::unordered_multimap, non_transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_equal_range<M>({{1, 2}, {1, 3}, {2, 3}});
+ test_non_transparent_equal_range<const M>({{1, 2}, {1, 3}, {2, 3}});
+ }
+
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/equal_range_const.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/equal_range_const.pass.cpp
index c827ae5009a6749..1c5c5c1d1c8760b 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/equal_range_const.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/equal_range_const.pass.cpp
@@ -23,84 +23,83 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multimap<int, std::string> C;
- typedef C::const_iterator I;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(50, "fiftyA"),
- P(50, "fiftyB"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- const C c(std::begin(a), std::end(a));
- std::pair<I, I> r = c.equal_range(30);
- assert(std::distance(r.first, r.second) == 1);
- assert(r.first->first == 30);
- assert(r.first->second == "thirty");
- r = c.equal_range(5);
- assert(std::distance(r.first, r.second) == 0);
- r = c.equal_range(50);
- std::set<std::string> s;
- s.insert("fifty");
- s.insert("fiftyA");
- s.insert("fiftyB");
- for ( int i = 0; i < 3; ++i )
- {
- assert(r.first->first == 50);
- assert(s.find(r.first->second) != s.end());
- s.erase(s.find(r.first->second));
- ++r.first;
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<int, std::string> C;
+ typedef C::const_iterator I;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(50, "fiftyA"),
+ P(50, "fiftyB"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ const C c(std::begin(a), std::end(a));
+ std::pair<I, I> r = c.equal_range(30);
+ assert(std::distance(r.first, r.second) == 1);
+ assert(r.first->first == 30);
+ assert(r.first->second == "thirty");
+ r = c.equal_range(5);
+ assert(std::distance(r.first, r.second) == 0);
+ r = c.equal_range(50);
+ std::set<std::string> s;
+ s.insert("fifty");
+ s.insert("fiftyA");
+ s.insert("fiftyB");
+ for (int i = 0; i < 3; ++i) {
+ assert(r.first->first == 50);
+ assert(s.find(r.first->second) != s.end());
+ s.erase(s.find(r.first->second));
+ ++r.first;
}
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef C::const_iterator I;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(50, "fiftyA"),
- P(50, "fiftyB"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- const C c(std::begin(a), std::end(a));
- std::pair<I, I> r = c.equal_range(30);
- assert(std::distance(r.first, r.second) == 1);
- assert(r.first->first == 30);
- assert(r.first->second == "thirty");
- r = c.equal_range(5);
- assert(std::distance(r.first, r.second) == 0);
- r = c.equal_range(50);
- std::set<std::string> s;
- s.insert("fifty");
- s.insert("fiftyA");
- s.insert("fiftyB");
- for ( int i = 0; i < 3; ++i )
- {
- assert(r.first->first == 50);
- assert(s.find(r.first->second) != s.end());
- s.erase(s.find(r.first->second));
- ++r.first;
- }
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef C::const_iterator I;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(50, "fiftyA"),
+ P(50, "fiftyB"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ const C c(std::begin(a), std::end(a));
+ std::pair<I, I> r = c.equal_range(30);
+ assert(std::distance(r.first, r.second) == 1);
+ assert(r.first->first == 30);
+ assert(r.first->second == "thirty");
+ r = c.equal_range(5);
+ assert(std::distance(r.first, r.second) == 0);
+ r = c.equal_range(50);
+ std::set<std::string> s;
+ s.insert("fifty");
+ s.insert("fiftyA");
+ s.insert("fiftyB");
+ for (int i = 0; i < 3; ++i) {
+ assert(r.first->first == 50);
+ assert(s.find(r.first->second) != s.end());
+ s.erase(s.find(r.first->second));
+ ++r.first;
}
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multimap/equal_range_non_const.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/equal_range_non_const.pass.cpp
index 6cfa586d5a17ebd..af2277221c17d45 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/equal_range_non_const.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/equal_range_non_const.pass.cpp
@@ -23,84 +23,83 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multimap<int, std::string> C;
- typedef C::iterator I;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(50, "fiftyA"),
- P(50, "fiftyB"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- C c(std::begin(a), std::end(a));
- std::pair<I, I> r = c.equal_range(30);
- assert(std::distance(r.first, r.second) == 1);
- assert(r.first->first == 30);
- assert(r.first->second == "thirty");
- r = c.equal_range(5);
- assert(std::distance(r.first, r.second) == 0);
- r = c.equal_range(50);
- std::set<std::string> s;
- s.insert("fifty");
- s.insert("fiftyA");
- s.insert("fiftyB");
- for ( int i = 0; i < 3; ++i )
- {
- assert(r.first->first == 50);
- assert(s.find(r.first->second) != s.end());
- s.erase(s.find(r.first->second));
- ++r.first;
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<int, std::string> C;
+ typedef C::iterator I;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(50, "fiftyA"),
+ P(50, "fiftyB"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c(std::begin(a), std::end(a));
+ std::pair<I, I> r = c.equal_range(30);
+ assert(std::distance(r.first, r.second) == 1);
+ assert(r.first->first == 30);
+ assert(r.first->second == "thirty");
+ r = c.equal_range(5);
+ assert(std::distance(r.first, r.second) == 0);
+ r = c.equal_range(50);
+ std::set<std::string> s;
+ s.insert("fifty");
+ s.insert("fiftyA");
+ s.insert("fiftyB");
+ for (int i = 0; i < 3; ++i) {
+ assert(r.first->first == 50);
+ assert(s.find(r.first->second) != s.end());
+ s.erase(s.find(r.first->second));
+ ++r.first;
}
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef C::iterator I;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(50, "fiftyA"),
- P(50, "fiftyB"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- C c(std::begin(a), std::end(a));
- std::pair<I, I> r = c.equal_range(30);
- assert(std::distance(r.first, r.second) == 1);
- assert(r.first->first == 30);
- assert(r.first->second == "thirty");
- r = c.equal_range(5);
- assert(std::distance(r.first, r.second) == 0);
- r = c.equal_range(50);
- std::set<std::string> s;
- s.insert("fifty");
- s.insert("fiftyA");
- s.insert("fiftyB");
- for ( int i = 0; i < 3; ++i )
- {
- assert(r.first->first == 50);
- assert(s.find(r.first->second) != s.end());
- s.erase(s.find(r.first->second));
- ++r.first;
- }
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef C::iterator I;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(50, "fiftyA"),
+ P(50, "fiftyB"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c(std::begin(a), std::end(a));
+ std::pair<I, I> r = c.equal_range(30);
+ assert(std::distance(r.first, r.second) == 1);
+ assert(r.first->first == 30);
+ assert(r.first->second == "thirty");
+ r = c.equal_range(5);
+ assert(std::distance(r.first, r.second) == 0);
+ r = c.equal_range(50);
+ std::set<std::string> s;
+ s.insert("fifty");
+ s.insert("fiftyA");
+ s.insert("fiftyB");
+ for (int i = 0; i < 3; ++i) {
+ assert(r.first->first == 50);
+ assert(s.find(r.first->second) != s.end());
+ s.erase(s.find(r.first->second));
+ ++r.first;
}
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multimap/erase_if.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/erase_if.pass.cpp
index 90a6cae088c4fdb..2f4ef2c010e4cb5 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/erase_if.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/erase_if.pass.cpp
@@ -22,12 +22,11 @@
using Init = std::initializer_list<int>;
template <typename M>
-M make (Init vals)
-{
- M ret;
- for (int v : vals)
- ret.emplace(static_cast<typename M::key_type>(v), static_cast<typename M::mapped_type>(v + 10));
- return ret;
+M make(Init vals) {
+ M ret;
+ for (int v : vals)
+ ret.emplace(static_cast<typename M::key_type>(v), static_cast<typename M::mapped_type>(v + 10));
+ return ret;
}
template <typename M, typename Pred>
@@ -40,52 +39,56 @@ void test0(Init vals, Pred p, Init expected, std::size_t expected_erased_count)
}
template <typename S>
-void test()
-{
- auto is1 = [](auto v) { return v.first == 1;};
- auto is2 = [](auto v) { return v.first == 2;};
- auto is3 = [](auto v) { return v.first == 3;};
- auto is4 = [](auto v) { return v.first == 4;};
- auto True = [](auto) { return true; };
- auto False = [](auto) { return false; };
-
- test0<S>({}, is1, {}, 0);
-
- test0<S>({1}, is1, {}, 1);
- test0<S>({1}, is2, {1}, 0);
-
- test0<S>({1, 2}, is1, {2}, 1);
- test0<S>({1, 2}, is2, {1}, 1);
- test0<S>({1, 2}, is3, {1, 2}, 0);
- test0<S>({1, 1}, is1, {}, 2);
- test0<S>({1, 1}, is3, {1, 1}, 0);
-
- test0<S>({1, 2, 3}, is1, {2, 3}, 1);
- test0<S>({1, 2, 3}, is2, {1, 3}, 1);
- test0<S>({1, 2, 3}, is3, {1, 2}, 1);
- test0<S>({1, 2, 3}, is4, {1, 2, 3}, 0);
-
- test0<S>({1, 1, 1}, is1, {}, 3);
- test0<S>({1, 1, 1}, is2, {1, 1, 1}, 0);
- test0<S>({1, 1, 2}, is1, {2}, 2);
- test0<S>({1, 1, 2}, is2, {1, 1}, 1);
- test0<S>({1, 1, 2}, is3, {1, 1, 2}, 0);
- test0<S>({1, 2, 2}, is1, {2, 2}, 1);
- test0<S>({1, 2, 2}, is2, {1}, 2);
- test0<S>({1, 2, 2}, is3, {1, 2, 2}, 0);
-
- test0<S>({1, 2, 3}, True, {}, 3);
- test0<S>({1, 2, 3}, False, {1, 2, 3}, 0);
+void test() {
+ auto is1 = [](auto v) { return v.first == 1; };
+ auto is2 = [](auto v) { return v.first == 2; };
+ auto is3 = [](auto v) { return v.first == 3; };
+ auto is4 = [](auto v) { return v.first == 4; };
+ auto True = [](auto) { return true; };
+ auto False = [](auto) { return false; };
+
+ test0<S>({}, is1, {}, 0);
+
+ test0<S>({1}, is1, {}, 1);
+ test0<S>({1}, is2, {1}, 0);
+
+ test0<S>({1, 2}, is1, {2}, 1);
+ test0<S>({1, 2}, is2, {1}, 1);
+ test0<S>({1, 2}, is3, {1, 2}, 0);
+ test0<S>({1, 1}, is1, {}, 2);
+ test0<S>({1, 1}, is3, {1, 1}, 0);
+
+ test0<S>({1, 2, 3}, is1, {2, 3}, 1);
+ test0<S>({1, 2, 3}, is2, {1, 3}, 1);
+ test0<S>({1, 2, 3}, is3, {1, 2}, 1);
+ test0<S>({1, 2, 3}, is4, {1, 2, 3}, 0);
+
+ test0<S>({1, 1, 1}, is1, {}, 3);
+ test0<S>({1, 1, 1}, is2, {1, 1, 1}, 0);
+ test0<S>({1, 1, 2}, is1, {2}, 2);
+ test0<S>({1, 1, 2}, is2, {1, 1}, 1);
+ test0<S>({1, 1, 2}, is3, {1, 1, 2}, 0);
+ test0<S>({1, 2, 2}, is1, {2, 2}, 1);
+ test0<S>({1, 2, 2}, is2, {1}, 2);
+ test0<S>({1, 2, 2}, is3, {1, 2, 2}, 0);
+
+ test0<S>({1, 2, 3}, True, {}, 3);
+ test0<S>({1, 2, 3}, False, {1, 2, 3}, 0);
}
-int main(int, char**)
-{
- test<std::unordered_multimap<int, int>>();
- test<std::unordered_multimap<int, int, std::hash<int>, std::equal_to<int>, min_allocator<std::pair<const int, int>>>> ();
- test<std::unordered_multimap<int, int, std::hash<int>, std::equal_to<int>, test_allocator<std::pair<const int, int>>>> ();
-
- test<std::unordered_multimap<long, short>>();
- test<std::unordered_multimap<short, double>>();
+int main(int, char**) {
+ test<std::unordered_multimap<int, int>>();
+ test<
+ std::
+ unordered_multimap<int, int, std::hash<int>, std::equal_to<int>, min_allocator<std::pair<const int, int>>>>();
+ test<std::unordered_multimap<int,
+ int,
+ std::hash<int>,
+ std::equal_to<int>,
+ test_allocator<std::pair<const int, int>>>>();
+
+ test<std::unordered_multimap<long, short>>();
+ test<std::unordered_multimap<short, double>>();
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/find.transparent.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/find.transparent.pass.cpp
index 4a32248b13ad6aa..18351e398d389dc 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/find.transparent.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/find.transparent.pass.cpp
@@ -21,44 +21,43 @@
#include "test_transparent_unordered.h"
-int main(int, char**)
-{
- using key_type = StoredType<int>;
-
- {
- // Make sure conversions don't happen for transparent non-final hasher and key_equal
- using M = unord_map_type<std::unordered_multimap, transparent_hash, std::equal_to<>>;
- test_transparent_find<M>({{1, 2}, {1, 3}, {2, 3}});
- test_transparent_find<const M>({{1, 2}, {1, 3}, {2, 3}});
- }
-
- {
- // Make sure conversions don't happen for transparent final hasher and key_equal
- using M = unord_map_type<std::unordered_multimap, transparent_hash_final, transparent_equal_final>;
- test_transparent_find<M>({{1, 2}, {1, 3}, {2, 3}});
- test_transparent_find<const M>({{1, 2}, {1, 3}, {2, 3}});
- }
-
- {
- // Make sure conversions do happen for non-transparent hasher
- using M = unord_map_type<std::unordered_multimap, non_transparent_hash, std::equal_to<>>;
- test_non_transparent_find<M>({{1, 2}, {1, 3}, {2, 3}});
- test_non_transparent_find<const M>({{1, 2}, {1, 3}, {2, 3}});
- }
-
- {
- // Make sure conversions do happen for non-transparent key_equal
- using M = unord_map_type<std::unordered_multimap, transparent_hash, std::equal_to<key_type>>;
- test_non_transparent_find<M>({{1, 2}, {1, 3}, {2, 3}});
- test_non_transparent_find<const M>({{1, 2}, {1, 3}, {2, 3}});
- }
-
- {
- // Make sure conversions do happen for both non-transparent hasher and key_equal
- using M = unord_map_type<std::unordered_multimap, non_transparent_hash, std::equal_to<key_type>>;
- test_non_transparent_find<M>({{1, 2}, {1, 3}, {2, 3}});
- test_non_transparent_find<const M>({{1, 2}, {1, 3}, {2, 3}});
- }
-
- return 0;
+int main(int, char**) {
+ using key_type = StoredType<int>;
+
+ {
+ // Make sure conversions don't happen for transparent non-final hasher and key_equal
+ using M = unord_map_type<std::unordered_multimap, transparent_hash, std::equal_to<>>;
+ test_transparent_find<M>({{1, 2}, {1, 3}, {2, 3}});
+ test_transparent_find<const M>({{1, 2}, {1, 3}, {2, 3}});
+ }
+
+ {
+ // Make sure conversions don't happen for transparent final hasher and key_equal
+ using M = unord_map_type<std::unordered_multimap, transparent_hash_final, transparent_equal_final>;
+ test_transparent_find<M>({{1, 2}, {1, 3}, {2, 3}});
+ test_transparent_find<const M>({{1, 2}, {1, 3}, {2, 3}});
+ }
+
+ {
+ // Make sure conversions do happen for non-transparent hasher
+ using M = unord_map_type<std::unordered_multimap, non_transparent_hash, std::equal_to<>>;
+ test_non_transparent_find<M>({{1, 2}, {1, 3}, {2, 3}});
+ test_non_transparent_find<const M>({{1, 2}, {1, 3}, {2, 3}});
+ }
+
+ {
+ // Make sure conversions do happen for non-transparent key_equal
+ using M = unord_map_type<std::unordered_multimap, transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_find<M>({{1, 2}, {1, 3}, {2, 3}});
+ test_non_transparent_find<const M>({{1, 2}, {1, 3}, {2, 3}});
+ }
+
+ {
+ // Make sure conversions do happen for both non-transparent hasher and key_equal
+ using M = unord_map_type<std::unordered_multimap, non_transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_find<M>({{1, 2}, {1, 3}, {2, 3}});
+ test_non_transparent_find<const M>({{1, 2}, {1, 3}, {2, 3}});
+ }
+
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/find_const.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/find_const.pass.cpp
index d9ccd868896c7d4..0da245bc2a943a9 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/find_const.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/find_const.pass.cpp
@@ -22,52 +22,53 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multimap<int, std::string> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- const C c(std::begin(a), std::end(a));
- C::const_iterator i = c.find(30);
- assert(i->first == 30);
- assert(i->second == "thirty");
- i = c.find(5);
- assert(i == c.cend());
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ const C c(std::begin(a), std::end(a));
+ C::const_iterator i = c.find(30);
+ assert(i->first == 30);
+ assert(i->second == "thirty");
+ i = c.find(5);
+ assert(i == c.cend());
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- const C c(std::begin(a), std::end(a));
- C::const_iterator i = c.find(30);
- assert(i->first == 30);
- assert(i->second == "thirty");
- i = c.find(5);
- assert(i == c.cend());
- }
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ const C c(std::begin(a), std::end(a));
+ C::const_iterator i = c.find(30);
+ assert(i->first == 30);
+ assert(i->second == "thirty");
+ i = c.find(5);
+ assert(i == c.cend());
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multimap/find_non_const.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/find_non_const.pass.cpp
index 5f9b60fdfdc84af..9a73008c4e15ec0 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/find_non_const.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/find_non_const.pass.cpp
@@ -22,52 +22,53 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multimap<int, std::string> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- C c(std::begin(a), std::end(a));
- C::iterator i = c.find(30);
- assert(i->first == 30);
- assert(i->second == "thirty");
- i = c.find(5);
- assert(i == c.end());
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c(std::begin(a), std::end(a));
+ C::iterator i = c.find(30);
+ assert(i->first == 30);
+ assert(i->second == "thirty");
+ i = c.find(5);
+ assert(i == c.end());
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- C c(std::begin(a), std::end(a));
- C::iterator i = c.find(30);
- assert(i->first == 30);
- assert(i->second == "thirty");
- i = c.find(5);
- assert(i == c.end());
- }
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c(std::begin(a), std::end(a));
+ C::iterator i = c.find(30);
+ assert(i->first == 30);
+ assert(i->second == "thirty");
+ i = c.find(5);
+ assert(i == c.end());
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multimap/get_allocator.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/get_allocator.pass.cpp
index 2cca55894902660..0a8d6c4d098ebe9 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/get_allocator.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/get_allocator.pass.cpp
@@ -20,19 +20,18 @@
#include "test_macros.h"
int main(int, char**) {
- typedef std::pair<const int, std::string> ValueType;
- {
- std::allocator<ValueType> alloc;
- const std::unordered_multimap<int, std::string> m(alloc);
- assert(m.get_allocator() == alloc);
- }
- {
- other_allocator<ValueType> alloc(1);
- const std::unordered_multimap<int, std::string, std::hash<int>,
- std::equal_to<int>,
- other_allocator<ValueType> > m(alloc);
- assert(m.get_allocator() == alloc);
- }
+ typedef std::pair<const int, std::string> ValueType;
+ {
+ std::allocator<ValueType> alloc;
+ const std::unordered_multimap<int, std::string> m(alloc);
+ assert(m.get_allocator() == alloc);
+ }
+ {
+ other_allocator<ValueType> alloc(1);
+ const std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>, other_allocator<ValueType> > m(
+ alloc);
+ assert(m.get_allocator() == alloc);
+ }
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/incomplete.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/incomplete.pass.cpp
index 5d76e6f83e9892d..2cc33030b552c5b 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/incomplete.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/incomplete.pass.cpp
@@ -19,22 +19,22 @@
template <class Tp>
struct MyHash {
MyHash() {}
- std::size_t operator()(Tp const&) const {return 42;}
+ std::size_t operator()(Tp const&) const { return 42; }
};
struct A {
- typedef std::unordered_multimap<A, A, MyHash<A> > Map;
- Map m;
- Map::iterator it;
- Map::const_iterator cit;
- Map::local_iterator lit;
- Map::const_local_iterator clit;
+ typedef std::unordered_multimap<A, A, MyHash<A> > Map;
+ Map m;
+ Map::iterator it;
+ Map::const_iterator cit;
+ Map::local_iterator lit;
+ Map::const_local_iterator clit;
};
inline bool operator==(A const& L, A const& R) { return &L == &R; }
int main(int, char**) {
- A a;
+ A a;
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/iterator_concept_conformance.compile.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/iterator_concept_conformance.compile.pass.cpp
index 5b1b25a855edeff..b1a969d843ee5a9 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/iterator_concept_conformance.compile.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/iterator_concept_conformance.compile.pass.cpp
@@ -16,11 +16,11 @@
#include "test_macros.h"
-using iterator = std::unordered_multimap<int, int>::iterator;
-using const_iterator = std::unordered_multimap<int, int>::const_iterator;
-using local_iterator = std::unordered_multimap<int, int>::local_iterator;
+using iterator = std::unordered_multimap<int, int>::iterator;
+using const_iterator = std::unordered_multimap<int, int>::const_iterator;
+using local_iterator = std::unordered_multimap<int, int>::local_iterator;
using const_local_iterator = std::unordered_multimap<int, int>::const_local_iterator;
-using value_type = std::pair<const int, int>;
+using value_type = std::pair<const int, int>;
static_assert(std::forward_iterator<iterator>);
LIBCPP_STATIC_ASSERT(!std::bidirectional_iterator<iterator>);
diff --git a/libcxx/test/std/containers/unord/unord.multimap/iterators.compile.fail.cpp b/libcxx/test/std/containers/unord/unord.multimap/iterators.compile.fail.cpp
index 0c1b50fac059c43..9b9c25e39f355a4 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/iterators.compile.fail.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/iterators.compile.fail.cpp
@@ -25,48 +25,45 @@
#include "test_macros.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multimap<int, std::string> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
- C::iterator i = c.begin();
- i->second = "ONE";
- assert(i->second == "ONE");
- i->first = 2;
- }
- {
- typedef std::unordered_multimap<int, std::string> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- const C c(a, a + sizeof(a)/sizeof(a[0]));
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ C::iterator i = c.begin();
+ i->second = "ONE";
+ assert(i->second == "ONE");
+ i->first = 2;
+ }
+ {
+ typedef std::unordered_multimap<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ const C c(a, a + sizeof(a) / sizeof(a[0]));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/iterators.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/iterators.pass.cpp
index 5fd52beebbc7423..d8ff8e72ad90ed5 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/iterators.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/iterators.pass.cpp
@@ -27,110 +27,113 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multimap<int, std::string> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 7);
- assert(c.size() == 6);
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- C::iterator i;
- i = c.begin();
- i->second = "ONE";
- assert(i->second == "ONE");
- }
- {
- typedef std::unordered_multimap<int, std::string> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- const C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 7);
- assert(c.size() == 6);
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- C::const_iterator i;
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 7);
+ assert(c.size() == 6);
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ C::iterator i;
+ i = c.begin();
+ i->second = "ONE";
+ assert(i->second == "ONE");
+ }
+ {
+ typedef std::unordered_multimap<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ const C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 7);
+ assert(c.size() == 6);
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ C::const_iterator i;
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 7);
- assert(c.size() == 6);
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- C::iterator i;
- i = c.begin();
- i->second = "ONE";
- assert(i->second == "ONE");
- }
- {
- typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- const C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 7);
- assert(c.size() == 6);
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- C::const_iterator i;
- }
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 7);
+ assert(c.size() == 6);
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ C::iterator i;
+ i = c.begin();
+ i->second = "ONE";
+ assert(i->second == "ONE");
+ }
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ const C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 7);
+ assert(c.size() == 6);
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ C::const_iterator i;
+ }
#endif
#if TEST_STD_VER > 11
- { // N3644 testing
- typedef std::unordered_multimap<int,double> C;
- C::iterator ii1{}, ii2{};
- C::iterator ii4 = ii1;
- C::const_iterator cii{};
- assert ( ii1 == ii2 );
- assert ( ii1 == ii4 );
+ { // N3644 testing
+ typedef std::unordered_multimap<int, double> C;
+ C::iterator ii1{}, ii2{};
+ C::iterator ii4 = ii1;
+ C::const_iterator cii{};
+ assert(ii1 == ii2);
+ assert(ii1 == ii4);
- assert (!(ii1 != ii2 ));
+ assert(!(ii1 != ii2));
- assert ( (ii1 == cii ));
- assert ( (cii == ii1 ));
- assert (!(ii1 != cii ));
- assert (!(cii != ii1 ));
- }
+ assert((ii1 == cii));
+ assert((cii == ii1));
+ assert(!(ii1 != cii));
+ assert(!(cii != ii1));
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multimap/load_factor.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/load_factor.pass.cpp
index 81284edab8d4923..6cd2e28b0722935 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/load_factor.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/load_factor.pass.cpp
@@ -24,55 +24,60 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multimap<int, std::string> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- const C c(std::begin(a), std::end(a));
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- }
- {
- typedef std::unordered_multimap<int, std::string> C;
- const C c;
- assert(c.load_factor() == 0);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ const C c(std::begin(a), std::end(a));
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ }
+ {
+ typedef std::unordered_multimap<int, std::string> C;
+ const C c;
+ assert(c.load_factor() == 0);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- const C c(std::begin(a), std::end(a));
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- }
- {
- typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- const C c;
- assert(c.load_factor() == 0);
- }
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ const C c(std::begin(a), std::end(a));
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ }
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ const C c;
+ assert(c.load_factor() == 0);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multimap/local_iterators.compile.fail.cpp b/libcxx/test/std/containers/unord/unord.multimap/local_iterators.compile.fail.cpp
index f5af791804bddff..bcf307a0e2ef1ec 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/local_iterators.compile.fail.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/local_iterators.compile.fail.cpp
@@ -25,265 +25,260 @@
#include "test_macros.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multimap<int, std::string> C;
- typedef std::pair<int, std::string> P;
- typedef C::local_iterator I;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- LIBCPP_ASSERT(c.bucket_count() == 7);
- C::size_type b = c.bucket(0);
- I i = c.begin(b);
- I j = c.end(b);
- assert(std::distance(i, j) == 0);
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ typedef C::local_iterator I;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ C::size_type b = c.bucket(0);
+ I i = c.begin(b);
+ I j = c.end(b);
+ assert(std::distance(i, j) == 0);
- b = c.bucket(1);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 2);
- assert(i->first == 1);
- assert(i->second == "one");
- ++i;
- assert(i->first == 1);
- assert(i->second == "four");
- i->first = 2;
+ b = c.bucket(1);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 2);
+ assert(i->first == 1);
+ assert(i->second == "one");
+ ++i;
+ assert(i->first == 1);
+ assert(i->second == "four");
+ i->first = 2;
- b = c.bucket(2);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 2);
- assert(i->first == 2);
- assert(i->second == "two");
- ++i;
- assert(i->first == 2);
- assert(i->second == "four");
+ b = c.bucket(2);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 2);
+ assert(i->first == 2);
+ assert(i->second == "two");
+ ++i;
+ assert(i->first == 2);
+ assert(i->second == "four");
- b = c.bucket(3);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 3);
- assert(i->second == "three");
+ b = c.bucket(3);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 3);
+ assert(i->second == "three");
- b = c.bucket(4);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 4);
- assert(i->second == "four");
+ b = c.bucket(4);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 4);
+ assert(i->second == "four");
- b = c.bucket(5);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 0);
+ b = c.bucket(5);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 0);
- b = c.bucket(6);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 0);
- }
- {
- typedef std::unordered_multimap<int, std::string> C;
- typedef std::pair<int, std::string> P;
- typedef C::const_local_iterator I;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- const C c(a, a + sizeof(a)/sizeof(a[0]));
- LIBCPP_ASSERT(c.bucket_count() == 7);
- C::size_type b = c.bucket(0);
- I i = c.begin(b);
- I j = c.end(b);
- assert(std::distance(i, j) == 0);
+ b = c.bucket(6);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 0);
+ }
+ {
+ typedef std::unordered_multimap<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ typedef C::const_local_iterator I;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ const C c(a, a + sizeof(a) / sizeof(a[0]));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ C::size_type b = c.bucket(0);
+ I i = c.begin(b);
+ I j = c.end(b);
+ assert(std::distance(i, j) == 0);
- b = c.bucket(1);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 2);
- assert(i->first == 1);
- assert(i->second == "one");
- ++i;
- assert(i->first == 1);
- assert(i->second == "four");
+ b = c.bucket(1);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 2);
+ assert(i->first == 1);
+ assert(i->second == "one");
+ ++i;
+ assert(i->first == 1);
+ assert(i->second == "four");
- b = c.bucket(2);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 2);
- assert(i->first == 2);
- assert(i->second == "two");
- ++i;
- assert(i->first == 2);
- assert(i->second == "four");
+ b = c.bucket(2);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 2);
+ assert(i->first == 2);
+ assert(i->second == "two");
+ ++i;
+ assert(i->first == 2);
+ assert(i->second == "four");
- b = c.bucket(3);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 3);
- assert(i->second == "three");
+ b = c.bucket(3);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 3);
+ assert(i->second == "three");
- b = c.bucket(4);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 4);
- assert(i->second == "four");
+ b = c.bucket(4);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 4);
+ assert(i->second == "four");
- b = c.bucket(5);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 0);
+ b = c.bucket(5);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 0);
- b = c.bucket(6);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 0);
- }
- {
- typedef std::unordered_multimap<int, std::string> C;
- typedef std::pair<int, std::string> P;
- typedef C::const_local_iterator I;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- LIBCPP_ASSERT(c.bucket_count() == 7);
- C::size_type b = c.bucket(0);
- I i = c.cbegin(b);
- I j = c.cend(b);
- assert(std::distance(i, j) == 0);
+ b = c.bucket(6);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 0);
+ }
+ {
+ typedef std::unordered_multimap<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ typedef C::const_local_iterator I;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ C::size_type b = c.bucket(0);
+ I i = c.cbegin(b);
+ I j = c.cend(b);
+ assert(std::distance(i, j) == 0);
- b = c.bucket(1);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 2);
- assert(i->first == 1);
- assert(i->second == "one");
- ++i;
- assert(i->first == 1);
- assert(i->second == "four");
+ b = c.bucket(1);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 2);
+ assert(i->first == 1);
+ assert(i->second == "one");
+ ++i;
+ assert(i->first == 1);
+ assert(i->second == "four");
- b = c.bucket(2);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 2);
- assert(i->first == 2);
- assert(i->second == "two");
- ++i;
- assert(i->first == 2);
- assert(i->second == "four");
+ b = c.bucket(2);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 2);
+ assert(i->first == 2);
+ assert(i->second == "two");
+ ++i;
+ assert(i->first == 2);
+ assert(i->second == "four");
- b = c.bucket(3);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 3);
- assert(i->second == "three");
+ b = c.bucket(3);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 3);
+ assert(i->second == "three");
- b = c.bucket(4);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 4);
- assert(i->second == "four");
+ b = c.bucket(4);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 4);
+ assert(i->second == "four");
- b = c.bucket(5);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 0);
+ b = c.bucket(5);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 0);
- b = c.bucket(6);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 0);
- }
- {
- typedef std::unordered_multimap<int, std::string> C;
- typedef std::pair<int, std::string> P;
- typedef C::const_local_iterator I;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- const C c(a, a + sizeof(a)/sizeof(a[0]));
- LIBCPP_ASSERT(c.bucket_count() == 7);
- C::size_type b = c.bucket(0);
- I i = c.cbegin(b);
- I j = c.cend(b);
- assert(std::distance(i, j) == 0);
+ b = c.bucket(6);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+ }
+ {
+ typedef std::unordered_multimap<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ typedef C::const_local_iterator I;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ const C c(a, a + sizeof(a) / sizeof(a[0]));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ C::size_type b = c.bucket(0);
+ I i = c.cbegin(b);
+ I j = c.cend(b);
+ assert(std::distance(i, j) == 0);
- b = c.bucket(1);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 2);
- assert(i->first == 1);
- assert(i->second == "one");
- ++i;
- assert(i->first == 1);
- assert(i->second == "four");
+ b = c.bucket(1);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 2);
+ assert(i->first == 1);
+ assert(i->second == "one");
+ ++i;
+ assert(i->first == 1);
+ assert(i->second == "four");
- b = c.bucket(2);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 2);
- assert(i->first == 2);
- assert(i->second == "two");
- ++i;
- assert(i->first == 2);
- assert(i->second == "four");
+ b = c.bucket(2);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 2);
+ assert(i->first == 2);
+ assert(i->second == "two");
+ ++i;
+ assert(i->first == 2);
+ assert(i->second == "four");
- b = c.bucket(3);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 3);
- assert(i->second == "three");
+ b = c.bucket(3);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 3);
+ assert(i->second == "three");
- b = c.bucket(4);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 4);
- assert(i->second == "four");
+ b = c.bucket(4);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 4);
+ assert(i->second == "four");
- b = c.bucket(5);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 0);
+ b = c.bucket(5);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 0);
- b = c.bucket(6);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 0);
- }
+ b = c.bucket(6);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/local_iterators.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/local_iterators.pass.cpp
index 12b11aac8facea9..487c525d370c5f9 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/local_iterators.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/local_iterators.pass.cpp
@@ -27,637 +27,628 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ typedef C::local_iterator I;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 7);
+ C::size_type b = c.bucket(0);
+ I i = c.begin(b);
+ I j = c.end(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 2);
{
- typedef std::unordered_multimap<int, std::string> C;
- typedef std::pair<int, std::string> P;
- typedef C::local_iterator I;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 7);
- C::size_type b = c.bucket(0);
- I i = c.begin(b);
- I j = c.end(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(1);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 2);
- {
- std::set<std::string> s;
- s.insert("one");
- s.insert("four");
- for ( int n = 0; n < 2; ++n )
- {
- assert(i->first == 1);
- assert(s.find(i->second) != s.end());
- s.erase(s.find(i->second));
- ++i;
- }
- }
-
- b = c.bucket(2);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 2);
- {
- std::set<std::string> s;
- s.insert("two");
- s.insert("four");
- for ( int n = 0; n < 2; ++n )
- {
- assert(i->first == 2);
- assert(s.find(i->second) != s.end());
- s.erase(s.find(i->second));
- ++i;
- }
- }
-
- b = c.bucket(3);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 3);
- assert(i->second == "three");
-
- b = c.bucket(4);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 4);
- assert(i->second == "four");
-
- b = c.bucket(5);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(6);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 0);
+ std::set<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ for (int n = 0; n < 2; ++n) {
+ assert(i->first == 1);
+ assert(s.find(i->second) != s.end());
+ s.erase(s.find(i->second));
+ ++i;
+ }
}
+
+ b = c.bucket(2);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 2);
+ {
+ std::set<std::string> s;
+ s.insert("two");
+ s.insert("four");
+ for (int n = 0; n < 2; ++n) {
+ assert(i->first == 2);
+ assert(s.find(i->second) != s.end());
+ s.erase(s.find(i->second));
+ ++i;
+ }
+ }
+
+ b = c.bucket(3);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 3);
+ assert(i->second == "three");
+
+ b = c.bucket(4);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 4);
+ assert(i->second == "four");
+
+ b = c.bucket(5);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(6);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 0);
+ }
+ {
+ typedef std::unordered_multimap<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ typedef C::const_local_iterator I;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ const C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 7);
+ C::size_type b = c.bucket(0);
+ I i = c.begin(b);
+ I j = c.end(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 2);
+ {
+ std::set<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ for (int n = 0; n < 2; ++n) {
+ assert(i->first == 1);
+ assert(s.find(i->second) != s.end());
+ s.erase(s.find(i->second));
+ ++i;
+ }
+ }
+
+ b = c.bucket(2);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 2);
+ {
+ std::set<std::string> s;
+ s.insert("two");
+ s.insert("four");
+ for (int n = 0; n < 2; ++n) {
+ assert(i->first == 2);
+ assert(s.find(i->second) != s.end());
+ s.erase(s.find(i->second));
+ ++i;
+ }
+ }
+
+ b = c.bucket(3);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 3);
+ assert(i->second == "three");
+
+ b = c.bucket(4);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 4);
+ assert(i->second == "four");
+
+ b = c.bucket(5);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(6);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 0);
+ }
+ {
+ typedef std::unordered_multimap<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ typedef C::const_local_iterator I;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 7);
+ C::size_type b = c.bucket(0);
+ I i = c.cbegin(b);
+ I j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 2);
+ {
+ std::set<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ for (int n = 0; n < 2; ++n) {
+ assert(i->first == 1);
+ assert(s.find(i->second) != s.end());
+ s.erase(s.find(i->second));
+ ++i;
+ }
+ }
+
+ b = c.bucket(2);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 2);
{
- typedef std::unordered_multimap<int, std::string> C;
- typedef std::pair<int, std::string> P;
- typedef C::const_local_iterator I;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- const C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 7);
- C::size_type b = c.bucket(0);
- I i = c.begin(b);
- I j = c.end(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(1);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 2);
- {
- std::set<std::string> s;
- s.insert("one");
- s.insert("four");
- for ( int n = 0; n < 2; ++n )
- {
- assert(i->first == 1);
- assert(s.find(i->second) != s.end());
- s.erase(s.find(i->second));
- ++i;
- }
- }
-
- b = c.bucket(2);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 2);
- {
- std::set<std::string> s;
- s.insert("two");
- s.insert("four");
- for ( int n = 0; n < 2; ++n )
- {
- assert(i->first == 2);
- assert(s.find(i->second) != s.end());
- s.erase(s.find(i->second));
- ++i;
- }
- }
-
- b = c.bucket(3);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 3);
- assert(i->second == "three");
-
- b = c.bucket(4);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 4);
- assert(i->second == "four");
-
- b = c.bucket(5);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(6);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 0);
+ std::set<std::string> s;
+ s.insert("two");
+ s.insert("four");
+ for (int n = 0; n < 2; ++n) {
+ assert(i->first == 2);
+ assert(s.find(i->second) != s.end());
+ s.erase(s.find(i->second));
+ ++i;
+ }
}
+
+ b = c.bucket(3);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 3);
+ assert(i->second == "three");
+
+ b = c.bucket(4);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 4);
+ assert(i->second == "four");
+
+ b = c.bucket(5);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(6);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+ }
+ {
+ typedef std::unordered_multimap<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ typedef C::const_local_iterator I;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ const C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 7);
+ C::size_type b = c.bucket(0);
+ I i = c.cbegin(b);
+ I j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 2);
{
- typedef std::unordered_multimap<int, std::string> C;
- typedef std::pair<int, std::string> P;
- typedef C::const_local_iterator I;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 7);
- C::size_type b = c.bucket(0);
- I i = c.cbegin(b);
- I j = c.cend(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(1);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 2);
- {
- std::set<std::string> s;
- s.insert("one");
- s.insert("four");
- for ( int n = 0; n < 2; ++n )
- {
- assert(i->first == 1);
- assert(s.find(i->second) != s.end());
- s.erase(s.find(i->second));
- ++i;
- }
- }
-
- b = c.bucket(2);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 2);
- {
- std::set<std::string> s;
- s.insert("two");
- s.insert("four");
- for ( int n = 0; n < 2; ++n )
- {
- assert(i->first == 2);
- assert(s.find(i->second) != s.end());
- s.erase(s.find(i->second));
- ++i;
- }
- }
-
- b = c.bucket(3);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 3);
- assert(i->second == "three");
-
- b = c.bucket(4);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 4);
- assert(i->second == "four");
-
- b = c.bucket(5);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(6);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 0);
+ std::set<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ for (int n = 0; n < 2; ++n) {
+ assert(i->first == 1);
+ assert(s.find(i->second) != s.end());
+ s.erase(s.find(i->second));
+ ++i;
+ }
}
+
+ b = c.bucket(2);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 2);
{
- typedef std::unordered_multimap<int, std::string> C;
- typedef std::pair<int, std::string> P;
- typedef C::const_local_iterator I;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- const C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 7);
- C::size_type b = c.bucket(0);
- I i = c.cbegin(b);
- I j = c.cend(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(1);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 2);
- {
- std::set<std::string> s;
- s.insert("one");
- s.insert("four");
- for ( int n = 0; n < 2; ++n )
- {
- assert(i->first == 1);
- assert(s.find(i->second) != s.end());
- s.erase(s.find(i->second));
- ++i;
- }
- }
-
- b = c.bucket(2);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 2);
- {
- std::set<std::string> s;
- s.insert("two");
- s.insert("four");
- for ( int n = 0; n < 2; ++n )
- {
- assert(i->first == 2);
- assert(s.find(i->second) != s.end());
- s.erase(s.find(i->second));
- ++i;
- }
- }
-
- b = c.bucket(3);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 3);
- assert(i->second == "three");
-
- b = c.bucket(4);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 4);
- assert(i->second == "four");
-
- b = c.bucket(5);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(6);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 0);
+ std::set<std::string> s;
+ s.insert("two");
+ s.insert("four");
+ for (int n = 0; n < 2; ++n) {
+ assert(i->first == 2);
+ assert(s.find(i->second) != s.end());
+ s.erase(s.find(i->second));
+ ++i;
+ }
}
+
+ b = c.bucket(3);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 3);
+ assert(i->second == "three");
+
+ b = c.bucket(4);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 4);
+ assert(i->second == "four");
+
+ b = c.bucket(5);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(6);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+ }
#if TEST_STD_VER >= 11
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ typedef C::local_iterator I;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 7);
+ C::size_type b = c.bucket(0);
+ I i = c.begin(b);
+ I j = c.end(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 2);
{
- typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- typedef C::local_iterator I;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 7);
- C::size_type b = c.bucket(0);
- I i = c.begin(b);
- I j = c.end(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(1);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 2);
- {
- std::set<std::string> s;
- s.insert("one");
- s.insert("four");
- for ( int n = 0; n < 2; ++n )
- {
- assert(i->first == 1);
- assert(s.find(i->second) != s.end());
- s.erase(s.find(i->second));
- ++i;
- }
- }
-
- b = c.bucket(2);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 2);
- {
- std::set<std::string> s;
- s.insert("two");
- s.insert("four");
- for ( int n = 0; n < 2; ++n )
- {
- assert(i->first == 2);
- assert(s.find(i->second) != s.end());
- s.erase(s.find(i->second));
- ++i;
- }
- }
-
- b = c.bucket(3);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 3);
- assert(i->second == "three");
-
- b = c.bucket(4);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 4);
- assert(i->second == "four");
-
- b = c.bucket(5);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(6);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 0);
+ std::set<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ for (int n = 0; n < 2; ++n) {
+ assert(i->first == 1);
+ assert(s.find(i->second) != s.end());
+ s.erase(s.find(i->second));
+ ++i;
+ }
}
+
+ b = c.bucket(2);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 2);
+ {
+ std::set<std::string> s;
+ s.insert("two");
+ s.insert("four");
+ for (int n = 0; n < 2; ++n) {
+ assert(i->first == 2);
+ assert(s.find(i->second) != s.end());
+ s.erase(s.find(i->second));
+ ++i;
+ }
+ }
+
+ b = c.bucket(3);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 3);
+ assert(i->second == "three");
+
+ b = c.bucket(4);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 4);
+ assert(i->second == "four");
+
+ b = c.bucket(5);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(6);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 0);
+ }
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ typedef C::const_local_iterator I;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ const C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 7);
+ C::size_type b = c.bucket(0);
+ I i = c.begin(b);
+ I j = c.end(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 2);
+ {
+ std::set<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ for (int n = 0; n < 2; ++n) {
+ assert(i->first == 1);
+ assert(s.find(i->second) != s.end());
+ s.erase(s.find(i->second));
+ ++i;
+ }
+ }
+
+ b = c.bucket(2);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 2);
+ {
+ std::set<std::string> s;
+ s.insert("two");
+ s.insert("four");
+ for (int n = 0; n < 2; ++n) {
+ assert(i->first == 2);
+ assert(s.find(i->second) != s.end());
+ s.erase(s.find(i->second));
+ ++i;
+ }
+ }
+
+ b = c.bucket(3);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 3);
+ assert(i->second == "three");
+
+ b = c.bucket(4);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 4);
+ assert(i->second == "four");
+
+ b = c.bucket(5);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(6);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 0);
+ }
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ typedef C::const_local_iterator I;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 7);
+ C::size_type b = c.bucket(0);
+ I i = c.cbegin(b);
+ I j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 2);
+ {
+ std::set<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ for (int n = 0; n < 2; ++n) {
+ assert(i->first == 1);
+ assert(s.find(i->second) != s.end());
+ s.erase(s.find(i->second));
+ ++i;
+ }
+ }
+
+ b = c.bucket(2);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 2);
{
- typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- typedef C::const_local_iterator I;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- const C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 7);
- C::size_type b = c.bucket(0);
- I i = c.begin(b);
- I j = c.end(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(1);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 2);
- {
- std::set<std::string> s;
- s.insert("one");
- s.insert("four");
- for ( int n = 0; n < 2; ++n )
- {
- assert(i->first == 1);
- assert(s.find(i->second) != s.end());
- s.erase(s.find(i->second));
- ++i;
- }
- }
-
- b = c.bucket(2);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 2);
- {
- std::set<std::string> s;
- s.insert("two");
- s.insert("four");
- for ( int n = 0; n < 2; ++n )
- {
- assert(i->first == 2);
- assert(s.find(i->second) != s.end());
- s.erase(s.find(i->second));
- ++i;
- }
- }
-
- b = c.bucket(3);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 3);
- assert(i->second == "three");
-
- b = c.bucket(4);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 4);
- assert(i->second == "four");
-
- b = c.bucket(5);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(6);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 0);
+ std::set<std::string> s;
+ s.insert("two");
+ s.insert("four");
+ for (int n = 0; n < 2; ++n) {
+ assert(i->first == 2);
+ assert(s.find(i->second) != s.end());
+ s.erase(s.find(i->second));
+ ++i;
+ }
}
+
+ b = c.bucket(3);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 3);
+ assert(i->second == "three");
+
+ b = c.bucket(4);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 4);
+ assert(i->second == "four");
+
+ b = c.bucket(5);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(6);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+ }
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ typedef C::const_local_iterator I;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ const C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 7);
+ C::size_type b = c.bucket(0);
+ I i = c.cbegin(b);
+ I j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 2);
{
- typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- typedef C::const_local_iterator I;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 7);
- C::size_type b = c.bucket(0);
- I i = c.cbegin(b);
- I j = c.cend(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(1);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 2);
- {
- std::set<std::string> s;
- s.insert("one");
- s.insert("four");
- for ( int n = 0; n < 2; ++n )
- {
- assert(i->first == 1);
- assert(s.find(i->second) != s.end());
- s.erase(s.find(i->second));
- ++i;
- }
- }
-
- b = c.bucket(2);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 2);
- {
- std::set<std::string> s;
- s.insert("two");
- s.insert("four");
- for ( int n = 0; n < 2; ++n )
- {
- assert(i->first == 2);
- assert(s.find(i->second) != s.end());
- s.erase(s.find(i->second));
- ++i;
- }
- }
-
- b = c.bucket(3);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 3);
- assert(i->second == "three");
-
- b = c.bucket(4);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 4);
- assert(i->second == "four");
-
- b = c.bucket(5);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(6);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 0);
+ std::set<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ for (int n = 0; n < 2; ++n) {
+ assert(i->first == 1);
+ assert(s.find(i->second) != s.end());
+ s.erase(s.find(i->second));
+ ++i;
+ }
}
+
+ b = c.bucket(2);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 2);
{
- typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- typedef C::const_local_iterator I;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- const C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 7);
- C::size_type b = c.bucket(0);
- I i = c.cbegin(b);
- I j = c.cend(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(1);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 2);
- {
- std::set<std::string> s;
- s.insert("one");
- s.insert("four");
- for ( int n = 0; n < 2; ++n )
- {
- assert(i->first == 1);
- assert(s.find(i->second) != s.end());
- s.erase(s.find(i->second));
- ++i;
- }
- }
-
- b = c.bucket(2);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 2);
- {
- std::set<std::string> s;
- s.insert("two");
- s.insert("four");
- for ( int n = 0; n < 2; ++n )
- {
- assert(i->first == 2);
- assert(s.find(i->second) != s.end());
- s.erase(s.find(i->second));
- ++i;
- }
- }
-
- b = c.bucket(3);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 3);
- assert(i->second == "three");
-
- b = c.bucket(4);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(i->first == 4);
- assert(i->second == "four");
-
- b = c.bucket(5);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(6);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 0);
+ std::set<std::string> s;
+ s.insert("two");
+ s.insert("four");
+ for (int n = 0; n < 2; ++n) {
+ assert(i->first == 2);
+ assert(s.find(i->second) != s.end());
+ s.erase(s.find(i->second));
+ ++i;
+ }
}
+
+ b = c.bucket(3);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 3);
+ assert(i->second == "three");
+
+ b = c.bucket(4);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 4);
+ assert(i->second == "four");
+
+ b = c.bucket(5);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(6);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multimap/max_bucket_count.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/max_bucket_count.pass.cpp
index 1dac9024cbedde1..6416539c4fa5953 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/max_bucket_count.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/max_bucket_count.pass.cpp
@@ -21,20 +21,23 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multimap<int, std::string> C;
- const C c;
- assert(c.max_bucket_count() > 0);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<int, std::string> C;
+ const C c;
+ assert(c.max_bucket_count() > 0);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- const C c;
- assert(c.max_bucket_count() > 0);
- }
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ const C c;
+ assert(c.max_bucket_count() > 0);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multimap/max_load_factor.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/max_load_factor.pass.cpp
index ab08808783df712..cd4d06248bd5279 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/max_load_factor.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/max_load_factor.pass.cpp
@@ -22,36 +22,43 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multimap<int, std::string> C;
- const C c;
- assert(c.max_load_factor() == 1);
- }
- {
- typedef std::unordered_multimap<int, std::string> C;
- C c;
- assert(c.max_load_factor() == 1);
- c.max_load_factor(2.5);
- assert(c.max_load_factor() == 2.5);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<int, std::string> C;
+ const C c;
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef std::unordered_multimap<int, std::string> C;
+ C c;
+ assert(c.max_load_factor() == 1);
+ c.max_load_factor(2.5);
+ assert(c.max_load_factor() == 2.5);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- const C c;
- assert(c.max_load_factor() == 1);
- }
- {
- typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- C c;
- assert(c.max_load_factor() == 1);
- c.max_load_factor(2.5);
- assert(c.max_load_factor() == 2.5);
- }
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ const C c;
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ C c;
+ assert(c.max_load_factor() == 1);
+ c.max_load_factor(2.5);
+ assert(c.max_load_factor() == 2.5);
+ }
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/max_size.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/max_size.pass.cpp
index 182f5a3693b034c..4f8706760a6b17f 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/max_size.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/max_size.pass.cpp
@@ -20,37 +20,30 @@
#include "test_allocator.h"
#include "test_macros.h"
-int main(int, char**)
-{
+int main(int, char**) {
typedef std::pair<const int, int> KV;
{
typedef limited_allocator<KV, 10> A;
- typedef std::unordered_multimap<int, int, std::hash<int>,
- std::equal_to<int>, A>
- C;
+ typedef std::unordered_multimap<int, int, std::hash<int>, std::equal_to<int>, A> C;
C c;
assert(c.max_size() <= 10);
LIBCPP_ASSERT(c.max_size() == 10);
}
{
typedef limited_allocator<KV, (std::size_t)-1> A;
- typedef std::unordered_multimap<int, int, std::hash<int>,
- std::equal_to<int>, A>
- C;
- const C::size_type max_dist =
- static_cast<C::size_type>(std::numeric_limits<C::
diff erence_type>::max());
+ typedef std::unordered_multimap<int, int, std::hash<int>, std::equal_to<int>, A> C;
+ const C::size_type max_dist = static_cast<C::size_type>(std::numeric_limits<C::
diff erence_type>::max());
C c;
assert(c.max_size() <= max_dist);
LIBCPP_ASSERT(c.max_size() == max_dist);
- }
- {
- typedef std::unordered_multimap<char, int> C;
- const C::size_type max_dist =
- static_cast<C::size_type>(std::numeric_limits<C::
diff erence_type>::max());
- C c;
- assert(c.max_size() <= max_dist);
- assert(c.max_size() <= alloc_max_size(c.get_allocator()));
- }
+ }
+ {
+ typedef std::unordered_multimap<char, int> C;
+ const C::size_type max_dist = static_cast<C::size_type>(std::numeric_limits<C::
diff erence_type>::max());
+ C c;
+ assert(c.max_size() <= max_dist);
+ assert(c.max_size() <= alloc_max_size(c.get_allocator()));
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/range_concept_conformance.compile.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/range_concept_conformance.compile.pass.cpp
index 31c7df7032205ac..f90fa470f7b8b34 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/range_concept_conformance.compile.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/range_concept_conformance.compile.pass.cpp
@@ -19,7 +19,6 @@
using range = std::unordered_multimap<int, int>;
-
static_assert(std::same_as<std::ranges::iterator_t<range>, range::iterator>);
static_assert(std::ranges::common_range<range>);
static_assert(std::ranges::forward_range<range>);
diff --git a/libcxx/test/std/containers/unord/unord.multimap/rehash.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/rehash.pass.cpp
index 33d2bc0ed107b13..f496a5e8c2e15f8 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/rehash.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/rehash.pass.cpp
@@ -26,123 +26,120 @@
#include "min_allocator.h"
template <class C>
-void rehash_postcondition(const C& c, std::size_t n)
-{
- assert(c.bucket_count() >= c.size() / c.max_load_factor() && c.bucket_count() >= n);
+void rehash_postcondition(const C& c, std::size_t n) {
+ assert(c.bucket_count() >= c.size() / c.max_load_factor() && c.bucket_count() >= n);
}
template <class C>
-void test(const C& c)
-{
- assert(c.size() == 6);
- typedef std::pair<typename C::const_iterator, typename C::const_iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- typename C::const_iterator i = eq.first;
- {
- std::set<std::string> s;
- s.insert("one");
- s.insert("four");
- for ( int n = 0; n < 2; ++n )
- {
- assert(i->first == 1);
- assert(s.find(i->second) != s.end());
- s.erase(s.find(i->second));
- ++i;
- }
+void test(const C& c) {
+ assert(c.size() == 6);
+ typedef std::pair<typename C::const_iterator, typename C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ typename C::const_iterator i = eq.first;
+ {
+ std::set<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ for (int n = 0; n < 2; ++n) {
+ assert(i->first == 1);
+ assert(s.find(i->second) != s.end());
+ s.erase(s.find(i->second));
+ ++i;
}
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- i = eq.first;
- {
- std::set<std::string> s;
- s.insert("two");
- s.insert("four");
- for ( int n = 0; n < 2; ++n )
- {
- assert(i->first == 2);
- assert(s.find(i->second) != s.end());
- s.erase(s.find(i->second));
- ++i;
- }
+ }
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ i = eq.first;
+ {
+ std::set<std::string> s;
+ s.insert("two");
+ s.insert("four");
+ for (int n = 0; n < 2; ++n) {
+ assert(i->first == 2);
+ assert(s.find(i->second) != s.end());
+ s.erase(s.find(i->second));
+ ++i;
}
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- i = eq.first;
- assert(i->first == 3);
- assert(i->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- i = eq.first;
- assert(i->first == 4);
- assert(i->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ }
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
}
-int main(int, char**)
-{
- {
- typedef std::unordered_multimap<int, std::string> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- test(c);
- assert(c.bucket_count() >= 7);
- c.rehash(3);
- rehash_postcondition(c, 3);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- test(c);
- c.max_load_factor(2);
- c.rehash(3);
- rehash_postcondition(c, 3);
- LIBCPP_ASSERT(c.bucket_count() == 3);
- test(c);
- c.rehash(31);
- rehash_postcondition(c, 31);
- LIBCPP_ASSERT(c.bucket_count() == 31);
- test(c);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ test(c);
+ assert(c.bucket_count() >= 7);
+ c.rehash(3);
+ rehash_postcondition(c, 3);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ test(c);
+ c.max_load_factor(2);
+ c.rehash(3);
+ rehash_postcondition(c, 3);
+ LIBCPP_ASSERT(c.bucket_count() == 3);
+ test(c);
+ c.rehash(31);
+ rehash_postcondition(c, 31);
+ LIBCPP_ASSERT(c.bucket_count() == 31);
+ test(c);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- test(c);
- assert(c.bucket_count() >= 7);
- c.rehash(3);
- rehash_postcondition(c, 3);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- test(c);
- c.max_load_factor(2);
- c.rehash(3);
- rehash_postcondition(c, 3);
- LIBCPP_ASSERT(c.bucket_count() == 3);
- test(c);
- c.rehash(31);
- rehash_postcondition(c, 31);
- LIBCPP_ASSERT(c.bucket_count() == 31);
- test(c);
- }
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ test(c);
+ assert(c.bucket_count() >= 7);
+ c.rehash(3);
+ rehash_postcondition(c, 3);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ test(c);
+ c.max_load_factor(2);
+ c.rehash(3);
+ rehash_postcondition(c, 3);
+ LIBCPP_ASSERT(c.bucket_count() == 3);
+ test(c);
+ c.rehash(31);
+ rehash_postcondition(c, 31);
+ LIBCPP_ASSERT(c.bucket_count() == 31);
+ test(c);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multimap/reserve.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/reserve.pass.cpp
index b658539c401e5ad..6063853ef4674d3 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/reserve.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/reserve.pass.cpp
@@ -23,102 +23,100 @@
#include "min_allocator.h"
template <class C>
-void test(const C& c)
-{
- assert(c.size() == 6);
- {
- std::set<std::string> s;
- s.insert("one");
- s.insert("four");
- assert(s.find(c.find(1)->second) != s.end());
- s.erase(s.find(c.find(1)->second));
- assert(s.find(std::next(c.find(1))->second) != s.end());
- }
- {
- std::set<std::string> s;
- s.insert("two");
- s.insert("four");
- assert(s.find(c.find(2)->second) != s.end());
- s.erase(s.find(c.find(2)->second));
- assert(s.find(std::next(c.find(2))->second) != s.end());
- }
- assert(c.find(3)->second == "three");
- assert(c.find(4)->second == "four");
+void test(const C& c) {
+ assert(c.size() == 6);
+ {
+ std::set<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ assert(s.find(c.find(1)->second) != s.end());
+ s.erase(s.find(c.find(1)->second));
+ assert(s.find(std::next(c.find(1))->second) != s.end());
+ }
+ {
+ std::set<std::string> s;
+ s.insert("two");
+ s.insert("four");
+ assert(s.find(c.find(2)->second) != s.end());
+ s.erase(s.find(c.find(2)->second));
+ assert(s.find(std::next(c.find(2))->second) != s.end());
+ }
+ assert(c.find(3)->second == "three");
+ assert(c.find(4)->second == "four");
}
void reserve_invariant(std::size_t n) // LWG #2156
{
- for (std::size_t i = 0; i < n; ++i)
- {
- std::unordered_multimap<std::size_t, size_t> c;
- c.reserve(n);
- std::size_t buckets = c.bucket_count();
- for (std::size_t j = 0; j < i; ++j)
- {
- c.insert(std::unordered_multimap<std::size_t, size_t>::value_type(i,i));
- assert(buckets == c.bucket_count());
- }
+ for (std::size_t i = 0; i < n; ++i) {
+ std::unordered_multimap<std::size_t, size_t> c;
+ c.reserve(n);
+ std::size_t buckets = c.bucket_count();
+ for (std::size_t j = 0; j < i; ++j) {
+ c.insert(std::unordered_multimap<std::size_t, size_t>::value_type(i, i));
+ assert(buckets == c.bucket_count());
}
+ }
}
-int main(int, char**)
-{
- {
- typedef std::unordered_multimap<int, std::string> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- test(c);
- assert(c.bucket_count() >= 7);
- c.reserve(3);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- test(c);
- c.max_load_factor(2);
- c.reserve(3);
- LIBCPP_ASSERT(c.bucket_count() == 3);
- test(c);
- c.reserve(31);
- assert(c.bucket_count() >= 16);
- test(c);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ test(c);
+ assert(c.bucket_count() >= 7);
+ c.reserve(3);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ test(c);
+ c.max_load_factor(2);
+ c.reserve(3);
+ LIBCPP_ASSERT(c.bucket_count() == 3);
+ test(c);
+ c.reserve(31);
+ assert(c.bucket_count() >= 16);
+ test(c);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- test(c);
- assert(c.bucket_count() >= 7);
- c.reserve(3);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- test(c);
- c.max_load_factor(2);
- c.reserve(3);
- LIBCPP_ASSERT(c.bucket_count() == 3);
- test(c);
- c.reserve(31);
- assert(c.bucket_count() >= 16);
- test(c);
- }
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ test(c);
+ assert(c.bucket_count() >= 7);
+ c.reserve(3);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ test(c);
+ c.max_load_factor(2);
+ c.reserve(3);
+ LIBCPP_ASSERT(c.bucket_count() == 3);
+ test(c);
+ c.reserve(31);
+ assert(c.bucket_count() >= 16);
+ test(c);
+ }
#endif
- reserve_invariant(20);
+ reserve_invariant(20);
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/scary.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/scary.pass.cpp
index b306da2f818ed7e..59ade49434ca9f4 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/scary.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/scary.pass.cpp
@@ -16,13 +16,12 @@
#include "test_macros.h"
-int main(int, char**)
-{
- typedef std::unordered_map<int, int> M1;
- typedef std::unordered_multimap<int, int> M2;
- M2::iterator i;
- M1::iterator j = i;
- ((void)j);
+int main(int, char**) {
+ typedef std::unordered_map<int, int> M1;
+ typedef std::unordered_multimap<int, int> M2;
+ M2::iterator i;
+ M1::iterator j = i;
+ ((void)j);
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/size.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/size.pass.cpp
index 493b8d757cfddce..a577419112fc578 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/size.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/size.pass.cpp
@@ -18,9 +18,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::unordered_multimap<int, double> M;
M m;
ASSERT_NOEXCEPT(m.size());
@@ -37,10 +36,12 @@ int main(int, char**)
assert(m.size() == 1);
m.erase(m.begin());
assert(m.size() == 0);
- }
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multimap<int, double, std::hash<int>, std::equal_to<int>, min_allocator<std::pair<const int, double>>> M;
+ {
+ typedef std::
+ unordered_multimap<int, double, std::hash<int>, std::equal_to<int>, min_allocator<std::pair<const int, double>>>
+ M;
M m;
ASSERT_NOEXCEPT(m.size());
assert(m.size() == 0);
@@ -56,7 +57,7 @@ int main(int, char**)
assert(m.size() == 1);
m.erase(m.begin());
assert(m.size() == 0);
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multimap/swap_member.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/swap_member.pass.cpp
index 257938b0628f148..af6cebdc9d7a4da 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/swap_member.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/swap_member.pass.cpp
@@ -28,631 +28,618 @@
#include "min_allocator.h"
-int main(int, char**)
-{
+int main(int, char**) {
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef test_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
+ C c1(0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(0, Hash(2), Compare(2), Alloc(1, 2));
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ LIBCPP_ASSERT(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ LIBCPP_ASSERT(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef test_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ P a2[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c1(0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ assert(c1.bucket_count() >= 8);
+ assert(c1.size() == 8);
+ assert(c1.find(10)->second == "ten");
+ assert(c1.find(20)->second == "twenty");
+ assert(c1.find(30)->second == "thirty");
+ assert(c1.find(40)->second == "forty");
+ assert(c1.find(50)->second == "fifty");
+ assert(c1.find(60)->second == "sixty");
+ assert(c1.find(70)->second == "seventy");
+ assert(c1.find(80)->second == "eighty");
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ LIBCPP_ASSERT(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef test_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ P a1[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(0, Hash(2), Compare(2), Alloc(1, 2));
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ LIBCPP_ASSERT(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 6);
+ assert(c2.size() == 6);
{
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef test_allocator<std::pair<const int, std::string> > Alloc;
- typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
- C c1(0, Hash(1), Compare(1), Alloc(1, 1));
- C c2(0, Hash(2), Compare(2), Alloc(1, 2));
- c2.max_load_factor(2);
- c1.swap(c2);
-
- LIBCPP_ASSERT(c1.bucket_count() == 0);
- assert(c1.size() == 0);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator().get_id() == 1);
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- LIBCPP_ASSERT(c2.bucket_count() == 0);
- assert(c2.size() == 0);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator().get_id() == 2);
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
+ std::set<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ assert(s.find(c2.find(1)->second) != s.end());
+ s.erase(s.find(c2.find(1)->second));
+ assert(s.find(std::next(c2.find(1))->second) != s.end());
}
{
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef test_allocator<std::pair<const int, std::string> > Alloc;
- typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
- typedef std::pair<int, std::string> P;
- P a2[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- C c1(0, Hash(1), Compare(1), Alloc(1, 1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
- c2.max_load_factor(2);
- c1.swap(c2);
-
- assert(c1.bucket_count() >= 8);
- assert(c1.size() == 8);
- assert(c1.find(10)->second == "ten");
- assert(c1.find(20)->second == "twenty");
- assert(c1.find(30)->second == "thirty");
- assert(c1.find(40)->second == "forty");
- assert(c1.find(50)->second == "fifty");
- assert(c1.find(60)->second == "sixty");
- assert(c1.find(70)->second == "seventy");
- assert(c1.find(80)->second == "eighty");
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator().get_id() == 1);
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- LIBCPP_ASSERT(c2.bucket_count() == 0);
- assert(c2.size() == 0);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator().get_id() == 2);
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
+ std::set<std::string> s;
+ s.insert("two");
+ s.insert("four");
+ assert(s.find(c2.find(2)->second) != s.end());
+ s.erase(s.find(c2.find(2)->second));
+ assert(s.find(std::next(c2.find(2))->second) != s.end());
}
+ assert(c2.find(3)->second == "three");
+ assert(c2.find(4)->second == "four");
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef test_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ P a1[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ P a2[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ assert(c1.bucket_count() >= 8);
+ assert(c1.size() == 8);
+ assert(c1.find(10)->second == "ten");
+ assert(c1.find(20)->second == "twenty");
+ assert(c1.find(30)->second == "thirty");
+ assert(c1.find(40)->second == "forty");
+ assert(c1.find(50)->second == "fifty");
+ assert(c1.find(60)->second == "sixty");
+ assert(c1.find(70)->second == "seventy");
+ assert(c1.find(80)->second == "eighty");
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 6);
+ assert(c2.size() == 6);
{
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef test_allocator<std::pair<const int, std::string> > Alloc;
- typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
- typedef std::pair<int, std::string> P;
- P a1[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
- C c2(0, Hash(2), Compare(2), Alloc(1, 2));
- c2.max_load_factor(2);
- c1.swap(c2);
-
- LIBCPP_ASSERT(c1.bucket_count() == 0);
- assert(c1.size() == 0);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator().get_id() == 1);
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- assert(c2.bucket_count() >= 6);
- assert(c2.size() == 6);
- {
- std::set<std::string> s;
- s.insert("one");
- s.insert("four");
- assert(s.find(c2.find(1)->second) != s.end());
- s.erase(s.find(c2.find(1)->second));
- assert(s.find(std::next(c2.find(1))->second) != s.end());
- }
- {
- std::set<std::string> s;
- s.insert("two");
- s.insert("four");
- assert(s.find(c2.find(2)->second) != s.end());
- s.erase(s.find(c2.find(2)->second));
- assert(s.find(std::next(c2.find(2))->second) != s.end());
- }
- assert(c2.find(3)->second == "three");
- assert(c2.find(4)->second == "four");
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator().get_id() == 2);
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
+ std::set<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ assert(s.find(c2.find(1)->second) != s.end());
+ s.erase(s.find(c2.find(1)->second));
+ assert(s.find(std::next(c2.find(1))->second) != s.end());
}
{
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef test_allocator<std::pair<const int, std::string> > Alloc;
- typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
- typedef std::pair<int, std::string> P;
- P a1[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- P a2[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
- c2.max_load_factor(2);
- c1.swap(c2);
-
- assert(c1.bucket_count() >= 8);
- assert(c1.size() == 8);
- assert(c1.find(10)->second == "ten");
- assert(c1.find(20)->second == "twenty");
- assert(c1.find(30)->second == "thirty");
- assert(c1.find(40)->second == "forty");
- assert(c1.find(50)->second == "fifty");
- assert(c1.find(60)->second == "sixty");
- assert(c1.find(70)->second == "seventy");
- assert(c1.find(80)->second == "eighty");
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator().get_id() == 1);
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- assert(c2.bucket_count() >= 6);
- assert(c2.size() == 6);
- {
- std::set<std::string> s;
- s.insert("one");
- s.insert("four");
- assert(s.find(c2.find(1)->second) != s.end());
- s.erase(s.find(c2.find(1)->second));
- assert(s.find(std::next(c2.find(1))->second) != s.end());
- }
- {
- std::set<std::string> s;
- s.insert("two");
- s.insert("four");
- assert(s.find(c2.find(2)->second) != s.end());
- s.erase(s.find(c2.find(2)->second));
- assert(s.find(std::next(c2.find(2))->second) != s.end());
- }
- assert(c2.find(3)->second == "three");
- assert(c2.find(4)->second == "four");
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator().get_id() == 2);
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
+ std::set<std::string> s;
+ s.insert("two");
+ s.insert("four");
+ assert(s.find(c2.find(2)->second) != s.end());
+ s.erase(s.find(c2.find(2)->second));
+ assert(s.find(std::next(c2.find(2))->second) != s.end());
}
-
+ assert(c2.find(3)->second == "three");
+ assert(c2.find(4)->second == "four");
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef other_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
+ C c1(0, Hash(1), Compare(1), Alloc(1));
+ C c2(0, Hash(2), Compare(2), Alloc(2));
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ LIBCPP_ASSERT(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc(2));
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ LIBCPP_ASSERT(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc(1));
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef other_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ P a2[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c1(0, Hash(1), Compare(1), Alloc(1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ assert(c1.bucket_count() >= 8);
+ assert(c1.size() == 8);
+ assert(c1.find(10)->second == "ten");
+ assert(c1.find(20)->second == "twenty");
+ assert(c1.find(30)->second == "thirty");
+ assert(c1.find(40)->second == "forty");
+ assert(c1.find(50)->second == "fifty");
+ assert(c1.find(60)->second == "sixty");
+ assert(c1.find(70)->second == "seventy");
+ assert(c1.find(80)->second == "eighty");
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc(2));
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ LIBCPP_ASSERT(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc(1));
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef other_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ P a1[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
+ C c2(0, Hash(2), Compare(2), Alloc(2));
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ LIBCPP_ASSERT(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc(2));
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 6);
+ assert(c2.size() == 6);
{
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef other_allocator<std::pair<const int, std::string> > Alloc;
- typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
- C c1(0, Hash(1), Compare(1), Alloc(1));
- C c2(0, Hash(2), Compare(2), Alloc(2));
- c2.max_load_factor(2);
- c1.swap(c2);
-
- LIBCPP_ASSERT(c1.bucket_count() == 0);
- assert(c1.size() == 0);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(2));
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- LIBCPP_ASSERT(c2.bucket_count() == 0);
- assert(c2.size() == 0);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(1));
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
+ std::set<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ assert(s.find(c2.find(1)->second) != s.end());
+ s.erase(s.find(c2.find(1)->second));
+ assert(s.find(std::next(c2.find(1))->second) != s.end());
}
{
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef other_allocator<std::pair<const int, std::string> > Alloc;
- typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
- typedef std::pair<int, std::string> P;
- P a2[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- C c1(0, Hash(1), Compare(1), Alloc(1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
- c2.max_load_factor(2);
- c1.swap(c2);
-
- assert(c1.bucket_count() >= 8);
- assert(c1.size() == 8);
- assert(c1.find(10)->second == "ten");
- assert(c1.find(20)->second == "twenty");
- assert(c1.find(30)->second == "thirty");
- assert(c1.find(40)->second == "forty");
- assert(c1.find(50)->second == "fifty");
- assert(c1.find(60)->second == "sixty");
- assert(c1.find(70)->second == "seventy");
- assert(c1.find(80)->second == "eighty");
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(2));
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- LIBCPP_ASSERT(c2.bucket_count() == 0);
- assert(c2.size() == 0);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(1));
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
+ std::set<std::string> s;
+ s.insert("two");
+ s.insert("four");
+ assert(s.find(c2.find(2)->second) != s.end());
+ s.erase(s.find(c2.find(2)->second));
+ assert(s.find(std::next(c2.find(2))->second) != s.end());
}
+ assert(c2.find(3)->second == "three");
+ assert(c2.find(4)->second == "four");
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc(1));
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef other_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ P a1[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ P a2[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ assert(c1.bucket_count() >= 8);
+ assert(c1.size() == 8);
+ assert(c1.find(10)->second == "ten");
+ assert(c1.find(20)->second == "twenty");
+ assert(c1.find(30)->second == "thirty");
+ assert(c1.find(40)->second == "forty");
+ assert(c1.find(50)->second == "fifty");
+ assert(c1.find(60)->second == "sixty");
+ assert(c1.find(70)->second == "seventy");
+ assert(c1.find(80)->second == "eighty");
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc(2));
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 6);
+ assert(c2.size() == 6);
{
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef other_allocator<std::pair<const int, std::string> > Alloc;
- typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
- typedef std::pair<int, std::string> P;
- P a1[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
- C c2(0, Hash(2), Compare(2), Alloc(2));
- c2.max_load_factor(2);
- c1.swap(c2);
-
- LIBCPP_ASSERT(c1.bucket_count() == 0);
- assert(c1.size() == 0);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(2));
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- assert(c2.bucket_count() >= 6);
- assert(c2.size() == 6);
- {
- std::set<std::string> s;
- s.insert("one");
- s.insert("four");
- assert(s.find(c2.find(1)->second) != s.end());
- s.erase(s.find(c2.find(1)->second));
- assert(s.find(std::next(c2.find(1))->second) != s.end());
- }
- {
- std::set<std::string> s;
- s.insert("two");
- s.insert("four");
- assert(s.find(c2.find(2)->second) != s.end());
- s.erase(s.find(c2.find(2)->second));
- assert(s.find(std::next(c2.find(2))->second) != s.end());
- }
- assert(c2.find(3)->second == "three");
- assert(c2.find(4)->second == "four");
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(1));
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
+ std::set<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ assert(s.find(c2.find(1)->second) != s.end());
+ s.erase(s.find(c2.find(1)->second));
+ assert(s.find(std::next(c2.find(1))->second) != s.end());
}
{
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef other_allocator<std::pair<const int, std::string> > Alloc;
- typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
- typedef std::pair<int, std::string> P;
- P a1[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- P a2[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
- c2.max_load_factor(2);
- c1.swap(c2);
-
- assert(c1.bucket_count() >= 8);
- assert(c1.size() == 8);
- assert(c1.find(10)->second == "ten");
- assert(c1.find(20)->second == "twenty");
- assert(c1.find(30)->second == "thirty");
- assert(c1.find(40)->second == "forty");
- assert(c1.find(50)->second == "fifty");
- assert(c1.find(60)->second == "sixty");
- assert(c1.find(70)->second == "seventy");
- assert(c1.find(80)->second == "eighty");
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(2));
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- assert(c2.bucket_count() >= 6);
- assert(c2.size() == 6);
- {
- std::set<std::string> s;
- s.insert("one");
- s.insert("four");
- assert(s.find(c2.find(1)->second) != s.end());
- s.erase(s.find(c2.find(1)->second));
- assert(s.find(std::next(c2.find(1))->second) != s.end());
- }
- {
- std::set<std::string> s;
- s.insert("two");
- s.insert("four");
- assert(s.find(c2.find(2)->second) != s.end());
- s.erase(s.find(c2.find(2)->second));
- assert(s.find(std::next(c2.find(2))->second) != s.end());
- }
- assert(c2.find(3)->second == "three");
- assert(c2.find(4)->second == "four");
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(1));
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
+ std::set<std::string> s;
+ s.insert("two");
+ s.insert("four");
+ assert(s.find(c2.find(2)->second) != s.end());
+ s.erase(s.find(c2.find(2)->second));
+ assert(s.find(std::next(c2.find(2))->second) != s.end());
}
+ assert(c2.find(3)->second == "three");
+ assert(c2.find(4)->second == "four");
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc(1));
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef min_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
+ C c1(0, Hash(1), Compare(1), Alloc());
+ C c2(0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ LIBCPP_ASSERT(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ LIBCPP_ASSERT(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef min_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ P a2[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c1(0, Hash(1), Compare(1), Alloc());
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ assert(c1.bucket_count() >= 8);
+ assert(c1.size() == 8);
+ assert(c1.find(10)->second == "ten");
+ assert(c1.find(20)->second == "twenty");
+ assert(c1.find(30)->second == "thirty");
+ assert(c1.find(40)->second == "forty");
+ assert(c1.find(50)->second == "fifty");
+ assert(c1.find(60)->second == "sixty");
+ assert(c1.find(70)->second == "seventy");
+ assert(c1.find(80)->second == "eighty");
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ LIBCPP_ASSERT(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef min_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ P a1[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
+ C c2(0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ LIBCPP_ASSERT(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 6);
+ assert(c2.size() == 6);
{
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef min_allocator<std::pair<const int, std::string> > Alloc;
- typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
- C c1(0, Hash(1), Compare(1), Alloc());
- C c2(0, Hash(2), Compare(2), Alloc());
- c2.max_load_factor(2);
- c1.swap(c2);
-
- LIBCPP_ASSERT(c1.bucket_count() == 0);
- assert(c1.size() == 0);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- LIBCPP_ASSERT(c2.bucket_count() == 0);
- assert(c2.size() == 0);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
+ std::set<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ assert(s.find(c2.find(1)->second) != s.end());
+ s.erase(s.find(c2.find(1)->second));
+ assert(s.find(std::next(c2.find(1))->second) != s.end());
}
{
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef min_allocator<std::pair<const int, std::string> > Alloc;
- typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
- typedef std::pair<int, std::string> P;
- P a2[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- C c1(0, Hash(1), Compare(1), Alloc());
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
- c2.max_load_factor(2);
- c1.swap(c2);
-
- assert(c1.bucket_count() >= 8);
- assert(c1.size() == 8);
- assert(c1.find(10)->second == "ten");
- assert(c1.find(20)->second == "twenty");
- assert(c1.find(30)->second == "thirty");
- assert(c1.find(40)->second == "forty");
- assert(c1.find(50)->second == "fifty");
- assert(c1.find(60)->second == "sixty");
- assert(c1.find(70)->second == "seventy");
- assert(c1.find(80)->second == "eighty");
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- LIBCPP_ASSERT(c2.bucket_count() == 0);
- assert(c2.size() == 0);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
+ std::set<std::string> s;
+ s.insert("two");
+ s.insert("four");
+ assert(s.find(c2.find(2)->second) != s.end());
+ s.erase(s.find(c2.find(2)->second));
+ assert(s.find(std::next(c2.find(2))->second) != s.end());
}
+ assert(c2.find(3)->second == "three");
+ assert(c2.find(4)->second == "four");
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef min_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ P a1[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ P a2[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ assert(c1.bucket_count() >= 8);
+ assert(c1.size() == 8);
+ assert(c1.find(10)->second == "ten");
+ assert(c1.find(20)->second == "twenty");
+ assert(c1.find(30)->second == "thirty");
+ assert(c1.find(40)->second == "forty");
+ assert(c1.find(50)->second == "fifty");
+ assert(c1.find(60)->second == "sixty");
+ assert(c1.find(70)->second == "seventy");
+ assert(c1.find(80)->second == "eighty");
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 6);
+ assert(c2.size() == 6);
{
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef min_allocator<std::pair<const int, std::string> > Alloc;
- typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
- typedef std::pair<int, std::string> P;
- P a1[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
- C c2(0, Hash(2), Compare(2), Alloc());
- c2.max_load_factor(2);
- c1.swap(c2);
-
- LIBCPP_ASSERT(c1.bucket_count() == 0);
- assert(c1.size() == 0);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- assert(c2.bucket_count() >= 6);
- assert(c2.size() == 6);
- {
- std::set<std::string> s;
- s.insert("one");
- s.insert("four");
- assert(s.find(c2.find(1)->second) != s.end());
- s.erase(s.find(c2.find(1)->second));
- assert(s.find(std::next(c2.find(1))->second) != s.end());
- }
- {
- std::set<std::string> s;
- s.insert("two");
- s.insert("four");
- assert(s.find(c2.find(2)->second) != s.end());
- s.erase(s.find(c2.find(2)->second));
- assert(s.find(std::next(c2.find(2))->second) != s.end());
- }
- assert(c2.find(3)->second == "three");
- assert(c2.find(4)->second == "four");
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
+ std::set<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ assert(s.find(c2.find(1)->second) != s.end());
+ s.erase(s.find(c2.find(1)->second));
+ assert(s.find(std::next(c2.find(1))->second) != s.end());
}
{
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef min_allocator<std::pair<const int, std::string> > Alloc;
- typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
- typedef std::pair<int, std::string> P;
- P a1[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- P a2[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
- c2.max_load_factor(2);
- c1.swap(c2);
-
- assert(c1.bucket_count() >= 8);
- assert(c1.size() == 8);
- assert(c1.find(10)->second == "ten");
- assert(c1.find(20)->second == "twenty");
- assert(c1.find(30)->second == "thirty");
- assert(c1.find(40)->second == "forty");
- assert(c1.find(50)->second == "fifty");
- assert(c1.find(60)->second == "sixty");
- assert(c1.find(70)->second == "seventy");
- assert(c1.find(80)->second == "eighty");
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- assert(c2.bucket_count() >= 6);
- assert(c2.size() == 6);
- {
- std::set<std::string> s;
- s.insert("one");
- s.insert("four");
- assert(s.find(c2.find(1)->second) != s.end());
- s.erase(s.find(c2.find(1)->second));
- assert(s.find(std::next(c2.find(1))->second) != s.end());
- }
- {
- std::set<std::string> s;
- s.insert("two");
- s.insert("four");
- assert(s.find(c2.find(2)->second) != s.end());
- s.erase(s.find(c2.find(2)->second));
- assert(s.find(std::next(c2.find(2))->second) != s.end());
- }
- assert(c2.find(3)->second == "three");
- assert(c2.find(4)->second == "four");
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
+ std::set<std::string> s;
+ s.insert("two");
+ s.insert("four");
+ assert(s.find(c2.find(2)->second) != s.end());
+ s.erase(s.find(c2.find(2)->second));
+ assert(s.find(std::next(c2.find(2))->second) != s.end());
}
+ assert(c2.find(3)->second == "three");
+ assert(c2.find(4)->second == "four");
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multimap/types.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/types.pass.cpp
index 5af2f68b616868e..e9f5878646dc88b 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/types.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/types.pass.cpp
@@ -33,41 +33,44 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multimap<char, short> C;
- static_assert((std::is_same<C::key_type, char>::value), "");
- static_assert((std::is_same<C::mapped_type, short>::value), "");
- static_assert((std::is_same<C::hasher, std::hash<C::key_type> >::value), "");
- static_assert((std::is_same<C::key_equal, std::equal_to<C::key_type> >::value), "");
- static_assert((std::is_same<C::allocator_type, std::allocator<C::value_type> >::value), "");
- static_assert((std::is_same<C::value_type, std::pair<const C::key_type, C::mapped_type> >::value), "");
- static_assert((std::is_same<C::reference, C::value_type&>::value), "");
- static_assert((std::is_same<C::const_reference, const C::value_type&>::value), "");
- static_assert((std::is_same<C::pointer, C::value_type*>::value), "");
- static_assert((std::is_same<C::const_pointer, const C::value_type*>::value), "");
- static_assert((std::is_same<C::size_type, std::size_t>::value), "");
- static_assert((std::is_same<C::
diff erence_type, std::ptr
diff _t>::value), "");
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<char, short> C;
+ static_assert((std::is_same<C::key_type, char>::value), "");
+ static_assert((std::is_same<C::mapped_type, short>::value), "");
+ static_assert((std::is_same<C::hasher, std::hash<C::key_type> >::value), "");
+ static_assert((std::is_same<C::key_equal, std::equal_to<C::key_type> >::value), "");
+ static_assert((std::is_same<C::allocator_type, std::allocator<C::value_type> >::value), "");
+ static_assert((std::is_same<C::value_type, std::pair<const C::key_type, C::mapped_type> >::value), "");
+ static_assert((std::is_same<C::reference, C::value_type&>::value), "");
+ static_assert((std::is_same<C::const_reference, const C::value_type&>::value), "");
+ static_assert((std::is_same<C::pointer, C::value_type*>::value), "");
+ static_assert((std::is_same<C::const_pointer, const C::value_type*>::value), "");
+ static_assert((std::is_same<C::size_type, std::size_t>::value), "");
+ static_assert((std::is_same<C::
diff erence_type, std::ptr
diff _t>::value), "");
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multimap<char, short, std::hash<char>, std::equal_to<char>,
- min_allocator<std::pair<const char, short>>> C;
- static_assert((std::is_same<C::key_type, char>::value), "");
- static_assert((std::is_same<C::mapped_type, short>::value), "");
- static_assert((std::is_same<C::hasher, std::hash<C::key_type> >::value), "");
- static_assert((std::is_same<C::key_equal, std::equal_to<C::key_type> >::value), "");
- static_assert((std::is_same<C::allocator_type, min_allocator<C::value_type> >::value), "");
- static_assert((std::is_same<C::value_type, std::pair<const C::key_type, C::mapped_type> >::value), "");
- static_assert((std::is_same<C::reference, C::value_type&>::value), "");
- static_assert((std::is_same<C::const_reference, const C::value_type&>::value), "");
- static_assert((std::is_same<C::pointer, min_pointer<C::value_type>>::value), "");
- static_assert((std::is_same<C::const_pointer, min_pointer<const C::value_type>>::value), "");
+ {
+ typedef std::unordered_multimap<char,
+ short,
+ std::hash<char>,
+ std::equal_to<char>,
+ min_allocator<std::pair<const char, short>>>
+ C;
+ static_assert((std::is_same<C::key_type, char>::value), "");
+ static_assert((std::is_same<C::mapped_type, short>::value), "");
+ static_assert((std::is_same<C::hasher, std::hash<C::key_type> >::value), "");
+ static_assert((std::is_same<C::key_equal, std::equal_to<C::key_type> >::value), "");
+ static_assert((std::is_same<C::allocator_type, min_allocator<C::value_type> >::value), "");
+ static_assert((std::is_same<C::value_type, std::pair<const C::key_type, C::mapped_type> >::value), "");
+ static_assert((std::is_same<C::reference, C::value_type&>::value), "");
+ static_assert((std::is_same<C::const_reference, const C::value_type&>::value), "");
+ static_assert((std::is_same<C::pointer, min_pointer<C::value_type>>::value), "");
+ static_assert((std::is_same<C::const_pointer, min_pointer<const C::value_type>>::value), "");
// min_allocator doesn't have a size_type, so one gets synthesized
- static_assert((std::is_same<C::size_type, std::make_unsigned<C::
diff erence_type>::type>::value), "");
- static_assert((std::is_same<C::
diff erence_type, std::ptr
diff _t>::value), "");
- }
+ static_assert((std::is_same<C::size_type, std::make_unsigned<C::
diff erence_type>::type>::value), "");
+ static_assert((std::is_same<C::
diff erence_type, std::ptr
diff _t>::value), "");
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/allocator.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/allocator.pass.cpp
index de69e6743067da6..9610408f25351ca 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/allocator.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/allocator.pass.cpp
@@ -24,107 +24,105 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multimap<NotConstructible, NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- test_allocator<std::pair<const NotConstructible,
- NotConstructible> >
- > C;
- C c(test_allocator<std::pair<const NotConstructible, NotConstructible> >(10));
- LIBCPP_ASSERT(c.bucket_count() == 0);
- assert(c.hash_function() == test_hash<NotConstructible>());
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() ==
- (test_allocator<std::pair<const NotConstructible, NotConstructible> >(10)));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<NotConstructible,
+ NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ test_allocator<std::pair<const NotConstructible, NotConstructible> > >
+ C;
+ C c(test_allocator<std::pair<const NotConstructible, NotConstructible> >(10));
+ LIBCPP_ASSERT(c.bucket_count() == 0);
+ assert(c.hash_function() == test_hash<NotConstructible>());
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == (test_allocator<std::pair<const NotConstructible, NotConstructible> >(10)));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multimap<NotConstructible, NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- min_allocator<std::pair<const NotConstructible,
- NotConstructible> >
- > C;
- C c(min_allocator<std::pair<const NotConstructible, NotConstructible> >{});
- LIBCPP_ASSERT(c.bucket_count() == 0);
- assert(c.hash_function() == test_hash<NotConstructible>());
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() ==
- (min_allocator<std::pair<const NotConstructible, NotConstructible> >()));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef explicit_allocator<std::pair<const NotConstructible, NotConstructible>> A;
- typedef std::unordered_multimap<NotConstructible, NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- A
- > C;
- C c(A{});
- LIBCPP_ASSERT(c.bucket_count() == 0);
- assert(c.hash_function() == test_hash<NotConstructible>());
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() == A{});
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
-#if TEST_STD_VER > 11
- {
- typedef NotConstructible T;
- typedef test_allocator<std::pair<const T, T>> A;
- typedef test_hash<T> HF;
- typedef test_equal_to<T> Comp;
- typedef std::unordered_multimap<T, T, HF, Comp, A> C;
+ {
+ typedef std::unordered_multimap<NotConstructible,
+ NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ min_allocator<std::pair<const NotConstructible, NotConstructible> > >
+ C;
+ C c(min_allocator<std::pair<const NotConstructible, NotConstructible> >{});
+ LIBCPP_ASSERT(c.bucket_count() == 0);
+ assert(c.hash_function() == test_hash<NotConstructible>());
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == (min_allocator<std::pair<const NotConstructible, NotConstructible> >()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef explicit_allocator<std::pair<const NotConstructible, NotConstructible>> A;
+ typedef std::unordered_multimap<NotConstructible,
+ NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ A >
+ C;
+ C c(A{});
+ LIBCPP_ASSERT(c.bucket_count() == 0);
+ assert(c.hash_function() == test_hash<NotConstructible>());
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == A{});
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+# if TEST_STD_VER > 11
+ {
+ typedef NotConstructible T;
+ typedef test_allocator<std::pair<const T, T>> A;
+ typedef test_hash<T> HF;
+ typedef test_equal_to<T> Comp;
+ typedef std::unordered_multimap<T, T, HF, Comp, A> C;
- A a(10);
- C c(2, a);
- LIBCPP_ASSERT(c.bucket_count() == 2);
- assert(c.hash_function() == HF());
- assert(c.key_eq() == Comp());
- assert(c.get_allocator() == a);
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef NotConstructible T;
- typedef test_allocator<std::pair<const T, T>> A;
- typedef test_hash<T> HF;
- typedef test_equal_to<T> Comp;
- typedef std::unordered_multimap<T, T, HF, Comp, A> C;
+ A a(10);
+ C c(2, a);
+ LIBCPP_ASSERT(c.bucket_count() == 2);
+ assert(c.hash_function() == HF());
+ assert(c.key_eq() == Comp());
+ assert(c.get_allocator() == a);
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef NotConstructible T;
+ typedef test_allocator<std::pair<const T, T>> A;
+ typedef test_hash<T> HF;
+ typedef test_equal_to<T> Comp;
+ typedef std::unordered_multimap<T, T, HF, Comp, A> C;
- A a(10);
- HF hf(12);
- C c(2, hf, a);
- LIBCPP_ASSERT(c.bucket_count() == 2);
- assert(c.hash_function() == hf);
- assert(!(c.hash_function() == HF()));
- assert(c.key_eq() == Comp());
- assert(c.get_allocator() == a);
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
-#endif
+ A a(10);
+ HF hf(12);
+ C c(2, hf, a);
+ LIBCPP_ASSERT(c.bucket_count() == 2);
+ assert(c.hash_function() == hf);
+ assert(!(c.hash_function() == HF()));
+ assert(c.key_eq() == Comp());
+ assert(c.get_allocator() == a);
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+# endif
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_copy.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_copy.pass.cpp
index d35d00d4de1a04e..8897b6abd1439b7 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_copy.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_copy.pass.cpp
@@ -30,183 +30,136 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef test_allocator<std::pair<const int, std::string> > A;
- typedef std::unordered_multimap<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A(10)
- );
- C c(a, a + 2,
- 7,
- test_hash<int>(2),
- test_equal_to<int>(3),
- A(4)
- );
- c = c0;
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- s.insert("three");
- CheckConsecutiveKeys<C::const_iterator>(c.find(3), c.end(), 3, s);
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(4), c.end(), 4, s);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == A(4));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef std::unordered_multimap<int, std::string> C;
- typedef std::pair<const int, std::string> P;
- const P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(a, a+sizeof(a)/sizeof(a[0]));
- C *p = &c;
- c = *p;
- assert(c.size() == 6);
- assert(std::is_permutation(c.begin(), c.end(), a));
- }
- {
- typedef other_allocator<std::pair<const int, std::string> > A;
- typedef std::unordered_multimap<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A(10)
- );
- C c(a, a + 2,
- 7,
- test_hash<int>(2),
- test_equal_to<int>(3),
- A(4)
- );
- c = c0;
- assert(c.bucket_count() >= 7);
- assert(c.size() == 6);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- s.insert("three");
- CheckConsecutiveKeys<C::const_iterator>(c.find(3), c.end(), 3, s);
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(4), c.end(), 4, s);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == A(10));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef test_allocator<std::pair<const int, std::string> > A;
+ typedef std::unordered_multimap<int, std::string, test_hash<int>, test_equal_to<int>, A > C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), A(10));
+ C c(a, a + 2, 7, test_hash<int>(2), test_equal_to<int>(3), A(4));
+ c = c0;
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+ s.insert("three");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(3), c.end(), 3, s);
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(4), c.end(), 4, s);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == A(4));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef std::unordered_multimap<int, std::string> C;
+ typedef std::pair<const int, std::string> P;
+ const P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ C* p = &c;
+ c = *p;
+ assert(c.size() == 6);
+ assert(std::is_permutation(c.begin(), c.end(), a));
+ }
+ {
+ typedef other_allocator<std::pair<const int, std::string> > A;
+ typedef std::unordered_multimap<int, std::string, test_hash<int>, test_equal_to<int>, A > C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), A(10));
+ C c(a, a + 2, 7, test_hash<int>(2), test_equal_to<int>(3), A(4));
+ c = c0;
+ assert(c.bucket_count() >= 7);
+ assert(c.size() == 6);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+ s.insert("three");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(3), c.end(), 3, s);
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(4), c.end(), 4, s);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == A(10));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef min_allocator<std::pair<const int, std::string> > A;
- typedef std::unordered_multimap<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A()
- );
- C c(a, a + 2,
- 7,
- test_hash<int>(2),
- test_equal_to<int>(3),
- A()
- );
- c = c0;
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- s.insert("three");
- CheckConsecutiveKeys<C::const_iterator>(c.find(3), c.end(), 3, s);
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(4), c.end(), 4, s);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == A());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+ {
+ typedef min_allocator<std::pair<const int, std::string> > A;
+ typedef std::unordered_multimap<int, std::string, test_hash<int>, test_equal_to<int>, A > C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), A());
+ C c(a, a + 2, 7, test_hash<int>(2), test_equal_to<int>(3), A());
+ c = c0;
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+ s.insert("three");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(3), c.end(), 3, s);
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(4), c.end(), 4, s);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == A());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_init.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_init.pass.cpp
index 9eb3fa3b13b80b1..785fbe7019c0b7a 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_init.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_init.pass.cpp
@@ -31,110 +31,101 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef test_allocator<std::pair<const int, std::string> > A;
- typedef std::unordered_multimap<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- typedef std::pair<int, std::string> P;
- C c = {
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- c = {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- assert(c.bucket_count() >= 7);
- assert(c.size() == 6);
- typedef std::pair<C::const_iterator, C::const_iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+int main(int, char**) {
+ {
+ typedef test_allocator<std::pair<const int, std::string> > A;
+ typedef std::unordered_multimap<int, std::string, test_hash<int>, test_equal_to<int>, A > C;
+ typedef std::pair<int, std::string> P;
+ C c = {
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ c = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ assert(c.bucket_count() >= 7);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- C::const_iterator i = eq.first;
- assert(i->first == 3);
- assert(i->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- i = eq.first;
- assert(i->first == 4);
- assert(i->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef min_allocator<std::pair<const int, std::string> > A;
- typedef std::unordered_multimap<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- typedef std::pair<int, std::string> P;
- C c = {
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- c = {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- assert(c.bucket_count() >= 7);
- assert(c.size() == 6);
- typedef std::pair<C::const_iterator, C::const_iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ C::const_iterator i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef min_allocator<std::pair<const int, std::string> > A;
+ typedef std::unordered_multimap<int, std::string, test_hash<int>, test_equal_to<int>, A > C;
+ typedef std::pair<int, std::string> P;
+ C c = {
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ c = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ assert(c.bucket_count() >= 7);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- C::const_iterator i = eq.first;
- assert(i->first == 3);
- assert(i->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- i = eq.first;
- assert(i->first == 4);
- assert(i->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ C::const_iterator i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_move.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_move.pass.cpp
index c4ba56781e55d61..799278e7a4aae81 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_move.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_move.pass.cpp
@@ -31,254 +31,193 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef test_allocator<std::pair<const int, std::string> > A;
- typedef std::unordered_multimap<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A(10)
- );
- C c(a, a + 2,
- 7,
- test_hash<int>(2),
- test_equal_to<int>(3),
- A(4)
- );
- c = std::move(c0);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- typedef std::pair<C::const_iterator, C::const_iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+int main(int, char**) {
+ {
+ typedef test_allocator<std::pair<const int, std::string> > A;
+ typedef std::unordered_multimap<int, std::string, test_hash<int>, test_equal_to<int>, A > C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), A(10));
+ C c(a, a + 2, 7, test_hash<int>(2), test_equal_to<int>(3), A(4));
+ c = std::move(c0);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- C::const_iterator i = eq.first;
- assert(i->first == 3);
- assert(i->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- i = eq.first;
- assert(i->first == 4);
- assert(i->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef test_allocator<std::pair<const int, std::string> > A;
- typedef std::unordered_multimap<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A(10)
- );
- C c(a, a + 2,
- 7,
- test_hash<int>(2),
- test_equal_to<int>(3),
- A(10)
- );
- C::iterator it0 = c0.begin();
- c = std::move(c0);
- assert(it0 == c.begin()); // Iterators remain valid
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- typedef std::pair<C::const_iterator, C::const_iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ C::const_iterator i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef test_allocator<std::pair<const int, std::string> > A;
+ typedef std::unordered_multimap<int, std::string, test_hash<int>, test_equal_to<int>, A > C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), A(10));
+ C c(a, a + 2, 7, test_hash<int>(2), test_equal_to<int>(3), A(10));
+ C::iterator it0 = c0.begin();
+ c = std::move(c0);
+ assert(it0 == c.begin()); // Iterators remain valid
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- C::const_iterator i = eq.first;
- assert(i->first == 3);
- assert(i->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- i = eq.first;
- assert(i->first == 4);
- assert(i->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef other_allocator<std::pair<const int, std::string> > A;
- typedef std::unordered_multimap<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A(10)
- );
- C c(a, a + 2,
- 7,
- test_hash<int>(2),
- test_equal_to<int>(3),
- A(4)
- );
- C::iterator it0 = c0.begin();
- c = std::move(c0);
- assert(it0 == c.begin()); // Iterators remain valid
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- typedef std::pair<C::const_iterator, C::const_iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ C::const_iterator i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef other_allocator<std::pair<const int, std::string> > A;
+ typedef std::unordered_multimap<int, std::string, test_hash<int>, test_equal_to<int>, A > C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), A(10));
+ C c(a, a + 2, 7, test_hash<int>(2), test_equal_to<int>(3), A(4));
+ C::iterator it0 = c0.begin();
+ c = std::move(c0);
+ assert(it0 == c.begin()); // Iterators remain valid
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- C::const_iterator i = eq.first;
- assert(i->first == 3);
- assert(i->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- i = eq.first;
- assert(i->first == 4);
- assert(i->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef min_allocator<std::pair<const int, std::string> > A;
- typedef std::unordered_multimap<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A()
- );
- C c(a, a + 2,
- 7,
- test_hash<int>(2),
- test_equal_to<int>(3),
- A()
- );
- C::iterator it0 = c0.begin();
- c = std::move(c0);
- assert(it0 == c.begin()); // Iterators remain valid
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- typedef std::pair<C::const_iterator, C::const_iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ C::const_iterator i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef min_allocator<std::pair<const int, std::string> > A;
+ typedef std::unordered_multimap<int, std::string, test_hash<int>, test_equal_to<int>, A > C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), A());
+ C c(a, a + 2, 7, test_hash<int>(2), test_equal_to<int>(3), A());
+ C::iterator it0 = c0.begin();
+ c = std::move(c0);
+ assert(it0 == c.begin()); // Iterators remain valid
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- C::const_iterator i = eq.first;
- assert(i->first == 3);
- assert(i->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- i = eq.first;
- assert(i->first == 4);
- assert(i->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ C::const_iterator i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/compare_copy_constructible.compile.fail.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/compare_copy_constructible.compile.fail.cpp
index 501ef7593c839cd..31e6ded016e8bfc 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/compare_copy_constructible.compile.fail.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/compare_copy_constructible.compile.fail.cpp
@@ -18,16 +18,16 @@
template <class T>
struct Comp {
- bool operator () (const T& lhs, const T& rhs) const { return lhs == rhs; }
+ bool operator()(const T& lhs, const T& rhs) const { return lhs == rhs; }
- Comp () {}
-private:
- Comp (const Comp &); // declared but not defined
- };
+ Comp() {}
+private:
+ Comp(const Comp&); // declared but not defined
+};
int main(int, char**) {
- std::unordered_multimap<int, int, std::hash<int>, Comp<int> > m;
+ std::unordered_multimap<int, int, std::hash<int>, Comp<int> > m;
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/copy.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/copy.pass.cpp
index 60c6341e0005043..e369ce2ac268e90 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/copy.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/copy.pass.cpp
@@ -29,147 +29,143 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multimap<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- test_allocator<std::pair<const int, std::string> >(10)
- );
- C c = c0;
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- s.insert("three");
- CheckConsecutiveKeys<C::const_iterator>(c.find(3), c.end(), 3, s);
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(4), c.end(), 4, s);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() ==
- (test_allocator<std::pair<const int, std::string> >(10)));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ test_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a,
+ a + sizeof(a) / sizeof(a[0]),
+ 7,
+ test_hash<int>(8),
+ test_equal_to<int>(9),
+ test_allocator<std::pair<const int, std::string> >(10));
+ C c = c0;
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+ s.insert("three");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(3), c.end(), 3, s);
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(4), c.end(), 4, s);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == (test_allocator<std::pair<const int, std::string> >(10)));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multimap<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- other_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- other_allocator<std::pair<const int, std::string> >(10)
- );
- C c = c0;
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- s.insert("three");
- CheckConsecutiveKeys<C::const_iterator>(c.find(3), c.end(), 3, s);
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(4), c.end(), 4, s);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() ==
- (other_allocator<std::pair<const int, std::string> >(-2)));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef std::unordered_multimap<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- min_allocator<std::pair<const int, std::string> >()
- );
- C c = c0;
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- s.insert("three");
- CheckConsecutiveKeys<C::const_iterator>(c.find(3), c.end(), 3, s);
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(4), c.end(), 4, s);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() ==
- (min_allocator<std::pair<const int, std::string> >()));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ other_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a,
+ a + sizeof(a) / sizeof(a[0]),
+ 7,
+ test_hash<int>(8),
+ test_equal_to<int>(9),
+ other_allocator<std::pair<const int, std::string> >(10));
+ C c = c0;
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+ s.insert("three");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(3), c.end(), 3, s);
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(4), c.end(), 4, s);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == (other_allocator<std::pair<const int, std::string> >(-2)));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ min_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a,
+ a + sizeof(a) / sizeof(a[0]),
+ 7,
+ test_hash<int>(8),
+ test_equal_to<int>(9),
+ min_allocator<std::pair<const int, std::string> >());
+ C c = c0;
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+ s.insert("three");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(3), c.end(), 3, s);
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(4), c.end(), 4, s);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == (min_allocator<std::pair<const int, std::string> >()));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/copy_alloc.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/copy_alloc.pass.cpp
index d9ec0ad901a3523..25348786a360759 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/copy_alloc.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/copy_alloc.pass.cpp
@@ -29,147 +29,134 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multimap<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- test_allocator<std::pair<const int, std::string> >(10)
- );
- C c(c0, test_allocator<std::pair<const int, std::string> >(5));
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- s.insert("three");
- CheckConsecutiveKeys<C::const_iterator>(c.find(3), c.end(), 3, s);
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(4), c.end(), 4, s);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() ==
- (test_allocator<std::pair<const int, std::string> >(5)));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ test_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a,
+ a + sizeof(a) / sizeof(a[0]),
+ 7,
+ test_hash<int>(8),
+ test_equal_to<int>(9),
+ test_allocator<std::pair<const int, std::string> >(10));
+ C c(c0, test_allocator<std::pair<const int, std::string> >(5));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+ s.insert("three");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(3), c.end(), 3, s);
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(4), c.end(), 4, s);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == (test_allocator<std::pair<const int, std::string> >(5)));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multimap<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- min_allocator<std::pair<const int, std::string> >()
- );
- C c(c0, min_allocator<std::pair<const int, std::string> >());
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- s.insert("three");
- CheckConsecutiveKeys<C::const_iterator>(c.find(3), c.end(), 3, s);
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(4), c.end(), 4, s);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() ==
- (min_allocator<std::pair<const int, std::string> >()));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef explicit_allocator<std::pair<const int, std::string>> A;
- typedef std::unordered_multimap<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A{}
- );
- C c(c0, A{});
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- s.insert("three");
- CheckConsecutiveKeys<C::const_iterator>(c.find(3), c.end(), 3, s);
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(4), c.end(), 4, s);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == A{});
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ min_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a,
+ a + sizeof(a) / sizeof(a[0]),
+ 7,
+ test_hash<int>(8),
+ test_equal_to<int>(9),
+ min_allocator<std::pair<const int, std::string> >());
+ C c(c0, min_allocator<std::pair<const int, std::string> >());
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+ s.insert("three");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(3), c.end(), 3, s);
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(4), c.end(), 4, s);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == (min_allocator<std::pair<const int, std::string> >()));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef explicit_allocator<std::pair<const int, std::string>> A;
+ typedef std::unordered_multimap<int, std::string, test_hash<int>, test_equal_to<int>, A > C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), A{});
+ C c(c0, A{});
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+ s.insert("three");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(3), c.end(), 3, s);
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(4), c.end(), 4, s);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == A{});
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/deduct.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/deduct.pass.cpp
index 7e93032f0175b61..5d625a1deaab555 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/deduct.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/deduct.pass.cpp
@@ -89,152 +89,165 @@
#include "deduction_guides_sfinae_checks.h"
#include "test_allocator.h"
-using P = std::pair<int, long>;
+using P = std::pair<int, long>;
using PC = std::pair<const int, long>;
-int main(int, char**)
-{
- const PC expected_m[] = { {1,1}, {1,1}, {2,2}, {3,1}, {INT_MAX,1} };
+int main(int, char**) {
+ const PC expected_m[] = {{1, 1}, {1, 1}, {2, 2}, {3, 1}, {INT_MAX, 1}};
- {
- const P arr[] = { {1,1}, {2,2}, {1,1}, {INT_MAX,1}, {3,1} };
+ {
+ const P arr[] = {{1, 1}, {2, 2}, {1, 1}, {INT_MAX, 1}, {3, 1}};
std::unordered_multimap m(std::begin(arr), std::end(arr));
ASSERT_SAME_TYPE(decltype(m), std::unordered_multimap<int, long>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
- }
+ }
- {
- const P arr[] = { {1,1}, {2,2}, {1,1}, {INT_MAX,1}, {3,1} };
+ {
+ const P arr[] = {{1, 1}, {2, 2}, {1, 1}, {INT_MAX, 1}, {3, 1}};
std::unordered_multimap m(std::begin(arr), std::end(arr), 42);
ASSERT_SAME_TYPE(decltype(m), std::unordered_multimap<int, long>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
- }
+ }
- {
- const P arr[] = { {1,1}, {2,2}, {1,1}, {INT_MAX,1}, {3,1} };
+ {
+ const P arr[] = {{1, 1}, {2, 2}, {1, 1}, {INT_MAX, 1}, {3, 1}};
std::unordered_multimap m(std::begin(arr), std::end(arr), 42, std::hash<short>());
ASSERT_SAME_TYPE(decltype(m), std::unordered_multimap<int, long, std::hash<short>, std::equal_to<int>>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
- }
+ }
- {
- const P arr[] = { {1,1}, {2,2}, {1,1}, {INT_MAX,1}, {3,1} };
+ {
+ const P arr[] = {{1, 1}, {2, 2}, {1, 1}, {INT_MAX, 1}, {3, 1}};
std::unordered_multimap m(std::begin(arr), std::end(arr), 42, std::hash<short>(), std::equal_to<>());
ASSERT_SAME_TYPE(decltype(m), std::unordered_multimap<int, long, std::hash<short>, std::equal_to<>>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
- }
-
- {
- const P arr[] = { {1,1}, {2,2}, {1,1}, {INT_MAX,1}, {3,1} };
- std::unordered_multimap m(std::begin(arr), std::end(arr), 42, std::hash<short>(), std::equal_to<>(), test_allocator<PC>(0, 41));
- ASSERT_SAME_TYPE(decltype(m), std::unordered_multimap<int, long, std::hash<short>, std::equal_to<>, test_allocator<PC>>);
+ }
+
+ {
+ const P arr[] = {{1, 1}, {2, 2}, {1, 1}, {INT_MAX, 1}, {3, 1}};
+ std::unordered_multimap m(
+ std::begin(arr), std::end(arr), 42, std::hash<short>(), std::equal_to<>(), test_allocator<PC>(0, 41));
+ ASSERT_SAME_TYPE(
+ decltype(m), std::unordered_multimap<int, long, std::hash<short>, std::equal_to<>, test_allocator<PC>>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
assert(m.get_allocator().get_id() == 41);
- }
+ }
- {
+ {
std::unordered_multimap<int, long> source;
std::unordered_multimap m(source);
ASSERT_SAME_TYPE(decltype(m), decltype(source));
assert(m.size() == 0);
- }
+ }
- {
+ {
std::unordered_multimap<int, long> source;
- std::unordered_multimap m{source}; // braces instead of parens
+ std::unordered_multimap m{source}; // braces instead of parens
ASSERT_SAME_TYPE(decltype(m), decltype(source));
assert(m.size() == 0);
- }
+ }
- {
+ {
std::unordered_multimap<int, long, std::hash<short>, std::equal_to<>, test_allocator<PC>> source;
test_allocator<PC> a(0, 42);
std::unordered_multimap m(source, a);
ASSERT_SAME_TYPE(decltype(m), decltype(source));
assert(m.get_allocator().get_id() == 42);
assert(m.size() == 0);
- }
+ }
- {
+ {
std::unordered_multimap<int, long, std::hash<short>, std::equal_to<>, test_allocator<PC>> source;
test_allocator<PC> a(0, 43);
- std::unordered_multimap m{source, a}; // braces instead of parens
+ std::unordered_multimap m{source, a}; // braces instead of parens
ASSERT_SAME_TYPE(decltype(m), decltype(source));
assert(m.get_allocator().get_id() == 43);
assert(m.size() == 0);
- }
+ }
- {
- std::unordered_multimap m { P{1,1L}, P{2,2L}, P{1,1L}, P{INT_MAX,1L}, P{3,1L} };
+ {
+ std::unordered_multimap m{P{1, 1L}, P{2, 2L}, P{1, 1L}, P{INT_MAX, 1L}, P{3, 1L}};
ASSERT_SAME_TYPE(decltype(m), std::unordered_multimap<int, long>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
- }
+ }
- {
- std::unordered_multimap m({ P{1,1L}, P{2,2L}, P{1,1L}, P{INT_MAX,1L}, P{3,1L} }, 42);
+ {
+ std::unordered_multimap m({P{1, 1L}, P{2, 2L}, P{1, 1L}, P{INT_MAX, 1L}, P{3, 1L}}, 42);
ASSERT_SAME_TYPE(decltype(m), std::unordered_multimap<int, long>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
- }
+ }
- {
- std::unordered_multimap m({ P{1,1L}, P{2,2L}, P{1,1L}, P{INT_MAX,1L}, P{3,1L} }, 42, std::hash<short>());
+ {
+ std::unordered_multimap m({P{1, 1L}, P{2, 2L}, P{1, 1L}, P{INT_MAX, 1L}, P{3, 1L}}, 42, std::hash<short>());
ASSERT_SAME_TYPE(decltype(m), std::unordered_multimap<int, long, std::hash<short>>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
- }
+ }
- {
- std::unordered_multimap m({ P{1,1L}, P{2,2L}, P{1,1L}, P{INT_MAX,1L}, P{3,1L} }, 42, std::hash<short>(), std::equal_to<>());
+ {
+ std::unordered_multimap m(
+ {P{1, 1L}, P{2, 2L}, P{1, 1L}, P{INT_MAX, 1L}, P{3, 1L}}, 42, std::hash<short>(), std::equal_to<>());
ASSERT_SAME_TYPE(decltype(m), std::unordered_multimap<int, long, std::hash<short>, std::equal_to<>>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
- }
-
- {
- std::unordered_multimap m({ P{1,1L}, P{2,2L}, P{1,1L}, P{INT_MAX,1L}, P{3,1L} }, 42, std::hash<short>(), std::equal_to<>(), test_allocator<PC>(0, 44));
- ASSERT_SAME_TYPE(decltype(m), std::unordered_multimap<int, long, std::hash<short>, std::equal_to<>, test_allocator<PC>>);
+ }
+
+ {
+ std::unordered_multimap m(
+ {P{1, 1L}, P{2, 2L}, P{1, 1L}, P{INT_MAX, 1L}, P{3, 1L}},
+ 42,
+ std::hash<short>(),
+ std::equal_to<>(),
+ test_allocator<PC>(0, 44));
+ ASSERT_SAME_TYPE(
+ decltype(m), std::unordered_multimap<int, long, std::hash<short>, std::equal_to<>, test_allocator<PC>>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
assert(m.get_allocator().get_id() == 44);
- }
+ }
- {
- const P arr[] = { {1,1}, {2,2}, {1,1}, {INT_MAX,1}, {3,1} };
+ {
+ const P arr[] = {{1, 1}, {2, 2}, {1, 1}, {INT_MAX, 1}, {3, 1}};
std::unordered_multimap m(std::begin(arr), std::end(arr), 42, test_allocator<PC>(0, 45));
- ASSERT_SAME_TYPE(decltype(m), std::unordered_multimap<int, long, std::hash<int>, std::equal_to<int>, test_allocator<PC>>);
+ ASSERT_SAME_TYPE(
+ decltype(m), std::unordered_multimap<int, long, std::hash<int>, std::equal_to<int>, test_allocator<PC>>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
assert(m.get_allocator().get_id() == 45);
- }
+ }
- {
- const P arr[] = { {1,1}, {2,2}, {1,1}, {INT_MAX,1}, {3,1} };
+ {
+ const P arr[] = {{1, 1}, {2, 2}, {1, 1}, {INT_MAX, 1}, {3, 1}};
std::unordered_multimap m(std::begin(arr), std::end(arr), 42, std::hash<short>(), test_allocator<PC>(0, 46));
- ASSERT_SAME_TYPE(decltype(m), std::unordered_multimap<int, long, std::hash<short>, std::equal_to<int>, test_allocator<PC>>);
+ ASSERT_SAME_TYPE(
+ decltype(m), std::unordered_multimap<int, long, std::hash<short>, std::equal_to<int>, test_allocator<PC>>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
assert(m.get_allocator().get_id() == 46);
- }
+ }
- {
- std::unordered_multimap m({ P{1,1L}, P{2,2L}, P{1,1L}, P{INT_MAX,1L}, P{3,1L} }, 42, test_allocator<PC>(0, 47));
- ASSERT_SAME_TYPE(decltype(m), std::unordered_multimap<int, long, std::hash<int>, std::equal_to<int>, test_allocator<PC>>);
+ {
+ std::unordered_multimap m({P{1, 1L}, P{2, 2L}, P{1, 1L}, P{INT_MAX, 1L}, P{3, 1L}}, 42, test_allocator<PC>(0, 47));
+ ASSERT_SAME_TYPE(
+ decltype(m), std::unordered_multimap<int, long, std::hash<int>, std::equal_to<int>, test_allocator<PC>>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
assert(m.get_allocator().get_id() == 47);
- }
+ }
- {
- std::unordered_multimap m({ P{1,1L}, P{2,2L}, P{1,1L}, P{INT_MAX,1L}, P{3,1L} }, 42, std::hash<short>(), test_allocator<PC>(0, 48));
- ASSERT_SAME_TYPE(decltype(m), std::unordered_multimap<int, long, std::hash<short>, std::equal_to<int>, test_allocator<PC>>);
+ {
+ std::unordered_multimap m(
+ {P{1, 1L}, P{2, 2L}, P{1, 1L}, P{INT_MAX, 1L}, P{3, 1L}}, 42, std::hash<short>(), test_allocator<PC>(0, 48));
+ ASSERT_SAME_TYPE(
+ decltype(m), std::unordered_multimap<int, long, std::hash<short>, std::equal_to<int>, test_allocator<PC>>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
assert(m.get_allocator().get_id() == 48);
- }
+ }
- {
+ {
// Examples from LWG3025
std::unordered_multimap m{std::pair{1, 1}, {2, 2}, {3, 3}};
ASSERT_SAME_TYPE(decltype(m), std::unordered_multimap<int, int>);
std::unordered_multimap m2{m.begin(), m.end()};
ASSERT_SAME_TYPE(decltype(m2), std::unordered_multimap<int, int>);
- }
+ }
- {
+ {
// Examples from LWG3531
std::unordered_multimap m1{{std::pair{1, 2}, {3, 4}}, 0};
ASSERT_SAME_TYPE(decltype(m1), std::unordered_multimap<int, int>);
@@ -242,61 +255,61 @@ int main(int, char**)
using value_type = std::pair<const int, int>;
std::unordered_multimap m2{{value_type{1, 2}, {3, 4}}, 0};
ASSERT_SAME_TYPE(decltype(m2), std::unordered_multimap<int, int>);
- }
+ }
#if TEST_STD_VER >= 23
- {
- using Range = std::array<P, 0>;
- using Pred = test_equal_to<int>;
- using DefaultPred = std::equal_to<int>;
- using Hash = test_hash<int>;
- using DefaultHash = std::hash<int>;
- using Alloc = test_allocator<PC>;
-
- { // (from_range, range)
- std::unordered_multimap c(std::from_range, Range());
- static_assert(std::is_same_v<decltype(c), std::unordered_multimap<int, long>>);
- }
-
- { // (from_range, range, n)
- std::unordered_multimap c(std::from_range, Range(), std::size_t());
- static_assert(std::is_same_v<decltype(c), std::unordered_multimap<int, long>>);
- }
-
- { // (from_range, range, n, hash)
- std::unordered_multimap c(std::from_range, Range(), std::size_t(), Hash());
- static_assert(std::is_same_v<decltype(c), std::unordered_multimap<int, long, Hash>>);
- }
-
- { // (from_range, range, n, hash, pred)
- std::unordered_multimap c(std::from_range, Range(), std::size_t(), Hash(), Pred());
- static_assert(std::is_same_v<decltype(c), std::unordered_multimap<int, long, Hash, Pred>>);
- }
-
- { // (from_range, range, n, hash, pred, alloc)
- std::unordered_multimap c(std::from_range, Range(), std::size_t(), Hash(), Pred(), Alloc());
- static_assert(std::is_same_v<decltype(c), std::unordered_multimap<int, long, Hash, Pred, Alloc>>);
- }
-
- { // (from_range, range, n, alloc)
- std::unordered_multimap c(std::from_range, Range(), std::size_t(), Alloc());
- static_assert(std::is_same_v<decltype(c), std::unordered_multimap<int, long, DefaultHash, DefaultPred, Alloc>>);
- }
-
- // TODO(LWG 2713): uncomment this test once the constructor is added.
- { // (from_range, range, alloc)
- //std::unordered_multimap c(std::from_range, Range(), Alloc());
- //static_assert(std::is_same_v<decltype(c), std::unordered_multimap<int, long, DefaultHash, DefaultPred, Alloc>>);
- }
-
- { // (from_range, range, n, hash, alloc)
- std::unordered_multimap c(std::from_range, Range(), std::size_t(), Hash(), Alloc());
- static_assert(std::is_same_v<decltype(c), std::unordered_multimap<int, long, Hash, DefaultPred, Alloc>>);
- }
+ {
+ using Range = std::array<P, 0>;
+ using Pred = test_equal_to<int>;
+ using DefaultPred = std::equal_to<int>;
+ using Hash = test_hash<int>;
+ using DefaultHash = std::hash<int>;
+ using Alloc = test_allocator<PC>;
+
+ { // (from_range, range)
+ std::unordered_multimap c(std::from_range, Range());
+ static_assert(std::is_same_v<decltype(c), std::unordered_multimap<int, long>>);
+ }
+
+ { // (from_range, range, n)
+ std::unordered_multimap c(std::from_range, Range(), std::size_t());
+ static_assert(std::is_same_v<decltype(c), std::unordered_multimap<int, long>>);
+ }
+
+ { // (from_range, range, n, hash)
+ std::unordered_multimap c(std::from_range, Range(), std::size_t(), Hash());
+ static_assert(std::is_same_v<decltype(c), std::unordered_multimap<int, long, Hash>>);
+ }
+
+ { // (from_range, range, n, hash, pred)
+ std::unordered_multimap c(std::from_range, Range(), std::size_t(), Hash(), Pred());
+ static_assert(std::is_same_v<decltype(c), std::unordered_multimap<int, long, Hash, Pred>>);
+ }
+
+ { // (from_range, range, n, hash, pred, alloc)
+ std::unordered_multimap c(std::from_range, Range(), std::size_t(), Hash(), Pred(), Alloc());
+ static_assert(std::is_same_v<decltype(c), std::unordered_multimap<int, long, Hash, Pred, Alloc>>);
+ }
+
+ { // (from_range, range, n, alloc)
+ std::unordered_multimap c(std::from_range, Range(), std::size_t(), Alloc());
+ static_assert(std::is_same_v<decltype(c), std::unordered_multimap<int, long, DefaultHash, DefaultPred, Alloc>>);
+ }
+
+ // TODO(LWG 2713): uncomment this test once the constructor is added.
+ { // (from_range, range, alloc)
+ //std::unordered_multimap c(std::from_range, Range(), Alloc());
+ //static_assert(std::is_same_v<decltype(c), std::unordered_multimap<int, long, DefaultHash, DefaultPred, Alloc>>);
+ }
+
+ { // (from_range, range, n, hash, alloc)
+ std::unordered_multimap c(std::from_range, Range(), std::size_t(), Hash(), Alloc());
+ static_assert(std::is_same_v<decltype(c), std::unordered_multimap<int, long, Hash, DefaultPred, Alloc>>);
}
+ }
#endif
- UnorderedContainerDeductionGuidesSfinaeAway<std::unordered_multimap, std::unordered_multimap<int, long>>();
+ UnorderedContainerDeductionGuidesSfinaeAway<std::unordered_multimap, std::unordered_multimap<int, long>>();
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/deduct.verify.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/deduct.verify.cpp
index efcbbbce0e30277..11410ef2da9a493 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/deduct.verify.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/deduct.verify.cpp
@@ -59,47 +59,48 @@
#include <functional>
#include <unordered_map>
-int main(int, char**)
-{
- using P = std::pair<const int, int>;
- {
- // cannot deduce Key from nothing
- std::unordered_multimap m; // expected-error-re{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_multimap'}}
- }
- {
- // cannot deduce Key from just (Size)
- std::unordered_multimap m(42); // expected-error-re{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_multimap'}}
- }
- {
- // cannot deduce Key from just (Size, Hash)
- std::unordered_multimap m(42, std::hash<int>());
- // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_multimap'}}
- }
- {
- // cannot deduce Key from just (Size, Hash, Pred)
- std::unordered_multimap m(42, std::hash<int>(), std::equal_to<int>());
- // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_multimap'}}
- }
- {
- // cannot deduce Key from just (Size, Hash, Pred, Allocator)
- std::unordered_multimap m(42, std::hash<int>(), std::equal_to<int>(), std::allocator<P>());
- // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_multimap'}}
- }
- {
- // cannot deduce Key from just (Allocator)
- std::unordered_multimap m(std::allocator<P>{});
- // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_multimap'}}
- }
- {
- // cannot deduce Key from just (Size, Allocator)
- std::unordered_multimap m(42, std::allocator<P>());
- // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_multimap'}}
- }
- {
- // cannot deduce Key from just (Size, Hash, Allocator)
- std::unordered_multimap m(42, std::hash<int>(), std::allocator<P>());
- // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_multimap'}}
- }
+int main(int, char**) {
+ using P = std::pair<const int, int>;
+ {
+ // cannot deduce Key from nothing
+ std::unordered_multimap m;
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_multimap'}}
+ }
+ {
+ // cannot deduce Key from just (Size)
+ std::unordered_multimap m(42);
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_multimap'}}
+ }
+ {
+ // cannot deduce Key from just (Size, Hash)
+ std::unordered_multimap m(42, std::hash<int>());
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_multimap'}}
+ }
+ {
+ // cannot deduce Key from just (Size, Hash, Pred)
+ std::unordered_multimap m(42, std::hash<int>(), std::equal_to<int>());
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_multimap'}}
+ }
+ {
+ // cannot deduce Key from just (Size, Hash, Pred, Allocator)
+ std::unordered_multimap m(42, std::hash<int>(), std::equal_to<int>(), std::allocator<P>());
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_multimap'}}
+ }
+ {
+ // cannot deduce Key from just (Allocator)
+ std::unordered_multimap m(std::allocator<P>{});
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_multimap'}}
+ }
+ {
+ // cannot deduce Key from just (Size, Allocator)
+ std::unordered_multimap m(42, std::allocator<P>());
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_multimap'}}
+ }
+ {
+ // cannot deduce Key from just (Size, Hash, Allocator)
+ std::unordered_multimap m(42, std::hash<int>(), std::allocator<P>());
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_multimap'}}
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/deduct_const.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/deduct_const.pass.cpp
index 5a98a013a09335a..5d6930a2bdfc476 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/deduct_const.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/deduct_const.pass.cpp
@@ -65,109 +65,126 @@
#include "test_allocator.h"
-using P = std::pair<int, long>;
+using P = std::pair<int, long>;
using PC = std::pair<const int, long>;
-int main(int, char**)
-{
- const PC expected_m[] = { {1,1}, {1,1}, {2,2}, {3,1}, {INT_MAX,1} };
+int main(int, char**) {
+ const PC expected_m[] = {{1, 1}, {1, 1}, {2, 2}, {3, 1}, {INT_MAX, 1}};
- {
- const PC arr[] = { {1,1}, {2,2}, {1,1}, {INT_MAX,1}, {3,1} };
+ {
+ const PC arr[] = {{1, 1}, {2, 2}, {1, 1}, {INT_MAX, 1}, {3, 1}};
std::unordered_multimap m(std::begin(arr), std::end(arr));
ASSERT_SAME_TYPE(decltype(m), std::unordered_multimap<int, long>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
- }
+ }
- {
- const PC arr[] = { {1,1}, {2,2}, {1,1}, {INT_MAX,1}, {3,1} };
+ {
+ const PC arr[] = {{1, 1}, {2, 2}, {1, 1}, {INT_MAX, 1}, {3, 1}};
std::unordered_multimap m(std::begin(arr), std::end(arr), 42);
ASSERT_SAME_TYPE(decltype(m), std::unordered_multimap<int, long>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
- }
+ }
- {
- const PC arr[] = { {1,1}, {2,2}, {1,1}, {INT_MAX,1}, {3,1} };
+ {
+ const PC arr[] = {{1, 1}, {2, 2}, {1, 1}, {INT_MAX, 1}, {3, 1}};
std::unordered_multimap m(std::begin(arr), std::end(arr), 42, std::hash<short>());
ASSERT_SAME_TYPE(decltype(m), std::unordered_multimap<int, long, std::hash<short>, std::equal_to<int>>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
- }
+ }
- {
- const PC arr[] = { {1,1}, {2,2}, {1,1}, {INT_MAX,1}, {3,1} };
+ {
+ const PC arr[] = {{1, 1}, {2, 2}, {1, 1}, {INT_MAX, 1}, {3, 1}};
std::unordered_multimap m(std::begin(arr), std::end(arr), 42, std::hash<short>(), std::equal_to<>());
ASSERT_SAME_TYPE(decltype(m), std::unordered_multimap<int, long, std::hash<short>, std::equal_to<>>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
- }
-
- {
- const PC arr[] = { {1,1}, {2,2}, {1,1}, {INT_MAX,1}, {3,1} };
- std::unordered_multimap m(std::begin(arr), std::end(arr), 42, std::hash<short>(), std::equal_to<>(), test_allocator<PC>(0, 41));
- ASSERT_SAME_TYPE(decltype(m), std::unordered_multimap<int, long, std::hash<short>, std::equal_to<>, test_allocator<PC>>);
+ }
+
+ {
+ const PC arr[] = {{1, 1}, {2, 2}, {1, 1}, {INT_MAX, 1}, {3, 1}};
+ std::unordered_multimap m(
+ std::begin(arr), std::end(arr), 42, std::hash<short>(), std::equal_to<>(), test_allocator<PC>(0, 41));
+ ASSERT_SAME_TYPE(
+ decltype(m), std::unordered_multimap<int, long, std::hash<short>, std::equal_to<>, test_allocator<PC>>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
assert(m.get_allocator().get_id() == 41);
- }
+ }
- {
- std::unordered_multimap m { PC{1,1L}, PC{2,2L}, PC{1,1L}, PC{INT_MAX,1L}, PC{3,1L} };
+ {
+ std::unordered_multimap m{PC{1, 1L}, PC{2, 2L}, PC{1, 1L}, PC{INT_MAX, 1L}, PC{3, 1L}};
ASSERT_SAME_TYPE(decltype(m), std::unordered_multimap<int, long>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
- }
+ }
- {
- std::unordered_multimap m({ PC{1,1L}, PC{2,2L}, PC{1,1L}, PC{INT_MAX,1L}, PC{3,1L} }, 42);
+ {
+ std::unordered_multimap m({PC{1, 1L}, PC{2, 2L}, PC{1, 1L}, PC{INT_MAX, 1L}, PC{3, 1L}}, 42);
ASSERT_SAME_TYPE(decltype(m), std::unordered_multimap<int, long>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
- }
+ }
- {
- std::unordered_multimap m({ PC{1,1L}, PC{2,2L}, PC{1,1L}, PC{INT_MAX,1L}, PC{3,1L} }, 42, std::hash<short>());
+ {
+ std::unordered_multimap m({PC{1, 1L}, PC{2, 2L}, PC{1, 1L}, PC{INT_MAX, 1L}, PC{3, 1L}}, 42, std::hash<short>());
ASSERT_SAME_TYPE(decltype(m), std::unordered_multimap<int, long, std::hash<short>>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
- }
+ }
- {
- std::unordered_multimap m({ PC{1,1L}, PC{2,2L}, PC{1,1L}, PC{INT_MAX,1L}, PC{3,1L} }, 42, std::hash<short>(), std::equal_to<>());
+ {
+ std::unordered_multimap m(
+ {PC{1, 1L}, PC{2, 2L}, PC{1, 1L}, PC{INT_MAX, 1L}, PC{3, 1L}}, 42, std::hash<short>(), std::equal_to<>());
ASSERT_SAME_TYPE(decltype(m), std::unordered_multimap<int, long, std::hash<short>, std::equal_to<>>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
- }
-
- {
- std::unordered_multimap m({ PC{1,1L}, PC{2,2L}, PC{1,1L}, PC{INT_MAX,1L}, PC{3,1L} }, 42, std::hash<short>(), std::equal_to<>(), test_allocator<PC>(0, 44));
- ASSERT_SAME_TYPE(decltype(m), std::unordered_multimap<int, long, std::hash<short>, std::equal_to<>, test_allocator<PC>>);
+ }
+
+ {
+ std::unordered_multimap m(
+ {PC{1, 1L}, PC{2, 2L}, PC{1, 1L}, PC{INT_MAX, 1L}, PC{3, 1L}},
+ 42,
+ std::hash<short>(),
+ std::equal_to<>(),
+ test_allocator<PC>(0, 44));
+ ASSERT_SAME_TYPE(
+ decltype(m), std::unordered_multimap<int, long, std::hash<short>, std::equal_to<>, test_allocator<PC>>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
assert(m.get_allocator().get_id() == 44);
- }
+ }
- {
- const PC arr[] = { {1,1}, {2,2}, {1,1}, {INT_MAX,1}, {3,1} };
+ {
+ const PC arr[] = {{1, 1}, {2, 2}, {1, 1}, {INT_MAX, 1}, {3, 1}};
std::unordered_multimap m(std::begin(arr), std::end(arr), 42, test_allocator<PC>(0, 45));
- ASSERT_SAME_TYPE(decltype(m), std::unordered_multimap<int, long, std::hash<int>, std::equal_to<int>, test_allocator<PC>>);
+ ASSERT_SAME_TYPE(
+ decltype(m), std::unordered_multimap<int, long, std::hash<int>, std::equal_to<int>, test_allocator<PC>>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
assert(m.get_allocator().get_id() == 45);
- }
+ }
- {
- const PC arr[] = { {1,1}, {2,2}, {1,1}, {INT_MAX,1}, {3,1} };
+ {
+ const PC arr[] = {{1, 1}, {2, 2}, {1, 1}, {INT_MAX, 1}, {3, 1}};
std::unordered_multimap m(std::begin(arr), std::end(arr), 42, std::hash<short>(), test_allocator<PC>(0, 46));
- ASSERT_SAME_TYPE(decltype(m), std::unordered_multimap<int, long, std::hash<short>, std::equal_to<int>, test_allocator<PC>>);
+ ASSERT_SAME_TYPE(
+ decltype(m), std::unordered_multimap<int, long, std::hash<short>, std::equal_to<int>, test_allocator<PC>>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
assert(m.get_allocator().get_id() == 46);
- }
+ }
- {
- std::unordered_multimap m({ PC{1,1L}, PC{2,2L}, PC{1,1L}, PC{INT_MAX,1L}, PC{3,1L} }, 42, test_allocator<PC>(0, 47));
- ASSERT_SAME_TYPE(decltype(m), std::unordered_multimap<int, long, std::hash<int>, std::equal_to<int>, test_allocator<PC>>);
+ {
+ std::unordered_multimap m(
+ {PC{1, 1L}, PC{2, 2L}, PC{1, 1L}, PC{INT_MAX, 1L}, PC{3, 1L}}, 42, test_allocator<PC>(0, 47));
+ ASSERT_SAME_TYPE(
+ decltype(m), std::unordered_multimap<int, long, std::hash<int>, std::equal_to<int>, test_allocator<PC>>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
assert(m.get_allocator().get_id() == 47);
- }
-
- {
- std::unordered_multimap m({ PC{1,1L}, PC{2,2L}, PC{1,1L}, PC{INT_MAX,1L}, PC{3,1L} }, 42, std::hash<short>(), test_allocator<PC>(0, 48));
- ASSERT_SAME_TYPE(decltype(m), std::unordered_multimap<int, long, std::hash<short>, std::equal_to<int>, test_allocator<PC>>);
+ }
+
+ {
+ std::unordered_multimap m(
+ {PC{1, 1L}, PC{2, 2L}, PC{1, 1L}, PC{INT_MAX, 1L}, PC{3, 1L}},
+ 42,
+ std::hash<short>(),
+ test_allocator<PC>(0, 48));
+ ASSERT_SAME_TYPE(
+ decltype(m), std::unordered_multimap<int, long, std::hash<short>, std::equal_to<int>, test_allocator<PC>>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
assert(m.get_allocator().get_id() == 48);
- }
+ }
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/default.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/default.pass.cpp
index deea354543093cd..4e66768db1b2238 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/default.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/default.pass.cpp
@@ -24,89 +24,87 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multimap<NotConstructible, NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- test_allocator<std::pair<const NotConstructible,
- NotConstructible> >
- > C;
- C c;
- LIBCPP_ASSERT(c.bucket_count() == 0);
- assert(c.hash_function() == test_hash<NotConstructible>());
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() ==
- (test_allocator<std::pair<const NotConstructible, NotConstructible> >()));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<NotConstructible,
+ NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ test_allocator<std::pair<const NotConstructible, NotConstructible> > >
+ C;
+ C c;
+ LIBCPP_ASSERT(c.bucket_count() == 0);
+ assert(c.hash_function() == test_hash<NotConstructible>());
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == (test_allocator<std::pair<const NotConstructible, NotConstructible> >()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
+ {
+ typedef std::unordered_multimap<NotConstructible,
+ NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ min_allocator<std::pair<const NotConstructible, NotConstructible> > >
+ C;
+ C c;
+ LIBCPP_ASSERT(c.bucket_count() == 0);
+ assert(c.hash_function() == test_hash<NotConstructible>());
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == (min_allocator<std::pair<const NotConstructible, NotConstructible> >()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef explicit_allocator<std::pair<const NotConstructible, NotConstructible>> A;
+ typedef std::unordered_multimap<NotConstructible,
+ NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ A >
+ C;
{
- typedef std::unordered_multimap<NotConstructible, NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- min_allocator<std::pair<const NotConstructible,
- NotConstructible> >
- > C;
- C c;
- LIBCPP_ASSERT(c.bucket_count() == 0);
- assert(c.hash_function() == test_hash<NotConstructible>());
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() ==
- (min_allocator<std::pair<const NotConstructible, NotConstructible> >()));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef explicit_allocator<std::pair<const NotConstructible, NotConstructible>> A;
- typedef std::unordered_multimap<NotConstructible, NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- A
- > C;
- {
- C c;
- LIBCPP_ASSERT(c.bucket_count() == 0);
- assert(c.hash_function() == test_hash<NotConstructible>());
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() == A());
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
- {
- A a;
- C c(a);
- LIBCPP_ASSERT(c.bucket_count() == 0);
- assert(c.hash_function() == test_hash<NotConstructible>());
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() == a);
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+ C c;
+ LIBCPP_ASSERT(c.bucket_count() == 0);
+ assert(c.hash_function() == test_hash<NotConstructible>());
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == A());
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
}
{
- std::unordered_multimap<int, int> c = {};
- LIBCPP_ASSERT(c.bucket_count() == 0);
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
+ A a;
+ C c(a);
+ LIBCPP_ASSERT(c.bucket_count() == 0);
+ assert(c.hash_function() == test_hash<NotConstructible>());
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == a);
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
}
+ }
+ {
+ std::unordered_multimap<int, int> c = {};
+ LIBCPP_ASSERT(c.bucket_count() == 0);
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/default_noexcept.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/default_noexcept.pass.cpp
index 394600a43b388f1..5e8f92d8ebdd323 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/default_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/default_noexcept.pass.cpp
@@ -27,50 +27,54 @@
#include "../../../test_hash.h"
template <class T>
-struct some_comp
-{
- typedef T value_type;
- some_comp();
- some_comp(const some_comp&);
- bool operator()(const T&, const T&) const { return false; }
+struct some_comp {
+ typedef T value_type;
+ some_comp();
+ some_comp(const some_comp&);
+ bool operator()(const T&, const T&) const { return false; }
};
template <class T>
-struct some_hash
-{
- typedef T value_type;
- some_hash();
- some_hash(const some_hash&);
- std::size_t operator()(T const&) const;
+struct some_hash {
+ typedef T value_type;
+ some_hash();
+ some_hash(const some_hash&);
+ std::size_t operator()(T const&) const;
};
-int main(int, char**)
-{
+int main(int, char**) {
#if defined(_LIBCPP_VERSION)
- {
- typedef std::unordered_multimap<MoveOnly, MoveOnly> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
- }
- {
- typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, test_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
- }
+ {
+ typedef std::unordered_multimap<MoveOnly, MoveOnly> C;
+ static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ }
+ {
+ typedef std::unordered_multimap<MoveOnly,
+ MoveOnly,
+ std::hash<MoveOnly>,
+ std::equal_to<MoveOnly>,
+ test_allocator<std::pair<const MoveOnly, MoveOnly>>>
+ C;
+ static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ }
#endif // _LIBCPP_VERSION
- {
- typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, other_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
- static_assert(!std::is_nothrow_default_constructible<C>::value, "");
- }
- {
- typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash<MoveOnly>> C;
- static_assert(!std::is_nothrow_default_constructible<C>::value, "");
- }
- {
- typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>,
- some_comp<MoveOnly>> C;
- static_assert(!std::is_nothrow_default_constructible<C>::value, "");
- }
+ {
+ typedef std::unordered_multimap<MoveOnly,
+ MoveOnly,
+ std::hash<MoveOnly>,
+ std::equal_to<MoveOnly>,
+ other_allocator<std::pair<const MoveOnly, MoveOnly>>>
+ C;
+ static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+ }
+ {
+ typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash<MoveOnly>> C;
+ static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+ }
+ {
+ typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>, some_comp<MoveOnly>> C;
+ static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/dtor_noexcept.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/dtor_noexcept.pass.cpp
index e8160e160549be2..6fdc9e3eb7f5ec1 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/dtor_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/dtor_noexcept.pass.cpp
@@ -20,49 +20,53 @@
#include "test_allocator.h"
template <class T>
-struct some_comp
-{
- typedef T value_type;
- ~some_comp() noexcept(false);
- bool operator()(const T&, const T&) const { return false; }
+struct some_comp {
+ typedef T value_type;
+ ~some_comp() noexcept(false);
+ bool operator()(const T&, const T&) const { return false; }
};
template <class T>
-struct some_hash
-{
- typedef T value_type;
- some_hash();
- some_hash(const some_hash&);
- ~some_hash() noexcept(false);
- std::size_t operator()(T const&) const;
+struct some_hash {
+ typedef T value_type;
+ some_hash();
+ some_hash(const some_hash&);
+ ~some_hash() noexcept(false);
+ std::size_t operator()(T const&) const;
};
-int main(int, char**)
-{
- {
- typedef std::unordered_multimap<MoveOnly, MoveOnly> C;
- static_assert(std::is_nothrow_destructible<C>::value, "");
- }
- {
- typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, test_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
- static_assert(std::is_nothrow_destructible<C>::value, "");
- }
- {
- typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, other_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
- static_assert(std::is_nothrow_destructible<C>::value, "");
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<MoveOnly, MoveOnly> C;
+ static_assert(std::is_nothrow_destructible<C>::value, "");
+ }
+ {
+ typedef std::unordered_multimap<MoveOnly,
+ MoveOnly,
+ std::hash<MoveOnly>,
+ std::equal_to<MoveOnly>,
+ test_allocator<std::pair<const MoveOnly, MoveOnly>>>
+ C;
+ static_assert(std::is_nothrow_destructible<C>::value, "");
+ }
+ {
+ typedef std::unordered_multimap<MoveOnly,
+ MoveOnly,
+ std::hash<MoveOnly>,
+ std::equal_to<MoveOnly>,
+ other_allocator<std::pair<const MoveOnly, MoveOnly>>>
+ C;
+ static_assert(std::is_nothrow_destructible<C>::value, "");
+ }
#if defined(_LIBCPP_VERSION)
- {
- typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash<MoveOnly>> C;
- static_assert(!std::is_nothrow_destructible<C>::value, "");
- }
- {
- typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>,
- some_comp<MoveOnly>> C;
- static_assert(!std::is_nothrow_destructible<C>::value, "");
- }
+ {
+ typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash<MoveOnly>> C;
+ static_assert(!std::is_nothrow_destructible<C>::value, "");
+ }
+ {
+ typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>, some_comp<MoveOnly>> C;
+ static_assert(!std::is_nothrow_destructible<C>::value, "");
+ }
#endif // _LIBCPP_VERSION
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/from_range.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/from_range.pass.cpp
index 4fe95da0103945c..df8b3c54ff1bc41 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/from_range.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/from_range.pass.cpp
@@ -28,11 +28,9 @@
#include "test_macros.h"
void test_duplicates() {
- using T = std::pair<const int, char>;
- std::array input = {
- T{1, 'a'}, T{2, 'a'}, T{3, 'a'}, T{3, 'b'}, T{3, 'c'}, T{2, 'b'}, T{4, 'a'}
- };
- auto c = std::unordered_multimap<int, char>(std::from_range, input);
+ using T = std::pair<const int, char>;
+ std::array input = {T{1, 'a'}, T{2, 'a'}, T{3, 'a'}, T{3, 'b'}, T{3, 'c'}, T{2, 'b'}, T{4, 'a'}};
+ auto c = std::unordered_multimap<int, char>(std::from_range, input);
assert(std::ranges::is_permutation(input, c));
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/hash_copy_constructible.compile.fail.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/hash_copy_constructible.compile.fail.cpp
index 77faad2e7654291..5949334c5a3fba5 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/hash_copy_constructible.compile.fail.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/hash_copy_constructible.compile.fail.cpp
@@ -18,16 +18,16 @@
template <class T>
struct Hash {
- std::size_t operator () (const T& lhs) const { return 0; }
+ std::size_t operator()(const T& lhs) const { return 0; }
- Hash () {}
-private:
- Hash (const Hash &); // declared but not defined
- };
+ Hash() {}
+private:
+ Hash(const Hash&); // declared but not defined
+};
int main(int, char**) {
- std::unordered_multimap<int, int, Hash<int> > m;
+ std::unordered_multimap<int, int, Hash<int> > m;
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init.pass.cpp
index 8486062dbc250d6..a1c0be2a3c64e0c 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init.pass.cpp
@@ -31,207 +31,215 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multimap<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- C c = {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- assert(c.bucket_count() >= 7);
- assert(c.size() == 6);
- typedef std::pair<C::const_iterator, C::const_iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ test_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ C c = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ assert(c.bucket_count() >= 7);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- C::const_iterator i = eq.first;
- assert(i->first == 3);
- assert(i->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- i = eq.first;
- assert(i->first == 4);
- assert(i->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- assert(c.hash_function() == test_hash<int>());
- assert(c.key_eq() == test_equal_to<int>());
- assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >()));
- }
- {
- typedef std::unordered_multimap<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- C c = {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- assert(c.bucket_count() >= 7);
- assert(c.size() == 6);
- typedef std::pair<C::const_iterator, C::const_iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ C::const_iterator i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c.hash_function() == test_hash<int>());
+ assert(c.key_eq() == test_equal_to<int>());
+ assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >()));
+ }
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ min_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ C c = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ assert(c.bucket_count() >= 7);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- C::const_iterator i = eq.first;
- assert(i->first == 3);
- assert(i->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- i = eq.first;
- assert(i->first == 4);
- assert(i->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- assert(c.hash_function() == test_hash<int>());
- assert(c.key_eq() == test_equal_to<int>());
- assert((c.get_allocator() == min_allocator<std::pair<const int, std::string> >()));
- }
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ C::const_iterator i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c.hash_function() == test_hash<int>());
+ assert(c.key_eq() == test_equal_to<int>());
+ assert((c.get_allocator() == min_allocator<std::pair<const int, std::string> >()));
+ }
#if TEST_STD_VER > 11
- {
- typedef std::pair<int, std::string> P;
- typedef test_allocator<std::pair<const int, std::string>> A;
- typedef test_hash<int> HF;
- typedef test_equal_to<int> Comp;
- typedef std::unordered_multimap<int, std::string, HF, Comp, A> C;
+ {
+ typedef std::pair<int, std::string> P;
+ typedef test_allocator<std::pair<const int, std::string>> A;
+ typedef test_hash<int> HF;
+ typedef test_equal_to<int> Comp;
+ typedef std::unordered_multimap<int, std::string, HF, Comp, A> C;
- A a(42);
- C c ({
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- }, 12, a );
- assert(c.bucket_count() >= 12);
- assert(c.size() == 6);
- typedef std::pair<C::const_iterator, C::const_iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+ A a(42);
+ C c(
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ },
+ 12,
+ a);
+ assert(c.bucket_count() >= 12);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- C::const_iterator i = eq.first;
- assert(i->first == 3);
- assert(i->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- i = eq.first;
- assert(i->first == 4);
- assert(i->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- assert(c.hash_function() == HF());
- assert(c.key_eq() == Comp());
- assert(c.get_allocator() == a);
- assert(!(c.get_allocator() == A()));
- }
- {
- typedef std::pair<int, std::string> P;
- typedef test_allocator<std::pair<const int, std::string>> A;
- typedef test_hash<int> HF;
- typedef test_equal_to<int> Comp;
- typedef std::unordered_multimap<int, std::string, HF, Comp, A> C;
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ C::const_iterator i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c.hash_function() == HF());
+ assert(c.key_eq() == Comp());
+ assert(c.get_allocator() == a);
+ assert(!(c.get_allocator() == A()));
+ }
+ {
+ typedef std::pair<int, std::string> P;
+ typedef test_allocator<std::pair<const int, std::string>> A;
+ typedef test_hash<int> HF;
+ typedef test_equal_to<int> Comp;
+ typedef std::unordered_multimap<int, std::string, HF, Comp, A> C;
- HF hf(42);
- A a(43);
- C c ({
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- }, 12, hf, a );
- assert(c.bucket_count() >= 12);
- assert(c.size() == 6);
- typedef std::pair<C::const_iterator, C::const_iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+ HF hf(42);
+ A a(43);
+ C c(
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ },
+ 12,
+ hf,
+ a);
+ assert(c.bucket_count() >= 12);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- C::const_iterator i = eq.first;
- assert(i->first == 3);
- assert(i->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- i = eq.first;
- assert(i->first == 4);
- assert(i->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- assert(c.hash_function() == hf);
- assert(!(c.hash_function() == HF()));
- assert(c.key_eq() == Comp());
- assert(c.get_allocator() == a);
- assert(!(c.get_allocator() == A()));
- }
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ C::const_iterator i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c.hash_function() == hf);
+ assert(!(c.hash_function() == HF()));
+ assert(c.key_eq() == Comp());
+ assert(c.get_allocator() == a);
+ assert(!(c.get_allocator() == A()));
+ }
#endif // TEST_STD_VER > 11
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size.pass.cpp
index c5cb706269e2144..6231a02be9ff167 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size.pass.cpp
@@ -31,108 +31,109 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multimap<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- C c({
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- },
- 7
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- typedef std::pair<C::const_iterator, C::const_iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ test_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ C c(
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ },
+ 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- C::const_iterator i = eq.first;
- assert(i->first == 3);
- assert(i->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- i = eq.first;
- assert(i->first == 4);
- assert(i->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- assert(c.hash_function() == test_hash<int>());
- assert(c.key_eq() == test_equal_to<int>());
- assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >()));
- }
- {
- typedef std::unordered_multimap<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- C c({
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- },
- 7
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- typedef std::pair<C::const_iterator, C::const_iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ C::const_iterator i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c.hash_function() == test_hash<int>());
+ assert(c.key_eq() == test_equal_to<int>());
+ assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >()));
+ }
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ min_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ C c(
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ },
+ 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- C::const_iterator i = eq.first;
- assert(i->first == 3);
- assert(i->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- i = eq.first;
- assert(i->first == 4);
- assert(i->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- assert(c.hash_function() == test_hash<int>());
- assert(c.key_eq() == test_equal_to<int>());
- assert((c.get_allocator() == min_allocator<std::pair<const int, std::string> >()));
- }
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ C::const_iterator i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c.hash_function() == test_hash<int>());
+ assert(c.key_eq() == test_equal_to<int>());
+ assert((c.get_allocator() == min_allocator<std::pair<const int, std::string> >()));
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_allocator.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_allocator.pass.cpp
index 523977190c217cb..7ec2dd2efb89537 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_allocator.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_allocator.pass.cpp
@@ -34,67 +34,53 @@
#include "min_allocator.h"
template <class Allocator>
-void test(const Allocator& alloc)
-{
- typedef std::unordered_multimap<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- Allocator> C;
- typedef std::pair<int, std::string> P;
- C c({
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four")
- },
- 7,
- alloc);
+void test(const Allocator& alloc) {
+ typedef std::unordered_multimap<int, std::string, test_hash<int>, test_equal_to<int>, Allocator> C;
+ typedef std::pair<int, std::string> P;
+ C c({P(1, "one"), P(2, "two"), P(3, "three"), P(4, "four"), P(1, "four"), P(2, "four")}, 7, alloc);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
- typedef std::pair<typename C::const_iterator, typename C::const_iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<typename C::const_iterator>(c.find(1), c.end(), 1, s);
+ typedef std::pair<typename C::const_iterator, typename C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<typename C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<typename C::const_iterator>(c.find(2), c.end(), 2, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<typename C::const_iterator>(c.find(2), c.end(), 2, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- typename C::const_iterator i = eq.first;
- assert(i->first == 3);
- assert(i->second == "three");
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ typename C::const_iterator i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- i = eq.first;
- assert(i->first == 4);
- assert(i->second == "four");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- assert(c.hash_function() == test_hash<int>());
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() == alloc);
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c.hash_function() == test_hash<int>());
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == alloc);
}
-int main(int, char**)
-{
- typedef std::pair<const int, std::string> V;
- test(test_allocator<V>(10));
- test(min_allocator<V>());
- test(explicit_allocator<V>());
+int main(int, char**) {
+ typedef std::pair<const int, std::string> V;
+ test(test_allocator<V>(10));
+ test(min_allocator<V>());
+ test(explicit_allocator<V>());
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash.pass.cpp
index 785df175094d197..7550d3781f4c09e 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash.pass.cpp
@@ -31,110 +31,111 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multimap<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- C c({
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- },
- 7,
- test_hash<int>(8)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- typedef std::pair<C::const_iterator, C::const_iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ test_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ C c(
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ },
+ 7,
+ test_hash<int>(8));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- C::const_iterator i = eq.first;
- assert(i->first == 3);
- assert(i->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- i = eq.first;
- assert(i->first == 4);
- assert(i->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>());
- assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >()));
- }
- {
- typedef std::unordered_multimap<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- C c({
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- },
- 7,
- test_hash<int>(8)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- typedef std::pair<C::const_iterator, C::const_iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ C::const_iterator i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>());
+ assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >()));
+ }
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ min_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ C c(
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ },
+ 7,
+ test_hash<int>(8));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- C::const_iterator i = eq.first;
- assert(i->first == 3);
- assert(i->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- i = eq.first;
- assert(i->first == 4);
- assert(i->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>());
- assert((c.get_allocator() == min_allocator<std::pair<const int, std::string> >()));
- }
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ C::const_iterator i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>());
+ assert((c.get_allocator() == min_allocator<std::pair<const int, std::string> >()));
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_allocator.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_allocator.pass.cpp
index 6d0f4e5404afb44..eab5d60fbf6f488 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_allocator.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_allocator.pass.cpp
@@ -34,68 +34,53 @@
#include "min_allocator.h"
template <class Allocator>
-void test(const Allocator& alloc)
-{
- typedef std::unordered_multimap<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- Allocator> C;
- typedef std::pair<int, std::string> P;
- C c({
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four")
- },
- 7,
- test_hash<int>(5),
- alloc);
+void test(const Allocator& alloc) {
+ typedef std::unordered_multimap<int, std::string, test_hash<int>, test_equal_to<int>, Allocator> C;
+ typedef std::pair<int, std::string> P;
+ C c({P(1, "one"), P(2, "two"), P(3, "three"), P(4, "four"), P(1, "four"), P(2, "four")}, 7, test_hash<int>(5), alloc);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
- typedef std::pair<typename C::const_iterator, typename C::const_iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<typename C::const_iterator>(c.find(1), c.end(), 1, s);
+ typedef std::pair<typename C::const_iterator, typename C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<typename C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<typename C::const_iterator>(c.find(2), c.end(), 2, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<typename C::const_iterator>(c.find(2), c.end(), 2, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- typename C::const_iterator i = eq.first;
- assert(i->first == 3);
- assert(i->second == "three");
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ typename C::const_iterator i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- i = eq.first;
- assert(i->first == 4);
- assert(i->second == "four");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- assert(c.hash_function() == test_hash<int>(5));
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() == alloc);
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c.hash_function() == test_hash<int>(5));
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == alloc);
}
-int main(int, char**)
-{
- typedef std::pair<const int, std::string> V;
- test(test_allocator<V>(10));
- test(min_allocator<V>());
- test(explicit_allocator<V>());
+int main(int, char**) {
+ typedef std::pair<const int, std::string> V;
+ test(test_allocator<V>(10));
+ test(min_allocator<V>());
+ test(explicit_allocator<V>());
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal.pass.cpp
index 42d3aa2ba659a00..88408926b0b5e7a 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal.pass.cpp
@@ -32,112 +32,113 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multimap<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- C c({
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- },
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- typedef std::pair<C::const_iterator, C::const_iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ test_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ C c(
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ },
+ 7,
+ test_hash<int>(8),
+ test_equal_to<int>(9));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- C::const_iterator i = eq.first;
- assert(i->first == 3);
- assert(i->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- i = eq.first;
- assert(i->first == 4);
- assert(i->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >()));
- }
- {
- typedef std::unordered_multimap<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- C c({
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- },
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- typedef std::pair<C::const_iterator, C::const_iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ C::const_iterator i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >()));
+ }
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ min_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ C c(
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ },
+ 7,
+ test_hash<int>(8),
+ test_equal_to<int>(9));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- C::const_iterator i = eq.first;
- assert(i->first == 3);
- assert(i->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- i = eq.first;
- assert(i->first == 4);
- assert(i->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert((c.get_allocator() == min_allocator<std::pair<const int, std::string> >()));
- }
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ C::const_iterator i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert((c.get_allocator() == min_allocator<std::pair<const int, std::string> >()));
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal_allocator.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal_allocator.pass.cpp
index beeb5b355ec51df..493d6a708915493 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal_allocator.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal_allocator.pass.cpp
@@ -32,168 +32,165 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multimap<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- C c({
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- },
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- test_allocator<std::pair<const int, std::string> >(10)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- typedef std::pair<C::const_iterator, C::const_iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ test_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ C c(
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ },
+ 7,
+ test_hash<int>(8),
+ test_equal_to<int>(9),
+ test_allocator<std::pair<const int, std::string> >(10));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- C::const_iterator i = eq.first;
- assert(i->first == 3);
- assert(i->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- i = eq.first;
- assert(i->first == 4);
- assert(i->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >(10)));
- }
- {
- typedef std::unordered_multimap<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- C c({
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- },
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- min_allocator<std::pair<const int, std::string> >()
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- typedef std::pair<C::const_iterator, C::const_iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ C::const_iterator i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >(10)));
+ }
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ min_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ C c(
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ },
+ 7,
+ test_hash<int>(8),
+ test_equal_to<int>(9),
+ min_allocator<std::pair<const int, std::string> >());
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- C::const_iterator i = eq.first;
- assert(i->first == 3);
- assert(i->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- i = eq.first;
- assert(i->first == 4);
- assert(i->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert((c.get_allocator() == min_allocator<std::pair<const int, std::string> >()));
- }
- {
- typedef explicit_allocator<std::pair<const int, std::string>> A;
- typedef std::unordered_multimap<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- typedef std::pair<int, std::string> P;
- C c({
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- },
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A{}
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- typedef std::pair<C::const_iterator, C::const_iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ C::const_iterator i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert((c.get_allocator() == min_allocator<std::pair<const int, std::string> >()));
+ }
+ {
+ typedef explicit_allocator<std::pair<const int, std::string>> A;
+ typedef std::unordered_multimap<int, std::string, test_hash<int>, test_equal_to<int>, A > C;
+ typedef std::pair<int, std::string> P;
+ C c(
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ },
+ 7,
+ test_hash<int>(8),
+ test_equal_to<int>(9),
+ A{});
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- C::const_iterator i = eq.first;
- assert(i->first == 3);
- assert(i->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- i = eq.first;
- assert(i->first == 4);
- assert(i->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == A{});
- }
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ C::const_iterator i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == A{});
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/iter_iter.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/iter_iter.pass.cpp
index b3974e08a3d67e0..f370d762a459ec8 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/iter_iter.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/iter_iter.pass.cpp
@@ -32,217 +32,214 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multimap<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])));
- assert(c.bucket_count() >= 7);
- assert(c.size() == 6);
- typedef std::pair<C::const_iterator, C::const_iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ test_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])));
+ assert(c.bucket_count() >= 7);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- C::const_iterator i = eq.first;
- assert(i->first == 3);
- assert(i->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- i = eq.first;
- assert(i->first == 4);
- assert(i->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- assert(c.hash_function() == test_hash<int>());
- assert(c.key_eq() == test_equal_to<int>());
- assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >()));
- }
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ C::const_iterator i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c.hash_function() == test_hash<int>());
+ assert(c.key_eq() == test_equal_to<int>());
+ assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >()));
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multimap<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])));
- assert(c.bucket_count() >= 7);
- assert(c.size() == 6);
- typedef std::pair<C::const_iterator, C::const_iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ min_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])));
+ assert(c.bucket_count() >= 7);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- C::const_iterator i = eq.first;
- assert(i->first == 3);
- assert(i->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- i = eq.first;
- assert(i->first == 4);
- assert(i->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- assert(c.hash_function() == test_hash<int>());
- assert(c.key_eq() == test_equal_to<int>());
- assert((c.get_allocator() == min_allocator<std::pair<const int, std::string> >()));
- }
-#if TEST_STD_VER > 11
- {
- typedef std::pair<int, std::string> P;
- typedef test_allocator<std::pair<const int, std::string>> A;
- typedef test_hash<int> HF;
- typedef test_equal_to<int> Comp;
- typedef std::unordered_multimap<int, std::string, HF, Comp, A> C;
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ C::const_iterator i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c.hash_function() == test_hash<int>());
+ assert(c.key_eq() == test_equal_to<int>());
+ assert((c.get_allocator() == min_allocator<std::pair<const int, std::string> >()));
+ }
+# if TEST_STD_VER > 11
+ {
+ typedef std::pair<int, std::string> P;
+ typedef test_allocator<std::pair<const int, std::string>> A;
+ typedef test_hash<int> HF;
+ typedef test_equal_to<int> Comp;
+ typedef std::unordered_multimap<int, std::string, HF, Comp, A> C;
- P arr[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- A a(42);
- C c(cpp17_input_iterator<P*>(arr), cpp17_input_iterator<P*>(arr + sizeof(arr)/sizeof(arr[0])), 14, a);
- assert(c.bucket_count() >= 14);
- assert(c.size() == 6);
- typedef std::pair<C::const_iterator, C::const_iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+ P arr[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ A a(42);
+ C c(cpp17_input_iterator<P*>(arr), cpp17_input_iterator<P*>(arr + sizeof(arr) / sizeof(arr[0])), 14, a);
+ assert(c.bucket_count() >= 14);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- C::const_iterator i = eq.first;
- assert(i->first == 3);
- assert(i->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- i = eq.first;
- assert(i->first == 4);
- assert(i->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- assert(c.hash_function() == HF());
- assert(c.key_eq() == Comp());
- assert(c.get_allocator() == a);
- assert(!(c.get_allocator() == A()));
- }
- {
- typedef std::pair<int, std::string> P;
- typedef test_allocator<std::pair<const int, std::string>> A;
- typedef test_hash<int> HF;
- typedef test_equal_to<int> Comp;
- typedef std::unordered_multimap<int, std::string, HF, Comp, A> C;
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ C::const_iterator i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c.hash_function() == HF());
+ assert(c.key_eq() == Comp());
+ assert(c.get_allocator() == a);
+ assert(!(c.get_allocator() == A()));
+ }
+ {
+ typedef std::pair<int, std::string> P;
+ typedef test_allocator<std::pair<const int, std::string>> A;
+ typedef test_hash<int> HF;
+ typedef test_equal_to<int> Comp;
+ typedef std::unordered_multimap<int, std::string, HF, Comp, A> C;
- P arr[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- A a(42);
- HF hf (43);
- C c(cpp17_input_iterator<P*>(arr), cpp17_input_iterator<P*>(arr + sizeof(arr)/sizeof(arr[0])), 12, hf, a );
- assert(c.bucket_count() >= 12);
- assert(c.size() == 6);
- typedef std::pair<C::const_iterator, C::const_iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+ P arr[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ A a(42);
+ HF hf(43);
+ C c(cpp17_input_iterator<P*>(arr), cpp17_input_iterator<P*>(arr + sizeof(arr) / sizeof(arr[0])), 12, hf, a);
+ assert(c.bucket_count() >= 12);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- C::const_iterator i = eq.first;
- assert(i->first == 3);
- assert(i->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- i = eq.first;
- assert(i->first == 4);
- assert(i->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- assert(c.hash_function() == hf);
- assert(!(c.hash_function() == HF()));
- assert(c.key_eq() == Comp());
- assert(c.get_allocator() == a);
- assert(!(c.get_allocator() == A()));
- }
-#endif
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ C::const_iterator i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c.hash_function() == hf);
+ assert(!(c.hash_function() == HF()));
+ assert(c.key_eq() == Comp());
+ assert(c.get_allocator() == a);
+ assert(!(c.get_allocator() == A()));
+ }
+# endif
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/iter_iter_size.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/iter_iter_size.pass.cpp
index 374e95eaf842301..9f42bff9f417533 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/iter_iter_size.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/iter_iter_size.pass.cpp
@@ -32,113 +32,108 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multimap<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
- 10
- );
- LIBCPP_ASSERT(c.bucket_count() == 11);
- assert(c.size() == 6);
- typedef std::pair<C::const_iterator, C::const_iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ test_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])), 10);
+ LIBCPP_ASSERT(c.bucket_count() == 11);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- C::const_iterator i = eq.first;
- assert(i->first == 3);
- assert(i->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- i = eq.first;
- assert(i->first == 4);
- assert(i->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- assert(c.hash_function() == test_hash<int>());
- assert(c.key_eq() == test_equal_to<int>());
- assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >()));
- }
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ C::const_iterator i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c.hash_function() == test_hash<int>());
+ assert(c.key_eq() == test_equal_to<int>());
+ assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >()));
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multimap<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
- 10
- );
- LIBCPP_ASSERT(c.bucket_count() == 11);
- assert(c.size() == 6);
- typedef std::pair<C::const_iterator, C::const_iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ min_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])), 10);
+ LIBCPP_ASSERT(c.bucket_count() == 11);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- C::const_iterator i = eq.first;
- assert(i->first == 3);
- assert(i->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- i = eq.first;
- assert(i->first == 4);
- assert(i->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- assert(c.hash_function() == test_hash<int>());
- assert(c.key_eq() == test_equal_to<int>());
- assert((c.get_allocator() == min_allocator<std::pair<const int, std::string> >()));
- }
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ C::const_iterator i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c.hash_function() == test_hash<int>());
+ assert(c.key_eq() == test_equal_to<int>());
+ assert((c.get_allocator() == min_allocator<std::pair<const int, std::string> >()));
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/iter_iter_size_allocator.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/iter_iter_size_allocator.pass.cpp
index 5c1f4b6e39f58aa..ad6ad9d1ad1ef19 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/iter_iter_size_allocator.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/iter_iter_size_allocator.pass.cpp
@@ -36,70 +36,55 @@
#include "min_allocator.h"
template <class Allocator>
-void test(const Allocator& alloc)
-{
- typedef std::unordered_multimap<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- Allocator> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four")
- };
-
- C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])),
- 7,
- alloc);
-
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
-
- typedef std::pair<typename C::const_iterator, typename C::const_iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<typename C::const_iterator>(c.find(1), c.end(), 1, s);
-
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<typename C::const_iterator>(c.find(2), c.end(), 2, s);
-
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- typename C::const_iterator i = eq.first;
- assert(i->first == 3);
- assert(i->second == "three");
-
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- i = eq.first;
- assert(i->first == 4);
- assert(i->second == "four");
-
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- assert(c.hash_function() == test_hash<int>());
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() == alloc);
+void test(const Allocator& alloc) {
+ typedef std::unordered_multimap<int, std::string, test_hash<int>, test_equal_to<int>, Allocator> C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {P(1, "one"), P(2, "two"), P(3, "three"), P(4, "four"), P(1, "four"), P(2, "four")};
+
+ C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])), 7, alloc);
+
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+
+ typedef std::pair<typename C::const_iterator, typename C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<typename C::const_iterator>(c.find(1), c.end(), 1, s);
+
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<typename C::const_iterator>(c.find(2), c.end(), 2, s);
+
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ typename C::const_iterator i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c.hash_function() == test_hash<int>());
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == alloc);
}
-int main(int, char**)
-{
- typedef std::pair<const int, std::string> V;
- test(test_allocator<V>(10));
- test(min_allocator<V>());
- test(explicit_allocator<V>());
+int main(int, char**) {
+ typedef std::pair<const int, std::string> V;
+ test(test_allocator<V>(10));
+ test(min_allocator<V>());
+ test(explicit_allocator<V>());
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/iter_iter_size_hash.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/iter_iter_size_hash.pass.cpp
index ce99c918acfea13..dc6a567fa88496c 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/iter_iter_size_hash.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/iter_iter_size_hash.pass.cpp
@@ -33,115 +33,108 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multimap<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
- 7,
- test_hash<int>(8)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- typedef std::pair<C::const_iterator, C::const_iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ test_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])), 7, test_hash<int>(8));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- C::const_iterator i = eq.first;
- assert(i->first == 3);
- assert(i->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- i = eq.first;
- assert(i->first == 4);
- assert(i->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>());
- assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >()));
- }
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ C::const_iterator i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>());
+ assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >()));
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multimap<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
- 7,
- test_hash<int>(8)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- typedef std::pair<C::const_iterator, C::const_iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ min_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])), 7, test_hash<int>(8));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- C::const_iterator i = eq.first;
- assert(i->first == 3);
- assert(i->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- i = eq.first;
- assert(i->first == 4);
- assert(i->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>());
- assert((c.get_allocator() == min_allocator<std::pair<const int, std::string> >()));
- }
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ C::const_iterator i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>());
+ assert((c.get_allocator() == min_allocator<std::pair<const int, std::string> >()));
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/iter_iter_size_hash_allocator.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/iter_iter_size_hash_allocator.pass.cpp
index 82cb9fc443f2a56..ee35b36cf75193d 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/iter_iter_size_hash_allocator.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/iter_iter_size_hash_allocator.pass.cpp
@@ -36,71 +36,55 @@
#include "min_allocator.h"
template <class Allocator>
-void test(const Allocator& alloc)
-{
- typedef std::unordered_multimap<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- Allocator> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four")
- };
-
- C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])),
- 7,
- test_hash<int>(5),
- alloc);
-
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
-
- typedef std::pair<typename C::const_iterator, typename C::const_iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<typename C::const_iterator>(c.find(1), c.end(), 1, s);
-
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<typename C::const_iterator>(c.find(2), c.end(), 2, s);
-
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- typename C::const_iterator i = eq.first;
- assert(i->first == 3);
- assert(i->second == "three");
-
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- i = eq.first;
- assert(i->first == 4);
- assert(i->second == "four");
-
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- assert(c.hash_function() == test_hash<int>(5));
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() == alloc);
+void test(const Allocator& alloc) {
+ typedef std::unordered_multimap<int, std::string, test_hash<int>, test_equal_to<int>, Allocator> C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {P(1, "one"), P(2, "two"), P(3, "three"), P(4, "four"), P(1, "four"), P(2, "four")};
+
+ C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])), 7, test_hash<int>(5), alloc);
+
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+
+ typedef std::pair<typename C::const_iterator, typename C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<typename C::const_iterator>(c.find(1), c.end(), 1, s);
+
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<typename C::const_iterator>(c.find(2), c.end(), 2, s);
+
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ typename C::const_iterator i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c.hash_function() == test_hash<int>(5));
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == alloc);
}
-int main(int, char**)
-{
- typedef std::pair<const int, std::string> V;
- test(test_allocator<V>(10));
- test(min_allocator<V>());
- test(explicit_allocator<V>());
+int main(int, char**) {
+ typedef std::pair<const int, std::string> V;
+ test(test_allocator<V>(10));
+ test(min_allocator<V>());
+ test(explicit_allocator<V>());
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/iter_iter_size_hash_equal.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/iter_iter_size_hash_equal.pass.cpp
index 0a27a4c37f62a40..d071f182f95bca2 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/iter_iter_size_hash_equal.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/iter_iter_size_hash_equal.pass.cpp
@@ -33,117 +33,116 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multimap<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- typedef std::pair<C::const_iterator, C::const_iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ test_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(cpp17_input_iterator<P*>(a),
+ cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])),
+ 7,
+ test_hash<int>(8),
+ test_equal_to<int>(9));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- C::const_iterator i = eq.first;
- assert(i->first == 3);
- assert(i->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- i = eq.first;
- assert(i->first == 4);
- assert(i->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >()));
- }
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ C::const_iterator i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >()));
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multimap<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- typedef std::pair<C::const_iterator, C::const_iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ min_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(cpp17_input_iterator<P*>(a),
+ cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])),
+ 7,
+ test_hash<int>(8),
+ test_equal_to<int>(9));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- C::const_iterator i = eq.first;
- assert(i->first == 3);
- assert(i->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- i = eq.first;
- assert(i->first == 4);
- assert(i->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert((c.get_allocator() == min_allocator<std::pair<const int, std::string> >()));
- }
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ C::const_iterator i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert((c.get_allocator() == min_allocator<std::pair<const int, std::string> >()));
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/iter_iter_size_hash_equal_allocator.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/iter_iter_size_hash_equal_allocator.pass.cpp
index 0dd157ae5b11a56..4eee3451c610f01 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/iter_iter_size_hash_equal_allocator.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/iter_iter_size_hash_equal_allocator.pass.cpp
@@ -34,175 +34,169 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multimap<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- test_allocator<std::pair<const int, std::string> >(10)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- typedef std::pair<C::const_iterator, C::const_iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ test_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(cpp17_input_iterator<P*>(a),
+ cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])),
+ 7,
+ test_hash<int>(8),
+ test_equal_to<int>(9),
+ test_allocator<std::pair<const int, std::string> >(10));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- C::const_iterator i = eq.first;
- assert(i->first == 3);
- assert(i->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- i = eq.first;
- assert(i->first == 4);
- assert(i->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >(10)));
- }
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ C::const_iterator i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >(10)));
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multimap<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- min_allocator<std::pair<const int, std::string> >()
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- typedef std::pair<C::const_iterator, C::const_iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ min_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(cpp17_input_iterator<P*>(a),
+ cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])),
+ 7,
+ test_hash<int>(8),
+ test_equal_to<int>(9),
+ min_allocator<std::pair<const int, std::string> >());
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- C::const_iterator i = eq.first;
- assert(i->first == 3);
- assert(i->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- i = eq.first;
- assert(i->first == 4);
- assert(i->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert((c.get_allocator() == min_allocator<std::pair<const int, std::string> >()));
- }
- {
- typedef explicit_allocator<std::pair<const int, std::string>> A;
- typedef std::unordered_multimap<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A{}
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- typedef std::pair<C::const_iterator, C::const_iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ C::const_iterator i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert((c.get_allocator() == min_allocator<std::pair<const int, std::string> >()));
+ }
+ {
+ typedef explicit_allocator<std::pair<const int, std::string>> A;
+ typedef std::unordered_multimap<int, std::string, test_hash<int>, test_equal_to<int>, A > C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(cpp17_input_iterator<P*>(a),
+ cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])),
+ 7,
+ test_hash<int>(8),
+ test_equal_to<int>(9),
+ A{});
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- C::const_iterator i = eq.first;
- assert(i->first == 3);
- assert(i->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- i = eq.first;
- assert(i->first == 4);
- assert(i->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == A{});
- }
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ C::const_iterator i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == A{});
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move.pass.cpp
index afe88a27c7c51a2..12e6d07708d87cd 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move.pass.cpp
@@ -31,181 +31,172 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multimap<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<std::pair<const int, std::string> >
- > C;
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ test_allocator<std::pair<const int, std::string> > >
+ C;
- C c0(7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- test_allocator<std::pair<const int, std::string> >(10)
- );
- C c = std::move(c0);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 0);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() ==
- (test_allocator<std::pair<const int, std::string> >(10)));
- assert(c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
+ C c0(7, test_hash<int>(8), test_equal_to<int>(9), test_allocator<std::pair<const int, std::string> >(10));
+ C c = std::move(c0);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 0);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == (test_allocator<std::pair<const int, std::string> >(10)));
+ assert(c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
- assert(c0.empty());
- }
- {
- typedef std::unordered_multimap<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- test_allocator<std::pair<const int, std::string> >(10)
- );
- C::iterator it0 = c0.begin();
- C c = std::move(c0);
- assert(it0 == c.begin()); // Iterators remain valid
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- typedef std::pair<C::const_iterator, C::const_iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+ assert(c0.empty());
+ }
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ test_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a,
+ a + sizeof(a) / sizeof(a[0]),
+ 7,
+ test_hash<int>(8),
+ test_equal_to<int>(9),
+ test_allocator<std::pair<const int, std::string> >(10));
+ C::iterator it0 = c0.begin();
+ C c = std::move(c0);
+ assert(it0 == c.begin()); // Iterators remain valid
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- C::const_iterator i = eq.first;
- assert(i->first == 3);
- assert(i->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- i = eq.first;
- assert(i->first == 4);
- assert(i->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >(10)));
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ C::const_iterator i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >(10)));
- assert(c0.empty());
- }
- {
- typedef std::unordered_multimap<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<std::pair<const int, std::string> >
- > C;
- C c0(7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- min_allocator<std::pair<const int, std::string> >()
- );
- C c = std::move(c0);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 0);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() ==
- (min_allocator<std::pair<const int, std::string> >()));
- assert(c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
+ assert(c0.empty());
+ }
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ min_allocator<std::pair<const int, std::string> > >
+ C;
+ C c0(7, test_hash<int>(8), test_equal_to<int>(9), min_allocator<std::pair<const int, std::string> >());
+ C c = std::move(c0);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 0);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == (min_allocator<std::pair<const int, std::string> >()));
+ assert(c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
- assert(c0.empty());
- }
- {
- typedef std::unordered_multimap<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<std::pair<const int, std::string> >
- > C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- min_allocator<std::pair<const int, std::string> >()
- );
- C::iterator it0 = c0.begin();
- C c = std::move(c0);
- assert(it0 == c.begin()); // Iterators remain valid
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- typedef std::pair<C::const_iterator, C::const_iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+ assert(c0.empty());
+ }
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ test_hash<int>,
+ test_equal_to<int>,
+ min_allocator<std::pair<const int, std::string> > >
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a,
+ a + sizeof(a) / sizeof(a[0]),
+ 7,
+ test_hash<int>(8),
+ test_equal_to<int>(9),
+ min_allocator<std::pair<const int, std::string> >());
+ C::iterator it0 = c0.begin();
+ C c = std::move(c0);
+ assert(it0 == c.begin()); // Iterators remain valid
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- C::const_iterator i = eq.first;
- assert(i->first == 3);
- assert(i->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- i = eq.first;
- assert(i->first == 4);
- assert(i->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert((c.get_allocator() == min_allocator<std::pair<const int, std::string> >()));
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ C::const_iterator i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert((c.get_allocator() == min_allocator<std::pair<const int, std::string> >()));
- assert(c0.empty());
- }
+ assert(c0.empty());
+ }
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_alloc.addressof.compile.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_alloc.addressof.compile.pass.cpp
index 6419a03666d656e..53c51792429499e 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_alloc.addressof.compile.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_alloc.addressof.compile.pass.cpp
@@ -28,8 +28,12 @@
void test() {
using A = test_allocator<std::pair<const operator_hijacker, operator_hijacker>>;
- using C = std::unordered_multimap<operator_hijacker, operator_hijacker, std::hash<operator_hijacker>,
- std::equal_to<operator_hijacker>, A>;
+ using C =
+ std::unordered_multimap<operator_hijacker,
+ operator_hijacker,
+ std::hash<operator_hijacker>,
+ std::equal_to<operator_hijacker>,
+ A>;
C mo;
C m(std::move(mo), A());
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_alloc.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_alloc.pass.cpp
index 01260c4662701fc..4a038dc4a6589ea 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_alloc.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_alloc.pass.cpp
@@ -31,244 +31,203 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::pair<int, std::string> P;
- typedef test_allocator<std::pair<const int, std::string>> A;
- typedef std::unordered_multimap<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A(10)
- );
- C c(std::move(c0), A(12));
- assert(c.bucket_count() >= 7);
- assert(c.size() == 6);
- typedef std::pair<C::const_iterator, C::const_iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
-
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- C::const_iterator i = eq.first;
- assert(i->first == 3);
- assert(i->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- i = eq.first;
- assert(i->first == 4);
- assert(i->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >(12)));
-
- assert(c0.empty());
- }
- {
- typedef std::pair<int, std::string> P;
- typedef test_allocator<std::pair<const int, std::string>> A;
- typedef std::unordered_multimap<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A(10)
- );
- C c(std::move(c0), A(10));
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- typedef std::pair<C::const_iterator, C::const_iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
-
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- C::const_iterator i = eq.first;
- assert(i->first == 3);
- assert(i->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- i = eq.first;
- assert(i->first == 4);
- assert(i->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >(10)));
-
- assert(c0.empty());
- }
- {
- typedef std::pair<int, std::string> P;
- typedef min_allocator<std::pair<const int, std::string>> A;
- typedef std::unordered_multimap<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A()
- );
- C c(std::move(c0), A());
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- typedef std::pair<C::const_iterator, C::const_iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
-
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- C::const_iterator i = eq.first;
- assert(i->first == 3);
- assert(i->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- i = eq.first;
- assert(i->first == 4);
- assert(i->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert((c.get_allocator() == min_allocator<std::pair<const int, std::string> >()));
-
- assert(c0.empty());
- }
- {
- typedef std::pair<int, std::string> P;
- typedef explicit_allocator<std::pair<const int, std::string>> A;
- typedef std::unordered_multimap<int, std::string,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A{}
- );
- C c(std::move(c0), A());
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- typedef std::pair<C::const_iterator, C::const_iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
-
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- C::const_iterator i = eq.first;
- assert(i->first == 3);
- assert(i->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- i = eq.first;
- assert(i->first == 4);
- assert(i->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == A{});
-
- assert(c0.empty());
- }
-
- return 0;
+int main(int, char**) {
+ {
+ typedef std::pair<int, std::string> P;
+ typedef test_allocator<std::pair<const int, std::string>> A;
+ typedef std::unordered_multimap<int, std::string, test_hash<int>, test_equal_to<int>, A > C;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), A(10));
+ C c(std::move(c0), A(12));
+ assert(c.bucket_count() >= 7);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ C::const_iterator i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >(12)));
+
+ assert(c0.empty());
+ }
+ {
+ typedef std::pair<int, std::string> P;
+ typedef test_allocator<std::pair<const int, std::string>> A;
+ typedef std::unordered_multimap<int, std::string, test_hash<int>, test_equal_to<int>, A > C;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), A(10));
+ C c(std::move(c0), A(10));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ C::const_iterator i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >(10)));
+
+ assert(c0.empty());
+ }
+ {
+ typedef std::pair<int, std::string> P;
+ typedef min_allocator<std::pair<const int, std::string>> A;
+ typedef std::unordered_multimap<int, std::string, test_hash<int>, test_equal_to<int>, A > C;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), A());
+ C c(std::move(c0), A());
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ C::const_iterator i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert((c.get_allocator() == min_allocator<std::pair<const int, std::string> >()));
+
+ assert(c0.empty());
+ }
+ {
+ typedef std::pair<int, std::string> P;
+ typedef explicit_allocator<std::pair<const int, std::string>> A;
+ typedef std::unordered_multimap<int, std::string, test_hash<int>, test_equal_to<int>, A > C;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), A{});
+ C c(std::move(c0), A());
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ C::const_iterator i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == A{});
+
+ assert(c0.empty());
+ }
+
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_noexcept.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_noexcept.pass.cpp
index ae62e66d4071aee..229ec7121cf3eef 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_noexcept.pass.cpp
@@ -24,49 +24,53 @@
#include "test_allocator.h"
template <class T>
-struct some_comp
-{
- typedef T value_type;
- some_comp(const some_comp&);
- bool operator()(const T&, const T&) const { return false; }
+struct some_comp {
+ typedef T value_type;
+ some_comp(const some_comp&);
+ bool operator()(const T&, const T&) const { return false; }
};
template <class T>
-struct some_hash
-{
- typedef T value_type;
- some_hash();
- some_hash(const some_hash&);
- std::size_t operator()(T const&) const;
+struct some_hash {
+ typedef T value_type;
+ some_hash();
+ some_hash(const some_hash&);
+ std::size_t operator()(T const&) const;
};
-int main(int, char**)
-{
+int main(int, char**) {
#if defined(_LIBCPP_VERSION)
- {
- typedef std::unordered_multimap<MoveOnly, MoveOnly> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
- }
- {
- typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, test_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
- }
- {
- typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, other_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
- }
+ {
+ typedef std::unordered_multimap<MoveOnly, MoveOnly> C;
+ static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ }
+ {
+ typedef std::unordered_multimap<MoveOnly,
+ MoveOnly,
+ std::hash<MoveOnly>,
+ std::equal_to<MoveOnly>,
+ test_allocator<std::pair<const MoveOnly, MoveOnly>>>
+ C;
+ static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ }
+ {
+ typedef std::unordered_multimap<MoveOnly,
+ MoveOnly,
+ std::hash<MoveOnly>,
+ std::equal_to<MoveOnly>,
+ other_allocator<std::pair<const MoveOnly, MoveOnly>>>
+ C;
+ static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ }
#endif // _LIBCPP_VERSION
- {
- typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash<MoveOnly>> C;
- static_assert(!std::is_nothrow_move_constructible<C>::value, "");
- }
- {
- typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>,
- some_comp<MoveOnly>> C;
- static_assert(!std::is_nothrow_move_constructible<C>::value, "");
- }
+ {
+ typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash<MoveOnly>> C;
+ static_assert(!std::is_nothrow_move_constructible<C>::value, "");
+ }
+ {
+ typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>, some_comp<MoveOnly>> C;
+ static_assert(!std::is_nothrow_move_constructible<C>::value, "");
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size.compile.fail.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size.compile.fail.cpp
index 810f6a51c72c2b6..a550d23d55b3888 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size.compile.fail.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size.compile.fail.cpp
@@ -24,47 +24,44 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multimap<NotConstructible, NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- test_allocator<std::pair<const NotConstructible,
- NotConstructible> >
- > C;
- C c = 7;
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.hash_function() == test_hash<NotConstructible>());
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() ==
- (test_allocator<std::pair<const NotConstructible, NotConstructible> >()));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<NotConstructible,
+ NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ test_allocator<std::pair<const NotConstructible, NotConstructible> > >
+ C;
+ C c = 7;
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<NotConstructible>());
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == (test_allocator<std::pair<const NotConstructible, NotConstructible> >()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multimap<NotConstructible, NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- min_allocator<std::pair<const NotConstructible,
- NotConstructible> >
- > C;
- C c = 7;
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.hash_function() == test_hash<NotConstructible>());
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() ==
- (min_allocator<std::pair<const NotConstructible, NotConstructible> >()));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+ {
+ typedef std::unordered_multimap<NotConstructible,
+ NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ min_allocator<std::pair<const NotConstructible, NotConstructible> > >
+ C;
+ C c = 7;
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<NotConstructible>());
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == (min_allocator<std::pair<const NotConstructible, NotConstructible> >()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size.pass.cpp
index fa87144f1692fe9..20f09424489ad33 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size.pass.cpp
@@ -24,47 +24,44 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multimap<NotConstructible, NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- test_allocator<std::pair<const NotConstructible,
- NotConstructible> >
- > C;
- C c(7);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.hash_function() == test_hash<NotConstructible>());
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() ==
- (test_allocator<std::pair<const NotConstructible, NotConstructible> >()));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<NotConstructible,
+ NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ test_allocator<std::pair<const NotConstructible, NotConstructible> > >
+ C;
+ C c(7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<NotConstructible>());
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == (test_allocator<std::pair<const NotConstructible, NotConstructible> >()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multimap<NotConstructible, NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- min_allocator<std::pair<const NotConstructible,
- NotConstructible> >
- > C;
- C c(7);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.hash_function() == test_hash<NotConstructible>());
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() ==
- (min_allocator<std::pair<const NotConstructible, NotConstructible> >()));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+ {
+ typedef std::unordered_multimap<NotConstructible,
+ NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ min_allocator<std::pair<const NotConstructible, NotConstructible> > >
+ C;
+ C c(7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<NotConstructible>());
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == (min_allocator<std::pair<const NotConstructible, NotConstructible> >()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_allocator.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_allocator.pass.cpp
index b90f6db7913b899..d49be5518922a78 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_allocator.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_allocator.pass.cpp
@@ -28,31 +28,30 @@
#include "min_allocator.h"
template <class Allocator>
-void test(const Allocator& alloc)
-{
- typedef std::unordered_multimap<NotConstructible, NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- Allocator> C;
- C c(7,
- alloc);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.hash_function() == test_hash<NotConstructible>());
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() == alloc);
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
+void test(const Allocator& alloc) {
+ typedef std::unordered_multimap<NotConstructible,
+ NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ Allocator>
+ C;
+ C c(7, alloc);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<NotConstructible>());
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == alloc);
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
}
-int main(int, char**)
-{
- typedef std::pair<const NotConstructible, NotConstructible> V;
- test(test_allocator<V>(10));
- test(min_allocator<V>());
- test(explicit_allocator<V>());
+int main(int, char**) {
+ typedef std::pair<const NotConstructible, NotConstructible> V;
+ test(test_allocator<V>(10));
+ test(min_allocator<V>());
+ test(explicit_allocator<V>());
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash.pass.cpp
index 70bab4197449bbd..99575cc8cadf91f 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash.pass.cpp
@@ -24,51 +24,44 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multimap<NotConstructible, NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- test_allocator<std::pair<const NotConstructible,
- NotConstructible> >
- > C;
- C c(7,
- test_hash<NotConstructible>(8)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.hash_function() == test_hash<NotConstructible>(8));
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() ==
- (test_allocator<std::pair<const NotConstructible, NotConstructible> >()));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<NotConstructible,
+ NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ test_allocator<std::pair<const NotConstructible, NotConstructible> > >
+ C;
+ C c(7, test_hash<NotConstructible>(8));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<NotConstructible>(8));
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == (test_allocator<std::pair<const NotConstructible, NotConstructible> >()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multimap<NotConstructible, NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- min_allocator<std::pair<const NotConstructible,
- NotConstructible> >
- > C;
- C c(7,
- test_hash<NotConstructible>(8)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.hash_function() == test_hash<NotConstructible>(8));
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() ==
- (min_allocator<std::pair<const NotConstructible, NotConstructible> >()));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+ {
+ typedef std::unordered_multimap<NotConstructible,
+ NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ min_allocator<std::pair<const NotConstructible, NotConstructible> > >
+ C;
+ C c(7, test_hash<NotConstructible>(8));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<NotConstructible>(8));
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == (min_allocator<std::pair<const NotConstructible, NotConstructible> >()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash_allocator.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash_allocator.pass.cpp
index ad98e99558d4810..f26fae2a2a81dce 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash_allocator.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash_allocator.pass.cpp
@@ -28,32 +28,30 @@
#include "min_allocator.h"
template <class Allocator>
-void test(const Allocator& alloc)
-{
- typedef std::unordered_multimap<NotConstructible, NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- Allocator> C;
- C c(7,
- test_hash<NotConstructible>(8),
- alloc);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.hash_function() == test_hash<NotConstructible>(8));
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() == alloc);
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
+void test(const Allocator& alloc) {
+ typedef std::unordered_multimap<NotConstructible,
+ NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ Allocator>
+ C;
+ C c(7, test_hash<NotConstructible>(8), alloc);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<NotConstructible>(8));
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == alloc);
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
}
-int main(int, char**)
-{
- typedef std::pair<const NotConstructible, NotConstructible> V;
- test(test_allocator<V>(10));
- test(min_allocator<V>());
- test(explicit_allocator<V>());
+int main(int, char**) {
+ typedef std::pair<const NotConstructible, NotConstructible> V;
+ test(test_allocator<V>(10));
+ test(min_allocator<V>());
+ test(explicit_allocator<V>());
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash_equal.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash_equal.pass.cpp
index 7709dfe9452f70c..8cd804d1b401c24 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash_equal.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash_equal.pass.cpp
@@ -24,53 +24,44 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multimap<NotConstructible, NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- test_allocator<std::pair<const NotConstructible,
- NotConstructible> >
- > C;
- C c(7,
- test_hash<NotConstructible>(8),
- test_equal_to<NotConstructible>(9)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.hash_function() == test_hash<NotConstructible>(8));
- assert(c.key_eq() == test_equal_to<NotConstructible>(9));
- assert(c.get_allocator() ==
- (test_allocator<std::pair<const NotConstructible, NotConstructible> >()));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<NotConstructible,
+ NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ test_allocator<std::pair<const NotConstructible, NotConstructible> > >
+ C;
+ C c(7, test_hash<NotConstructible>(8), test_equal_to<NotConstructible>(9));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<NotConstructible>(8));
+ assert(c.key_eq() == test_equal_to<NotConstructible>(9));
+ assert(c.get_allocator() == (test_allocator<std::pair<const NotConstructible, NotConstructible> >()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multimap<NotConstructible, NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- min_allocator<std::pair<const NotConstructible,
- NotConstructible> >
- > C;
- C c(7,
- test_hash<NotConstructible>(8),
- test_equal_to<NotConstructible>(9)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.hash_function() == test_hash<NotConstructible>(8));
- assert(c.key_eq() == test_equal_to<NotConstructible>(9));
- assert(c.get_allocator() ==
- (min_allocator<std::pair<const NotConstructible, NotConstructible> >()));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+ {
+ typedef std::unordered_multimap<NotConstructible,
+ NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ min_allocator<std::pair<const NotConstructible, NotConstructible> > >
+ C;
+ C c(7, test_hash<NotConstructible>(8), test_equal_to<NotConstructible>(9));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<NotConstructible>(8));
+ assert(c.key_eq() == test_equal_to<NotConstructible>(9));
+ assert(c.get_allocator() == (min_allocator<std::pair<const NotConstructible, NotConstructible> >()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash_equal_allocator.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash_equal_allocator.pass.cpp
index 1fd4bb60a5dbe50..64298cd610c14b2 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash_equal_allocator.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash_equal_allocator.pass.cpp
@@ -24,77 +24,69 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multimap<NotConstructible, NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- test_allocator<std::pair<const NotConstructible,
- NotConstructible> >
- > C;
- C c(7,
- test_hash<NotConstructible>(8),
- test_equal_to<NotConstructible>(9),
- test_allocator<std::pair<const NotConstructible, NotConstructible> >(10)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.hash_function() == test_hash<NotConstructible>(8));
- assert(c.key_eq() == test_equal_to<NotConstructible>(9));
- assert(c.get_allocator() ==
- (test_allocator<std::pair<const NotConstructible, NotConstructible> >(10)));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<NotConstructible,
+ NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ test_allocator<std::pair<const NotConstructible, NotConstructible> > >
+ C;
+ C c(7,
+ test_hash<NotConstructible>(8),
+ test_equal_to<NotConstructible>(9),
+ test_allocator<std::pair<const NotConstructible, NotConstructible> >(10));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<NotConstructible>(8));
+ assert(c.key_eq() == test_equal_to<NotConstructible>(9));
+ assert(c.get_allocator() == (test_allocator<std::pair<const NotConstructible, NotConstructible> >(10)));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multimap<NotConstructible, NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- min_allocator<std::pair<const NotConstructible,
- NotConstructible> >
- > C;
- C c(7,
- test_hash<NotConstructible>(8),
- test_equal_to<NotConstructible>(9),
- min_allocator<std::pair<const NotConstructible, NotConstructible> >()
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.hash_function() == test_hash<NotConstructible>(8));
- assert(c.key_eq() == test_equal_to<NotConstructible>(9));
- assert(c.get_allocator() ==
- (min_allocator<std::pair<const NotConstructible, NotConstructible> >()));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef explicit_allocator<std::pair<const NotConstructible, NotConstructible> > A;
- typedef std::unordered_multimap<NotConstructible, NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- A
- > C;
- C c(7,
- test_hash<NotConstructible>(8),
- test_equal_to<NotConstructible>(9),
- A{}
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.hash_function() == test_hash<NotConstructible>(8));
- assert(c.key_eq() == test_equal_to<NotConstructible>(9));
- assert(c.get_allocator() == A{});
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+ {
+ typedef std::unordered_multimap<NotConstructible,
+ NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ min_allocator<std::pair<const NotConstructible, NotConstructible> > >
+ C;
+ C c(7,
+ test_hash<NotConstructible>(8),
+ test_equal_to<NotConstructible>(9),
+ min_allocator<std::pair<const NotConstructible, NotConstructible> >());
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<NotConstructible>(8));
+ assert(c.key_eq() == test_equal_to<NotConstructible>(9));
+ assert(c.get_allocator() == (min_allocator<std::pair<const NotConstructible, NotConstructible> >()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef explicit_allocator<std::pair<const NotConstructible, NotConstructible> > A;
+ typedef std::unordered_multimap<NotConstructible,
+ NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ A >
+ C;
+ C c(7, test_hash<NotConstructible>(8), test_equal_to<NotConstructible>(9), A{});
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<NotConstructible>(8));
+ assert(c.key_eq() == test_equal_to<NotConstructible>(9));
+ assert(c.get_allocator() == A{});
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/clear.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/clear.pass.cpp
index 71c3c57c215fecb..4e69b19cf2c109a 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/clear.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/clear.pass.cpp
@@ -21,44 +21,45 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multimap<int, std::string> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- ASSERT_NOEXCEPT(c.clear());
- c.clear();
- assert(c.size() == 0);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ ASSERT_NOEXCEPT(c.clear());
+ c.clear();
+ assert(c.size() == 0);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- ASSERT_NOEXCEPT(c.clear());
- c.clear();
- assert(c.size() == 0);
- }
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ ASSERT_NOEXCEPT(c.clear());
+ c.clear();
+ assert(c.size() == 0);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace.pass.cpp
index 1f32893f47add96..e3c1b6e2450e43f 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace.pass.cpp
@@ -24,51 +24,50 @@
#include "../../../Emplaceable.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multimap<int, Emplaceable> C;
- typedef C::iterator R;
- C c;
- R r = c.emplace(std::piecewise_construct, std::forward_as_tuple(3),
- std::forward_as_tuple());
- assert(c.size() == 1);
- assert(r->first == 3);
- assert(r->second == Emplaceable());
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<int, Emplaceable> C;
+ typedef C::iterator R;
+ C c;
+ R r = c.emplace(std::piecewise_construct, std::forward_as_tuple(3), std::forward_as_tuple());
+ assert(c.size() == 1);
+ assert(r->first == 3);
+ assert(r->second == Emplaceable());
- r = c.emplace(std::pair<const int, Emplaceable>(4, Emplaceable(5, 6)));
- assert(c.size() == 2);
- assert(r->first == 4);
- assert(r->second == Emplaceable(5, 6));
+ r = c.emplace(std::pair<const int, Emplaceable>(4, Emplaceable(5, 6)));
+ assert(c.size() == 2);
+ assert(r->first == 4);
+ assert(r->second == Emplaceable(5, 6));
- r = c.emplace(std::piecewise_construct, std::forward_as_tuple(5),
- std::forward_as_tuple(6, 7));
- assert(c.size() == 3);
- assert(r->first == 5);
- assert(r->second == Emplaceable(6, 7));
- }
- {
- typedef std::unordered_multimap<int, Emplaceable, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, Emplaceable>>> C;
- typedef C::iterator R;
- C c;
- R r = c.emplace(std::piecewise_construct, std::forward_as_tuple(3),
- std::forward_as_tuple());
- assert(c.size() == 1);
- assert(r->first == 3);
- assert(r->second == Emplaceable());
+ r = c.emplace(std::piecewise_construct, std::forward_as_tuple(5), std::forward_as_tuple(6, 7));
+ assert(c.size() == 3);
+ assert(r->first == 5);
+ assert(r->second == Emplaceable(6, 7));
+ }
+ {
+ typedef std::unordered_multimap<int,
+ Emplaceable,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, Emplaceable>>>
+ C;
+ typedef C::iterator R;
+ C c;
+ R r = c.emplace(std::piecewise_construct, std::forward_as_tuple(3), std::forward_as_tuple());
+ assert(c.size() == 1);
+ assert(r->first == 3);
+ assert(r->second == Emplaceable());
- r = c.emplace(std::pair<const int, Emplaceable>(4, Emplaceable(5, 6)));
- assert(c.size() == 2);
- assert(r->first == 4);
- assert(r->second == Emplaceable(5, 6));
+ r = c.emplace(std::pair<const int, Emplaceable>(4, Emplaceable(5, 6)));
+ assert(c.size() == 2);
+ assert(r->first == 4);
+ assert(r->second == Emplaceable(5, 6));
- r = c.emplace(std::piecewise_construct, std::forward_as_tuple(5),
- std::forward_as_tuple(6, 7));
- assert(c.size() == 3);
- assert(r->first == 5);
- assert(r->second == Emplaceable(6, 7));
- }
+ r = c.emplace(std::piecewise_construct, std::forward_as_tuple(5), std::forward_as_tuple(6, 7));
+ assert(c.size() == 3);
+ assert(r->first == 5);
+ assert(r->second == Emplaceable(6, 7));
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp
index 2a6e3f60ca6b57b..1d0014275bf8c2b 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp
@@ -17,7 +17,6 @@
// template <class... Args>
// iterator emplace_hint(const_iterator p, Args&&... args);
-
#include <unordered_map>
#include <cassert>
#include <iterator>
@@ -26,69 +25,68 @@
#include "min_allocator.h"
#include "test_macros.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multimap<int, Emplaceable> C;
- typedef C::iterator R;
- C c;
- C::const_iterator e = c.end();
- R r = c.emplace_hint(e, std::piecewise_construct, std::forward_as_tuple(3),
- std::forward_as_tuple());
- assert(c.size() == 1);
- assert(r->first == 3);
- assert(r->second == Emplaceable());
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<int, Emplaceable> C;
+ typedef C::iterator R;
+ C c;
+ C::const_iterator e = c.end();
+ R r = c.emplace_hint(e, std::piecewise_construct, std::forward_as_tuple(3), std::forward_as_tuple());
+ assert(c.size() == 1);
+ assert(r->first == 3);
+ assert(r->second == Emplaceable());
- r = c.emplace_hint(c.end(), std::pair<const int, Emplaceable>(3, Emplaceable(5, 6)));
- assert(c.size() == 2);
- assert(r->first == 3);
- assert(r->second == Emplaceable(5, 6));
- LIBCPP_ASSERT(r == std::next(c.begin()));
+ r = c.emplace_hint(c.end(), std::pair<const int, Emplaceable>(3, Emplaceable(5, 6)));
+ assert(c.size() == 2);
+ assert(r->first == 3);
+ assert(r->second == Emplaceable(5, 6));
+ LIBCPP_ASSERT(r == std::next(c.begin()));
- r = c.emplace_hint(r, std::piecewise_construct, std::forward_as_tuple(3),
- std::forward_as_tuple(6, 7));
- assert(c.size() == 3);
- assert(r->first == 3);
- assert(r->second == Emplaceable(6, 7));
- LIBCPP_ASSERT(r == std::next(c.begin()));
- r = c.begin();
- assert(r->first == 3);
- LIBCPP_ASSERT(r->second == Emplaceable());
- r = std::next(r, 2);
- assert(r->first == 3);
- LIBCPP_ASSERT(r->second == Emplaceable(5, 6));
- }
- {
- typedef std::unordered_multimap<int, Emplaceable, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, Emplaceable>>> C;
- typedef C::iterator R;
- C c;
- C::const_iterator e = c.end();
- R r = c.emplace_hint(e, std::piecewise_construct, std::forward_as_tuple(3),
- std::forward_as_tuple());
- assert(c.size() == 1);
- assert(r->first == 3);
- assert(r->second == Emplaceable());
+ r = c.emplace_hint(r, std::piecewise_construct, std::forward_as_tuple(3), std::forward_as_tuple(6, 7));
+ assert(c.size() == 3);
+ assert(r->first == 3);
+ assert(r->second == Emplaceable(6, 7));
+ LIBCPP_ASSERT(r == std::next(c.begin()));
+ r = c.begin();
+ assert(r->first == 3);
+ LIBCPP_ASSERT(r->second == Emplaceable());
+ r = std::next(r, 2);
+ assert(r->first == 3);
+ LIBCPP_ASSERT(r->second == Emplaceable(5, 6));
+ }
+ {
+ typedef std::unordered_multimap<int,
+ Emplaceable,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, Emplaceable>>>
+ C;
+ typedef C::iterator R;
+ C c;
+ C::const_iterator e = c.end();
+ R r = c.emplace_hint(e, std::piecewise_construct, std::forward_as_tuple(3), std::forward_as_tuple());
+ assert(c.size() == 1);
+ assert(r->first == 3);
+ assert(r->second == Emplaceable());
- r = c.emplace_hint(c.end(), std::pair<const int, Emplaceable>(3, Emplaceable(5, 6)));
- assert(c.size() == 2);
- assert(r->first == 3);
- assert(r->second == Emplaceable(5, 6));
- LIBCPP_ASSERT(r == std::next(c.begin()));
+ r = c.emplace_hint(c.end(), std::pair<const int, Emplaceable>(3, Emplaceable(5, 6)));
+ assert(c.size() == 2);
+ assert(r->first == 3);
+ assert(r->second == Emplaceable(5, 6));
+ LIBCPP_ASSERT(r == std::next(c.begin()));
- r = c.emplace_hint(r, std::piecewise_construct, std::forward_as_tuple(3),
- std::forward_as_tuple(6, 7));
- assert(c.size() == 3);
- assert(r->first == 3);
- assert(r->second == Emplaceable(6, 7));
- LIBCPP_ASSERT(r == std::next(c.begin()));
- r = c.begin();
- assert(r->first == 3);
- LIBCPP_ASSERT(r->second == Emplaceable());
- r = std::next(r, 2);
- assert(r->first == 3);
- LIBCPP_ASSERT(r->second == Emplaceable(5, 6));
- }
+ r = c.emplace_hint(r, std::piecewise_construct, std::forward_as_tuple(3), std::forward_as_tuple(6, 7));
+ assert(c.size() == 3);
+ assert(r->first == 3);
+ assert(r->second == Emplaceable(6, 7));
+ LIBCPP_ASSERT(r == std::next(c.begin()));
+ r = c.begin();
+ assert(r->first == 3);
+ LIBCPP_ASSERT(r->second == Emplaceable());
+ r = std::next(r, 2);
+ assert(r->first == 3);
+ LIBCPP_ASSERT(r->second == Emplaceable(5, 6));
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_const_iter.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_const_iter.pass.cpp
index 24e9249bd78b2d2..5e55183f52e74bc 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_const_iter.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_const_iter.pass.cpp
@@ -24,125 +24,127 @@
#include "../../../check_consecutive.h"
#include "min_allocator.h"
-struct TemplateConstructor
-{
- template<typename T>
- TemplateConstructor (const T&) {}
+struct TemplateConstructor {
+ template <typename T>
+ TemplateConstructor(const T&) {}
};
bool operator==(const TemplateConstructor&, const TemplateConstructor&) { return false; }
-struct Hash { std::size_t operator() (const TemplateConstructor &) const { return 0; } };
+struct Hash {
+ std::size_t operator()(const TemplateConstructor&) const { return 0; }
+};
-int main(int, char**)
-{
- {
- typedef std::unordered_multimap<int, std::string> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- C::const_iterator i = c.find(2);
- C::const_iterator i_next = i;
- ++i_next;
- std::string es = i->second;
- C::iterator j = c.erase(i);
- assert(j == i_next);
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ C::const_iterator i = c.find(2);
+ C::const_iterator i_next = i;
+ ++i_next;
+ std::string es = i->second;
+ C::iterator j = c.erase(i);
+ assert(j == i_next);
- assert(c.size() == 5);
- typedef std::pair<C::const_iterator, C::const_iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 1);
- C::const_iterator k = eq.first;
- assert(k->first == 2);
- assert(k->second == (es == "two" ? "four" : "two"));
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- k = eq.first;
- assert(k->first == 3);
- assert(k->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- k = eq.first;
- assert(k->first == 4);
- assert(k->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- }
+ assert(c.size() == 5);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 1);
+ C::const_iterator k = eq.first;
+ assert(k->first == 2);
+ assert(k->second == (es == "two" ? "four" : "two"));
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 3);
+ assert(k->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 4);
+ assert(k->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- C::const_iterator i = c.find(2);
- C::const_iterator i_next = i;
- ++i_next;
- std::string es = i->second;
- C::iterator j = c.erase(i);
- assert(j == i_next);
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ C::const_iterator i = c.find(2);
+ C::const_iterator i_next = i;
+ ++i_next;
+ std::string es = i->second;
+ C::iterator j = c.erase(i);
+ assert(j == i_next);
- assert(c.size() == 5);
- typedef std::pair<C::const_iterator, C::const_iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 1);
- C::const_iterator k = eq.first;
- assert(k->first == 2);
- assert(k->second == (es == "two" ? "four" : "two"));
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- k = eq.first;
- assert(k->first == 3);
- assert(k->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- k = eq.first;
- assert(k->first == 4);
- assert(k->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- }
+ assert(c.size() == 5);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 1);
+ C::const_iterator k = eq.first;
+ assert(k->first == 2);
+ assert(k->second == (es == "two" ? "four" : "two"));
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 3);
+ assert(k->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 4);
+ assert(k->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ }
#endif
#if TEST_STD_VER >= 14
- {
+ {
// This is LWG #2059
- typedef TemplateConstructor T;
- typedef std::unordered_multimap<T, int, Hash> C;
- typedef C::iterator I;
+ typedef TemplateConstructor T;
+ typedef std::unordered_multimap<T, int, Hash> C;
+ typedef C::iterator I;
- C m;
- T a{0};
- I it = m.find(a);
- if (it != m.end())
- m.erase(it);
- }
+ C m;
+ T a{0};
+ I it = m.find(a);
+ if (it != m.end())
+ m.erase(it);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_key.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_key.pass.cpp
index 25464c2c3495a50..d988e2a31e58fee 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_key.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_key.pass.cpp
@@ -26,333 +26,334 @@
#if TEST_STD_VER >= 11
template <typename Unordered>
-bool only_deletions ( const Unordered &whole, const Unordered &part ) {
- typename Unordered::const_iterator w = whole.begin();
- typename Unordered::const_iterator p = part.begin();
+bool only_deletions(const Unordered& whole, const Unordered& part) {
+ typename Unordered::const_iterator w = whole.begin();
+ typename Unordered::const_iterator p = part.begin();
- while ( w != whole.end () && p != part.end()) {
- if ( *w == *p )
- p++;
- w++;
- }
+ while (w != whole.end() && p != part.end()) {
+ if (*w == *p)
+ p++;
+ w++;
+ }
- return p == part.end();
+ return p == part.end();
}
#endif
-int main(int, char**)
-{
- {
- typedef std::unordered_multimap<int, std::string> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.erase(5) == 0);
- assert(c.size() == 6);
- typedef std::pair<C::const_iterator, C::const_iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- C::const_iterator k = eq.first;
- assert(k->first == 3);
- assert(k->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- k = eq.first;
- assert(k->first == 4);
- assert(k->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.erase(5) == 0);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ C::const_iterator k = eq.first;
+ assert(k->first == 3);
+ assert(k->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 4);
+ assert(k->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(c.erase(2) == 2);
- assert(c.size() == 4);
- eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- k = eq.first;
- assert(k->first == 3);
- assert(k->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- k = eq.first;
- assert(k->first == 4);
- assert(k->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(c.erase(2) == 2);
+ assert(c.size() == 4);
+ eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 3);
+ assert(k->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 4);
+ assert(k->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(c.erase(2) == 0);
- assert(c.size() == 4);
- eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- k = eq.first;
- assert(k->first == 3);
- assert(k->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- k = eq.first;
- assert(k->first == 4);
- assert(k->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(c.erase(2) == 0);
+ assert(c.size() == 4);
+ eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 3);
+ assert(k->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 4);
+ assert(k->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(c.erase(4) == 1);
- assert(c.size() == 3);
- eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- k = eq.first;
- assert(k->first == 3);
- assert(k->second == "three");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(c.erase(4) == 1);
+ assert(c.size() == 3);
+ eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 3);
+ assert(k->second == "three");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(c.erase(4) == 0);
- assert(c.size() == 3);
- eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- k = eq.first;
- assert(k->first == 3);
- assert(k->second == "three");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(c.erase(4) == 0);
+ assert(c.size() == 3);
+ eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 3);
+ assert(k->second == "three");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(c.erase(1) == 2);
- assert(c.size() == 1);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- k = eq.first;
- assert(k->first == 3);
- assert(k->second == "three");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(c.erase(1) == 2);
+ assert(c.size() == 1);
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 3);
+ assert(k->second == "three");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(c.erase(1) == 0);
- assert(c.size() == 1);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- k = eq.first;
- assert(k->first == 3);
- assert(k->second == "three");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(c.erase(1) == 0);
+ assert(c.size() == 1);
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 3);
+ assert(k->second == "three");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(c.erase(3) == 1);
- assert(c.size() == 0);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 0);
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(c.erase(3) == 1);
+ assert(c.size() == 0);
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 0);
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(c.erase(3) == 0);
- assert(c.size() == 0);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 0);
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- }
+ assert(c.erase(3) == 0);
+ assert(c.size() == 0);
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 0);
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.erase(5) == 0);
- assert(c.size() == 6);
- typedef std::pair<C::const_iterator, C::const_iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- C::const_iterator k = eq.first;
- assert(k->first == 3);
- assert(k->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- k = eq.first;
- assert(k->first == 4);
- assert(k->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.erase(5) == 0);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ C::const_iterator k = eq.first;
+ assert(k->first == 3);
+ assert(k->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 4);
+ assert(k->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(c.erase(2) == 2);
- assert(c.size() == 4);
- eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- k = eq.first;
- assert(k->first == 3);
- assert(k->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- k = eq.first;
- assert(k->first == 4);
- assert(k->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(c.erase(2) == 2);
+ assert(c.size() == 4);
+ eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 3);
+ assert(k->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 4);
+ assert(k->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(c.erase(2) == 0);
- assert(c.size() == 4);
- eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- k = eq.first;
- assert(k->first == 3);
- assert(k->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- k = eq.first;
- assert(k->first == 4);
- assert(k->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(c.erase(2) == 0);
+ assert(c.size() == 4);
+ eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 3);
+ assert(k->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 4);
+ assert(k->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(c.erase(4) == 1);
- assert(c.size() == 3);
- eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- k = eq.first;
- assert(k->first == 3);
- assert(k->second == "three");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(c.erase(4) == 1);
+ assert(c.size() == 3);
+ eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 3);
+ assert(k->second == "three");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(c.erase(4) == 0);
- assert(c.size() == 3);
- eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- k = eq.first;
- assert(k->first == 3);
- assert(k->second == "three");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(c.erase(4) == 0);
+ assert(c.size() == 3);
+ eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 3);
+ assert(k->second == "three");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(c.erase(1) == 2);
- assert(c.size() == 1);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- k = eq.first;
- assert(k->first == 3);
- assert(k->second == "three");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(c.erase(1) == 2);
+ assert(c.size() == 1);
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 3);
+ assert(k->second == "three");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(c.erase(1) == 0);
- assert(c.size() == 1);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- k = eq.first;
- assert(k->first == 3);
- assert(k->second == "three");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(c.erase(1) == 0);
+ assert(c.size() == 1);
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 3);
+ assert(k->second == "three");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(c.erase(3) == 1);
- assert(c.size() == 0);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 0);
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(c.erase(3) == 1);
+ assert(c.size() == 0);
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 0);
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(c.erase(3) == 0);
- assert(c.size() == 0);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 0);
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- }
- {
+ assert(c.erase(3) == 0);
+ assert(c.size() == 0);
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 0);
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ }
+ {
typedef std::unordered_multimap<int, int> C;
C m, m2;
- for ( int i = 0; i < 10; ++i ) {
- for (int j = 0; j < 2; ++j ) {
- m.insert (std::make_pair(i,j));
- m2.insert(std::make_pair(i,j));
- }
- }
+ for (int i = 0; i < 10; ++i) {
+ for (int j = 0; j < 2; ++j) {
+ m.insert(std::make_pair(i, j));
+ m2.insert(std::make_pair(i, j));
+ }
+ }
C::iterator i = m2.begin();
- int ctr = 0;
+ int ctr = 0;
while (i != m2.end()) {
- if (ctr++ % 2 == 0)
- m2.erase(i++);
- else
- ++i;
- }
-
- assert (only_deletions (m, m2));
+ if (ctr++ % 2 == 0)
+ m2.erase(i++);
+ else
+ ++i;
}
+
+ assert(only_deletions(m, m2));
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_range.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_range.pass.cpp
index cab3702b1273f92..f8a2bdd3fee73bf 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_range.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_range.pass.cpp
@@ -24,144 +24,145 @@
#include "../../../check_consecutive.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multimap<int, std::string> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- C::const_iterator i = c.find(2);
- C::const_iterator j = std::next(i, 2);
- C::iterator k = c.erase(i, i);
- assert(k == i);
- assert(c.size() == 6);
- typedef std::pair<C::iterator, C::iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- k = eq.first;
- assert(k->first == 3);
- assert(k->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- k = eq.first;
- assert(k->first == 4);
- assert(k->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ C::const_iterator i = c.find(2);
+ C::const_iterator j = std::next(i, 2);
+ C::iterator k = c.erase(i, i);
+ assert(k == i);
+ assert(c.size() == 6);
+ typedef std::pair<C::iterator, C::iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 3);
+ assert(k->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 4);
+ assert(k->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- k = c.erase(i, j);
- assert(c.size() == 4);
- eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- k = eq.first;
- assert(k->first == 3);
- assert(k->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- k = eq.first;
- assert(k->first == 4);
- assert(k->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ k = c.erase(i, j);
+ assert(c.size() == 4);
+ eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 3);
+ assert(k->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 4);
+ assert(k->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- k = c.erase(c.cbegin(), c.cend());
- assert(c.size() == 0);
- assert(k == c.end());
- }
+ k = c.erase(c.cbegin(), c.cend());
+ assert(c.size() == 0);
+ assert(k == c.end());
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- C::const_iterator i = c.find(2);
- C::const_iterator j = std::next(i, 2);
- C::iterator k = c.erase(i, i);
- assert(k == i);
- assert(c.size() == 6);
- typedef std::pair<C::iterator, C::iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- k = eq.first;
- assert(k->first == 3);
- assert(k->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- k = eq.first;
- assert(k->first == 4);
- assert(k->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ C::const_iterator i = c.find(2);
+ C::const_iterator j = std::next(i, 2);
+ C::iterator k = c.erase(i, i);
+ assert(k == i);
+ assert(c.size() == 6);
+ typedef std::pair<C::iterator, C::iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 3);
+ assert(k->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 4);
+ assert(k->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- k = c.erase(i, j);
- assert(c.size() == 4);
- eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- k = eq.first;
- assert(k->first == 3);
- assert(k->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- k = eq.first;
- assert(k->first == 4);
- assert(k->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ k = c.erase(i, j);
+ assert(c.size() == 4);
+ eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 3);
+ assert(k->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 4);
+ assert(k->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- k = c.erase(c.cbegin(), c.cend());
- assert(c.size() == 0);
- assert(k == c.end());
- }
+ k = c.erase(c.cbegin(), c.cend());
+ assert(c.size() == 0);
+ assert(k == c.end());
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/extract_iterator.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/extract_iterator.pass.cpp
index 8905dc2c119c427..d8a73cd3d2b3be4 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/extract_iterator.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/extract_iterator.pass.cpp
@@ -20,50 +20,45 @@
#include "Counter.h"
template <class Container>
-void test(Container& c)
-{
- std::size_t sz = c.size();
+void test(Container& c) {
+ std::size_t sz = c.size();
- auto some_key = c.cbegin()->first;
+ auto some_key = c.cbegin()->first;
- for (auto first = c.cbegin(); first != c.cend();)
- {
- auto key_value = first->first;
- typename Container::node_type t = c.extract(first++);
- --sz;
- assert(t.key() == key_value);
- t.key() = some_key;
- assert(t.key() == some_key);
- assert(t.get_allocator() == c.get_allocator());
- assert(sz == c.size());
- }
+ for (auto first = c.cbegin(); first != c.cend();) {
+ auto key_value = first->first;
+ typename Container::node_type t = c.extract(first++);
+ --sz;
+ assert(t.key() == key_value);
+ t.key() = some_key;
+ assert(t.key() == some_key);
+ assert(t.get_allocator() == c.get_allocator());
+ assert(sz == c.size());
+ }
- assert(c.size() == 0);
+ assert(c.size() == 0);
}
-int main(int, char**)
-{
- {
- using map_type = std::unordered_multimap<int, int>;
- map_type m = {{1,1}, {2,2}, {3,3}, {4,4}, {5,5}, {6,6}};
- test(m);
- }
+int main(int, char**) {
+ {
+ using map_type = std::unordered_multimap<int, int>;
+ map_type m = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}};
+ test(m);
+ }
- {
- std::unordered_multimap<Counter<int>, Counter<int>> m =
- {{1,1}, {2,2}, {3,3}, {4,4}, {5,5}, {6,6}};
- assert(Counter_base::gConstructed == 12);
- test(m);
- assert(Counter_base::gConstructed == 0);
- }
+ {
+ std::unordered_multimap<Counter<int>, Counter<int>> m = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}};
+ assert(Counter_base::gConstructed == 12);
+ test(m);
+ assert(Counter_base::gConstructed == 0);
+ }
- {
- using min_alloc_map =
- std::unordered_multimap<int, int, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, int>>>;
- min_alloc_map m = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}};
- test(m);
- }
+ {
+ using min_alloc_map =
+ std::unordered_multimap<int, int, std::hash<int>, std::equal_to<int>, min_allocator<std::pair<const int, int>>>;
+ min_alloc_map m = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}};
+ test(m);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/extract_key.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/extract_key.pass.cpp
index 3f2f69f031b7b9e..28716f13fbd6c32 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/extract_key.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/extract_key.pass.cpp
@@ -20,60 +20,53 @@
#include "Counter.h"
template <class Container, class KeyTypeIter>
-void test(Container& c, KeyTypeIter first, KeyTypeIter last)
-{
- std::size_t sz = c.size();
- assert((std::size_t)std::distance(first, last) == sz);
+void test(Container& c, KeyTypeIter first, KeyTypeIter last) {
+ std::size_t sz = c.size();
+ assert((std::size_t)std::distance(first, last) == sz);
- for (KeyTypeIter copy = first; copy != last; ++copy)
- {
- typename Container::node_type t = c.extract(*copy);
- assert(!t.empty());
- --sz;
- assert(t.key() == *copy);
- t.key() = *first; // We should be able to mutate key.
- assert(t.key() == *first);
- assert(t.get_allocator() == c.get_allocator());
- assert(sz == c.size());
- }
+ for (KeyTypeIter copy = first; copy != last; ++copy) {
+ typename Container::node_type t = c.extract(*copy);
+ assert(!t.empty());
+ --sz;
+ assert(t.key() == *copy);
+ t.key() = *first; // We should be able to mutate key.
+ assert(t.key() == *first);
+ assert(t.get_allocator() == c.get_allocator());
+ assert(sz == c.size());
+ }
- assert(c.size() == 0);
+ assert(c.size() == 0);
- for (KeyTypeIter copy = first; copy != last; ++copy)
- {
- typename Container::node_type t = c.extract(*copy);
- assert(t.empty());
- }
+ for (KeyTypeIter copy = first; copy != last; ++copy) {
+ typename Container::node_type t = c.extract(*copy);
+ assert(t.empty());
+ }
}
-int main(int, char**)
-{
- {
- std::unordered_multimap<int, int> m =
- {{1,1}, {2,2}, {3,3}, {4,4}, {5,5}, {6,6}};
- int keys[] = {1, 2, 3, 4, 5, 6};
- test(m, std::begin(keys), std::end(keys));
- }
+int main(int, char**) {
+ {
+ std::unordered_multimap<int, int> m = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}};
+ int keys[] = {1, 2, 3, 4, 5, 6};
+ test(m, std::begin(keys), std::end(keys));
+ }
+ {
+ std::unordered_multimap<Counter<int>, Counter<int>> m = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}};
{
- std::unordered_multimap<Counter<int>, Counter<int>> m =
- {{1,1}, {2,2}, {3,3}, {4,4}, {5,5}, {6,6}};
- {
- Counter<int> keys[] = {1, 2, 3, 4, 5, 6};
- assert(Counter_base::gConstructed == 12+6);
- test(m, std::begin(keys), std::end(keys));
- }
- assert(Counter_base::gConstructed == 0);
+ Counter<int> keys[] = {1, 2, 3, 4, 5, 6};
+ assert(Counter_base::gConstructed == 12 + 6);
+ test(m, std::begin(keys), std::end(keys));
}
+ assert(Counter_base::gConstructed == 0);
+ }
- {
- using min_alloc_map =
- std::unordered_multimap<int, int, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, int>>>;
- min_alloc_map m = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}};
- int keys[] = {1, 2, 3, 4, 5, 6};
- test(m, std::begin(keys), std::end(keys));
- }
+ {
+ using min_alloc_map =
+ std::unordered_multimap<int, int, std::hash<int>, std::equal_to<int>, min_allocator<std::pair<const int, int>>>;
+ min_alloc_map m = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}};
+ int keys[] = {1, 2, 3, 4, 5, 6};
+ test(m, std::begin(keys), std::end(keys));
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_allocator_requirements.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_allocator_requirements.pass.cpp
index d9d338c357823d7..261a7b68f2194de 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_allocator_requirements.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_allocator_requirements.pass.cpp
@@ -20,8 +20,7 @@
#include "container_test_types.h"
#include "../../../map_allocator_requirement_test_templates.h"
-int main(int, char**)
-{
+int main(int, char**) {
testMultimapInsert<TCT::unordered_multimap<> >();
testMultimapInsertHint<TCT::unordered_multimap<> >();
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_const_lvalue.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_const_lvalue.pass.cpp
index fb3d390aa74acec..ef63a00f5b5260a 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_const_lvalue.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_const_lvalue.pass.cpp
@@ -20,47 +20,49 @@
#include "test_macros.h"
#include "min_allocator.h"
-template<class Container>
-void do_insert_const_lvalue_test()
-{
- typedef Container C;
- typedef typename C::iterator R;
- typedef typename C::value_type VT;
- C c;
- const VT v1(3.5, 3);
- R r = c.insert(v1);
- assert(c.size() == 1);
- assert(r->first == 3.5);
- assert(r->second == 3);
+template <class Container>
+void do_insert_const_lvalue_test() {
+ typedef Container C;
+ typedef typename C::iterator R;
+ typedef typename C::value_type VT;
+ C c;
+ const VT v1(3.5, 3);
+ R r = c.insert(v1);
+ assert(c.size() == 1);
+ assert(r->first == 3.5);
+ assert(r->second == 3);
- const VT v2(3.5, 4);
- r = c.insert(v2);
- assert(c.size() == 2);
- assert(r->first == 3.5);
- assert(r->second == 4);
+ const VT v2(3.5, 4);
+ r = c.insert(v2);
+ assert(c.size() == 2);
+ assert(r->first == 3.5);
+ assert(r->second == 4);
- const VT v3(4.5, 4);
- r = c.insert(v3);
- assert(c.size() == 3);
- assert(r->first == 4.5);
- assert(r->second == 4);
+ const VT v3(4.5, 4);
+ r = c.insert(v3);
+ assert(c.size() == 3);
+ assert(r->first == 4.5);
+ assert(r->second == 4);
- const VT v4(5.5, 4);
- r = c.insert(v4);
- assert(c.size() == 4);
- assert(r->first == 5.5);
- assert(r->second == 4);
+ const VT v4(5.5, 4);
+ r = c.insert(v4);
+ assert(c.size() == 4);
+ assert(r->first == 5.5);
+ assert(r->second == 4);
}
-int main(int, char**)
-{
- do_insert_const_lvalue_test<std::unordered_multimap<double, int> >();
+int main(int, char**) {
+ do_insert_const_lvalue_test<std::unordered_multimap<double, int> >();
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multimap<double, int, std::hash<double>, std::equal_to<double>,
- min_allocator<std::pair<const double, int>>> C;
- do_insert_const_lvalue_test<C>();
- }
+ {
+ typedef std::unordered_multimap<double,
+ int,
+ std::hash<double>,
+ std::equal_to<double>,
+ min_allocator<std::pair<const double, int>>>
+ C;
+ do_insert_const_lvalue_test<C>();
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_hint_const_lvalue.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_hint_const_lvalue.pass.cpp
index b3a5487c0786079..1682ec5ba90ca5a 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_hint_const_lvalue.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_hint_const_lvalue.pass.cpp
@@ -20,49 +20,51 @@
#include "test_macros.h"
#include "min_allocator.h"
-template<class Container>
-void do_insert_const_lvalue_test()
-{
- typedef Container C;
- typedef typename C::iterator R;
- typedef typename C::value_type VT;
- C c;
- typename C::const_iterator e = c.end();
- const VT v1(3.5, 3);
- R r = c.insert(e, v1);
- assert(c.size() == 1);
- assert(r->first == 3.5);
- assert(r->second == 3);
+template <class Container>
+void do_insert_const_lvalue_test() {
+ typedef Container C;
+ typedef typename C::iterator R;
+ typedef typename C::value_type VT;
+ C c;
+ typename C::const_iterator e = c.end();
+ const VT v1(3.5, 3);
+ R r = c.insert(e, v1);
+ assert(c.size() == 1);
+ assert(r->first == 3.5);
+ assert(r->second == 3);
- const VT v2(3.5, 4);
- r = c.insert(r, v2);
- assert(c.size() == 2);
- assert(r->first == 3.5);
- assert(r->second == 4);
+ const VT v2(3.5, 4);
+ r = c.insert(r, v2);
+ assert(c.size() == 2);
+ assert(r->first == 3.5);
+ assert(r->second == 4);
- const VT v3(4.5, 4);
- r = c.insert(c.end(), v3);
- assert(c.size() == 3);
- assert(r->first == 4.5);
- assert(r->second == 4);
+ const VT v3(4.5, 4);
+ r = c.insert(c.end(), v3);
+ assert(c.size() == 3);
+ assert(r->first == 4.5);
+ assert(r->second == 4);
- const VT v4(5.5, 4);
- r = c.insert(c.end(), v4);
- assert(c.size() == 4);
- assert(r->first == 5.5);
- assert(r->second == 4);
+ const VT v4(5.5, 4);
+ r = c.insert(c.end(), v4);
+ assert(c.size() == 4);
+ assert(r->first == 5.5);
+ assert(r->second == 4);
}
-int main(int, char**)
-{
- do_insert_const_lvalue_test<std::unordered_multimap<double, int> >();
+int main(int, char**) {
+ do_insert_const_lvalue_test<std::unordered_multimap<double, int> >();
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multimap<double, int, std::hash<double>, std::equal_to<double>,
- min_allocator<std::pair<const double, int>>> C;
- do_insert_const_lvalue_test<C>();
- }
+ {
+ typedef std::unordered_multimap<double,
+ int,
+ std::hash<double>,
+ std::equal_to<double>,
+ min_allocator<std::pair<const double, int>>>
+ C;
+ do_insert_const_lvalue_test<C>();
+ }
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_hint_rvalue.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_hint_rvalue.pass.cpp
index 6fa3b45fab779c9..63a3624b1743762 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_hint_rvalue.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_hint_rvalue.pass.cpp
@@ -25,139 +25,146 @@
#include "MoveOnly.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multimap<double, int> C;
- typedef C::iterator R;
- typedef std::pair<double, short> P;
- C c;
- C::const_iterator e = c.end();
- R r = c.insert(e, P(3.5, static_cast<short>(3)));
- assert(c.size() == 1);
- assert(r->first == 3.5);
- assert(r->second == 3);
-
- r = c.insert(r, P(3.5, static_cast<short>(4)));
- assert(c.size() == 2);
- assert(r->first == 3.5);
- assert(r->second == 4);
-
- r = c.insert(c.end(), P(4.5, static_cast<short>(4)));
- assert(c.size() == 3);
- assert(r->first == 4.5);
- assert(r->second == 4);
-
- r = c.insert(c.end(), P(5.5, static_cast<short>(4)));
- assert(c.size() == 4);
- assert(r->first == 5.5);
- assert(r->second == 4);
- }
- {
- typedef std::unordered_multimap<MoveOnly, MoveOnly> C;
- typedef C::iterator R;
- typedef std::pair<MoveOnly, MoveOnly> P;
- C c;
- C::const_iterator e = c.end();
- R r = c.insert(e, P(3, 3));
- assert(c.size() == 1);
- assert(r->first == 3);
- assert(r->second == 3);
-
- r = c.insert(r, P(3, 4));
- assert(c.size() == 2);
- assert(r->first == 3);
- assert(r->second == 4);
-
- r = c.insert(c.end(), P(4, 4));
- assert(c.size() == 3);
- assert(r->first == 4);
- assert(r->second == 4);
-
- r = c.insert(c.end(), P(5, 4));
- assert(c.size() == 4);
- assert(r->first == 5);
- assert(r->second == 4);
- }
- {
- typedef std::unordered_multimap<double, int, std::hash<double>, std::equal_to<double>,
- min_allocator<std::pair<const double, int>>> C;
- typedef C::iterator R;
- typedef std::pair<double, short> P;
- C c;
- C::const_iterator e = c.end();
- R r = c.insert(e, P(3.5, static_cast<short>(3)));
- assert(c.size() == 1);
- assert(r->first == 3.5);
- assert(r->second == 3);
-
- r = c.insert(r, P(3.5, static_cast<short>(4)));
- assert(c.size() == 2);
- assert(r->first == 3.5);
- assert(r->second == 4);
-
- r = c.insert(c.end(), P(4.5, static_cast<short>(4)));
- assert(c.size() == 3);
- assert(r->first == 4.5);
- assert(r->second == 4);
-
- r = c.insert(c.end(), P(5.5, static_cast<short>(4)));
- assert(c.size() == 4);
- assert(r->first == 5.5);
- assert(r->second == 4);
- }
- {
- typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>, std::equal_to<MoveOnly>,
- min_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
- typedef C::iterator R;
- typedef std::pair<MoveOnly, MoveOnly> P;
- C c;
- C::const_iterator e = c.end();
- R r = c.insert(e, P(3, 3));
- assert(c.size() == 1);
- assert(r->first == 3);
- assert(r->second == 3);
-
- r = c.insert(r, P(3, 4));
- assert(c.size() == 2);
- assert(r->first == 3);
- assert(r->second == 4);
-
- r = c.insert(c.end(), P(4, 4));
- assert(c.size() == 3);
- assert(r->first == 4);
- assert(r->second == 4);
-
- r = c.insert(c.end(), P(5, 4));
- assert(c.size() == 4);
- assert(r->first == 5);
- assert(r->second == 4);
- }
- {
- typedef std::unordered_multimap<double, int> C;
- typedef C::iterator R;
- C c;
- C::const_iterator e = c.end();
- R r = c.insert(e, {3.5, 3});
- assert(c.size() == 1);
- assert(r->first == 3.5);
- assert(r->second == 3);
-
- r = c.insert(r, {3.5, 4});
- assert(c.size() == 2);
- assert(r->first == 3.5);
- assert(r->second == 4);
-
- r = c.insert(c.end(), {4.5, 4});
- assert(c.size() == 3);
- assert(r->first == 4.5);
- assert(r->second == 4);
-
- r = c.insert(c.end(), {5.5, 4});
- assert(c.size() == 4);
- assert(r->first == 5.5);
- assert(r->second == 4);
- }
-
- return 0;
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<double, int> C;
+ typedef C::iterator R;
+ typedef std::pair<double, short> P;
+ C c;
+ C::const_iterator e = c.end();
+ R r = c.insert(e, P(3.5, static_cast<short>(3)));
+ assert(c.size() == 1);
+ assert(r->first == 3.5);
+ assert(r->second == 3);
+
+ r = c.insert(r, P(3.5, static_cast<short>(4)));
+ assert(c.size() == 2);
+ assert(r->first == 3.5);
+ assert(r->second == 4);
+
+ r = c.insert(c.end(), P(4.5, static_cast<short>(4)));
+ assert(c.size() == 3);
+ assert(r->first == 4.5);
+ assert(r->second == 4);
+
+ r = c.insert(c.end(), P(5.5, static_cast<short>(4)));
+ assert(c.size() == 4);
+ assert(r->first == 5.5);
+ assert(r->second == 4);
+ }
+ {
+ typedef std::unordered_multimap<MoveOnly, MoveOnly> C;
+ typedef C::iterator R;
+ typedef std::pair<MoveOnly, MoveOnly> P;
+ C c;
+ C::const_iterator e = c.end();
+ R r = c.insert(e, P(3, 3));
+ assert(c.size() == 1);
+ assert(r->first == 3);
+ assert(r->second == 3);
+
+ r = c.insert(r, P(3, 4));
+ assert(c.size() == 2);
+ assert(r->first == 3);
+ assert(r->second == 4);
+
+ r = c.insert(c.end(), P(4, 4));
+ assert(c.size() == 3);
+ assert(r->first == 4);
+ assert(r->second == 4);
+
+ r = c.insert(c.end(), P(5, 4));
+ assert(c.size() == 4);
+ assert(r->first == 5);
+ assert(r->second == 4);
+ }
+ {
+ typedef std::unordered_multimap<double,
+ int,
+ std::hash<double>,
+ std::equal_to<double>,
+ min_allocator<std::pair<const double, int>>>
+ C;
+ typedef C::iterator R;
+ typedef std::pair<double, short> P;
+ C c;
+ C::const_iterator e = c.end();
+ R r = c.insert(e, P(3.5, static_cast<short>(3)));
+ assert(c.size() == 1);
+ assert(r->first == 3.5);
+ assert(r->second == 3);
+
+ r = c.insert(r, P(3.5, static_cast<short>(4)));
+ assert(c.size() == 2);
+ assert(r->first == 3.5);
+ assert(r->second == 4);
+
+ r = c.insert(c.end(), P(4.5, static_cast<short>(4)));
+ assert(c.size() == 3);
+ assert(r->first == 4.5);
+ assert(r->second == 4);
+
+ r = c.insert(c.end(), P(5.5, static_cast<short>(4)));
+ assert(c.size() == 4);
+ assert(r->first == 5.5);
+ assert(r->second == 4);
+ }
+ {
+ typedef std::unordered_multimap<MoveOnly,
+ MoveOnly,
+ std::hash<MoveOnly>,
+ std::equal_to<MoveOnly>,
+ min_allocator<std::pair<const MoveOnly, MoveOnly>>>
+ C;
+ typedef C::iterator R;
+ typedef std::pair<MoveOnly, MoveOnly> P;
+ C c;
+ C::const_iterator e = c.end();
+ R r = c.insert(e, P(3, 3));
+ assert(c.size() == 1);
+ assert(r->first == 3);
+ assert(r->second == 3);
+
+ r = c.insert(r, P(3, 4));
+ assert(c.size() == 2);
+ assert(r->first == 3);
+ assert(r->second == 4);
+
+ r = c.insert(c.end(), P(4, 4));
+ assert(c.size() == 3);
+ assert(r->first == 4);
+ assert(r->second == 4);
+
+ r = c.insert(c.end(), P(5, 4));
+ assert(c.size() == 4);
+ assert(r->first == 5);
+ assert(r->second == 4);
+ }
+ {
+ typedef std::unordered_multimap<double, int> C;
+ typedef C::iterator R;
+ C c;
+ C::const_iterator e = c.end();
+ R r = c.insert(e, {3.5, 3});
+ assert(c.size() == 1);
+ assert(r->first == 3.5);
+ assert(r->second == 3);
+
+ r = c.insert(r, {3.5, 4});
+ assert(c.size() == 2);
+ assert(r->first == 3.5);
+ assert(r->second == 4);
+
+ r = c.insert(c.end(), {4.5, 4});
+ assert(c.size() == 3);
+ assert(r->first == 4.5);
+ assert(r->second == 4);
+
+ r = c.insert(c.end(), {5.5, 4});
+ assert(c.size() == 4);
+ assert(r->first == 5.5);
+ assert(r->second == 4);
+ }
+
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_init.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_init.pass.cpp
index 3f7af5e5eebde72..18d42854d132519 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_init.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_init.pass.cpp
@@ -27,89 +27,88 @@
#include "test_iterators.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multimap<int, std::string> C;
- typedef std::pair<int, std::string> P;
- C c;
- c.insert(
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- }
- );
- assert(c.size() == 6);
- typedef std::pair<C::iterator, C::iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- C::iterator k = eq.first;
- assert(k->first == 3);
- assert(k->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- k = eq.first;
- assert(k->first == 4);
- assert(k->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- }
- {
- typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- C c;
- c.insert(
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- }
- );
- assert(c.size() == 6);
- typedef std::pair<C::iterator, C::iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- C::iterator k = eq.first;
- assert(k->first == 3);
- assert(k->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- k = eq.first;
- assert(k->first == 4);
- assert(k->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ C c;
+ c.insert({
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ });
+ assert(c.size() == 6);
+ typedef std::pair<C::iterator, C::iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ C::iterator k = eq.first;
+ assert(k->first == 3);
+ assert(k->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 4);
+ assert(k->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ }
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ C c;
+ c.insert({
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ });
+ assert(c.size() == 6);
+ typedef std::pair<C::iterator, C::iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ C::iterator k = eq.first;
+ assert(k->first == 3);
+ assert(k->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 4);
+ assert(k->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_iter_iter.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_iter_iter.pass.cpp
index 519ed7a7bf20ec1..13a847031622278 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_iter_iter.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_iter_iter.pass.cpp
@@ -26,90 +26,91 @@
#include "test_iterators.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multimap<int, std::string> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c;
- c.insert(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])));
- assert(c.size() == 6);
- typedef std::pair<C::iterator, C::iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- C::iterator k = eq.first;
- assert(k->first == 3);
- assert(k->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- k = eq.first;
- assert(k->first == 4);
- assert(k->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<int, std::string> C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c;
+ c.insert(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])));
+ assert(c.size() == 6);
+ typedef std::pair<C::iterator, C::iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ C::iterator k = eq.first;
+ assert(k->first == 3);
+ assert(k->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 4);
+ assert(k->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c;
- c.insert(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])));
- assert(c.size() == 6);
- typedef std::pair<C::iterator, C::iterator> Eq;
- Eq eq = c.equal_range(1);
- assert(std::distance(eq.first, eq.second) == 2);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
- eq = c.equal_range(2);
- assert(std::distance(eq.first, eq.second) == 2);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
- eq = c.equal_range(3);
- assert(std::distance(eq.first, eq.second) == 1);
- C::iterator k = eq.first;
- assert(k->first == 3);
- assert(k->second == "three");
- eq = c.equal_range(4);
- assert(std::distance(eq.first, eq.second) == 1);
- k = eq.first;
- assert(k->first == 4);
- assert(k->second == "four");
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- }
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ typedef std::pair<int, std::string> P;
+ P a[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c;
+ c.insert(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])));
+ assert(c.size() == 6);
+ typedef std::pair<C::iterator, C::iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(1), c.end(), 1, s);
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c.find(2), c.end(), 2, s);
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ C::iterator k = eq.first;
+ assert(k->first == 3);
+ assert(k->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 4);
+ assert(k->second == "four");
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_node_type.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_node_type.pass.cpp
index d9131c1f68f68ce..a9fdc89688ad9e5 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_node_type.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_node_type.pass.cpp
@@ -20,60 +20,54 @@
template <class Container>
typename Container::node_type
-node_factory(typename Container::key_type const& key,
- typename Container::mapped_type const& mapped)
-{
- static Container c;
- auto it = c.insert({key, mapped});
- return c.extract(it);
+node_factory(typename Container::key_type const& key, typename Container::mapped_type const& mapped) {
+ static Container c;
+ auto it = c.insert({key, mapped});
+ return c.extract(it);
}
template <class Container>
-void test(Container& c)
-{
- auto* nf = &node_factory<Container>;
+void test(Container& c) {
+ auto* nf = &node_factory<Container>;
- for (int i = 0; i != 10; ++i)
- {
- typename Container::node_type node = nf(i, i + 1);
- assert(!node.empty());
- typename Container::iterator it = c.insert(std::move(node));
- assert(node.empty());
- assert(it == c.find(i) && it != c.end());
- assert(it->first == i && it->second == i + 1);
- }
+ for (int i = 0; i != 10; ++i) {
+ typename Container::node_type node = nf(i, i + 1);
+ assert(!node.empty());
+ typename Container::iterator it = c.insert(std::move(node));
+ assert(node.empty());
+ assert(it == c.find(i) && it != c.end());
+ assert(it->first == i && it->second == i + 1);
+ }
- assert(c.size() == 10);
+ assert(c.size() == 10);
- { // Insert empty node.
- typename Container::node_type def;
- auto it = c.insert(std::move(def));
- assert(def.empty());
- assert(it == c.end());
- }
+ { // Insert empty node.
+ typename Container::node_type def;
+ auto it = c.insert(std::move(def));
+ assert(def.empty());
+ assert(it == c.end());
+ }
- { // Insert duplicate node.
- typename Container::node_type dupl = nf(0, 42);
- auto it = c.insert(std::move(dupl));
- assert(dupl.empty());
- assert(it != c.end() && it->second == 42);
- }
+ { // Insert duplicate node.
+ typename Container::node_type dupl = nf(0, 42);
+ auto it = c.insert(std::move(dupl));
+ assert(dupl.empty());
+ assert(it != c.end() && it->second == 42);
+ }
- assert(c.size() == 11);
- assert(c.count(0) == 2);
- for (int i = 1; i != 10; ++i)
- {
- assert(c.count(i) == 1);
- assert(c.find(i)->second == i + 1);
- }
+ assert(c.size() == 11);
+ assert(c.count(0) == 2);
+ for (int i = 1; i != 10; ++i) {
+ assert(c.count(i) == 1);
+ assert(c.find(i)->second == i + 1);
+ }
}
-int main(int, char**)
-{
- std::unordered_multimap<int, int> m;
- test(m);
- std::unordered_multimap<int, int, std::hash<int>, std::equal_to<int>, min_allocator<std::pair<const int, int>>> m2;
- test(m2);
+int main(int, char**) {
+ std::unordered_multimap<int, int> m;
+ test(m);
+ std::unordered_multimap<int, int, std::hash<int>, std::equal_to<int>, min_allocator<std::pair<const int, int>>> m2;
+ test(m2);
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_node_type_hint.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_node_type_hint.pass.cpp
index 461f7a33d35d043..c329001a086aeb9 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_node_type_hint.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_node_type_hint.pass.cpp
@@ -20,46 +20,40 @@
template <class Container>
typename Container::node_type
-node_factory(typename Container::key_type const& key,
- typename Container::mapped_type const& mapped)
-{
- static Container c;
- auto it = c.insert({key, mapped});
- return c.extract(it);
+node_factory(typename Container::key_type const& key, typename Container::mapped_type const& mapped) {
+ static Container c;
+ auto it = c.insert({key, mapped});
+ return c.extract(it);
}
template <class Container>
-void test(Container& c)
-{
- auto* nf = &node_factory<Container>;
-
- for (int i = 0; i != 10; ++i)
- {
- typename Container::node_type node = nf(i, i + 1);
- assert(!node.empty());
- std::size_t prev = c.size();
- auto it = c.insert(c.end(), std::move(node));
- assert(node.empty());
- assert(prev + 1 == c.size());
- assert(it->first == i);
- assert(it->second == i + 1);
- }
-
- assert(c.size() == 10);
-
- for (int i = 0; i != 10; ++i)
- {
- assert(c.count(i) == 1);
- assert(c.find(i)->second == i + 1);
- }
+void test(Container& c) {
+ auto* nf = &node_factory<Container>;
+
+ for (int i = 0; i != 10; ++i) {
+ typename Container::node_type node = nf(i, i + 1);
+ assert(!node.empty());
+ std::size_t prev = c.size();
+ auto it = c.insert(c.end(), std::move(node));
+ assert(node.empty());
+ assert(prev + 1 == c.size());
+ assert(it->first == i);
+ assert(it->second == i + 1);
+ }
+
+ assert(c.size() == 10);
+
+ for (int i = 0; i != 10; ++i) {
+ assert(c.count(i) == 1);
+ assert(c.find(i)->second == i + 1);
+ }
}
-int main(int, char**)
-{
- std::unordered_multimap<int, int> m;
- test(m);
- std::unordered_multimap<int, int, std::hash<int>, std::equal_to<int>, min_allocator<std::pair<const int, int>>> m2;
- test(m2);
+int main(int, char**) {
+ std::unordered_multimap<int, int> m;
+ test(m);
+ std::unordered_multimap<int, int, std::hash<int>, std::equal_to<int>, min_allocator<std::pair<const int, int>>> m2;
+ test(m2);
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_range.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_range.pass.cpp
index e6924ad52f6a795..8f269a7dd0151d2 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_range.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_range.pass.cpp
@@ -23,10 +23,13 @@
int main(int, char**) {
// Note: we want to use a pair with non-const elements for input (an assignable type is a lot more convenient) but
// have to use the exact `value_type` of the map (that is, `pair<const K, V>`) for the allocator.
- using Pair = std::pair<int, char>;
+ using Pair = std::pair<int, char>;
using ConstPair = std::pair<const int, char>;
for_all_iterators_and_allocators<ConstPair, const Pair*>([]<class Iter, class Sent, class Alloc>() {
- test_map_set_insert_range<std::unordered_multimap<int, char, test_hash<int>, test_equal_to<int>, Alloc>, Pair, Iter, Sent>(/*allow_duplicates=*/true);
+ test_map_set_insert_range<std::unordered_multimap<int, char, test_hash<int>, test_equal_to<int>, Alloc>,
+ Pair,
+ Iter,
+ Sent>(/*allow_duplicates=*/true);
});
static_assert(test_map_constraints_insert_range<std::unordered_multimap, int, int, char, double>());
@@ -38,4 +41,3 @@ int main(int, char**) {
return 0;
}
-
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_rvalue.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_rvalue.pass.cpp
index 89d842f9b9f6fd1..96754ff9bcc6140 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_rvalue.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_rvalue.pass.cpp
@@ -25,134 +25,141 @@
#include "MoveOnly.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multimap<double, int> C;
- typedef C::iterator R;
- typedef std::pair<double, short> P;
- C c;
- R r = c.insert(P(3.5, static_cast<short>(3)));
- assert(c.size() == 1);
- assert(r->first == 3.5);
- assert(r->second == 3);
-
- r = c.insert(P(3.5, static_cast<short>(4)));
- assert(c.size() == 2);
- assert(r->first == 3.5);
- assert(r->second == 4);
-
- r = c.insert(P(4.5, static_cast<short>(4)));
- assert(c.size() == 3);
- assert(r->first == 4.5);
- assert(r->second == 4);
-
- r = c.insert(P(5.5, static_cast<short>(4)));
- assert(c.size() == 4);
- assert(r->first == 5.5);
- assert(r->second == 4);
- }
- {
- typedef std::unordered_multimap<MoveOnly, MoveOnly> C;
- typedef C::iterator R;
- typedef std::pair<MoveOnly, MoveOnly> P;
- C c;
- R r = c.insert(P(3, 3));
- assert(c.size() == 1);
- assert(r->first == 3);
- assert(r->second == 3);
-
- r = c.insert(P(3, 4));
- assert(c.size() == 2);
- assert(r->first == 3);
- assert(r->second == 4);
-
- r = c.insert(P(4, 4));
- assert(c.size() == 3);
- assert(r->first == 4);
- assert(r->second == 4);
-
- r = c.insert(P(5, 4));
- assert(c.size() == 4);
- assert(r->first == 5);
- assert(r->second == 4);
- }
- {
- typedef std::unordered_multimap<double, int, std::hash<double>, std::equal_to<double>,
- min_allocator<std::pair<const double, int>>> C;
- typedef C::iterator R;
- typedef std::pair<double, short> P;
- C c;
- R r = c.insert(P(3.5, static_cast<short>(3)));
- assert(c.size() == 1);
- assert(r->first == 3.5);
- assert(r->second == 3);
-
- r = c.insert(P(3.5, static_cast<short>(4)));
- assert(c.size() == 2);
- assert(r->first == 3.5);
- assert(r->second == 4);
-
- r = c.insert(P(4.5, static_cast<short>(4)));
- assert(c.size() == 3);
- assert(r->first == 4.5);
- assert(r->second == 4);
-
- r = c.insert(P(5.5, static_cast<short>(4)));
- assert(c.size() == 4);
- assert(r->first == 5.5);
- assert(r->second == 4);
- }
- {
- typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>, std::equal_to<MoveOnly>,
- min_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
- typedef C::iterator R;
- typedef std::pair<MoveOnly, MoveOnly> P;
- C c;
- R r = c.insert(P(3, 3));
- assert(c.size() == 1);
- assert(r->first == 3);
- assert(r->second == 3);
-
- r = c.insert(P(3, 4));
- assert(c.size() == 2);
- assert(r->first == 3);
- assert(r->second == 4);
-
- r = c.insert(P(4, 4));
- assert(c.size() == 3);
- assert(r->first == 4);
- assert(r->second == 4);
-
- r = c.insert(P(5, 4));
- assert(c.size() == 4);
- assert(r->first == 5);
- assert(r->second == 4);
- }
- {
- typedef std::unordered_multimap<double, MoveOnly> C;
- typedef C::iterator R;
- C c;
- R r = c.insert({3.5, 3});
- assert(c.size() == 1);
- assert(r->first == 3.5);
- assert(r->second == 3);
-
- r = c.insert({3.5, 4});
- assert(c.size() == 2);
- assert(r->first == 3.5);
- assert(r->second == 4);
-
- r = c.insert({4.5, 4});
- assert(c.size() == 3);
- assert(r->first == 4.5);
- assert(r->second == 4);
-
- r = c.insert({5.5, 4});
- assert(c.size() == 4);
- assert(r->first == 5.5);
- assert(r->second == 4);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<double, int> C;
+ typedef C::iterator R;
+ typedef std::pair<double, short> P;
+ C c;
+ R r = c.insert(P(3.5, static_cast<short>(3)));
+ assert(c.size() == 1);
+ assert(r->first == 3.5);
+ assert(r->second == 3);
+
+ r = c.insert(P(3.5, static_cast<short>(4)));
+ assert(c.size() == 2);
+ assert(r->first == 3.5);
+ assert(r->second == 4);
+
+ r = c.insert(P(4.5, static_cast<short>(4)));
+ assert(c.size() == 3);
+ assert(r->first == 4.5);
+ assert(r->second == 4);
+
+ r = c.insert(P(5.5, static_cast<short>(4)));
+ assert(c.size() == 4);
+ assert(r->first == 5.5);
+ assert(r->second == 4);
+ }
+ {
+ typedef std::unordered_multimap<MoveOnly, MoveOnly> C;
+ typedef C::iterator R;
+ typedef std::pair<MoveOnly, MoveOnly> P;
+ C c;
+ R r = c.insert(P(3, 3));
+ assert(c.size() == 1);
+ assert(r->first == 3);
+ assert(r->second == 3);
+
+ r = c.insert(P(3, 4));
+ assert(c.size() == 2);
+ assert(r->first == 3);
+ assert(r->second == 4);
+
+ r = c.insert(P(4, 4));
+ assert(c.size() == 3);
+ assert(r->first == 4);
+ assert(r->second == 4);
+
+ r = c.insert(P(5, 4));
+ assert(c.size() == 4);
+ assert(r->first == 5);
+ assert(r->second == 4);
+ }
+ {
+ typedef std::unordered_multimap<double,
+ int,
+ std::hash<double>,
+ std::equal_to<double>,
+ min_allocator<std::pair<const double, int>>>
+ C;
+ typedef C::iterator R;
+ typedef std::pair<double, short> P;
+ C c;
+ R r = c.insert(P(3.5, static_cast<short>(3)));
+ assert(c.size() == 1);
+ assert(r->first == 3.5);
+ assert(r->second == 3);
+
+ r = c.insert(P(3.5, static_cast<short>(4)));
+ assert(c.size() == 2);
+ assert(r->first == 3.5);
+ assert(r->second == 4);
+
+ r = c.insert(P(4.5, static_cast<short>(4)));
+ assert(c.size() == 3);
+ assert(r->first == 4.5);
+ assert(r->second == 4);
+
+ r = c.insert(P(5.5, static_cast<short>(4)));
+ assert(c.size() == 4);
+ assert(r->first == 5.5);
+ assert(r->second == 4);
+ }
+ {
+ typedef std::unordered_multimap<MoveOnly,
+ MoveOnly,
+ std::hash<MoveOnly>,
+ std::equal_to<MoveOnly>,
+ min_allocator<std::pair<const MoveOnly, MoveOnly>>>
+ C;
+ typedef C::iterator R;
+ typedef std::pair<MoveOnly, MoveOnly> P;
+ C c;
+ R r = c.insert(P(3, 3));
+ assert(c.size() == 1);
+ assert(r->first == 3);
+ assert(r->second == 3);
+
+ r = c.insert(P(3, 4));
+ assert(c.size() == 2);
+ assert(r->first == 3);
+ assert(r->second == 4);
+
+ r = c.insert(P(4, 4));
+ assert(c.size() == 3);
+ assert(r->first == 4);
+ assert(r->second == 4);
+
+ r = c.insert(P(5, 4));
+ assert(c.size() == 4);
+ assert(r->first == 5);
+ assert(r->second == 4);
+ }
+ {
+ typedef std::unordered_multimap<double, MoveOnly> C;
+ typedef C::iterator R;
+ C c;
+ R r = c.insert({3.5, 3});
+ assert(c.size() == 1);
+ assert(r->first == 3.5);
+ assert(r->second == 3);
+
+ r = c.insert({3.5, 4});
+ assert(c.size() == 2);
+ assert(r->first == 3.5);
+ assert(r->second == 4);
+
+ r = c.insert({4.5, 4});
+ assert(c.size() == 3);
+ assert(r->first == 4.5);
+ assert(r->second == 4);
+
+ r = c.insert({5.5, 4});
+ assert(c.size() == 4);
+ assert(r->first == 5.5);
+ assert(r->second == 4);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/merge.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/merge.pass.cpp
index e9c0c3fb75a2a03..cbe8b0240fbef54 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/merge.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/merge.pass.cpp
@@ -27,131 +27,117 @@
#include "Counter.h"
template <class Map>
-bool map_equal(const Map& map, Map other)
-{
- return map == other;
+bool map_equal(const Map& map, Map other) {
+ return map == other;
}
#ifndef TEST_HAS_NO_EXCEPTIONS
template <class T>
-struct throw_hasher
-{
- bool& should_throw_;
+struct throw_hasher {
+ bool& should_throw_;
- throw_hasher(bool& should_throw) : should_throw_(should_throw) {}
+ throw_hasher(bool& should_throw) : should_throw_(should_throw) {}
- std::size_t operator()(const T& p) const
- {
- if (should_throw_)
- throw 0;
- return std::hash<T>()(p);
- }
+ std::size_t operator()(const T& p) const {
+ if (should_throw_)
+ throw 0;
+ return std::hash<T>()(p);
+ }
};
#endif
-int main(int, char**)
-{
- {
- std::unordered_multimap<int, int> src{{1, 0}, {3, 0}, {5, 0}};
- std::unordered_multimap<int, int> dst{{2, 0}, {4, 0}, {5, 0}};
- dst.merge(src);
- assert(map_equal(src, {}));
- assert(map_equal(dst, {{1, 0}, {2, 0}, {3, 0}, {4, 0}, {5, 0}, {5, 0}}));
- }
+int main(int, char**) {
+ {
+ std::unordered_multimap<int, int> src{{1, 0}, {3, 0}, {5, 0}};
+ std::unordered_multimap<int, int> dst{{2, 0}, {4, 0}, {5, 0}};
+ dst.merge(src);
+ assert(map_equal(src, {}));
+ assert(map_equal(dst, {{1, 0}, {2, 0}, {3, 0}, {4, 0}, {5, 0}, {5, 0}}));
+ }
#ifndef TEST_HAS_NO_EXCEPTIONS
- {
- bool do_throw = false;
- typedef std::unordered_multimap<Counter<int>, int, throw_hasher<Counter<int>>> map_type;
- map_type src({{1, 0}, {3, 0}, {5, 0}}, 0, throw_hasher<Counter<int>>(do_throw));
- map_type dst({{2, 0}, {4, 0}, {5, 0}}, 0, throw_hasher<Counter<int>>(do_throw));
-
- assert(Counter_base::gConstructed == 6);
-
- do_throw = true;
- try
- {
- dst.merge(src);
- }
- catch (int)
- {
- do_throw = false;
- }
- assert(!do_throw);
- assert(map_equal(src, map_type({{1, 0}, {3, 0}, {5, 0}}, 0, throw_hasher<Counter<int>>(do_throw))));
- assert(map_equal(dst, map_type({{2, 0}, {4, 0}, {5, 0}}, 0, throw_hasher<Counter<int>>(do_throw))));
+ {
+ bool do_throw = false;
+ typedef std::unordered_multimap<Counter<int>, int, throw_hasher<Counter<int>>> map_type;
+ map_type src({{1, 0}, {3, 0}, {5, 0}}, 0, throw_hasher<Counter<int>>(do_throw));
+ map_type dst({{2, 0}, {4, 0}, {5, 0}}, 0, throw_hasher<Counter<int>>(do_throw));
+
+ assert(Counter_base::gConstructed == 6);
+
+ do_throw = true;
+ try {
+ dst.merge(src);
+ } catch (int) {
+ do_throw = false;
}
+ assert(!do_throw);
+ assert(map_equal(src, map_type({{1, 0}, {3, 0}, {5, 0}}, 0, throw_hasher<Counter<int>>(do_throw))));
+ assert(map_equal(dst, map_type({{2, 0}, {4, 0}, {5, 0}}, 0, throw_hasher<Counter<int>>(do_throw))));
+ }
#endif
- assert(Counter_base::gConstructed == 0);
- struct equal
- {
- equal() = default;
-
- bool operator()(const Counter<int>& lhs, const Counter<int>& rhs) const
- {
- return lhs == rhs;
- }
- };
- struct hasher
- {
- hasher() = default;
- std::size_t operator()(const Counter<int>& p) const
- {
- return std::hash<Counter<int>>()(p);
- }
- };
- {
- typedef std::unordered_multimap<Counter<int>, int, std::hash<Counter<int>>, std::equal_to<Counter<int>>> first_map_type;
- typedef std::unordered_multimap<Counter<int>, int, hasher, equal> second_map_type;
- typedef std::unordered_map<Counter<int>, int, hasher, equal> third_map_type;
+ assert(Counter_base::gConstructed == 0);
+ struct equal {
+ equal() = default;
+
+ bool operator()(const Counter<int>& lhs, const Counter<int>& rhs) const { return lhs == rhs; }
+ };
+ struct hasher {
+ hasher() = default;
+ std::size_t operator()(const Counter<int>& p) const { return std::hash<Counter<int>>()(p); }
+ };
+ {
+ typedef std::unordered_multimap<Counter<int>, int, std::hash<Counter<int>>, std::equal_to<Counter<int>>>
+ first_map_type;
+ typedef std::unordered_multimap<Counter<int>, int, hasher, equal> second_map_type;
+ typedef std::unordered_map<Counter<int>, int, hasher, equal> third_map_type;
- {
- first_map_type first{{1, 0}, {2, 0}, {3, 0}};
- second_map_type second{{2, 0}, {3, 0}, {4, 0}};
- third_map_type third{{1, 0}, {3, 0}};
+ {
+ first_map_type first{{1, 0}, {2, 0}, {3, 0}};
+ second_map_type second{{2, 0}, {3, 0}, {4, 0}};
+ third_map_type third{{1, 0}, {3, 0}};
- assert(Counter_base::gConstructed == 8);
+ assert(Counter_base::gConstructed == 8);
- first.merge(second);
- first.merge(third);
+ first.merge(second);
+ first.merge(third);
- assert(map_equal(first, {{1, 0}, {2, 0}, {3, 0}, {4, 0}, {2, 0}, {3, 0}, {1, 0}, {3, 0}}));
- assert(map_equal(second, {}));
- assert(map_equal(third, {}));
+ assert(map_equal(first, {{1, 0}, {2, 0}, {3, 0}, {4, 0}, {2, 0}, {3, 0}, {1, 0}, {3, 0}}));
+ assert(map_equal(second, {}));
+ assert(map_equal(third, {}));
- assert(Counter_base::gConstructed == 8);
- }
- assert(Counter_base::gConstructed == 0);
- {
- first_map_type first{{1, 0}, {2, 0}, {3, 0}};
- second_map_type second{{2, 0}, {3, 0}, {4, 0}};
- third_map_type third{{1, 0}, {3, 0}};
+ assert(Counter_base::gConstructed == 8);
+ }
+ assert(Counter_base::gConstructed == 0);
+ {
+ first_map_type first{{1, 0}, {2, 0}, {3, 0}};
+ second_map_type second{{2, 0}, {3, 0}, {4, 0}};
+ third_map_type third{{1, 0}, {3, 0}};
- assert(Counter_base::gConstructed == 8);
+ assert(Counter_base::gConstructed == 8);
- first.merge(std::move(second));
- first.merge(std::move(third));
+ first.merge(std::move(second));
+ first.merge(std::move(third));
- assert(map_equal(first, {{1, 0}, {2, 0}, {3, 0}, {4, 0}, {2, 0}, {3, 0}, {1, 0}, {3, 0}}));
- assert(map_equal(second, {}));
- assert(map_equal(third, {}));
+ assert(map_equal(first, {{1, 0}, {2, 0}, {3, 0}, {4, 0}, {2, 0}, {3, 0}, {1, 0}, {3, 0}}));
+ assert(map_equal(second, {}));
+ assert(map_equal(third, {}));
- assert(Counter_base::gConstructed == 8);
- }
- assert(Counter_base::gConstructed == 0);
+ assert(Counter_base::gConstructed == 8);
+ }
+ assert(Counter_base::gConstructed == 0);
+ }
+ {
+ std::unordered_multimap<int, int> first;
+ {
+ std::unordered_multimap<int, int> second;
+ first.merge(second);
+ first.merge(std::move(second));
}
{
- std::unordered_multimap<int, int> first;
- {
- std::unordered_multimap<int, int> second;
- first.merge(second);
- first.merge(std::move(second));
- }
- {
- std::unordered_map<int, int> second;
- first.merge(second);
- first.merge(std::move(second));
- }
+ std::unordered_map<int, int> second;
+ first.merge(second);
+ first.merge(std::move(second));
}
- return 0;
+ }
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_noexcept.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_noexcept.pass.cpp
index 6220f55a3e86903..b60cd4cafc18d68 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_noexcept.pass.cpp
@@ -33,23 +33,21 @@
#include "test_allocator.h"
template <class T>
-struct some_comp
-{
- typedef T value_type;
+struct some_comp {
+ typedef T value_type;
- some_comp() {}
- some_comp(const some_comp&) {}
- bool operator()(const T&, const T&) const { return false; }
+ some_comp() {}
+ some_comp(const some_comp&) {}
+ bool operator()(const T&, const T&) const { return false; }
};
template <class T>
-struct some_comp2
-{
- typedef T value_type;
+struct some_comp2 {
+ typedef T value_type;
- some_comp2() {}
- some_comp2(const some_comp2&) {}
- bool operator()(const T&, const T&) const { return false; }
+ some_comp2() {}
+ some_comp2(const some_comp2&) {}
+ bool operator()(const T&, const T&) const { return false; }
};
#if TEST_STD_VER >= 14
@@ -58,21 +56,19 @@ void swap(some_comp2<T>&, some_comp2<T>&) noexcept {}
#endif
template <class T>
-struct some_hash
-{
- typedef T value_type;
- some_hash() {}
- some_hash(const some_hash&);
- std::size_t operator()(T const&) const;
+struct some_hash {
+ typedef T value_type;
+ some_hash() {}
+ some_hash(const some_hash&);
+ std::size_t operator()(T const&) const;
};
template <class T>
-struct some_hash2
-{
- typedef T value_type;
- some_hash2() {}
- some_hash2(const some_hash2&);
- std::size_t operator()(T const&) const;
+struct some_hash2 {
+ typedef T value_type;
+ some_hash2() {}
+ some_hash2(const some_hash2&);
+ std::size_t operator()(T const&) const;
};
#if TEST_STD_VER >= 14
@@ -81,111 +77,107 @@ void swap(some_hash2<T>&, some_hash2<T>&) noexcept {}
#endif
template <class T>
-struct some_alloc
-{
- typedef T value_type;
+struct some_alloc {
+ typedef T value_type;
- some_alloc() {}
- some_alloc(const some_alloc&);
- void deallocate(void*, unsigned) {}
+ some_alloc() {}
+ some_alloc(const some_alloc&);
+ void deallocate(void*, unsigned) {}
- typedef std::true_type propagate_on_container_swap;
+ typedef std::true_type propagate_on_container_swap;
};
template <class T>
-struct some_alloc2
-{
- typedef T value_type;
+struct some_alloc2 {
+ typedef T value_type;
- some_alloc2() {}
- some_alloc2(const some_alloc2&);
- void deallocate(void*, unsigned) {}
+ some_alloc2() {}
+ some_alloc2(const some_alloc2&);
+ void deallocate(void*, unsigned) {}
- typedef std::false_type propagate_on_container_swap;
- typedef std::true_type is_always_equal;
+ typedef std::false_type propagate_on_container_swap;
+ typedef std::true_type is_always_equal;
};
template <class T>
-struct some_alloc3
-{
- typedef T value_type;
+struct some_alloc3 {
+ typedef T value_type;
- some_alloc3() {}
- some_alloc3(const some_alloc3&);
- void deallocate(void*, unsigned) {}
+ some_alloc3() {}
+ some_alloc3(const some_alloc3&);
+ void deallocate(void*, unsigned) {}
- typedef std::false_type propagate_on_container_swap;
- typedef std::false_type is_always_equal;
+ typedef std::false_type propagate_on_container_swap;
+ typedef std::false_type is_always_equal;
};
-int main(int, char**)
-{
- typedef std::pair<const MoveOnly, MoveOnly> V;
- {
- typedef std::unordered_multimap<MoveOnly, MoveOnly> C;
- static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
+int main(int, char**) {
+ typedef std::pair<const MoveOnly, MoveOnly> V;
+ {
+ typedef std::unordered_multimap<MoveOnly, MoveOnly> C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
#if defined(_LIBCPP_VERSION)
- {
- typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, test_allocator<V>> C;
- static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- {
- typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, other_allocator<V>> C;
- static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
+ {
+ typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>, std::equal_to<MoveOnly>, test_allocator<V>>
+ C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
+ {
+ typedef std::
+ unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>, std::equal_to<MoveOnly>, other_allocator<V>>
+ C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
#endif // _LIBCPP_VERSION
- {
- typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash<MoveOnly>> C;
- static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- {
- typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>,
- some_comp<MoveOnly>> C;
- static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
+ {
+ typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash<MoveOnly>> C;
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
+ {
+ typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>, some_comp<MoveOnly>> C;
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
#if TEST_STD_VER >= 14
- { // POCS allocator, throwable swap for hash, throwable swap for comp
- typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash<MoveOnly>, some_comp <MoveOnly>, some_alloc <V>> C;
+ { // POCS allocator, throwable swap for hash, throwable swap for comp
+ typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash<MoveOnly>, some_comp<MoveOnly>, some_alloc<V>> C;
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- { // always equal allocator, throwable swap for hash, throwable swap for comp
- typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash<MoveOnly>, some_comp <MoveOnly>, some_alloc2<V>> C;
+ }
+ { // always equal allocator, throwable swap for hash, throwable swap for comp
+ typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash<MoveOnly>, some_comp<MoveOnly>, some_alloc2<V>> C;
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- { // POCS allocator, throwable swap for hash, nothrow swap for comp
- typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash<MoveOnly>, some_comp2<MoveOnly>, some_alloc <V>> C;
+ }
+ { // POCS allocator, throwable swap for hash, nothrow swap for comp
+ typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash<MoveOnly>, some_comp2<MoveOnly>, some_alloc<V>> C;
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- { // always equal allocator, throwable swap for hash, nothrow swap for comp
+ }
+ { // always equal allocator, throwable swap for hash, nothrow swap for comp
typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash<MoveOnly>, some_comp2<MoveOnly>, some_alloc2<V>> C;
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- { // POCS allocator, nothrow swap for hash, throwable swap for comp
- typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp <MoveOnly>, some_alloc <V>> C;
+ }
+ { // POCS allocator, nothrow swap for hash, throwable swap for comp
+ typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp<MoveOnly>, some_alloc<V>> C;
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- { // always equal allocator, nothrow swap for hash, throwable swap for comp
- typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp <MoveOnly>, some_alloc2<V>> C;
+ }
+ { // always equal allocator, nothrow swap for hash, throwable swap for comp
+ typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp<MoveOnly>, some_alloc2<V>> C;
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- { // POCS allocator, nothrow swap for hash, nothrow swap for comp
- typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc <V>> C;
- static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- { // always equal allocator, nothrow swap for hash, nothrow swap for comp
+ }
+ { // POCS allocator, nothrow swap for hash, nothrow swap for comp
+ typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc<V>> C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
+ { // always equal allocator, nothrow swap for hash, nothrow swap for comp
typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc2<V>> C;
- static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
-#if defined(_LIBCPP_VERSION)
- { // NOT always equal allocator, nothrow swap for hash, nothrow swap for comp
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
+# if defined(_LIBCPP_VERSION)
+ { // NOT always equal allocator, nothrow swap for hash, nothrow swap for comp
typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc3<V>> C;
- static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
-#endif // _LIBCPP_VERSION
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
+# endif // _LIBCPP_VERSION
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_non_member.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_non_member.pass.cpp
index 8aafbdd46b12b4a..fb2bdd2f79ef9d3 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_non_member.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_non_member.pass.cpp
@@ -28,585 +28,572 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef test_allocator<std::pair<const int, std::string> > Alloc;
- typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
- C c1(0, Hash(1), Compare(1), Alloc(1, 1));
- C c2(0, Hash(2), Compare(2), Alloc(1, 2));
- c2.max_load_factor(2);
- swap(c1, c2);
-
- LIBCPP_ASSERT(c1.bucket_count() == 0);
- assert(c1.size() == 0);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator().get_id() == 1);
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- LIBCPP_ASSERT(c2.bucket_count() == 0);
- assert(c2.size() == 0);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator().get_id() == 2);
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef test_allocator<std::pair<const int, std::string> > Alloc;
- typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
- typedef std::pair<int, std::string> P;
- P a2[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- C c1(0, Hash(1), Compare(1), Alloc(1, 1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
- c2.max_load_factor(2);
- C::iterator it2 = c2.begin();
- swap(c1, c2);
-
- assert(c1.bucket_count() >= 8);
- assert(c1.size() == 8);
- assert(c1.find(10)->second == "ten");
- assert(c1.find(20)->second == "twenty");
- assert(c1.find(30)->second == "thirty");
- assert(c1.find(40)->second == "forty");
- assert(c1.find(50)->second == "fifty");
- assert(c1.find(60)->second == "sixty");
- assert(c1.find(70)->second == "seventy");
- assert(c1.find(80)->second == "eighty");
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator().get_id() == 1);
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
- assert(it2 == c1.begin()); // Iterators are not invalidated
-
- LIBCPP_ASSERT(c2.bucket_count() == 0);
- assert(c2.size() == 0);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator().get_id() == 2);
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef test_allocator<std::pair<const int, std::string> > Alloc;
- typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
- typedef std::pair<int, std::string> P;
- P a1[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
- C c2(0, Hash(2), Compare(2), Alloc(1, 2));
- c2.max_load_factor(2);
- C::iterator it1 = c1.begin();
- swap(c1, c2);
-
- LIBCPP_ASSERT(c1.bucket_count() == 0);
- assert(c1.size() == 0);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator().get_id() == 1);
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- assert(c2.bucket_count() >= 6);
- assert(c2.size() == 6);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c2.find(1), c2.end(), 1, s);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c2.find(2), c2.end(), 2, s);
- assert(c2.find(3)->second == "three");
- assert(c2.find(4)->second == "four");
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator().get_id() == 2);
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- assert(it1 == c2.begin()); // Iterators are not invalidated
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef test_allocator<std::pair<const int, std::string> > Alloc;
- typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
- typedef std::pair<int, std::string> P;
- P a1[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- P a2[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
- c2.max_load_factor(2);
- C::iterator it1 = c1.begin();
- C::iterator it2 = c2.begin();
- swap(c1, c2);
-
- assert(c1.bucket_count() >= 8);
- assert(c1.size() == 8);
- assert(c1.find(10)->second == "ten");
- assert(c1.find(20)->second == "twenty");
- assert(c1.find(30)->second == "thirty");
- assert(c1.find(40)->second == "forty");
- assert(c1.find(50)->second == "fifty");
- assert(c1.find(60)->second == "sixty");
- assert(c1.find(70)->second == "seventy");
- assert(c1.find(80)->second == "eighty");
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator().get_id() == 1);
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
- assert(it2 == c1.begin()); // Iterators are not invalidated
-
- assert(c2.bucket_count() >= 6);
- assert(c2.size() == 6);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c2.find(1), c2.end(), 1, s);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c2.find(2), c2.end(), 2, s);
- assert(c2.find(3)->second == "three");
- assert(c2.find(4)->second == "four");
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator().get_id() == 2);
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- assert(it1 == c2.begin()); // Iterators are not invalidated
- }
-
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef other_allocator<std::pair<const int, std::string> > Alloc;
- typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
- C c1(0, Hash(1), Compare(1), Alloc(1));
- C c2(0, Hash(2), Compare(2), Alloc(2));
- c2.max_load_factor(2);
- swap(c1, c2);
-
- LIBCPP_ASSERT(c1.bucket_count() == 0);
- assert(c1.size() == 0);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(2));
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- LIBCPP_ASSERT(c2.bucket_count() == 0);
- assert(c2.size() == 0);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(1));
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef other_allocator<std::pair<const int, std::string> > Alloc;
- typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
- typedef std::pair<int, std::string> P;
- P a2[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- C c1(0, Hash(1), Compare(1), Alloc(1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
- c2.max_load_factor(2);
- swap(c1, c2);
-
- assert(c1.bucket_count() >= 8);
- assert(c1.size() == 8);
- assert(c1.find(10)->second == "ten");
- assert(c1.find(20)->second == "twenty");
- assert(c1.find(30)->second == "thirty");
- assert(c1.find(40)->second == "forty");
- assert(c1.find(50)->second == "fifty");
- assert(c1.find(60)->second == "sixty");
- assert(c1.find(70)->second == "seventy");
- assert(c1.find(80)->second == "eighty");
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(2));
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- LIBCPP_ASSERT(c2.bucket_count() == 0);
- assert(c2.size() == 0);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(1));
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef other_allocator<std::pair<const int, std::string> > Alloc;
- typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
- typedef std::pair<int, std::string> P;
- P a1[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
- C c2(0, Hash(2), Compare(2), Alloc(2));
- c2.max_load_factor(2);
- swap(c1, c2);
-
- LIBCPP_ASSERT(c1.bucket_count() == 0);
- assert(c1.size() == 0);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(2));
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- assert(c2.bucket_count() >= 6);
- assert(c2.size() == 6);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c2.find(1), c2.end(), 1, s);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c2.find(2), c2.end(), 2, s);
- assert(c2.find(3)->second == "three");
- assert(c2.find(4)->second == "four");
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(1));
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef other_allocator<std::pair<const int, std::string> > Alloc;
- typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
- typedef std::pair<int, std::string> P;
- P a1[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- P a2[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
- c2.max_load_factor(2);
- swap(c1, c2);
-
- assert(c1.bucket_count() >= 8);
- assert(c1.size() == 8);
- assert(c1.find(10)->second == "ten");
- assert(c1.find(20)->second == "twenty");
- assert(c1.find(30)->second == "thirty");
- assert(c1.find(40)->second == "forty");
- assert(c1.find(50)->second == "fifty");
- assert(c1.find(60)->second == "sixty");
- assert(c1.find(70)->second == "seventy");
- assert(c1.find(80)->second == "eighty");
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(2));
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- assert(c2.bucket_count() >= 6);
- assert(c2.size() == 6);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c2.find(1), c2.end(), 1, s);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c2.find(2), c2.end(), 2, s);
- assert(c2.find(3)->second == "three");
- assert(c2.find(4)->second == "four");
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(1));
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef test_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
+ C c1(0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(0, Hash(2), Compare(2), Alloc(1, 2));
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ LIBCPP_ASSERT(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ LIBCPP_ASSERT(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef test_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ P a2[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c1(0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
+ c2.max_load_factor(2);
+ C::iterator it2 = c2.begin();
+ swap(c1, c2);
+
+ assert(c1.bucket_count() >= 8);
+ assert(c1.size() == 8);
+ assert(c1.find(10)->second == "ten");
+ assert(c1.find(20)->second == "twenty");
+ assert(c1.find(30)->second == "thirty");
+ assert(c1.find(40)->second == "forty");
+ assert(c1.find(50)->second == "fifty");
+ assert(c1.find(60)->second == "sixty");
+ assert(c1.find(70)->second == "seventy");
+ assert(c1.find(80)->second == "eighty");
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+ assert(it2 == c1.begin()); // Iterators are not invalidated
+
+ LIBCPP_ASSERT(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef test_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ P a1[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(0, Hash(2), Compare(2), Alloc(1, 2));
+ c2.max_load_factor(2);
+ C::iterator it1 = c1.begin();
+ swap(c1, c2);
+
+ LIBCPP_ASSERT(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 6);
+ assert(c2.size() == 6);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c2.find(1), c2.end(), 1, s);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c2.find(2), c2.end(), 2, s);
+ assert(c2.find(3)->second == "three");
+ assert(c2.find(4)->second == "four");
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ assert(it1 == c2.begin()); // Iterators are not invalidated
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef test_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ P a1[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ P a2[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
+ c2.max_load_factor(2);
+ C::iterator it1 = c1.begin();
+ C::iterator it2 = c2.begin();
+ swap(c1, c2);
+
+ assert(c1.bucket_count() >= 8);
+ assert(c1.size() == 8);
+ assert(c1.find(10)->second == "ten");
+ assert(c1.find(20)->second == "twenty");
+ assert(c1.find(30)->second == "thirty");
+ assert(c1.find(40)->second == "forty");
+ assert(c1.find(50)->second == "fifty");
+ assert(c1.find(60)->second == "sixty");
+ assert(c1.find(70)->second == "seventy");
+ assert(c1.find(80)->second == "eighty");
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+ assert(it2 == c1.begin()); // Iterators are not invalidated
+
+ assert(c2.bucket_count() >= 6);
+ assert(c2.size() == 6);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c2.find(1), c2.end(), 1, s);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c2.find(2), c2.end(), 2, s);
+ assert(c2.find(3)->second == "three");
+ assert(c2.find(4)->second == "four");
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ assert(it1 == c2.begin()); // Iterators are not invalidated
+ }
+
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef other_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
+ C c1(0, Hash(1), Compare(1), Alloc(1));
+ C c2(0, Hash(2), Compare(2), Alloc(2));
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ LIBCPP_ASSERT(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc(2));
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ LIBCPP_ASSERT(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc(1));
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef other_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ P a2[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c1(0, Hash(1), Compare(1), Alloc(1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ assert(c1.bucket_count() >= 8);
+ assert(c1.size() == 8);
+ assert(c1.find(10)->second == "ten");
+ assert(c1.find(20)->second == "twenty");
+ assert(c1.find(30)->second == "thirty");
+ assert(c1.find(40)->second == "forty");
+ assert(c1.find(50)->second == "fifty");
+ assert(c1.find(60)->second == "sixty");
+ assert(c1.find(70)->second == "seventy");
+ assert(c1.find(80)->second == "eighty");
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc(2));
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ LIBCPP_ASSERT(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc(1));
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef other_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ P a1[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
+ C c2(0, Hash(2), Compare(2), Alloc(2));
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ LIBCPP_ASSERT(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc(2));
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 6);
+ assert(c2.size() == 6);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c2.find(1), c2.end(), 1, s);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c2.find(2), c2.end(), 2, s);
+ assert(c2.find(3)->second == "three");
+ assert(c2.find(4)->second == "four");
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc(1));
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef other_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ P a1[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ P a2[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ assert(c1.bucket_count() >= 8);
+ assert(c1.size() == 8);
+ assert(c1.find(10)->second == "ten");
+ assert(c1.find(20)->second == "twenty");
+ assert(c1.find(30)->second == "thirty");
+ assert(c1.find(40)->second == "forty");
+ assert(c1.find(50)->second == "fifty");
+ assert(c1.find(60)->second == "sixty");
+ assert(c1.find(70)->second == "seventy");
+ assert(c1.find(80)->second == "eighty");
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc(2));
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 6);
+ assert(c2.size() == 6);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c2.find(1), c2.end(), 1, s);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c2.find(2), c2.end(), 2, s);
+ assert(c2.find(3)->second == "three");
+ assert(c2.find(4)->second == "four");
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc(1));
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef min_allocator<std::pair<const int, std::string> > Alloc;
- typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
- C c1(0, Hash(1), Compare(1), Alloc());
- C c2(0, Hash(2), Compare(2), Alloc());
- c2.max_load_factor(2);
- swap(c1, c2);
-
- LIBCPP_ASSERT(c1.bucket_count() == 0);
- assert(c1.size() == 0);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- LIBCPP_ASSERT(c2.bucket_count() == 0);
- assert(c2.size() == 0);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef min_allocator<std::pair<const int, std::string> > Alloc;
- typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
- typedef std::pair<int, std::string> P;
- P a2[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- C c1(0, Hash(1), Compare(1), Alloc());
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
- c2.max_load_factor(2);
- swap(c1, c2);
-
- assert(c1.bucket_count() >= 8);
- assert(c1.size() == 8);
- assert(c1.find(10)->second == "ten");
- assert(c1.find(20)->second == "twenty");
- assert(c1.find(30)->second == "thirty");
- assert(c1.find(40)->second == "forty");
- assert(c1.find(50)->second == "fifty");
- assert(c1.find(60)->second == "sixty");
- assert(c1.find(70)->second == "seventy");
- assert(c1.find(80)->second == "eighty");
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- LIBCPP_ASSERT(c2.bucket_count() == 0);
- assert(c2.size() == 0);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef min_allocator<std::pair<const int, std::string> > Alloc;
- typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
- typedef std::pair<int, std::string> P;
- P a1[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
- C c2(0, Hash(2), Compare(2), Alloc());
- c2.max_load_factor(2);
- swap(c1, c2);
-
- LIBCPP_ASSERT(c1.bucket_count() == 0);
- assert(c1.size() == 0);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- assert(c2.bucket_count() >= 6);
- assert(c2.size() == 6);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c2.find(1), c2.end(), 1, s);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c2.find(2), c2.end(), 2, s);
- assert(c2.find(3)->second == "three");
- assert(c2.find(4)->second == "four");
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef min_allocator<std::pair<const int, std::string> > Alloc;
- typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
- typedef std::pair<int, std::string> P;
- P a1[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
- P a2[] =
- {
- P(10, "ten"),
- P(20, "twenty"),
- P(30, "thirty"),
- P(40, "forty"),
- P(50, "fifty"),
- P(60, "sixty"),
- P(70, "seventy"),
- P(80, "eighty"),
- };
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
- c2.max_load_factor(2);
- swap(c1, c2);
-
- assert(c1.bucket_count() >= 8);
- assert(c1.size() == 8);
- assert(c1.find(10)->second == "ten");
- assert(c1.find(20)->second == "twenty");
- assert(c1.find(30)->second == "thirty");
- assert(c1.find(40)->second == "forty");
- assert(c1.find(50)->second == "fifty");
- assert(c1.find(60)->second == "sixty");
- assert(c1.find(70)->second == "seventy");
- assert(c1.find(80)->second == "eighty");
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- assert(c2.bucket_count() >= 6);
- assert(c2.size() == 6);
- std::multiset<std::string> s;
- s.insert("one");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c2.find(1), c2.end(), 1, s);
- s.insert("two");
- s.insert("four");
- CheckConsecutiveKeys<C::const_iterator>(c2.find(2), c2.end(), 2, s);
- assert(c2.find(3)->second == "three");
- assert(c2.find(4)->second == "four");
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef min_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
+ C c1(0, Hash(1), Compare(1), Alloc());
+ C c2(0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ LIBCPP_ASSERT(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ LIBCPP_ASSERT(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef min_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ P a2[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c1(0, Hash(1), Compare(1), Alloc());
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ assert(c1.bucket_count() >= 8);
+ assert(c1.size() == 8);
+ assert(c1.find(10)->second == "ten");
+ assert(c1.find(20)->second == "twenty");
+ assert(c1.find(30)->second == "thirty");
+ assert(c1.find(40)->second == "forty");
+ assert(c1.find(50)->second == "fifty");
+ assert(c1.find(60)->second == "sixty");
+ assert(c1.find(70)->second == "seventy");
+ assert(c1.find(80)->second == "eighty");
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ LIBCPP_ASSERT(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef min_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ P a1[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
+ C c2(0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ LIBCPP_ASSERT(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 6);
+ assert(c2.size() == 6);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c2.find(1), c2.end(), 1, s);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c2.find(2), c2.end(), 2, s);
+ assert(c2.find(3)->second == "three");
+ assert(c2.find(4)->second == "four");
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef min_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ P a1[] = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ P a2[] = {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "forty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ assert(c1.bucket_count() >= 8);
+ assert(c1.size() == 8);
+ assert(c1.find(10)->second == "ten");
+ assert(c1.find(20)->second == "twenty");
+ assert(c1.find(30)->second == "thirty");
+ assert(c1.find(40)->second == "forty");
+ assert(c1.find(50)->second == "fifty");
+ assert(c1.find(60)->second == "sixty");
+ assert(c1.find(70)->second == "seventy");
+ assert(c1.find(80)->second == "eighty");
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 6);
+ assert(c2.size() == 6);
+ std::multiset<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c2.find(1), c2.end(), 1, s);
+ s.insert("two");
+ s.insert("four");
+ CheckConsecutiveKeys<C::const_iterator>(c2.find(2), c2.end(), 2, s);
+ assert(c2.find(3)->second == "three");
+ assert(c2.find(4)->second == "four");
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multiset/allocator_mismatch.verify.cpp b/libcxx/test/std/containers/unord/unord.multiset/allocator_mismatch.verify.cpp
index 39ec7077511a91d..0ed0c37191a7040 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/allocator_mismatch.verify.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/allocator_mismatch.verify.cpp
@@ -12,4 +12,4 @@
#include <unordered_set>
std::unordered_multiset<int, std::hash<int>, std::less<int>, std::allocator<long> > v;
- // expected-error-re@*:* {{static assertion failed{{.*}}Allocator::value_type must be same type as value_type}}
+// expected-error-re@*:* {{static assertion failed{{.*}}Allocator::value_type must be same type as value_type}}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/bucket.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/bucket.pass.cpp
index dd487106c43582e..27d3a27555a0b5e 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/bucket.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/bucket.pass.cpp
@@ -20,47 +20,29 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<int> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- const C c(std::begin(a), std::end(a));
- std::size_t bc = c.bucket_count();
- assert(bc >= 7);
- for (std::size_t i = 0; i < 13; ++i)
- LIBCPP_ASSERT(c.bucket(i) == i % bc);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<int> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ const C c(std::begin(a), std::end(a));
+ std::size_t bc = c.bucket_count();
+ assert(bc >= 7);
+ for (std::size_t i = 0; i < 13; ++i)
+ LIBCPP_ASSERT(c.bucket(i) == i % bc);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multiset<int, std::hash<int>,
- std::equal_to<int>, min_allocator<int>> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- const C c(std::begin(a), std::end(a));
- std::size_t bc = c.bucket_count();
- assert(bc >= 7);
- for (std::size_t i = 0; i < 13; ++i)
- LIBCPP_ASSERT(c.bucket(i) == i % bc);
- }
+ {
+ typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ const C c(std::begin(a), std::end(a));
+ std::size_t bc = c.bucket_count();
+ assert(bc >= 7);
+ for (std::size_t i = 0; i < 13; ++i)
+ LIBCPP_ASSERT(c.bucket(i) == i % bc);
+ }
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/bucket_count.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/bucket_count.pass.cpp
index 8f389ebc206ba2e..9df863bba120faa 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/bucket_count.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/bucket_count.pass.cpp
@@ -20,55 +20,32 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<int> C;
- const C c;
- LIBCPP_ASSERT(c.bucket_count() == 0);
- }
- {
- typedef std::unordered_multiset<int> C;
- typedef int P;
- P a[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- const C c(std::begin(a), std::end(a));
- assert(c.bucket_count() >= 8);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<int> C;
+ const C c;
+ LIBCPP_ASSERT(c.bucket_count() == 0);
+ }
+ {
+ typedef std::unordered_multiset<int> C;
+ typedef int P;
+ P a[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)};
+ const C c(std::begin(a), std::end(a));
+ assert(c.bucket_count() >= 8);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multiset<int, std::hash<int>,
- std::equal_to<int>, min_allocator<int>> C;
- const C c;
- LIBCPP_ASSERT(c.bucket_count() == 0);
- }
- {
- typedef std::unordered_multiset<int, std::hash<int>,
- std::equal_to<int>, min_allocator<int>> C;
- typedef int P;
- P a[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- const C c(std::begin(a), std::end(a));
- assert(c.bucket_count() >= 8);
- }
+ {
+ typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ const C c;
+ LIBCPP_ASSERT(c.bucket_count() == 0);
+ }
+ {
+ typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)};
+ const C c(std::begin(a), std::end(a));
+ assert(c.bucket_count() >= 8);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multiset/bucket_size.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/bucket_size.pass.cpp
index be7a651416e21cf..306cadd87e9d14a 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/bucket_size.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/bucket_size.pass.cpp
@@ -20,54 +20,36 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<int> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- const C c(std::begin(a), std::end(a));
- assert(c.bucket_count() >= 7);
- LIBCPP_ASSERT(c.bucket_size(0) == 0);
- LIBCPP_ASSERT(c.bucket_size(1) == 2);
- LIBCPP_ASSERT(c.bucket_size(2) == 2);
- LIBCPP_ASSERT(c.bucket_size(3) == 1);
- LIBCPP_ASSERT(c.bucket_size(4) == 1);
- LIBCPP_ASSERT(c.bucket_size(5) == 0);
- LIBCPP_ASSERT(c.bucket_size(6) == 0);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<int> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ const C c(std::begin(a), std::end(a));
+ assert(c.bucket_count() >= 7);
+ LIBCPP_ASSERT(c.bucket_size(0) == 0);
+ LIBCPP_ASSERT(c.bucket_size(1) == 2);
+ LIBCPP_ASSERT(c.bucket_size(2) == 2);
+ LIBCPP_ASSERT(c.bucket_size(3) == 1);
+ LIBCPP_ASSERT(c.bucket_size(4) == 1);
+ LIBCPP_ASSERT(c.bucket_size(5) == 0);
+ LIBCPP_ASSERT(c.bucket_size(6) == 0);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multiset<int, std::hash<int>,
- std::equal_to<int>, min_allocator<int>> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- const C c(std::begin(a), std::end(a));
- assert(c.bucket_count() >= 7);
- LIBCPP_ASSERT(c.bucket_size(0) == 0);
- LIBCPP_ASSERT(c.bucket_size(1) == 2);
- LIBCPP_ASSERT(c.bucket_size(2) == 2);
- LIBCPP_ASSERT(c.bucket_size(3) == 1);
- LIBCPP_ASSERT(c.bucket_size(4) == 1);
- LIBCPP_ASSERT(c.bucket_size(5) == 0);
- LIBCPP_ASSERT(c.bucket_size(6) == 0);
- }
+ {
+ typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ const C c(std::begin(a), std::end(a));
+ assert(c.bucket_count() >= 7);
+ LIBCPP_ASSERT(c.bucket_size(0) == 0);
+ LIBCPP_ASSERT(c.bucket_size(1) == 2);
+ LIBCPP_ASSERT(c.bucket_size(2) == 2);
+ LIBCPP_ASSERT(c.bucket_size(3) == 1);
+ LIBCPP_ASSERT(c.bucket_size(4) == 1);
+ LIBCPP_ASSERT(c.bucket_size(5) == 0);
+ LIBCPP_ASSERT(c.bucket_size(6) == 0);
+ }
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/clear.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/clear.pass.cpp
index 01ff0459383979f..2471c2a42ec376b 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/clear.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/clear.pass.cpp
@@ -20,44 +20,26 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<int> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- ASSERT_NOEXCEPT(c.clear());
- c.clear();
- assert(c.size() == 0);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<int> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ ASSERT_NOEXCEPT(c.clear());
+ c.clear();
+ assert(c.size() == 0);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multiset<int, std::hash<int>,
- std::equal_to<int>, min_allocator<int>> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- ASSERT_NOEXCEPT(c.clear());
- c.clear();
- assert(c.size() == 0);
- }
+ {
+ typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ ASSERT_NOEXCEPT(c.clear());
+ c.clear();
+ assert(c.size() == 0);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multiset/contains.transparent.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/contains.transparent.pass.cpp
index b14021c6b8c8cd3..58a4fe72c78e8ff 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/contains.transparent.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/contains.transparent.pass.cpp
@@ -20,44 +20,43 @@
#include <unordered_set>
#include "test_transparent_unordered.h"
-int main(int, char**)
-{
- using key_type = StoredType<int>;
-
- {
- // Make sure conversions don't happen for transparent non-final hasher and key_equal
- using S = unord_set_type<std::unordered_multiset, transparent_hash, std::equal_to<>>;
- test_transparent_contains<S>({1, 1, 2});
- test_transparent_contains<const S>({1, 1, 2});
- }
-
- {
- // Make sure conversions don't happen for transparent final hasher and key_equal
- using S = unord_set_type<std::unordered_multiset, transparent_hash_final, transparent_equal_final>;
- test_transparent_contains<S>({1, 1, 2});
- test_transparent_contains<const S>({1, 1, 2});
- }
-
- {
- // Make sure conversions do happen for non-transparent hasher
- using S = unord_set_type<std::unordered_multiset, non_transparent_hash, std::equal_to<>>;
- test_non_transparent_contains<S>({1, 1, 2});
- test_non_transparent_contains<const S>({1, 1, 2});
- }
-
- {
- // Make sure conversions do happen for non-transparent key_equal
- using S = unord_set_type<std::unordered_multiset, transparent_hash, std::equal_to<key_type>>;
- test_non_transparent_contains<S>({1, 1, 2});
- test_non_transparent_contains<const S>({1, 1, 2});
- }
-
- {
- // Make sure conversions do happen for both non-transparent hasher and key_equal
- using S = unord_set_type<std::unordered_multiset, non_transparent_hash, std::equal_to<key_type>>;
- test_non_transparent_contains<S>({1, 1, 2});
- test_non_transparent_contains<const S>({1, 1, 2});
- }
-
- return 0;
+int main(int, char**) {
+ using key_type = StoredType<int>;
+
+ {
+ // Make sure conversions don't happen for transparent non-final hasher and key_equal
+ using S = unord_set_type<std::unordered_multiset, transparent_hash, std::equal_to<>>;
+ test_transparent_contains<S>({1, 1, 2});
+ test_transparent_contains<const S>({1, 1, 2});
+ }
+
+ {
+ // Make sure conversions don't happen for transparent final hasher and key_equal
+ using S = unord_set_type<std::unordered_multiset, transparent_hash_final, transparent_equal_final>;
+ test_transparent_contains<S>({1, 1, 2});
+ test_transparent_contains<const S>({1, 1, 2});
+ }
+
+ {
+ // Make sure conversions do happen for non-transparent hasher
+ using S = unord_set_type<std::unordered_multiset, non_transparent_hash, std::equal_to<>>;
+ test_non_transparent_contains<S>({1, 1, 2});
+ test_non_transparent_contains<const S>({1, 1, 2});
+ }
+
+ {
+ // Make sure conversions do happen for non-transparent key_equal
+ using S = unord_set_type<std::unordered_multiset, transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_contains<S>({1, 1, 2});
+ test_non_transparent_contains<const S>({1, 1, 2});
+ }
+
+ {
+ // Make sure conversions do happen for both non-transparent hasher and key_equal
+ using S = unord_set_type<std::unordered_multiset, non_transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_contains<S>({1, 1, 2});
+ test_non_transparent_contains<const S>({1, 1, 2});
+ }
+
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/count.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/count.pass.cpp
index 9feb51c7892591d..be4514c4d69383f 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/count.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/count.pass.cpp
@@ -20,52 +20,26 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<int> C;
- typedef int P;
- P a[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(50),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- const C c(std::begin(a), std::end(a));
- assert(c.count(30) == 1);
- assert(c.count(50) == 3);
- assert(c.count(5) == 0);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<int> C;
+ typedef int P;
+ P a[] = {P(10), P(20), P(30), P(40), P(50), P(50), P(50), P(60), P(70), P(80)};
+ const C c(std::begin(a), std::end(a));
+ assert(c.count(30) == 1);
+ assert(c.count(50) == 3);
+ assert(c.count(5) == 0);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multiset<int, std::hash<int>,
- std::equal_to<int>, min_allocator<int>> C;
- typedef int P;
- P a[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(50),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- const C c(std::begin(a), std::end(a));
- assert(c.count(30) == 1);
- assert(c.count(50) == 3);
- assert(c.count(5) == 0);
- }
+ {
+ typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] = {P(10), P(20), P(30), P(40), P(50), P(50), P(50), P(60), P(70), P(80)};
+ const C c(std::begin(a), std::end(a));
+ assert(c.count(30) == 1);
+ assert(c.count(50) == 3);
+ assert(c.count(5) == 0);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multiset/count.transparent.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/count.transparent.pass.cpp
index 64f9eddbddae0fa..0c0ca58558d39ae 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/count.transparent.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/count.transparent.pass.cpp
@@ -21,44 +21,43 @@
#include "test_transparent_unordered.h"
-int main(int, char**)
-{
- using key_type = StoredType<int>;
-
- {
- // Make sure conversions don't happen for transparent non-final hasher and key_equal
- using S = unord_set_type<std::unordered_multiset, transparent_hash, std::equal_to<>>;
- test_transparent_count<S>({1, 1, 2});
- test_transparent_count<const S>({1, 1, 2});
- }
-
- {
- // Make sure conversions don't happen for transparent final hasher and key_equal
- using S = unord_set_type<std::unordered_multiset, transparent_hash_final, transparent_equal_final>;
- test_transparent_count<S>({1, 1, 2});
- test_transparent_count<const S>({1, 1, 2});
- }
-
- {
- // Make sure conversions do happen for non-transparent hasher
- using S = unord_set_type<std::unordered_multiset, non_transparent_hash, std::equal_to<>>;
- test_non_transparent_count<S>({1, 1, 2});
- test_non_transparent_count<const S>({1, 1, 2});
- }
-
- {
- // Make sure conversions do happen for non-transparent key_equal
- using S = unord_set_type<std::unordered_multiset, transparent_hash, std::equal_to<key_type>>;
- test_non_transparent_count<S>({1, 1, 2});
- test_non_transparent_count<const S>({1, 1, 2});
- }
-
- {
- // Make sure conversions do happen for both non-transparent hasher and key_equal
- using S = unord_set_type<std::unordered_multiset, non_transparent_hash, std::equal_to<key_type>>;
- test_non_transparent_count<S>({1, 1, 2});
- test_non_transparent_count<const S>({1, 1, 2});
- }
-
- return 0;
+int main(int, char**) {
+ using key_type = StoredType<int>;
+
+ {
+ // Make sure conversions don't happen for transparent non-final hasher and key_equal
+ using S = unord_set_type<std::unordered_multiset, transparent_hash, std::equal_to<>>;
+ test_transparent_count<S>({1, 1, 2});
+ test_transparent_count<const S>({1, 1, 2});
+ }
+
+ {
+ // Make sure conversions don't happen for transparent final hasher and key_equal
+ using S = unord_set_type<std::unordered_multiset, transparent_hash_final, transparent_equal_final>;
+ test_transparent_count<S>({1, 1, 2});
+ test_transparent_count<const S>({1, 1, 2});
+ }
+
+ {
+ // Make sure conversions do happen for non-transparent hasher
+ using S = unord_set_type<std::unordered_multiset, non_transparent_hash, std::equal_to<>>;
+ test_non_transparent_count<S>({1, 1, 2});
+ test_non_transparent_count<const S>({1, 1, 2});
+ }
+
+ {
+ // Make sure conversions do happen for non-transparent key_equal
+ using S = unord_set_type<std::unordered_multiset, transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_count<S>({1, 1, 2});
+ test_non_transparent_count<const S>({1, 1, 2});
+ }
+
+ {
+ // Make sure conversions do happen for both non-transparent hasher and key_equal
+ using S = unord_set_type<std::unordered_multiset, non_transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_count<S>({1, 1, 2});
+ test_non_transparent_count<const S>({1, 1, 2});
+ }
+
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/emplace.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/emplace.pass.cpp
index 820b4cb0c97f8c1..886ddd74efd4577 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/emplace.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/emplace.pass.cpp
@@ -24,41 +24,41 @@
#include "../../Emplaceable.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<Emplaceable> C;
- typedef C::iterator R;
- C c;
- R r = c.emplace();
- assert(c.size() == 1);
- assert(*r == Emplaceable());
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<Emplaceable> C;
+ typedef C::iterator R;
+ C c;
+ R r = c.emplace();
+ assert(c.size() == 1);
+ assert(*r == Emplaceable());
- r = c.emplace(Emplaceable(5, 6));
- assert(c.size() == 2);
- assert(*r == Emplaceable(5, 6));
+ r = c.emplace(Emplaceable(5, 6));
+ assert(c.size() == 2);
+ assert(*r == Emplaceable(5, 6));
- r = c.emplace(5, 6);
- assert(c.size() == 3);
- assert(*r == Emplaceable(5, 6));
- }
- {
- typedef std::unordered_multiset<Emplaceable, std::hash<Emplaceable>,
- std::equal_to<Emplaceable>, min_allocator<Emplaceable>> C;
- typedef C::iterator R;
- C c;
- R r = c.emplace();
- assert(c.size() == 1);
- assert(*r == Emplaceable());
+ r = c.emplace(5, 6);
+ assert(c.size() == 3);
+ assert(*r == Emplaceable(5, 6));
+ }
+ {
+ typedef std::
+ unordered_multiset<Emplaceable, std::hash<Emplaceable>, std::equal_to<Emplaceable>, min_allocator<Emplaceable>>
+ C;
+ typedef C::iterator R;
+ C c;
+ R r = c.emplace();
+ assert(c.size() == 1);
+ assert(*r == Emplaceable());
- r = c.emplace(Emplaceable(5, 6));
- assert(c.size() == 2);
- assert(*r == Emplaceable(5, 6));
+ r = c.emplace(Emplaceable(5, 6));
+ assert(c.size() == 2);
+ assert(*r == Emplaceable(5, 6));
- r = c.emplace(5, 6);
- assert(c.size() == 3);
- assert(*r == Emplaceable(5, 6));
- }
+ r = c.emplace(5, 6);
+ assert(c.size() == 3);
+ assert(*r == Emplaceable(5, 6));
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/emplace_hint.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/emplace_hint.pass.cpp
index 285a13db3b32a92..6eb5fca80dc89b9 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/emplace_hint.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/emplace_hint.pass.cpp
@@ -17,7 +17,6 @@
// template <class... Args>
// iterator emplace_hint(const_iterator p, Args&&... args);
-
#include <unordered_set>
#include <cassert>
@@ -25,43 +24,43 @@
#include "../../Emplaceable.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<Emplaceable> C;
- typedef C::iterator R;
- C c;
- C::const_iterator e = c.end();
- R r = c.emplace_hint(e);
- assert(c.size() == 1);
- assert(*r == Emplaceable());
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<Emplaceable> C;
+ typedef C::iterator R;
+ C c;
+ C::const_iterator e = c.end();
+ R r = c.emplace_hint(e);
+ assert(c.size() == 1);
+ assert(*r == Emplaceable());
- r = c.emplace_hint(c.end(), Emplaceable(5, 6));
- assert(c.size() == 2);
- assert(*r == Emplaceable(5, 6));
+ r = c.emplace_hint(c.end(), Emplaceable(5, 6));
+ assert(c.size() == 2);
+ assert(*r == Emplaceable(5, 6));
- r = c.emplace_hint(r, 5, 6);
- assert(c.size() == 3);
- assert(*r == Emplaceable(5, 6));
- }
- {
- typedef std::unordered_multiset<Emplaceable, std::hash<Emplaceable>,
- std::equal_to<Emplaceable>, min_allocator<Emplaceable>> C;
- typedef C::iterator R;
- C c;
- C::const_iterator e = c.end();
- R r = c.emplace_hint(e);
- assert(c.size() == 1);
- assert(*r == Emplaceable());
+ r = c.emplace_hint(r, 5, 6);
+ assert(c.size() == 3);
+ assert(*r == Emplaceable(5, 6));
+ }
+ {
+ typedef std::
+ unordered_multiset<Emplaceable, std::hash<Emplaceable>, std::equal_to<Emplaceable>, min_allocator<Emplaceable>>
+ C;
+ typedef C::iterator R;
+ C c;
+ C::const_iterator e = c.end();
+ R r = c.emplace_hint(e);
+ assert(c.size() == 1);
+ assert(*r == Emplaceable());
- r = c.emplace_hint(c.end(), Emplaceable(5, 6));
- assert(c.size() == 2);
- assert(*r == Emplaceable(5, 6));
+ r = c.emplace_hint(c.end(), Emplaceable(5, 6));
+ assert(c.size() == 2);
+ assert(*r == Emplaceable(5, 6));
- r = c.emplace_hint(r, 5, 6);
- assert(c.size() == 3);
- assert(*r == Emplaceable(5, 6));
- }
+ r = c.emplace_hint(r, 5, 6);
+ assert(c.size() == 3);
+ assert(*r == Emplaceable(5, 6));
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/empty.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/empty.pass.cpp
index 078f95f564b6812..63ef2a858880e37 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/empty.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/empty.pass.cpp
@@ -18,9 +18,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::unordered_multiset<int> M;
M m;
ASSERT_NOEXCEPT(m.empty());
@@ -29,9 +28,9 @@ int main(int, char**)
assert(!m.empty());
m.clear();
assert(m.empty());
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> M;
M m;
ASSERT_NOEXCEPT(m.empty());
@@ -40,7 +39,7 @@ int main(int, char**)
assert(!m.empty());
m.clear();
assert(m.empty());
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multiset/empty.verify.cpp b/libcxx/test/std/containers/unord/unord.multiset/empty.verify.cpp
index 8f5fa55c3aefbb1..8df5b993f31daad 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/empty.verify.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/empty.verify.cpp
@@ -17,6 +17,6 @@
#include <unordered_set>
void f() {
- std::unordered_multiset<int> c;
- c.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::unordered_multiset<int> c;
+ c.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/eq.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/eq.pass.cpp
index 7c4cfd63c7bb613..d05bc05a896957b 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/eq.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/eq.pass.cpp
@@ -27,189 +27,107 @@
#include "test_comparisons.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<int> C;
- typedef int P;
- P a[] =
- {
- P(10),
- P(20),
- P(20),
- P(30),
- P(40),
- P(50),
- P(50),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- const C c1(std::begin(a), std::end(a));
- const C c2;
- assert(!(c1 == c2));
- assert( (c1 != c2));
- }
- {
- typedef std::unordered_multiset<int> C;
- typedef int P;
- P a[] =
- {
- P(10),
- P(20),
- P(20),
- P(30),
- P(40),
- P(50),
- P(50),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- const C c1(std::begin(a), std::end(a));
- const C c2 = c1;
- assert( (c1 == c2));
- assert(!(c1 != c2));
- }
- {
- typedef std::unordered_multiset<int> C;
- typedef int P;
- P a[] =
- {
- P(10),
- P(20),
- P(20),
- P(30),
- P(40),
- P(50),
- P(50),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- C c1(std::begin(a), std::end(a));
- C c2 = c1;
- c2.rehash(30);
- assert( (c1 == c2));
- assert(!(c1 != c2));
- c2.insert(P(90));
- assert(!(c1 == c2));
- assert( (c1 != c2));
- c1.insert(P(90));
- assert( (c1 == c2));
- assert(!(c1 != c2));
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<int> C;
+ typedef int P;
+ P a[] = {P(10), P(20), P(20), P(30), P(40), P(50), P(50), P(50), P(60), P(70), P(80)};
+ const C c1(std::begin(a), std::end(a));
+ const C c2;
+ assert(!(c1 == c2));
+ assert((c1 != c2));
+ }
+ {
+ typedef std::unordered_multiset<int> C;
+ typedef int P;
+ P a[] = {P(10), P(20), P(20), P(30), P(40), P(50), P(50), P(50), P(60), P(70), P(80)};
+ const C c1(std::begin(a), std::end(a));
+ const C c2 = c1;
+ assert((c1 == c2));
+ assert(!(c1 != c2));
+ }
+ {
+ typedef std::unordered_multiset<int> C;
+ typedef int P;
+ P a[] = {P(10), P(20), P(20), P(30), P(40), P(50), P(50), P(50), P(60), P(70), P(80)};
+ C c1(std::begin(a), std::end(a));
+ C c2 = c1;
+ c2.rehash(30);
+ assert((c1 == c2));
+ assert(!(c1 != c2));
+ c2.insert(P(90));
+ assert(!(c1 == c2));
+ assert((c1 != c2));
+ c1.insert(P(90));
+ assert((c1 == c2));
+ assert(!(c1 != c2));
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multiset<int, std::hash<int>,
- std::equal_to<int>, min_allocator<int>> C;
- typedef int P;
- P a[] =
- {
- P(10),
- P(20),
- P(20),
- P(30),
- P(40),
- P(50),
- P(50),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- const C c1(std::begin(a), std::end(a));
- const C c2;
- assert(!(c1 == c2));
- assert( (c1 != c2));
- }
- {
- typedef std::unordered_multiset<int, std::hash<int>,
- std::equal_to<int>, min_allocator<int>> C;
- typedef int P;
- P a[] =
- {
- P(10),
- P(20),
- P(20),
- P(30),
- P(40),
- P(50),
- P(50),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- const C c1(std::begin(a), std::end(a));
- const C c2 = c1;
- assert( (c1 == c2));
- assert(!(c1 != c2));
- }
- {
- typedef std::unordered_multiset<int, std::hash<int>,
- std::equal_to<int>, min_allocator<int>> C;
- typedef int P;
- P a[] =
- {
- P(10),
- P(20),
- P(20),
- P(30),
- P(40),
- P(50),
- P(50),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- C c1(std::begin(a), std::end(a));
- C c2 = c1;
- c2.rehash(30);
- assert( (c1 == c2));
- assert(!(c1 != c2));
- c2.insert(P(90));
- assert(!(c1 == c2));
- assert( (c1 != c2));
- c1.insert(P(90));
- assert( (c1 == c2));
- assert(!(c1 != c2));
- }
+ {
+ typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] = {P(10), P(20), P(20), P(30), P(40), P(50), P(50), P(50), P(60), P(70), P(80)};
+ const C c1(std::begin(a), std::end(a));
+ const C c2;
+ assert(!(c1 == c2));
+ assert((c1 != c2));
+ }
+ {
+ typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] = {P(10), P(20), P(20), P(30), P(40), P(50), P(50), P(50), P(60), P(70), P(80)};
+ const C c1(std::begin(a), std::end(a));
+ const C c2 = c1;
+ assert((c1 == c2));
+ assert(!(c1 != c2));
+ }
+ {
+ typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] = {P(10), P(20), P(20), P(30), P(40), P(50), P(50), P(50), P(60), P(70), P(80)};
+ C c1(std::begin(a), std::end(a));
+ C c2 = c1;
+ c2.rehash(30);
+ assert((c1 == c2));
+ assert(!(c1 != c2));
+ c2.insert(P(90));
+ assert(!(c1 == c2));
+ assert((c1 != c2));
+ c1.insert(P(90));
+ assert((c1 == c2));
+ assert(!(c1 != c2));
+ }
#endif
- // Make sure we take into account the number of times that a key repeats into equality.
- {
- int a[] = {1, 1, 1, 2};
- int b[] = {1, 1, 1, 1, 2};
+ // Make sure we take into account the number of times that a key repeats into equality.
+ {
+ int a[] = {1, 1, 1, 2};
+ int b[] = {1, 1, 1, 1, 2};
- std::unordered_multiset<int> c1(std::begin(a), std::end(a));
- std::unordered_multiset<int> c2(std::begin(b), std::end(b));
- assert(testEquality(c1, c2, false));
- }
+ std::unordered_multiset<int> c1(std::begin(a), std::end(a));
+ std::unordered_multiset<int> c2(std::begin(b), std::end(b));
+ assert(testEquality(c1, c2, false));
+ }
- // Make sure we behave properly when a custom key predicate is provided.
- {
- int a[] = {1, 3};
- int b[] = {1, 1};
- // A very poor hash
- struct HashModuloOddness {
- std::size_t operator()(int x) const { return std::hash<int>()(x % 2); }
- };
- // A very poor hash
- struct CompareModuloOddness {
- bool operator()(int x, int y) const { return (x % 2) == (y % 2); }
- };
+ // Make sure we behave properly when a custom key predicate is provided.
+ {
+ int a[] = {1, 3};
+ int b[] = {1, 1};
+ // A very poor hash
+ struct HashModuloOddness {
+ std::size_t operator()(int x) const { return std::hash<int>()(x % 2); }
+ };
+ // A very poor hash
+ struct CompareModuloOddness {
+ bool operator()(int x, int y) const { return (x % 2) == (y % 2); }
+ };
- using Set = std::unordered_multiset<int, HashModuloOddness, CompareModuloOddness>;
- Set c1(std::begin(a), std::end(a));
- Set c2(std::begin(b), std::end(b));
+ using Set = std::unordered_multiset<int, HashModuloOddness, CompareModuloOddness>;
+ Set c1(std::begin(a), std::end(a));
+ Set c2(std::begin(b), std::end(b));
- assert(testEquality(c1, c2, false));
- }
+ assert(testEquality(c1, c2, false));
+ }
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/equal_range.transparent.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/equal_range.transparent.pass.cpp
index 741058d8d2514a8..4d3a1baa47d2393 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/equal_range.transparent.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/equal_range.transparent.pass.cpp
@@ -21,44 +21,43 @@
#include "test_transparent_unordered.h"
-int main(int, char**)
-{
- using key_type = StoredType<int>;
-
- {
- // Make sure conversions don't happen for transparent non-final hasher and key_equal
- using S = unord_set_type<std::unordered_multiset, transparent_hash, std::equal_to<>>;
- test_transparent_equal_range<S>({1, 1, 2});
- test_transparent_equal_range<const S>({1, 1, 2});
- }
-
- {
- // Make sure conversions don't happen for transparent final hasher and key_equal
- using S = unord_set_type<std::unordered_multiset, transparent_hash_final, transparent_equal_final>;
- test_transparent_equal_range<S>({1, 1, 2});
- test_transparent_equal_range<const S>({1, 1, 2});
- }
-
- {
- // Make sure conversions do happen for non-transparent hasher
- using S = unord_set_type<std::unordered_multiset, non_transparent_hash, std::equal_to<>>;
- test_non_transparent_equal_range<S>({1, 1, 2});
- test_non_transparent_equal_range<const S>({1, 1, 2});
- }
-
- {
- // Make sure conversions do happen for non-transparent key_equal
- using S = unord_set_type<std::unordered_multiset, transparent_hash, std::equal_to<key_type>>;
- test_non_transparent_equal_range<S>({1, 1, 2});
- test_non_transparent_equal_range<const S>({1, 1, 2});
- }
-
- {
- // Make sure conversions do happen for both non-transparent hasher and key_equal
- using S = unord_set_type<std::unordered_multiset, non_transparent_hash, std::equal_to<key_type>>;
- test_non_transparent_equal_range<S>({1, 1, 2});
- test_non_transparent_equal_range<const S>({1, 1, 2});
- }
-
- return 0;
+int main(int, char**) {
+ using key_type = StoredType<int>;
+
+ {
+ // Make sure conversions don't happen for transparent non-final hasher and key_equal
+ using S = unord_set_type<std::unordered_multiset, transparent_hash, std::equal_to<>>;
+ test_transparent_equal_range<S>({1, 1, 2});
+ test_transparent_equal_range<const S>({1, 1, 2});
+ }
+
+ {
+ // Make sure conversions don't happen for transparent final hasher and key_equal
+ using S = unord_set_type<std::unordered_multiset, transparent_hash_final, transparent_equal_final>;
+ test_transparent_equal_range<S>({1, 1, 2});
+ test_transparent_equal_range<const S>({1, 1, 2});
+ }
+
+ {
+ // Make sure conversions do happen for non-transparent hasher
+ using S = unord_set_type<std::unordered_multiset, non_transparent_hash, std::equal_to<>>;
+ test_non_transparent_equal_range<S>({1, 1, 2});
+ test_non_transparent_equal_range<const S>({1, 1, 2});
+ }
+
+ {
+ // Make sure conversions do happen for non-transparent key_equal
+ using S = unord_set_type<std::unordered_multiset, transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_equal_range<S>({1, 1, 2});
+ test_non_transparent_equal_range<const S>({1, 1, 2});
+ }
+
+ {
+ // Make sure conversions do happen for both non-transparent hasher and key_equal
+ using S = unord_set_type<std::unordered_multiset, non_transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_equal_range<S>({1, 1, 2});
+ test_non_transparent_equal_range<const S>({1, 1, 2});
+ }
+
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/equal_range_const.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/equal_range_const.pass.cpp
index 6ef53875fcbcb0d..f5ec5165c885a30 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/equal_range_const.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/equal_range_const.pass.cpp
@@ -20,72 +20,46 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<int> C;
- typedef C::const_iterator I;
- typedef int P;
- P a[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(50),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- const C c(std::begin(a), std::end(a));
- std::pair<I, I> r = c.equal_range(30);
- assert(std::distance(r.first, r.second) == 1);
- assert(*r.first == 30);
- r = c.equal_range(5);
- assert(std::distance(r.first, r.second) == 0);
- r = c.equal_range(50);
- assert(std::distance(r.first, r.second) == 3);
- assert(*r.first == 50);
- ++r.first;
- assert(*r.first == 50);
- ++r.first;
- assert(*r.first == 50);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<int> C;
+ typedef C::const_iterator I;
+ typedef int P;
+ P a[] = {P(10), P(20), P(30), P(40), P(50), P(50), P(50), P(60), P(70), P(80)};
+ const C c(std::begin(a), std::end(a));
+ std::pair<I, I> r = c.equal_range(30);
+ assert(std::distance(r.first, r.second) == 1);
+ assert(*r.first == 30);
+ r = c.equal_range(5);
+ assert(std::distance(r.first, r.second) == 0);
+ r = c.equal_range(50);
+ assert(std::distance(r.first, r.second) == 3);
+ assert(*r.first == 50);
+ ++r.first;
+ assert(*r.first == 50);
+ ++r.first;
+ assert(*r.first == 50);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multiset<int, std::hash<int>,
- std::equal_to<int>, min_allocator<int>> C;
- typedef C::const_iterator I;
- typedef int P;
- P a[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(50),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- const C c(std::begin(a), std::end(a));
- std::pair<I, I> r = c.equal_range(30);
- assert(std::distance(r.first, r.second) == 1);
- assert(*r.first == 30);
- r = c.equal_range(5);
- assert(std::distance(r.first, r.second) == 0);
- r = c.equal_range(50);
- assert(std::distance(r.first, r.second) == 3);
- assert(*r.first == 50);
- ++r.first;
- assert(*r.first == 50);
- ++r.first;
- assert(*r.first == 50);
- }
+ {
+ typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef C::const_iterator I;
+ typedef int P;
+ P a[] = {P(10), P(20), P(30), P(40), P(50), P(50), P(50), P(60), P(70), P(80)};
+ const C c(std::begin(a), std::end(a));
+ std::pair<I, I> r = c.equal_range(30);
+ assert(std::distance(r.first, r.second) == 1);
+ assert(*r.first == 30);
+ r = c.equal_range(5);
+ assert(std::distance(r.first, r.second) == 0);
+ r = c.equal_range(50);
+ assert(std::distance(r.first, r.second) == 3);
+ assert(*r.first == 50);
+ ++r.first;
+ assert(*r.first == 50);
+ ++r.first;
+ assert(*r.first == 50);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multiset/equal_range_non_const.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/equal_range_non_const.pass.cpp
index 3c70d8c89cf9b4d..8d3d11cabfd1eb8 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/equal_range_non_const.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/equal_range_non_const.pass.cpp
@@ -20,72 +20,46 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<int> C;
- typedef C::iterator I;
- typedef int P;
- P a[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(50),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- C c(std::begin(a), std::end(a));
- std::pair<I, I> r = c.equal_range(30);
- assert(std::distance(r.first, r.second) == 1);
- assert(*r.first == 30);
- r = c.equal_range(5);
- assert(std::distance(r.first, r.second) == 0);
- r = c.equal_range(50);
- assert(std::distance(r.first, r.second) == 3);
- assert(*r.first == 50);
- ++r.first;
- assert(*r.first == 50);
- ++r.first;
- assert(*r.first == 50);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<int> C;
+ typedef C::iterator I;
+ typedef int P;
+ P a[] = {P(10), P(20), P(30), P(40), P(50), P(50), P(50), P(60), P(70), P(80)};
+ C c(std::begin(a), std::end(a));
+ std::pair<I, I> r = c.equal_range(30);
+ assert(std::distance(r.first, r.second) == 1);
+ assert(*r.first == 30);
+ r = c.equal_range(5);
+ assert(std::distance(r.first, r.second) == 0);
+ r = c.equal_range(50);
+ assert(std::distance(r.first, r.second) == 3);
+ assert(*r.first == 50);
+ ++r.first;
+ assert(*r.first == 50);
+ ++r.first;
+ assert(*r.first == 50);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multiset<int, std::hash<int>,
- std::equal_to<int>, min_allocator<int>> C;
- typedef C::iterator I;
- typedef int P;
- P a[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(50),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- C c(std::begin(a), std::end(a));
- std::pair<I, I> r = c.equal_range(30);
- assert(std::distance(r.first, r.second) == 1);
- assert(*r.first == 30);
- r = c.equal_range(5);
- assert(std::distance(r.first, r.second) == 0);
- r = c.equal_range(50);
- assert(std::distance(r.first, r.second) == 3);
- assert(*r.first == 50);
- ++r.first;
- assert(*r.first == 50);
- ++r.first;
- assert(*r.first == 50);
- }
+ {
+ typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef C::iterator I;
+ typedef int P;
+ P a[] = {P(10), P(20), P(30), P(40), P(50), P(50), P(50), P(60), P(70), P(80)};
+ C c(std::begin(a), std::end(a));
+ std::pair<I, I> r = c.equal_range(30);
+ assert(std::distance(r.first, r.second) == 1);
+ assert(*r.first == 30);
+ r = c.equal_range(5);
+ assert(std::distance(r.first, r.second) == 0);
+ r = c.equal_range(50);
+ assert(std::distance(r.first, r.second) == 3);
+ assert(*r.first == 50);
+ ++r.first;
+ assert(*r.first == 50);
+ ++r.first;
+ assert(*r.first == 50);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multiset/erase_const_iter.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/erase_const_iter.pass.cpp
index ffdcde80d14d3cf..d30a3d4b202cee6 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/erase_const_iter.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/erase_const_iter.pass.cpp
@@ -20,82 +20,65 @@
#include "test_macros.h"
#include "min_allocator.h"
-struct TemplateConstructor
-{
- template<typename T>
- TemplateConstructor (const T&) {}
+struct TemplateConstructor {
+ template <typename T>
+ TemplateConstructor(const T&) {}
};
bool operator==(const TemplateConstructor&, const TemplateConstructor&) { return false; }
-struct Hash { std::size_t operator() (const TemplateConstructor &) const { return 0; } };
+struct Hash {
+ std::size_t operator()(const TemplateConstructor&) const { return 0; }
+};
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<int> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- C::const_iterator i = c.find(2);
- C::const_iterator i_next = i;
- ++i_next;
- C::iterator j = c.erase(i);
- assert(j == i_next);
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<int> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ C::const_iterator i = c.find(2);
+ C::const_iterator i_next = i;
+ ++i_next;
+ C::iterator j = c.erase(i);
+ assert(j == i_next);
- assert(c.size() == 5);
- assert(c.count(1) == 2);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- }
+ assert(c.size() == 5);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multiset<int, std::hash<int>,
- std::equal_to<int>, min_allocator<int>> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- C::const_iterator i = c.find(2);
- C::const_iterator i_next = i;
- ++i_next;
- C::iterator j = c.erase(i);
- assert(j == i_next);
- assert(c.size() == 5);
- assert(c.count(1) == 2);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- }
+ {
+ typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ C::const_iterator i = c.find(2);
+ C::const_iterator i_next = i;
+ ++i_next;
+ C::iterator j = c.erase(i);
+ assert(j == i_next);
+ assert(c.size() == 5);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ }
#endif
#if TEST_STD_VER >= 14
- {
+ {
// This is LWG #2059
- typedef TemplateConstructor T;
- typedef std::unordered_set<T, Hash> C;
- typedef C::iterator I;
+ typedef TemplateConstructor T;
+ typedef std::unordered_set<T, Hash> C;
+ typedef C::iterator I;
- C m;
- T a{0};
- I it = m.find(a);
- if (it != m.end())
- m.erase(it);
- }
+ C m;
+ T a{0};
+ I it = m.find(a);
+ if (it != m.end())
+ m.erase(it);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multiset/erase_if.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/erase_if.pass.cpp
index 7bdc4f871571fa7..23980d7e1bac553 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/erase_if.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/erase_if.pass.cpp
@@ -23,12 +23,11 @@
using Init = std::initializer_list<int>;
template <typename M>
-M make (Init vals)
-{
- M ret;
- for (int v : vals)
- ret.insert(v);
- return ret;
+M make(Init vals) {
+ M ret;
+ for (int v : vals)
+ ret.insert(v);
+ return ret;
}
template <typename M, typename Pred>
@@ -41,52 +40,50 @@ void test0(Init vals, Pred p, Init expected, std::size_t expected_erased_count)
}
template <typename S>
-void test()
-{
- auto is1 = [](auto v) { return v == 1;};
- auto is2 = [](auto v) { return v == 2;};
- auto is3 = [](auto v) { return v == 3;};
- auto is4 = [](auto v) { return v == 4;};
- auto True = [](auto) { return true; };
- auto False = [](auto) { return false; };
-
- test0<S>({}, is1, {}, 0);
-
- test0<S>({1}, is1, {}, 1);
- test0<S>({1}, is2, {1}, 0);
-
- test0<S>({1, 2}, is1, {2}, 1);
- test0<S>({1, 2}, is2, {1}, 1);
- test0<S>({1, 2}, is3, {1, 2}, 0);
- test0<S>({1, 1}, is1, {}, 2);
- test0<S>({1, 1}, is3, {1, 1}, 0);
-
- test0<S>({1, 2, 3}, is1, {2, 3}, 1);
- test0<S>({1, 2, 3}, is2, {1, 3}, 1);
- test0<S>({1, 2, 3}, is3, {1, 2}, 1);
- test0<S>({1, 2, 3}, is4, {1, 2, 3}, 0);
-
- test0<S>({1, 1, 1}, is1, {}, 3);
- test0<S>({1, 1, 1}, is2, {1, 1, 1}, 0);
- test0<S>({1, 1, 2}, is1, {2}, 2);
- test0<S>({1, 1, 2}, is2, {1, 1}, 1);
- test0<S>({1, 1, 2}, is3, {1, 1, 2}, 0);
- test0<S>({1, 2, 2}, is1, {2, 2}, 1);
- test0<S>({1, 2, 2}, is2, {1}, 2);
- test0<S>({1, 2, 2}, is3, {1, 2, 2}, 0);
-
- test0<S>({1, 2, 3}, True, {}, 3);
- test0<S>({1, 2, 3}, False, {1, 2, 3}, 0);
+void test() {
+ auto is1 = [](auto v) { return v == 1; };
+ auto is2 = [](auto v) { return v == 2; };
+ auto is3 = [](auto v) { return v == 3; };
+ auto is4 = [](auto v) { return v == 4; };
+ auto True = [](auto) { return true; };
+ auto False = [](auto) { return false; };
+
+ test0<S>({}, is1, {}, 0);
+
+ test0<S>({1}, is1, {}, 1);
+ test0<S>({1}, is2, {1}, 0);
+
+ test0<S>({1, 2}, is1, {2}, 1);
+ test0<S>({1, 2}, is2, {1}, 1);
+ test0<S>({1, 2}, is3, {1, 2}, 0);
+ test0<S>({1, 1}, is1, {}, 2);
+ test0<S>({1, 1}, is3, {1, 1}, 0);
+
+ test0<S>({1, 2, 3}, is1, {2, 3}, 1);
+ test0<S>({1, 2, 3}, is2, {1, 3}, 1);
+ test0<S>({1, 2, 3}, is3, {1, 2}, 1);
+ test0<S>({1, 2, 3}, is4, {1, 2, 3}, 0);
+
+ test0<S>({1, 1, 1}, is1, {}, 3);
+ test0<S>({1, 1, 1}, is2, {1, 1, 1}, 0);
+ test0<S>({1, 1, 2}, is1, {2}, 2);
+ test0<S>({1, 1, 2}, is2, {1, 1}, 1);
+ test0<S>({1, 1, 2}, is3, {1, 1, 2}, 0);
+ test0<S>({1, 2, 2}, is1, {2, 2}, 1);
+ test0<S>({1, 2, 2}, is2, {1}, 2);
+ test0<S>({1, 2, 2}, is3, {1, 2, 2}, 0);
+
+ test0<S>({1, 2, 3}, True, {}, 3);
+ test0<S>({1, 2, 3}, False, {1, 2, 3}, 0);
}
-int main(int, char**)
-{
- test<std::unordered_multiset<int>>();
- test<std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>>> ();
- test<std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, test_allocator<int>>> ();
+int main(int, char**) {
+ test<std::unordered_multiset<int>>();
+ test<std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>>>();
+ test<std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, test_allocator<int>>>();
- test<std::unordered_multiset<long>>();
- test<std::unordered_multiset<double>>();
+ test<std::unordered_multiset<long>>();
+ test<std::unordered_multiset<double>>();
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/erase_key.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/erase_key.pass.cpp
index 522b6de2b87b11b..93c3b23aaff3c43 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/erase_key.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/erase_key.pass.cpp
@@ -23,155 +23,139 @@
#if TEST_STD_VER >= 11
template <typename Unordered>
-bool only_deletions ( const Unordered &whole, const Unordered &part ) {
- typename Unordered::const_iterator w = whole.begin();
- typename Unordered::const_iterator p = part.begin();
+bool only_deletions(const Unordered& whole, const Unordered& part) {
+ typename Unordered::const_iterator w = whole.begin();
+ typename Unordered::const_iterator p = part.begin();
- while ( w != whole.end () && p != part.end()) {
- if ( *w == *p )
- p++;
- w++;
- }
+ while (w != whole.end() && p != part.end()) {
+ if (*w == *p)
+ p++;
+ w++;
+ }
- return p == part.end();
+ return p == part.end();
}
#endif
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<int> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.erase(5) == 0);
- assert(c.size() == 6);
- assert(c.count(1) == 2);
- assert(c.count(2) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
-
- assert(c.erase(2) == 2);
- assert(c.size() == 4);
- assert(c.count(1) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
-
- assert(c.erase(2) == 0);
- assert(c.size() == 4);
- assert(c.count(1) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
-
- assert(c.erase(4) == 1);
- assert(c.size() == 3);
- assert(c.count(1) == 2);
- assert(c.count(3) == 1);
-
- assert(c.erase(4) == 0);
- assert(c.size() == 3);
- assert(c.count(1) == 2);
- assert(c.count(3) == 1);
-
- assert(c.erase(1) == 2);
- assert(c.size() == 1);
- assert(c.count(3) == 1);
-
- assert(c.erase(1) == 0);
- assert(c.size() == 1);
- assert(c.count(3) == 1);
-
- assert(c.erase(3) == 1);
- assert(c.size() == 0);
-
- assert(c.erase(3) == 0);
- assert(c.size() == 0);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<int> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.erase(5) == 0);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+
+ assert(c.erase(2) == 2);
+ assert(c.size() == 4);
+ assert(c.count(1) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+
+ assert(c.erase(2) == 0);
+ assert(c.size() == 4);
+ assert(c.count(1) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+
+ assert(c.erase(4) == 1);
+ assert(c.size() == 3);
+ assert(c.count(1) == 2);
+ assert(c.count(3) == 1);
+
+ assert(c.erase(4) == 0);
+ assert(c.size() == 3);
+ assert(c.count(1) == 2);
+ assert(c.count(3) == 1);
+
+ assert(c.erase(1) == 2);
+ assert(c.size() == 1);
+ assert(c.count(3) == 1);
+
+ assert(c.erase(1) == 0);
+ assert(c.size() == 1);
+ assert(c.count(3) == 1);
+
+ assert(c.erase(3) == 1);
+ assert(c.size() == 0);
+
+ assert(c.erase(3) == 0);
+ assert(c.size() == 0);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multiset<int, std::hash<int>,
- std::equal_to<int>, min_allocator<int>> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.erase(5) == 0);
- assert(c.size() == 6);
- assert(c.count(1) == 2);
- assert(c.count(2) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
-
- assert(c.erase(2) == 2);
- assert(c.size() == 4);
- assert(c.count(1) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
-
- assert(c.erase(2) == 0);
- assert(c.size() == 4);
- assert(c.count(1) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
-
- assert(c.erase(4) == 1);
- assert(c.size() == 3);
- assert(c.count(1) == 2);
- assert(c.count(3) == 1);
-
- assert(c.erase(4) == 0);
- assert(c.size() == 3);
- assert(c.count(1) == 2);
- assert(c.count(3) == 1);
-
- assert(c.erase(1) == 2);
- assert(c.size() == 1);
- assert(c.count(3) == 1);
-
- assert(c.erase(1) == 0);
- assert(c.size() == 1);
- assert(c.count(3) == 1);
-
- assert(c.erase(3) == 1);
- assert(c.size() == 0);
-
- assert(c.erase(3) == 0);
- assert(c.size() == 0);
- }
- {
+ {
+ typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.erase(5) == 0);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+
+ assert(c.erase(2) == 2);
+ assert(c.size() == 4);
+ assert(c.count(1) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+
+ assert(c.erase(2) == 0);
+ assert(c.size() == 4);
+ assert(c.count(1) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+
+ assert(c.erase(4) == 1);
+ assert(c.size() == 3);
+ assert(c.count(1) == 2);
+ assert(c.count(3) == 1);
+
+ assert(c.erase(4) == 0);
+ assert(c.size() == 3);
+ assert(c.count(1) == 2);
+ assert(c.count(3) == 1);
+
+ assert(c.erase(1) == 2);
+ assert(c.size() == 1);
+ assert(c.count(3) == 1);
+
+ assert(c.erase(1) == 0);
+ assert(c.size() == 1);
+ assert(c.count(3) == 1);
+
+ assert(c.erase(3) == 1);
+ assert(c.size() == 0);
+
+ assert(c.erase(3) == 0);
+ assert(c.size() == 0);
+ }
+ {
typedef std::unordered_multiset<int> C;
C m, m2;
- for ( int i = 0; i < 10; ++i ) {
- m.insert(i); m.insert(i);
- m2.insert(i); m2.insert(i);
- }
+ for (int i = 0; i < 10; ++i) {
+ m.insert(i);
+ m.insert(i);
+ m2.insert(i);
+ m2.insert(i);
+ }
C::iterator i = m2.begin();
- int ctr = 0;
+ int ctr = 0;
while (i != m2.end()) {
- if (ctr++ % 2 == 0)
- m2.erase(i++);
- else
- ++i;
- }
-
- assert (only_deletions (m, m2));
+ if (ctr++ % 2 == 0)
+ m2.erase(i++);
+ else
+ ++i;
}
+
+ assert(only_deletions(m, m2));
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multiset/erase_range.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/erase_range.pass.cpp
index 954d3bc1f9ebc2c..62724fdbeead8de 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/erase_range.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/erase_range.pass.cpp
@@ -21,76 +21,58 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<int> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- C::const_iterator i = c.find(2);
- C::const_iterator j = std::next(i, 2);
- C::iterator k = c.erase(i, i);
- assert(k == i);
- assert(c.size() == 6);
- assert(c.count(1) == 2);
- assert(c.count(2) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<int> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ C::const_iterator i = c.find(2);
+ C::const_iterator j = std::next(i, 2);
+ C::iterator k = c.erase(i, i);
+ assert(k == i);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
- k = c.erase(i, j);
- assert(c.size() == 4);
- assert(c.count(1) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
+ k = c.erase(i, j);
+ assert(c.size() == 4);
+ assert(c.count(1) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
- k = c.erase(c.cbegin(), c.cend());
- assert(c.size() == 0);
- assert(k == c.end());
- }
+ k = c.erase(c.cbegin(), c.cend());
+ assert(c.size() == 0);
+ assert(k == c.end());
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multiset<int, std::hash<int>,
- std::equal_to<int>, min_allocator<int>> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- C::const_iterator i = c.find(2);
- C::const_iterator j = std::next(i, 2);
- C::iterator k = c.erase(i, i);
- assert(k == i);
- assert(c.size() == 6);
- assert(c.count(1) == 2);
- assert(c.count(2) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
+ {
+ typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ C::const_iterator i = c.find(2);
+ C::const_iterator j = std::next(i, 2);
+ C::iterator k = c.erase(i, i);
+ assert(k == i);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
- k = c.erase(i, j);
- assert(c.size() == 4);
- assert(c.count(1) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
+ k = c.erase(i, j);
+ assert(c.size() == 4);
+ assert(c.count(1) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
- k = c.erase(c.cbegin(), c.cend());
- assert(c.size() == 0);
- assert(k == c.end());
- }
+ k = c.erase(c.cbegin(), c.cend());
+ assert(c.size() == 0);
+ assert(k == c.end());
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multiset/extract_iterator.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/extract_iterator.pass.cpp
index d88e33bddd70d39..c0a40bf0b332e30 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/extract_iterator.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/extract_iterator.pass.cpp
@@ -20,43 +20,40 @@
#include "Counter.h"
template <class Container>
-void test(Container& c)
-{
- std::size_t sz = c.size();
-
- for (auto first = c.cbegin(); first != c.cend();)
- {
- auto key_value = *first;
- typename Container::node_type t = c.extract(first++);
- --sz;
- assert(t.value() == key_value);
- assert(t.get_allocator() == c.get_allocator());
- assert(sz == c.size());
- }
-
- assert(c.size() == 0);
+void test(Container& c) {
+ std::size_t sz = c.size();
+
+ for (auto first = c.cbegin(); first != c.cend();) {
+ auto key_value = *first;
+ typename Container::node_type t = c.extract(first++);
+ --sz;
+ assert(t.value() == key_value);
+ assert(t.get_allocator() == c.get_allocator());
+ assert(sz == c.size());
+ }
+
+ assert(c.size() == 0);
}
-int main(int, char**)
-{
- {
- using set_type = std::unordered_multiset<int>;
- set_type m = {1, 2, 3, 4, 5, 6};
- test(m);
- }
-
- {
- std::unordered_multiset<Counter<int>> m = {1, 2, 3, 4, 5, 6};
- assert(Counter_base::gConstructed == 6);
- test(m);
- assert(Counter_base::gConstructed == 0);
- }
-
- {
- using min_alloc_set = std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>>;
- min_alloc_set m = {1, 2, 3, 4, 5, 6};
- test(m);
- }
+int main(int, char**) {
+ {
+ using set_type = std::unordered_multiset<int>;
+ set_type m = {1, 2, 3, 4, 5, 6};
+ test(m);
+ }
+
+ {
+ std::unordered_multiset<Counter<int>> m = {1, 2, 3, 4, 5, 6};
+ assert(Counter_base::gConstructed == 6);
+ test(m);
+ assert(Counter_base::gConstructed == 0);
+ }
+
+ {
+ using min_alloc_set = std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>>;
+ min_alloc_set m = {1, 2, 3, 4, 5, 6};
+ test(m);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/extract_key.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/extract_key.pass.cpp
index ec1ace86b566155..bd83b45672d2f4c 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/extract_key.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/extract_key.pass.cpp
@@ -20,54 +20,50 @@
#include "Counter.h"
template <class Container, class KeyTypeIter>
-void test(Container& c, KeyTypeIter first, KeyTypeIter last)
-{
- std::size_t sz = c.size();
- assert((std::size_t)std::distance(first, last) == sz);
+void test(Container& c, KeyTypeIter first, KeyTypeIter last) {
+ std::size_t sz = c.size();
+ assert((std::size_t)std::distance(first, last) == sz);
- for (KeyTypeIter copy = first; copy != last; ++copy)
- {
- typename Container::node_type t = c.extract(*copy);
- assert(!t.empty());
- --sz;
- assert(t.value() == *copy);
- assert(t.get_allocator() == c.get_allocator());
- assert(sz == c.size());
- }
+ for (KeyTypeIter copy = first; copy != last; ++copy) {
+ typename Container::node_type t = c.extract(*copy);
+ assert(!t.empty());
+ --sz;
+ assert(t.value() == *copy);
+ assert(t.get_allocator() == c.get_allocator());
+ assert(sz == c.size());
+ }
- assert(c.size() == 0);
+ assert(c.size() == 0);
- for (KeyTypeIter copy = first; copy != last; ++copy)
- {
- typename Container::node_type t = c.extract(*copy);
- assert(t.empty());
- }
+ for (KeyTypeIter copy = first; copy != last; ++copy) {
+ typename Container::node_type t = c.extract(*copy);
+ assert(t.empty());
+ }
}
-int main(int, char**)
-{
- {
- std::unordered_multiset<int> m = {1, 2, 3, 4, 5, 6};
- int keys[] = {1, 2, 3, 4, 5, 6};
- test(m, std::begin(keys), std::end(keys));
- }
+int main(int, char**) {
+ {
+ std::unordered_multiset<int> m = {1, 2, 3, 4, 5, 6};
+ int keys[] = {1, 2, 3, 4, 5, 6};
+ test(m, std::begin(keys), std::end(keys));
+ }
+ {
+ std::unordered_multiset<Counter<int>> m = {1, 2, 3, 4, 5, 6};
{
- std::unordered_multiset<Counter<int>> m = {1, 2, 3, 4, 5, 6};
- {
- Counter<int> keys[] = {1, 2, 3, 4, 5, 6};
- assert(Counter_base::gConstructed == 6+6);
- test(m, std::begin(keys), std::end(keys));
- }
- assert(Counter_base::gConstructed == 0);
+ Counter<int> keys[] = {1, 2, 3, 4, 5, 6};
+ assert(Counter_base::gConstructed == 6 + 6);
+ test(m, std::begin(keys), std::end(keys));
}
+ assert(Counter_base::gConstructed == 0);
+ }
- {
- using min_alloc_set = std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>>;
- min_alloc_set m = {1, 2, 3, 4, 5, 6};
- int keys[] = {1, 2, 3, 4, 5, 6};
- test(m, std::begin(keys), std::end(keys));
- }
+ {
+ using min_alloc_set = std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>>;
+ min_alloc_set m = {1, 2, 3, 4, 5, 6};
+ int keys[] = {1, 2, 3, 4, 5, 6};
+ test(m, std::begin(keys), std::end(keys));
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/find.transparent.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/find.transparent.pass.cpp
index 27abb1569e4196e..3e67484a1dc2985 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/find.transparent.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/find.transparent.pass.cpp
@@ -21,44 +21,43 @@
#include "test_transparent_unordered.h"
-int main(int, char**)
-{
- using key_type = StoredType<int>;
-
- {
- // Make sure conversions don't happen for transparent non-final hasher and key_equal
- using S = unord_set_type<std::unordered_multiset, transparent_hash, std::equal_to<>>;
- test_transparent_find<S>({1, 1, 2});
- test_transparent_find<const S>({1, 1, 2});
- }
-
- {
- // Make sure conversions don't happen for transparent final hasher and key_equal
- using S = unord_set_type<std::unordered_multiset, transparent_hash_final, transparent_equal_final>;
- test_transparent_find<S>({1, 1, 2});
- test_transparent_find<const S>({1, 1, 2});
- }
-
- {
- // Make sure conversions do happen for non-transparent hasher
- using S = unord_set_type<std::unordered_multiset, non_transparent_hash, std::equal_to<>>;
- test_non_transparent_find<S>({1, 1, 2});
- test_non_transparent_find<const S>({1, 1, 2});
- }
-
- {
- // Make sure conversions do happen for non-transparent key_equal
- using S = unord_set_type<std::unordered_multiset, transparent_hash, std::equal_to<key_type>>;
- test_non_transparent_find<S>({1, 1, 2});
- test_non_transparent_find<const S>({1, 1, 2});
- }
-
- {
- // Make sure conversions do happen for both non-transparent hasher and key_equal
- using S = unord_set_type<std::unordered_multiset, non_transparent_hash, std::equal_to<key_type>>;
- test_non_transparent_find<S>({1, 1, 2});
- test_non_transparent_find<const S>({1, 1, 2});
- }
-
- return 0;
+int main(int, char**) {
+ using key_type = StoredType<int>;
+
+ {
+ // Make sure conversions don't happen for transparent non-final hasher and key_equal
+ using S = unord_set_type<std::unordered_multiset, transparent_hash, std::equal_to<>>;
+ test_transparent_find<S>({1, 1, 2});
+ test_transparent_find<const S>({1, 1, 2});
+ }
+
+ {
+ // Make sure conversions don't happen for transparent final hasher and key_equal
+ using S = unord_set_type<std::unordered_multiset, transparent_hash_final, transparent_equal_final>;
+ test_transparent_find<S>({1, 1, 2});
+ test_transparent_find<const S>({1, 1, 2});
+ }
+
+ {
+ // Make sure conversions do happen for non-transparent hasher
+ using S = unord_set_type<std::unordered_multiset, non_transparent_hash, std::equal_to<>>;
+ test_non_transparent_find<S>({1, 1, 2});
+ test_non_transparent_find<const S>({1, 1, 2});
+ }
+
+ {
+ // Make sure conversions do happen for non-transparent key_equal
+ using S = unord_set_type<std::unordered_multiset, transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_find<S>({1, 1, 2});
+ test_non_transparent_find<const S>({1, 1, 2});
+ }
+
+ {
+ // Make sure conversions do happen for both non-transparent hasher and key_equal
+ using S = unord_set_type<std::unordered_multiset, non_transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_find<S>({1, 1, 2});
+ test_non_transparent_find<const S>({1, 1, 2});
+ }
+
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/find_const.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/find_const.pass.cpp
index 65570dcb51e93b9..5d751ff57d9c9b5 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/find_const.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/find_const.pass.cpp
@@ -20,50 +20,28 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<int> C;
- typedef int P;
- P a[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- const C c(std::begin(a), std::end(a));
- C::const_iterator i = c.find(30);
- assert(*i == 30);
- i = c.find(5);
- assert(i == c.cend());
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<int> C;
+ typedef int P;
+ P a[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)};
+ const C c(std::begin(a), std::end(a));
+ C::const_iterator i = c.find(30);
+ assert(*i == 30);
+ i = c.find(5);
+ assert(i == c.cend());
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multiset<int, std::hash<int>,
- std::equal_to<int>, min_allocator<int>> C;
- typedef int P;
- P a[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- const C c(std::begin(a), std::end(a));
- C::const_iterator i = c.find(30);
- assert(*i == 30);
- i = c.find(5);
- assert(i == c.cend());
- }
+ {
+ typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)};
+ const C c(std::begin(a), std::end(a));
+ C::const_iterator i = c.find(30);
+ assert(*i == 30);
+ i = c.find(5);
+ assert(i == c.cend());
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multiset/find_non_const.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/find_non_const.pass.cpp
index a70109bb9444854..b15b6443e343c0a 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/find_non_const.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/find_non_const.pass.cpp
@@ -20,50 +20,28 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<int> C;
- typedef int P;
- P a[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- C c(std::begin(a), std::end(a));
- C::iterator i = c.find(30);
- assert(*i == 30);
- i = c.find(5);
- assert(i == c.cend());
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<int> C;
+ typedef int P;
+ P a[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)};
+ C c(std::begin(a), std::end(a));
+ C::iterator i = c.find(30);
+ assert(*i == 30);
+ i = c.find(5);
+ assert(i == c.cend());
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multiset<int, std::hash<int>,
- std::equal_to<int>, min_allocator<int>> C;
- typedef int P;
- P a[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- C c(std::begin(a), std::end(a));
- C::iterator i = c.find(30);
- assert(*i == 30);
- i = c.find(5);
- assert(i == c.cend());
- }
+ {
+ typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)};
+ C c(std::begin(a), std::end(a));
+ C::iterator i = c.find(30);
+ assert(*i == 30);
+ i = c.find(5);
+ assert(i == c.cend());
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multiset/get_allocator.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/get_allocator.pass.cpp
index 699565cc0378aa0..4005ff50a1a95ec 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/get_allocator.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/get_allocator.pass.cpp
@@ -19,18 +19,16 @@
#include "test_macros.h"
int main(int, char**) {
- {
- std::allocator<int> alloc;
- const std::unordered_multiset<int> s(alloc);
- assert(s.get_allocator() == alloc);
- }
- {
- other_allocator<int> alloc(1);
- const std::unordered_multiset<int, std::hash<int>,
- std::equal_to<int>,
- other_allocator<int> > s(alloc);
- assert(s.get_allocator() == alloc);
- }
+ {
+ std::allocator<int> alloc;
+ const std::unordered_multiset<int> s(alloc);
+ assert(s.get_allocator() == alloc);
+ }
+ {
+ other_allocator<int> alloc(1);
+ const std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, other_allocator<int> > s(alloc);
+ assert(s.get_allocator() == alloc);
+ }
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/incomplete.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/incomplete.pass.cpp
index a90aa9a7e19758d..5d78db2feb89b95 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/incomplete.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/incomplete.pass.cpp
@@ -20,22 +20,22 @@
template <class Tp>
struct MyHash {
MyHash() {}
- std::size_t operator()(Tp const&) const {return 42;}
+ std::size_t operator()(Tp const&) const { return 42; }
};
struct A {
- typedef std::unordered_multiset<A, MyHash<A> > Map;
- Map m;
- Map::iterator it;
- Map::const_iterator cit;
- Map::local_iterator lit;
- Map::const_local_iterator clit;
+ typedef std::unordered_multiset<A, MyHash<A> > Map;
+ Map m;
+ Map::iterator it;
+ Map::const_iterator cit;
+ Map::local_iterator lit;
+ Map::const_local_iterator clit;
};
inline bool operator==(A const& L, A const& R) { return &L == &R; }
int main(int, char**) {
- A a;
+ A a;
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/insert_const_lvalue.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/insert_const_lvalue.pass.cpp
index 6f7c05bea2bab98..6c458be54c412be 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/insert_const_lvalue.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/insert_const_lvalue.pass.cpp
@@ -20,42 +20,39 @@
#include "test_macros.h"
#include "min_allocator.h"
-template<class Container>
-void do_insert_const_lvalue_test()
-{
- typedef Container C;
- typedef typename C::iterator R;
- typedef typename C::value_type VT;
- C c;
- const VT v1(3.5);
- R r = c.insert(v1);
- assert(c.size() == 1);
- assert(*r == 3.5);
-
- r = c.insert(v1);
- assert(c.size() == 2);
- assert(*r == 3.5);
-
- const VT v2(4.5);
- r = c.insert(v2);
- assert(c.size() == 3);
- assert(*r == 4.5);
-
- const VT v3(5.5);
- r = c.insert(v3);
- assert(c.size() == 4);
- assert(*r == 5.5);
+template <class Container>
+void do_insert_const_lvalue_test() {
+ typedef Container C;
+ typedef typename C::iterator R;
+ typedef typename C::value_type VT;
+ C c;
+ const VT v1(3.5);
+ R r = c.insert(v1);
+ assert(c.size() == 1);
+ assert(*r == 3.5);
+
+ r = c.insert(v1);
+ assert(c.size() == 2);
+ assert(*r == 3.5);
+
+ const VT v2(4.5);
+ r = c.insert(v2);
+ assert(c.size() == 3);
+ assert(*r == 4.5);
+
+ const VT v3(5.5);
+ r = c.insert(v3);
+ assert(c.size() == 4);
+ assert(*r == 5.5);
}
-int main(int, char**)
-{
- do_insert_const_lvalue_test<std::unordered_multiset<double> >();
+int main(int, char**) {
+ do_insert_const_lvalue_test<std::unordered_multiset<double> >();
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multiset<double, std::hash<double>,
- std::equal_to<double>, min_allocator<double>> C;
- do_insert_const_lvalue_test<C>();
- }
+ {
+ typedef std::unordered_multiset<double, std::hash<double>, std::equal_to<double>, min_allocator<double>> C;
+ do_insert_const_lvalue_test<C>();
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multiset/insert_emplace_allocator_requirements.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/insert_emplace_allocator_requirements.pass.cpp
index c94f27c00a54bd1..751744892fe90ac 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/insert_emplace_allocator_requirements.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/insert_emplace_allocator_requirements.pass.cpp
@@ -19,8 +19,7 @@
#include "container_test_types.h"
#include "../../set_allocator_requirement_test_templates.h"
-int main(int, char**)
-{
+int main(int, char**) {
testMultisetInsert<TCT::unordered_multiset<> >();
testMultisetEmplace<TCT::unordered_multiset<> >();
diff --git a/libcxx/test/std/containers/unord/unord.multiset/insert_hint_const_lvalue.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/insert_hint_const_lvalue.pass.cpp
index a33cada53684c45..60a3b18f2232213 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/insert_hint_const_lvalue.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/insert_hint_const_lvalue.pass.cpp
@@ -20,44 +20,41 @@
#include "test_macros.h"
#include "min_allocator.h"
-template<class Container>
-void do_insert_hint_const_lvalue_test()
-{
- typedef Container C;
- typedef typename C::iterator R;
- typedef typename C::value_type VT;
- C c;
- typename C::const_iterator e = c.end();
- const VT v1(3.5);
- R r = c.insert(e, v1);
- assert(c.size() == 1);
- assert(*r == 3.5);
-
- r = c.insert(r, v1);
- assert(c.size() == 2);
- assert(*r == 3.5);
-
- const VT v2(4.5);
- r = c.insert(c.end(), v2);
- assert(c.size() == 3);
- assert(*r == 4.5);
-
- const VT v3(5.5);
- r = c.insert(c.end(), v3);
- assert(c.size() == 4);
- assert(*r == 5.5);
+template <class Container>
+void do_insert_hint_const_lvalue_test() {
+ typedef Container C;
+ typedef typename C::iterator R;
+ typedef typename C::value_type VT;
+ C c;
+ typename C::const_iterator e = c.end();
+ const VT v1(3.5);
+ R r = c.insert(e, v1);
+ assert(c.size() == 1);
+ assert(*r == 3.5);
+
+ r = c.insert(r, v1);
+ assert(c.size() == 2);
+ assert(*r == 3.5);
+
+ const VT v2(4.5);
+ r = c.insert(c.end(), v2);
+ assert(c.size() == 3);
+ assert(*r == 4.5);
+
+ const VT v3(5.5);
+ r = c.insert(c.end(), v3);
+ assert(c.size() == 4);
+ assert(*r == 5.5);
}
-int main(int, char**)
-{
- do_insert_hint_const_lvalue_test<std::unordered_multiset<double> >();
+int main(int, char**) {
+ do_insert_hint_const_lvalue_test<std::unordered_multiset<double> >();
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multiset<double, std::hash<double>,
- std::equal_to<double>, min_allocator<double>> C;
- do_insert_hint_const_lvalue_test<C>();
- }
+ {
+ typedef std::unordered_multiset<double, std::hash<double>, std::equal_to<double>, min_allocator<double>> C;
+ do_insert_hint_const_lvalue_test<C>();
+ }
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/insert_hint_rvalue.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/insert_hint_rvalue.pass.cpp
index ab5302462e97c0b..e87bfbdae4b1c69 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/insert_hint_rvalue.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/insert_hint_rvalue.pass.cpp
@@ -21,99 +21,96 @@
#include "MoveOnly.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<double> C;
- typedef C::iterator R;
- typedef double P;
- C c;
- C::const_iterator e = c.end();
- R r = c.insert(e, P(3.5));
- assert(c.size() == 1);
- assert(*r == 3.5);
-
- r = c.insert(r, P(3.5));
- assert(c.size() == 2);
- assert(*r == 3.5);
-
- r = c.insert(c.end(), P(4.5));
- assert(c.size() == 3);
- assert(*r == 4.5);
-
- r = c.insert(c.end(), P(5.5));
- assert(c.size() == 4);
- assert(*r == 5.5);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<double> C;
+ typedef C::iterator R;
+ typedef double P;
+ C c;
+ C::const_iterator e = c.end();
+ R r = c.insert(e, P(3.5));
+ assert(c.size() == 1);
+ assert(*r == 3.5);
+
+ r = c.insert(r, P(3.5));
+ assert(c.size() == 2);
+ assert(*r == 3.5);
+
+ r = c.insert(c.end(), P(4.5));
+ assert(c.size() == 3);
+ assert(*r == 4.5);
+
+ r = c.insert(c.end(), P(5.5));
+ assert(c.size() == 4);
+ assert(*r == 5.5);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multiset<MoveOnly> C;
- typedef C::iterator R;
- typedef MoveOnly P;
- C c;
- C::const_iterator e = c.end();
- R r = c.insert(e, P(3));
- assert(c.size() == 1);
- assert(*r == 3);
-
- r = c.insert(r, P(3));
- assert(c.size() == 2);
- assert(*r == 3);
-
- r = c.insert(c.end(), P(4));
- assert(c.size() == 3);
- assert(*r == 4);
-
- r = c.insert(c.end(), P(5));
- assert(c.size() == 4);
- assert(*r == 5);
- }
- {
- typedef std::unordered_multiset<double, std::hash<double>,
- std::equal_to<double>, min_allocator<double>> C;
- typedef C::iterator R;
- typedef double P;
- C c;
- C::const_iterator e = c.end();
- R r = c.insert(e, P(3.5));
- assert(c.size() == 1);
- assert(*r == 3.5);
-
- r = c.insert(r, P(3.5));
- assert(c.size() == 2);
- assert(*r == 3.5);
-
- r = c.insert(c.end(), P(4.5));
- assert(c.size() == 3);
- assert(*r == 4.5);
-
- r = c.insert(c.end(), P(5.5));
- assert(c.size() == 4);
- assert(*r == 5.5);
- }
- {
- typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, min_allocator<MoveOnly>> C;
- typedef C::iterator R;
- typedef MoveOnly P;
- C c;
- C::const_iterator e = c.end();
- R r = c.insert(e, P(3));
- assert(c.size() == 1);
- assert(*r == 3);
-
- r = c.insert(r, P(3));
- assert(c.size() == 2);
- assert(*r == 3);
-
- r = c.insert(c.end(), P(4));
- assert(c.size() == 3);
- assert(*r == 4);
-
- r = c.insert(c.end(), P(5));
- assert(c.size() == 4);
- assert(*r == 5);
- }
+ {
+ typedef std::unordered_multiset<MoveOnly> C;
+ typedef C::iterator R;
+ typedef MoveOnly P;
+ C c;
+ C::const_iterator e = c.end();
+ R r = c.insert(e, P(3));
+ assert(c.size() == 1);
+ assert(*r == 3);
+
+ r = c.insert(r, P(3));
+ assert(c.size() == 2);
+ assert(*r == 3);
+
+ r = c.insert(c.end(), P(4));
+ assert(c.size() == 3);
+ assert(*r == 4);
+
+ r = c.insert(c.end(), P(5));
+ assert(c.size() == 4);
+ assert(*r == 5);
+ }
+ {
+ typedef std::unordered_multiset<double, std::hash<double>, std::equal_to<double>, min_allocator<double>> C;
+ typedef C::iterator R;
+ typedef double P;
+ C c;
+ C::const_iterator e = c.end();
+ R r = c.insert(e, P(3.5));
+ assert(c.size() == 1);
+ assert(*r == 3.5);
+
+ r = c.insert(r, P(3.5));
+ assert(c.size() == 2);
+ assert(*r == 3.5);
+
+ r = c.insert(c.end(), P(4.5));
+ assert(c.size() == 3);
+ assert(*r == 4.5);
+
+ r = c.insert(c.end(), P(5.5));
+ assert(c.size() == 4);
+ assert(*r == 5.5);
+ }
+ {
+ typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>, std::equal_to<MoveOnly>, min_allocator<MoveOnly>> C;
+ typedef C::iterator R;
+ typedef MoveOnly P;
+ C c;
+ C::const_iterator e = c.end();
+ R r = c.insert(e, P(3));
+ assert(c.size() == 1);
+ assert(*r == 3);
+
+ r = c.insert(r, P(3));
+ assert(c.size() == 2);
+ assert(*r == 3);
+
+ r = c.insert(c.end(), P(4));
+ assert(c.size() == 3);
+ assert(*r == 4);
+
+ r = c.insert(c.end(), P(5));
+ assert(c.size() == 4);
+ assert(*r == 5);
+ }
#endif // TEST_STD_VER >= 11
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multiset/insert_init.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/insert_init.pass.cpp
index d27d0a9b65a58cc..b58df799042a555 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/insert_init.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/insert_init.pass.cpp
@@ -23,49 +23,29 @@
#include "test_iterators.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<int> C;
- typedef int P;
- C c;
- c.insert(
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- }
- );
- assert(c.size() == 6);
- assert(c.count(1) == 2);
- assert(c.count(2) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- }
- {
- typedef std::unordered_multiset<int, std::hash<int>,
- std::equal_to<int>, min_allocator<int>> C;
- typedef int P;
- C c;
- c.insert(
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- }
- );
- assert(c.size() == 6);
- assert(c.count(1) == 2);
- assert(c.count(2) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<int> C;
+ typedef int P;
+ C c;
+ c.insert({P(1), P(2), P(3), P(4), P(1), P(2)});
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ }
+ {
+ typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ C c;
+ c.insert({P(1), P(2), P(3), P(4), P(1), P(2)});
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/insert_iter_iter.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/insert_iter_iter.pass.cpp
index f893a9dfd0912b8..e449ab51e5709b3 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/insert_iter_iter.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/insert_iter_iter.pass.cpp
@@ -22,50 +22,32 @@
#include "test_iterators.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<int> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c;
- c.insert(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])));
- assert(c.size() == 6);
- assert(c.count(1) == 2);
- assert(c.count(2) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<int> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c;
+ c.insert(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])));
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multiset<int, std::hash<int>,
- std::equal_to<int>, min_allocator<int>> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c;
- c.insert(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])));
- assert(c.size() == 6);
- assert(c.count(1) == 2);
- assert(c.count(2) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- }
+ {
+ typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c;
+ c.insert(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])));
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multiset/insert_node_type.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/insert_node_type.pass.cpp
index d57427724dcaf89..8006a254f9379e7 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/insert_node_type.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/insert_node_type.pass.cpp
@@ -20,59 +20,53 @@
#include "min_allocator.h"
template <class Container>
-typename Container::node_type
-node_factory(typename Container::key_type const& key)
-{
- static Container c;
- auto it = c.insert(key);
- return c.extract(it);
+typename Container::node_type node_factory(typename Container::key_type const& key) {
+ static Container c;
+ auto it = c.insert(key);
+ return c.extract(it);
}
template <class Container>
-void test(Container& c)
-{
- auto* nf = &node_factory<Container>;
+void test(Container& c) {
+ auto* nf = &node_factory<Container>;
- for (int i = 0; i != 10; ++i)
- {
- typename Container::node_type node = nf(i);
- assert(!node.empty());
- typename Container::iterator it = c.insert(std::move(node));
- assert(node.empty());
- assert(it == c.find(i) && it != c.end());
- assert(*it == i);
- assert(node.empty());
- }
+ for (int i = 0; i != 10; ++i) {
+ typename Container::node_type node = nf(i);
+ assert(!node.empty());
+ typename Container::iterator it = c.insert(std::move(node));
+ assert(node.empty());
+ assert(it == c.find(i) && it != c.end());
+ assert(*it == i);
+ assert(node.empty());
+ }
- assert(c.size() == 10);
+ assert(c.size() == 10);
- { // Insert empty node.
- typename Container::node_type def;
- auto it = c.insert(std::move(def));
- assert(def.empty());
- assert(it == c.end());
- }
+ { // Insert empty node.
+ typename Container::node_type def;
+ auto it = c.insert(std::move(def));
+ assert(def.empty());
+ assert(it == c.end());
+ }
- { // Insert duplicate node.
- typename Container::node_type dupl = nf(0);
- auto it = c.insert(std::move(dupl));
- assert(*it == 0);
- }
+ { // Insert duplicate node.
+ typename Container::node_type dupl = nf(0);
+ auto it = c.insert(std::move(dupl));
+ assert(*it == 0);
+ }
- assert(c.size() == 11);
- assert(c.count(0) == 2);
- for (int i = 1; i != 10; ++i)
- {
- assert(c.count(i) == 1);
- }
+ assert(c.size() == 11);
+ assert(c.count(0) == 2);
+ for (int i = 1; i != 10; ++i) {
+ assert(c.count(i) == 1);
+ }
}
-int main(int, char**)
-{
- std::unordered_multiset<int> m;
- test(m);
- std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> m2;
- test(m2);
+int main(int, char**) {
+ std::unordered_multiset<int> m;
+ test(m);
+ std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> m2;
+ test(m2);
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/insert_node_type_hint.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/insert_node_type_hint.pass.cpp
index 2706899b19a9590..7509cf746043fe5 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/insert_node_type_hint.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/insert_node_type_hint.pass.cpp
@@ -19,43 +19,37 @@
#include "min_allocator.h"
template <class Container>
-typename Container::node_type
-node_factory(typename Container::key_type const& key)
-{
- static Container c;
- auto it = c.insert(key);
- return c.extract(it);
+typename Container::node_type node_factory(typename Container::key_type const& key) {
+ static Container c;
+ auto it = c.insert(key);
+ return c.extract(it);
}
template <class Container>
-void test(Container& c)
-{
- auto* nf = &node_factory<Container>;
-
- for (int i = 0; i != 10; ++i)
- {
- typename Container::node_type node = nf(i);
- assert(!node.empty());
- std::size_t prev = c.size();
- auto it = c.insert(c.end(), std::move(node));
- assert(prev + 1 == c.size());
- assert(*it == i);
- }
-
- assert(c.size() == 10);
-
- for (int i = 0; i != 10; ++i)
- {
- assert(c.count(i) == 1);
- }
+void test(Container& c) {
+ auto* nf = &node_factory<Container>;
+
+ for (int i = 0; i != 10; ++i) {
+ typename Container::node_type node = nf(i);
+ assert(!node.empty());
+ std::size_t prev = c.size();
+ auto it = c.insert(c.end(), std::move(node));
+ assert(prev + 1 == c.size());
+ assert(*it == i);
+ }
+
+ assert(c.size() == 10);
+
+ for (int i = 0; i != 10; ++i) {
+ assert(c.count(i) == 1);
+ }
}
-int main(int, char**)
-{
- std::unordered_multiset<int> m;
- test(m);
- std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> m2;
- test(m2);
+int main(int, char**) {
+ std::unordered_multiset<int> m;
+ test(m);
+ std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> m2;
+ test(m2);
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/insert_range.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/insert_range.pass.cpp
index c2d5ed3278332ed..6aeb463685d72e8 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/insert_range.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/insert_range.pass.cpp
@@ -22,7 +22,8 @@
int main(int, char**) {
for_all_iterators_and_allocators<int, const int*>([]<class Iter, class Sent, class Alloc>() {
- test_map_set_insert_range<std::unordered_multiset<int, test_hash<int>, test_equal_to<int>, Alloc>, int, Iter, Sent>(/*allow_duplicates=*/true);
+ test_map_set_insert_range<std::unordered_multiset<int, test_hash<int>, test_equal_to<int>, Alloc>, int, Iter, Sent>(
+ /*allow_duplicates=*/true);
});
static_assert(test_set_constraints_insert_range<std::unordered_multiset, int, double>());
@@ -34,4 +35,3 @@ int main(int, char**) {
return 0;
}
-
diff --git a/libcxx/test/std/containers/unord/unord.multiset/insert_rvalue.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/insert_rvalue.pass.cpp
index 1696f52b066e0d2..53ac84eccc2f177 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/insert_rvalue.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/insert_rvalue.pass.cpp
@@ -21,95 +21,92 @@
#include "MoveOnly.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<double> C;
- typedef C::iterator R;
- typedef double P;
- C c;
- R r = c.insert(P(3.5));
- assert(c.size() == 1);
- assert(*r == 3.5);
-
- r = c.insert(P(3.5));
- assert(c.size() == 2);
- assert(*r == 3.5);
-
- r = c.insert(P(4.5));
- assert(c.size() == 3);
- assert(*r == 4.5);
-
- r = c.insert(P(5.5));
- assert(c.size() == 4);
- assert(*r == 5.5);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<double> C;
+ typedef C::iterator R;
+ typedef double P;
+ C c;
+ R r = c.insert(P(3.5));
+ assert(c.size() == 1);
+ assert(*r == 3.5);
+
+ r = c.insert(P(3.5));
+ assert(c.size() == 2);
+ assert(*r == 3.5);
+
+ r = c.insert(P(4.5));
+ assert(c.size() == 3);
+ assert(*r == 4.5);
+
+ r = c.insert(P(5.5));
+ assert(c.size() == 4);
+ assert(*r == 5.5);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multiset<MoveOnly> C;
- typedef C::iterator R;
- typedef MoveOnly P;
- C c;
- R r = c.insert(P(3));
- assert(c.size() == 1);
- assert(*r == 3);
-
- r = c.insert(P(3));
- assert(c.size() == 2);
- assert(*r == 3);
-
- r = c.insert(P(4));
- assert(c.size() == 3);
- assert(*r == 4);
-
- r = c.insert(P(5));
- assert(c.size() == 4);
- assert(*r == 5);
- }
- {
- typedef std::unordered_multiset<double, std::hash<double>,
- std::equal_to<double>, min_allocator<double>> C;
- typedef C::iterator R;
- typedef double P;
- C c;
- R r = c.insert(P(3.5));
- assert(c.size() == 1);
- assert(*r == 3.5);
-
- r = c.insert(P(3.5));
- assert(c.size() == 2);
- assert(*r == 3.5);
-
- r = c.insert(P(4.5));
- assert(c.size() == 3);
- assert(*r == 4.5);
-
- r = c.insert(P(5.5));
- assert(c.size() == 4);
- assert(*r == 5.5);
- }
- {
- typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, min_allocator<MoveOnly>> C;
- typedef C::iterator R;
- typedef MoveOnly P;
- C c;
- R r = c.insert(P(3));
- assert(c.size() == 1);
- assert(*r == 3);
-
- r = c.insert(P(3));
- assert(c.size() == 2);
- assert(*r == 3);
-
- r = c.insert(P(4));
- assert(c.size() == 3);
- assert(*r == 4);
-
- r = c.insert(P(5));
- assert(c.size() == 4);
- assert(*r == 5);
- }
+ {
+ typedef std::unordered_multiset<MoveOnly> C;
+ typedef C::iterator R;
+ typedef MoveOnly P;
+ C c;
+ R r = c.insert(P(3));
+ assert(c.size() == 1);
+ assert(*r == 3);
+
+ r = c.insert(P(3));
+ assert(c.size() == 2);
+ assert(*r == 3);
+
+ r = c.insert(P(4));
+ assert(c.size() == 3);
+ assert(*r == 4);
+
+ r = c.insert(P(5));
+ assert(c.size() == 4);
+ assert(*r == 5);
+ }
+ {
+ typedef std::unordered_multiset<double, std::hash<double>, std::equal_to<double>, min_allocator<double>> C;
+ typedef C::iterator R;
+ typedef double P;
+ C c;
+ R r = c.insert(P(3.5));
+ assert(c.size() == 1);
+ assert(*r == 3.5);
+
+ r = c.insert(P(3.5));
+ assert(c.size() == 2);
+ assert(*r == 3.5);
+
+ r = c.insert(P(4.5));
+ assert(c.size() == 3);
+ assert(*r == 4.5);
+
+ r = c.insert(P(5.5));
+ assert(c.size() == 4);
+ assert(*r == 5.5);
+ }
+ {
+ typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>, std::equal_to<MoveOnly>, min_allocator<MoveOnly>> C;
+ typedef C::iterator R;
+ typedef MoveOnly P;
+ C c;
+ R r = c.insert(P(3));
+ assert(c.size() == 1);
+ assert(*r == 3);
+
+ r = c.insert(P(3));
+ assert(c.size() == 2);
+ assert(*r == 3);
+
+ r = c.insert(P(4));
+ assert(c.size() == 3);
+ assert(*r == 4);
+
+ r = c.insert(P(5));
+ assert(c.size() == 4);
+ assert(*r == 5);
+ }
#endif // TEST_STD_VER >= 11
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multiset/iterator_concept_conformance.compile.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/iterator_concept_conformance.compile.pass.cpp
index 816baa143f3d330..6e209ba892efb5c 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/iterator_concept_conformance.compile.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/iterator_concept_conformance.compile.pass.cpp
@@ -16,11 +16,11 @@
#include "test_macros.h"
-using iterator = std::unordered_multiset<int>::iterator;
-using const_iterator = std::unordered_multiset<int>::const_iterator;
-using local_iterator = std::unordered_multiset<int>::local_iterator;
+using iterator = std::unordered_multiset<int>::iterator;
+using const_iterator = std::unordered_multiset<int>::const_iterator;
+using local_iterator = std::unordered_multiset<int>::local_iterator;
using const_local_iterator = std::unordered_multiset<int>::const_local_iterator;
-using value_type = int;
+using value_type = int;
static_assert(std::forward_iterator<iterator>);
LIBCPP_STATIC_ASSERT(!std::bidirectional_iterator<iterator>);
diff --git a/libcxx/test/std/containers/unord/unord.multiset/iterators.compile.fail.cpp b/libcxx/test/std/containers/unord/unord.multiset/iterators.compile.fail.cpp
index 2c282fdbaab4bfb..08950f732a044ee 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/iterators.compile.fail.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/iterators.compile.fail.cpp
@@ -24,47 +24,30 @@
#include "test_macros.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<int> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
- C::iterator i = c.begin();
- assert(*i == 1);
- *i = 2;
- }
- {
- typedef std::unordered_multiset<int> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- const C c(a, a + sizeof(a)/sizeof(a[0]));
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<int> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ C::iterator i = c.begin();
+ assert(*i == 1);
+ *i = 2;
+ }
+ {
+ typedef std::unordered_multiset<int> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ const C c(a, a + sizeof(a) / sizeof(a[0]));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/iterators.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/iterators.pass.cpp
index 2c0cd496ddb240c..c75be738506564e 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/iterators.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/iterators.pass.cpp
@@ -26,104 +26,69 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<int> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 7);
- assert(c.size() == 6);
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- C::iterator i;
- }
- {
- typedef std::unordered_multiset<int> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- const C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 7);
- assert(c.size() == 6);
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- C::const_iterator i;
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<int> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 7);
+ assert(c.size() == 6);
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ C::iterator i;
+ }
+ {
+ typedef std::unordered_multiset<int> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ const C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 7);
+ assert(c.size() == 6);
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ C::const_iterator i;
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multiset<int, std::hash<int>,
- std::equal_to<int>, min_allocator<int>> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 7);
- assert(c.size() == 6);
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- C::iterator i;
- }
- {
- typedef std::unordered_multiset<int, std::hash<int>,
- std::equal_to<int>, min_allocator<int>> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- const C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 7);
- assert(c.size() == 6);
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- C::const_iterator i;
- }
+ {
+ typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 7);
+ assert(c.size() == 6);
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ C::iterator i;
+ }
+ {
+ typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ const C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 7);
+ assert(c.size() == 6);
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ C::const_iterator i;
+ }
#endif
#if TEST_STD_VER > 11
- { // N3644 testing
- typedef std::unordered_multiset<int> C;
- C::iterator ii1{}, ii2{};
- C::iterator ii4 = ii1;
- C::const_iterator cii{};
- assert ( ii1 == ii2 );
- assert ( ii1 == ii4 );
+ { // N3644 testing
+ typedef std::unordered_multiset<int> C;
+ C::iterator ii1{}, ii2{};
+ C::iterator ii4 = ii1;
+ C::const_iterator cii{};
+ assert(ii1 == ii2);
+ assert(ii1 == ii4);
- assert (!(ii1 != ii2 ));
+ assert(!(ii1 != ii2));
- assert ( (ii1 == cii ));
- assert ( (cii == ii1 ));
- assert (!(ii1 != cii ));
- assert (!(cii != ii1 ));
- }
+ assert((ii1 == cii));
+ assert((cii == ii1));
+ assert(!(ii1 != cii));
+ assert(!(cii != ii1));
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multiset/load_factor.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/load_factor.pass.cpp
index 76c8132efe40864..d383ae74948d704 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/load_factor.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/load_factor.pass.cpp
@@ -22,55 +22,32 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<int> C;
- typedef int P;
- P a[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- const C c(std::begin(a), std::end(a));
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- }
- {
- typedef std::unordered_multiset<int> C;
- const C c;
- assert(c.load_factor() == 0);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<int> C;
+ typedef int P;
+ P a[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)};
+ const C c(std::begin(a), std::end(a));
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ }
+ {
+ typedef std::unordered_multiset<int> C;
+ const C c;
+ assert(c.load_factor() == 0);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multiset<int, std::hash<int>,
- std::equal_to<int>, min_allocator<int>> C;
- typedef int P;
- P a[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- const C c(std::begin(a), std::end(a));
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- }
- {
- typedef std::unordered_multiset<int, std::hash<int>,
- std::equal_to<int>, min_allocator<int>> C;
- const C c;
- assert(c.load_factor() == 0);
- }
+ {
+ typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)};
+ const C c(std::begin(a), std::end(a));
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ }
+ {
+ typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ const C c;
+ assert(c.load_factor() == 0);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multiset/local_iterators.compile.fail.cpp b/libcxx/test/std/containers/unord/unord.multiset/local_iterators.compile.fail.cpp
index d6f1a55fd49cbc4..b5b424f48873803 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/local_iterators.compile.fail.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/local_iterators.compile.fail.cpp
@@ -24,241 +24,208 @@
#include "test_macros.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<int> C;
- typedef int P;
- typedef C::local_iterator I;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- LIBCPP_ASSERT(c.bucket_count() == 7);
- C::size_type b = c.bucket(0);
- I i = c.begin(b);
- I j = c.end(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(1);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 2);
- assert(*i == 1);
- ++i;
- assert(*i == 1);
- *i = 2;
-
- b = c.bucket(2);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 2);
- assert(*i == 2);
- ++i;
- assert(*i == 2);
-
- b = c.bucket(3);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 3);
-
- b = c.bucket(4);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 4);
-
- b = c.bucket(5);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(6);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 0);
- }
- {
- typedef std::unordered_multiset<int> C;
- typedef int P;
- typedef C::const_local_iterator I;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- const C c(a, a + sizeof(a)/sizeof(a[0]));
- LIBCPP_ASSERT(c.bucket_count() == 7);
- C::size_type b = c.bucket(0);
- I i = c.begin(b);
- I j = c.end(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(1);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 2);
- assert(*i == 1);
- ++i;
- assert(*i == 1);
-
- b = c.bucket(2);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 2);
- assert(*i == 2);
- ++i;
- assert(*i == 2);
-
- b = c.bucket(3);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 3);
-
- b = c.bucket(4);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 4);
-
- b = c.bucket(5);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(6);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 0);
- }
- {
- typedef std::unordered_multiset<int> C;
- typedef int P;
- typedef C::const_local_iterator I;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- LIBCPP_ASSERT(c.bucket_count() == 7);
- C::size_type b = c.bucket(0);
- I i = c.cbegin(b);
- I j = c.cend(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(1);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 2);
- assert(*i == 1);
- ++i;
- assert(*i == 1);
-
- b = c.bucket(2);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 2);
- assert(*i == 2);
- ++i;
- assert(*i == 2);
-
- b = c.bucket(3);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 3);
-
- b = c.bucket(4);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 4);
-
- b = c.bucket(5);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(6);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 0);
- }
- {
- typedef std::unordered_multiset<int> C;
- typedef int P;
- typedef C::const_local_iterator I;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- const C c(a, a + sizeof(a)/sizeof(a[0]));
- LIBCPP_ASSERT(c.bucket_count() == 7);
- C::size_type b = c.bucket(0);
- I i = c.cbegin(b);
- I j = c.cend(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(1);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 2);
- assert(*i == 1);
- ++i;
- assert(*i == 1);
-
- b = c.bucket(2);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 2);
- assert(*i == 2);
- ++i;
- assert(*i == 2);
-
- b = c.bucket(3);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 3);
-
- b = c.bucket(4);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 4);
-
- b = c.bucket(5);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(6);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 0);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<int> C;
+ typedef int P;
+ typedef C::local_iterator I;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ C::size_type b = c.bucket(0);
+ I i = c.begin(b);
+ I j = c.end(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 2);
+ assert(*i == 1);
+ ++i;
+ assert(*i == 1);
+ *i = 2;
+
+ b = c.bucket(2);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 2);
+ assert(*i == 2);
+ ++i;
+ assert(*i == 2);
+
+ b = c.bucket(3);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 3);
+
+ b = c.bucket(4);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 4);
+
+ b = c.bucket(5);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(6);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 0);
+ }
+ {
+ typedef std::unordered_multiset<int> C;
+ typedef int P;
+ typedef C::const_local_iterator I;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ const C c(a, a + sizeof(a) / sizeof(a[0]));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ C::size_type b = c.bucket(0);
+ I i = c.begin(b);
+ I j = c.end(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 2);
+ assert(*i == 1);
+ ++i;
+ assert(*i == 1);
+
+ b = c.bucket(2);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 2);
+ assert(*i == 2);
+ ++i;
+ assert(*i == 2);
+
+ b = c.bucket(3);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 3);
+
+ b = c.bucket(4);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 4);
+
+ b = c.bucket(5);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(6);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 0);
+ }
+ {
+ typedef std::unordered_multiset<int> C;
+ typedef int P;
+ typedef C::const_local_iterator I;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ C::size_type b = c.bucket(0);
+ I i = c.cbegin(b);
+ I j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 2);
+ assert(*i == 1);
+ ++i;
+ assert(*i == 1);
+
+ b = c.bucket(2);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 2);
+ assert(*i == 2);
+ ++i;
+ assert(*i == 2);
+
+ b = c.bucket(3);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 3);
+
+ b = c.bucket(4);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 4);
+
+ b = c.bucket(5);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(6);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+ }
+ {
+ typedef std::unordered_multiset<int> C;
+ typedef int P;
+ typedef C::const_local_iterator I;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ const C c(a, a + sizeof(a) / sizeof(a[0]));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ C::size_type b = c.bucket(0);
+ I i = c.cbegin(b);
+ I j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 2);
+ assert(*i == 1);
+ ++i;
+ assert(*i == 1);
+
+ b = c.bucket(2);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 2);
+ assert(*i == 2);
+ ++i;
+ assert(*i == 2);
+
+ b = c.bucket(3);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 3);
+
+ b = c.bucket(4);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 4);
+
+ b = c.bucket(5);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(6);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/local_iterators.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/local_iterators.pass.cpp
index 5d4053272d17608..180b2deb56647dc 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/local_iterators.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/local_iterators.pass.cpp
@@ -25,477 +25,408 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<int> C;
- typedef int P;
- typedef C::local_iterator I;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 7);
- C::size_type b = c.bucket(0);
- I i = c.begin(b);
- I j = c.end(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(1);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 2);
- assert(*i == 1);
- ++i;
- assert(*i == 1);
-
- b = c.bucket(2);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 2);
- assert(*i == 2);
- ++i;
- assert(*i == 2);
-
- b = c.bucket(3);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 3);
-
- b = c.bucket(4);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 4);
-
- b = c.bucket(5);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(6);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 0);
- }
- {
- typedef std::unordered_multiset<int> C;
- typedef int P;
- typedef C::const_local_iterator I;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- const C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 7);
- C::size_type b = c.bucket(0);
- I i = c.begin(b);
- I j = c.end(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(1);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 2);
- assert(*i == 1);
- ++i;
- assert(*i == 1);
-
- b = c.bucket(2);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 2);
- assert(*i == 2);
- ++i;
- assert(*i == 2);
-
- b = c.bucket(3);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 3);
-
- b = c.bucket(4);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 4);
-
- b = c.bucket(5);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(6);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 0);
- }
- {
- typedef std::unordered_multiset<int> C;
- typedef int P;
- typedef C::const_local_iterator I;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 7);
- C::size_type b = c.bucket(0);
- I i = c.cbegin(b);
- I j = c.cend(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(1);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 2);
- assert(*i == 1);
- ++i;
- assert(*i == 1);
-
- b = c.bucket(2);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 2);
- assert(*i == 2);
- ++i;
- assert(*i == 2);
-
- b = c.bucket(3);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 3);
-
- b = c.bucket(4);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 4);
-
- b = c.bucket(5);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(6);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 0);
- }
- {
- typedef std::unordered_multiset<int> C;
- typedef int P;
- typedef C::const_local_iterator I;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- const C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 7);
- C::size_type b = c.bucket(0);
- I i = c.cbegin(b);
- I j = c.cend(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(1);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 2);
- assert(*i == 1);
- ++i;
- assert(*i == 1);
-
- b = c.bucket(2);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 2);
- assert(*i == 2);
- ++i;
- assert(*i == 2);
-
- b = c.bucket(3);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 3);
-
- b = c.bucket(4);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 4);
-
- b = c.bucket(5);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(6);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 0);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<int> C;
+ typedef int P;
+ typedef C::local_iterator I;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 7);
+ C::size_type b = c.bucket(0);
+ I i = c.begin(b);
+ I j = c.end(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 2);
+ assert(*i == 1);
+ ++i;
+ assert(*i == 1);
+
+ b = c.bucket(2);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 2);
+ assert(*i == 2);
+ ++i;
+ assert(*i == 2);
+
+ b = c.bucket(3);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 3);
+
+ b = c.bucket(4);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 4);
+
+ b = c.bucket(5);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(6);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 0);
+ }
+ {
+ typedef std::unordered_multiset<int> C;
+ typedef int P;
+ typedef C::const_local_iterator I;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ const C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 7);
+ C::size_type b = c.bucket(0);
+ I i = c.begin(b);
+ I j = c.end(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 2);
+ assert(*i == 1);
+ ++i;
+ assert(*i == 1);
+
+ b = c.bucket(2);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 2);
+ assert(*i == 2);
+ ++i;
+ assert(*i == 2);
+
+ b = c.bucket(3);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 3);
+
+ b = c.bucket(4);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 4);
+
+ b = c.bucket(5);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(6);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 0);
+ }
+ {
+ typedef std::unordered_multiset<int> C;
+ typedef int P;
+ typedef C::const_local_iterator I;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 7);
+ C::size_type b = c.bucket(0);
+ I i = c.cbegin(b);
+ I j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 2);
+ assert(*i == 1);
+ ++i;
+ assert(*i == 1);
+
+ b = c.bucket(2);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 2);
+ assert(*i == 2);
+ ++i;
+ assert(*i == 2);
+
+ b = c.bucket(3);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 3);
+
+ b = c.bucket(4);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 4);
+
+ b = c.bucket(5);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(6);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+ }
+ {
+ typedef std::unordered_multiset<int> C;
+ typedef int P;
+ typedef C::const_local_iterator I;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ const C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 7);
+ C::size_type b = c.bucket(0);
+ I i = c.cbegin(b);
+ I j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 2);
+ assert(*i == 1);
+ ++i;
+ assert(*i == 1);
+
+ b = c.bucket(2);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 2);
+ assert(*i == 2);
+ ++i;
+ assert(*i == 2);
+
+ b = c.bucket(3);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 3);
+
+ b = c.bucket(4);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 4);
+
+ b = c.bucket(5);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(6);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multiset<int, std::hash<int>,
- std::equal_to<int>, min_allocator<int>> C;
- typedef int P;
- typedef C::local_iterator I;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 7);
- C::size_type b = c.bucket(0);
- I i = c.begin(b);
- I j = c.end(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(1);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 2);
- assert(*i == 1);
- ++i;
- assert(*i == 1);
-
- b = c.bucket(2);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 2);
- assert(*i == 2);
- ++i;
- assert(*i == 2);
-
- b = c.bucket(3);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 3);
-
- b = c.bucket(4);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 4);
-
- b = c.bucket(5);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(6);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 0);
- }
- {
- typedef std::unordered_multiset<int, std::hash<int>,
- std::equal_to<int>, min_allocator<int>> C;
- typedef int P;
- typedef C::const_local_iterator I;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- const C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 7);
- C::size_type b = c.bucket(0);
- I i = c.begin(b);
- I j = c.end(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(1);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 2);
- assert(*i == 1);
- ++i;
- assert(*i == 1);
-
- b = c.bucket(2);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 2);
- assert(*i == 2);
- ++i;
- assert(*i == 2);
-
- b = c.bucket(3);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 3);
-
- b = c.bucket(4);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 4);
-
- b = c.bucket(5);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(6);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 0);
- }
- {
- typedef std::unordered_multiset<int, std::hash<int>,
- std::equal_to<int>, min_allocator<int>> C;
- typedef int P;
- typedef C::const_local_iterator I;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 7);
- C::size_type b = c.bucket(0);
- I i = c.cbegin(b);
- I j = c.cend(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(1);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 2);
- assert(*i == 1);
- ++i;
- assert(*i == 1);
-
- b = c.bucket(2);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 2);
- assert(*i == 2);
- ++i;
- assert(*i == 2);
-
- b = c.bucket(3);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 3);
-
- b = c.bucket(4);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 4);
-
- b = c.bucket(5);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(6);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 0);
- }
- {
- typedef std::unordered_multiset<int, std::hash<int>,
- std::equal_to<int>, min_allocator<int>> C;
- typedef int P;
- typedef C::const_local_iterator I;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- const C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 7);
- C::size_type b = c.bucket(0);
- I i = c.cbegin(b);
- I j = c.cend(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(1);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 2);
- assert(*i == 1);
- ++i;
- assert(*i == 1);
-
- b = c.bucket(2);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 2);
- assert(*i == 2);
- ++i;
- assert(*i == 2);
-
- b = c.bucket(3);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 3);
-
- b = c.bucket(4);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 4);
-
- b = c.bucket(5);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(6);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 0);
- }
+ {
+ typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ typedef C::local_iterator I;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 7);
+ C::size_type b = c.bucket(0);
+ I i = c.begin(b);
+ I j = c.end(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 2);
+ assert(*i == 1);
+ ++i;
+ assert(*i == 1);
+
+ b = c.bucket(2);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 2);
+ assert(*i == 2);
+ ++i;
+ assert(*i == 2);
+
+ b = c.bucket(3);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 3);
+
+ b = c.bucket(4);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 4);
+
+ b = c.bucket(5);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(6);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 0);
+ }
+ {
+ typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ typedef C::const_local_iterator I;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ const C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 7);
+ C::size_type b = c.bucket(0);
+ I i = c.begin(b);
+ I j = c.end(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 2);
+ assert(*i == 1);
+ ++i;
+ assert(*i == 1);
+
+ b = c.bucket(2);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 2);
+ assert(*i == 2);
+ ++i;
+ assert(*i == 2);
+
+ b = c.bucket(3);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 3);
+
+ b = c.bucket(4);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 4);
+
+ b = c.bucket(5);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(6);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 0);
+ }
+ {
+ typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ typedef C::const_local_iterator I;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 7);
+ C::size_type b = c.bucket(0);
+ I i = c.cbegin(b);
+ I j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 2);
+ assert(*i == 1);
+ ++i;
+ assert(*i == 1);
+
+ b = c.bucket(2);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 2);
+ assert(*i == 2);
+ ++i;
+ assert(*i == 2);
+
+ b = c.bucket(3);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 3);
+
+ b = c.bucket(4);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 4);
+
+ b = c.bucket(5);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(6);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+ }
+ {
+ typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ typedef C::const_local_iterator I;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ const C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 7);
+ C::size_type b = c.bucket(0);
+ I i = c.cbegin(b);
+ I j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 2);
+ assert(*i == 1);
+ ++i;
+ assert(*i == 1);
+
+ b = c.bucket(2);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 2);
+ assert(*i == 2);
+ ++i;
+ assert(*i == 2);
+
+ b = c.bucket(3);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 3);
+
+ b = c.bucket(4);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 4);
+
+ b = c.bucket(5);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(6);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multiset/max_bucket_count.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/max_bucket_count.pass.cpp
index 675101b4d33af7b..fd70bd9c247b5c4 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/max_bucket_count.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/max_bucket_count.pass.cpp
@@ -20,20 +20,18 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<int> C;
- const C c;
- assert(c.max_bucket_count() > 0);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<int> C;
+ const C c;
+ assert(c.max_bucket_count() > 0);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multiset<int, std::hash<int>,
- std::equal_to<int>, min_allocator<int>> C;
- const C c;
- assert(c.max_bucket_count() > 0);
- }
+ {
+ typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ const C c;
+ assert(c.max_bucket_count() > 0);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multiset/max_load_factor.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/max_load_factor.pass.cpp
index 4d6738ba4e8d10a..1391df7d9f52a60 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/max_load_factor.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/max_load_factor.pass.cpp
@@ -21,36 +21,33 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<int> C;
- const C c;
- assert(c.max_load_factor() == 1);
- }
- {
- typedef std::unordered_multiset<int> C;
- C c;
- assert(c.max_load_factor() == 1);
- c.max_load_factor(2.5);
- assert(c.max_load_factor() == 2.5);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<int> C;
+ const C c;
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef std::unordered_multiset<int> C;
+ C c;
+ assert(c.max_load_factor() == 1);
+ c.max_load_factor(2.5);
+ assert(c.max_load_factor() == 2.5);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multiset<int, std::hash<int>,
- std::equal_to<int>, min_allocator<int>> C;
- const C c;
- assert(c.max_load_factor() == 1);
- }
- {
- typedef std::unordered_multiset<int, std::hash<int>,
- std::equal_to<int>, min_allocator<int>> C;
- C c;
- assert(c.max_load_factor() == 1);
- c.max_load_factor(2.5);
- assert(c.max_load_factor() == 2.5);
- }
+ {
+ typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ const C c;
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ C c;
+ assert(c.max_load_factor() == 1);
+ c.max_load_factor(2.5);
+ assert(c.max_load_factor() == 2.5);
+ }
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/max_size.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/max_size.pass.cpp
index 47b165f230007b8..745dca9eb95a017 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/max_size.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/max_size.pass.cpp
@@ -20,36 +20,29 @@
#include "test_allocator.h"
#include "test_macros.h"
-int main(int, char**)
-{
- {
- typedef limited_allocator<int, 10> A;
- typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>,
- A>
- C;
- C c;
- assert(c.max_size() <= 10);
- LIBCPP_ASSERT(c.max_size() == 10);
- }
- {
- typedef limited_allocator<int, (std::size_t)-1> A;
- typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>,
- A>
- C;
- const C::size_type max_dist =
- static_cast<C::size_type>(std::numeric_limits<C::
diff erence_type>::max());
- C c;
- assert(c.max_size() <= max_dist);
- LIBCPP_ASSERT(c.max_size() == max_dist);
- }
- {
- typedef std::unordered_multiset<char> C;
- const C::size_type max_dist =
- static_cast<C::size_type>(std::numeric_limits<C::
diff erence_type>::max());
- C c;
- assert(c.max_size() <= max_dist);
- assert(c.max_size() <= alloc_max_size(c.get_allocator()));
- }
+int main(int, char**) {
+ {
+ typedef limited_allocator<int, 10> A;
+ typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, A> C;
+ C c;
+ assert(c.max_size() <= 10);
+ LIBCPP_ASSERT(c.max_size() == 10);
+ }
+ {
+ typedef limited_allocator<int, (std::size_t)-1> A;
+ typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, A> C;
+ const C::size_type max_dist = static_cast<C::size_type>(std::numeric_limits<C::
diff erence_type>::max());
+ C c;
+ assert(c.max_size() <= max_dist);
+ LIBCPP_ASSERT(c.max_size() == max_dist);
+ }
+ {
+ typedef std::unordered_multiset<char> C;
+ const C::size_type max_dist = static_cast<C::size_type>(std::numeric_limits<C::
diff erence_type>::max());
+ C c;
+ assert(c.max_size() <= max_dist);
+ assert(c.max_size() <= alloc_max_size(c.get_allocator()));
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/merge.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/merge.pass.cpp
index 00435d8df6a06aa..ce69111f9544f5d 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/merge.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/merge.pass.cpp
@@ -27,128 +27,116 @@
#include "Counter.h"
template <class Set>
-bool set_equal(const Set& set, Set other)
-{
- return set == other;
+bool set_equal(const Set& set, Set other) {
+ return set == other;
}
#ifndef TEST_HAS_NO_EXCEPTIONS
template <class T>
-struct throw_hasher
-{
- bool& should_throw_;
+struct throw_hasher {
+ bool& should_throw_;
- throw_hasher(bool& should_throw) : should_throw_(should_throw) {}
+ throw_hasher(bool& should_throw) : should_throw_(should_throw) {}
- std::size_t operator()(const T& p) const
- {
- if (should_throw_)
- throw 0;
- return std::hash<T>()(p);
- }
+ std::size_t operator()(const T& p) const {
+ if (should_throw_)
+ throw 0;
+ return std::hash<T>()(p);
+ }
};
#endif
-int main(int, char**)
-{
- {
- std::unordered_multiset<int> src{1, 3, 5};
- std::unordered_multiset<int> dst{2, 4, 5};
- dst.merge(src);
- assert(set_equal(src, {}));
- assert(set_equal(dst, {1, 2, 3, 4, 5, 5}));
- }
+int main(int, char**) {
+ {
+ std::unordered_multiset<int> src{1, 3, 5};
+ std::unordered_multiset<int> dst{2, 4, 5};
+ dst.merge(src);
+ assert(set_equal(src, {}));
+ assert(set_equal(dst, {1, 2, 3, 4, 5, 5}));
+ }
#ifndef TEST_HAS_NO_EXCEPTIONS
- {
- bool do_throw = false;
- typedef std::unordered_multiset<Counter<int>, throw_hasher<Counter<int>>> set_type;
- set_type src({1, 3, 5}, 0, throw_hasher<Counter<int>>(do_throw));
- set_type dst({2, 4, 5}, 0, throw_hasher<Counter<int>>(do_throw));
-
- assert(Counter_base::gConstructed == 6);
-
- do_throw = true;
- try
- {
- dst.merge(src);
- }
- catch (int)
- {
- do_throw = false;
- }
- assert(!do_throw);
- assert(set_equal(src, set_type({1, 3, 5}, 0, throw_hasher<Counter<int>>(do_throw))));
- assert(set_equal(dst, set_type({2, 4, 5}, 0, throw_hasher<Counter<int>>(do_throw))));
+ {
+ bool do_throw = false;
+ typedef std::unordered_multiset<Counter<int>, throw_hasher<Counter<int>>> set_type;
+ set_type src({1, 3, 5}, 0, throw_hasher<Counter<int>>(do_throw));
+ set_type dst({2, 4, 5}, 0, throw_hasher<Counter<int>>(do_throw));
+
+ assert(Counter_base::gConstructed == 6);
+
+ do_throw = true;
+ try {
+ dst.merge(src);
+ } catch (int) {
+ do_throw = false;
}
+ assert(!do_throw);
+ assert(set_equal(src, set_type({1, 3, 5}, 0, throw_hasher<Counter<int>>(do_throw))));
+ assert(set_equal(dst, set_type({2, 4, 5}, 0, throw_hasher<Counter<int>>(do_throw))));
+ }
#endif
- assert(Counter_base::gConstructed == 0);
- struct equal
- {
- equal() = default;
-
- bool operator()(const Counter<int>& lhs, const Counter<int>& rhs) const
- {
- return lhs == rhs;
- }
- };
- struct hasher
- {
- hasher() = default;
- std::size_t operator()(const Counter<int>& p) const { return std::hash<Counter<int>>()(p); }
- };
- {
- typedef std::unordered_multiset<Counter<int>, std::hash<Counter<int>>, std::equal_to<Counter<int>>> first_set_type;
- typedef std::unordered_multiset<Counter<int>, hasher, equal> second_set_type;
- typedef std::unordered_set<Counter<int>, hasher, equal> third_set_type;
+ assert(Counter_base::gConstructed == 0);
+ struct equal {
+ equal() = default;
+
+ bool operator()(const Counter<int>& lhs, const Counter<int>& rhs) const { return lhs == rhs; }
+ };
+ struct hasher {
+ hasher() = default;
+ std::size_t operator()(const Counter<int>& p) const { return std::hash<Counter<int>>()(p); }
+ };
+ {
+ typedef std::unordered_multiset<Counter<int>, std::hash<Counter<int>>, std::equal_to<Counter<int>>> first_set_type;
+ typedef std::unordered_multiset<Counter<int>, hasher, equal> second_set_type;
+ typedef std::unordered_set<Counter<int>, hasher, equal> third_set_type;
- {
- first_set_type first{1, 2, 3};
- second_set_type second{2, 3, 4};
- third_set_type third{1, 3};
+ {
+ first_set_type first{1, 2, 3};
+ second_set_type second{2, 3, 4};
+ third_set_type third{1, 3};
- assert(Counter_base::gConstructed == 8);
+ assert(Counter_base::gConstructed == 8);
- first.merge(second);
- first.merge(third);
+ first.merge(second);
+ first.merge(third);
- assert(set_equal(first, {1, 2, 3, 4, 2, 3, 1, 3}));
- assert(set_equal(second, {}));
- assert(set_equal(third, {}));
+ assert(set_equal(first, {1, 2, 3, 4, 2, 3, 1, 3}));
+ assert(set_equal(second, {}));
+ assert(set_equal(third, {}));
- assert(Counter_base::gConstructed == 8);
- }
- assert(Counter_base::gConstructed == 0);
- {
- first_set_type first{1, 2, 3};
- second_set_type second{2, 3, 4};
- third_set_type third{1, 3};
+ assert(Counter_base::gConstructed == 8);
+ }
+ assert(Counter_base::gConstructed == 0);
+ {
+ first_set_type first{1, 2, 3};
+ second_set_type second{2, 3, 4};
+ third_set_type third{1, 3};
- assert(Counter_base::gConstructed == 8);
+ assert(Counter_base::gConstructed == 8);
- first.merge(std::move(second));
- first.merge(std::move(third));
+ first.merge(std::move(second));
+ first.merge(std::move(third));
- assert(set_equal(first, {1, 2, 3, 4, 2, 3, 1, 3}));
- assert(set_equal(second, {}));
- assert(set_equal(third, {}));
+ assert(set_equal(first, {1, 2, 3, 4, 2, 3, 1, 3}));
+ assert(set_equal(second, {}));
+ assert(set_equal(third, {}));
- assert(Counter_base::gConstructed == 8);
- }
- assert(Counter_base::gConstructed == 0);
+ assert(Counter_base::gConstructed == 8);
+ }
+ assert(Counter_base::gConstructed == 0);
+ }
+ {
+ std::unordered_multiset<int> first;
+ {
+ std::unordered_multiset<int> second;
+ first.merge(second);
+ first.merge(std::move(second));
}
{
- std::unordered_multiset<int> first;
- {
- std::unordered_multiset<int> second;
- first.merge(second);
- first.merge(std::move(second));
- }
- {
- std::unordered_set<int> second;
- first.merge(second);
- first.merge(std::move(second));
- }
+ std::unordered_set<int> second;
+ first.merge(second);
+ first.merge(std::move(second));
}
- return 0;
+ }
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/range_concept_conformance.compile.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/range_concept_conformance.compile.pass.cpp
index 1a87404c835e183..1cb91e9e6b83c6d 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/range_concept_conformance.compile.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/range_concept_conformance.compile.pass.cpp
@@ -19,7 +19,6 @@
using range = std::unordered_multiset<int>;
-
static_assert(std::same_as<std::ranges::iterator_t<range>, range::iterator>);
static_assert(std::ranges::common_range<range>);
static_assert(std::ranges::forward_range<range>);
diff --git a/libcxx/test/std/containers/unord/unord.multiset/rehash.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/rehash.pass.cpp
index 1ef3bdcb99d0bdd..e6012eceae10bc5 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/rehash.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/rehash.pass.cpp
@@ -21,83 +21,63 @@
#include "min_allocator.h"
template <class C>
-void rehash_postcondition(const C& c, std::size_t n)
-{
- assert(c.bucket_count() >= c.size() / c.max_load_factor() && c.bucket_count() >= n);
+void rehash_postcondition(const C& c, std::size_t n) {
+ assert(c.bucket_count() >= c.size() / c.max_load_factor() && c.bucket_count() >= n);
}
template <class C>
-void test(const C& c)
-{
- assert(c.size() == 6);
- assert(c.count(1) == 2);
- assert(c.count(2) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
+void test(const C& c) {
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
}
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<int> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- test(c);
- assert(c.bucket_count() >= 7);
- c.rehash(3);
- rehash_postcondition(c, 3);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- test(c);
- c.max_load_factor(2);
- c.rehash(3);
- rehash_postcondition(c, 3);
- LIBCPP_ASSERT(c.bucket_count() == 3);
- test(c);
- c.rehash(31);
- rehash_postcondition(c, 31);
- LIBCPP_ASSERT(c.bucket_count() == 31);
- test(c);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<int> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ test(c);
+ assert(c.bucket_count() >= 7);
+ c.rehash(3);
+ rehash_postcondition(c, 3);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ test(c);
+ c.max_load_factor(2);
+ c.rehash(3);
+ rehash_postcondition(c, 3);
+ LIBCPP_ASSERT(c.bucket_count() == 3);
+ test(c);
+ c.rehash(31);
+ rehash_postcondition(c, 31);
+ LIBCPP_ASSERT(c.bucket_count() == 31);
+ test(c);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multiset<int, std::hash<int>,
- std::equal_to<int>, min_allocator<int>> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- test(c);
- assert(c.bucket_count() >= 7);
- c.rehash(3);
- rehash_postcondition(c, 3);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- test(c);
- c.max_load_factor(2);
- c.rehash(3);
- rehash_postcondition(c, 3);
- LIBCPP_ASSERT(c.bucket_count() == 3);
- test(c);
- c.rehash(31);
- rehash_postcondition(c, 31);
- LIBCPP_ASSERT(c.bucket_count() == 31);
- test(c);
- }
+ {
+ typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ test(c);
+ assert(c.bucket_count() >= 7);
+ c.rehash(3);
+ rehash_postcondition(c, 3);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ test(c);
+ c.max_load_factor(2);
+ c.rehash(3);
+ rehash_postcondition(c, 3);
+ LIBCPP_ASSERT(c.bucket_count() == 3);
+ test(c);
+ c.rehash(31);
+ rehash_postcondition(c, 31);
+ LIBCPP_ASSERT(c.bucket_count() == 31);
+ test(c);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multiset/reserve.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/reserve.pass.cpp
index 557a9241b4de1ee..4862ed2ec730d26 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/reserve.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/reserve.pass.cpp
@@ -21,88 +21,67 @@
#include "min_allocator.h"
template <class C>
-void test(const C& c)
-{
- assert(c.size() == 6);
- assert(c.count(1) == 2);
- assert(c.count(2) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
+void test(const C& c) {
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
}
void reserve_invariant(std::size_t n) // LWG #2156
{
- for (std::size_t i = 0; i < n; ++i)
- {
- std::unordered_multiset<std::size_t> c;
- c.reserve(n);
- std::size_t buckets = c.bucket_count();
- for (std::size_t j = 0; j < i; ++j)
- {
- c.insert(i);
- assert(buckets == c.bucket_count());
- }
+ for (std::size_t i = 0; i < n; ++i) {
+ std::unordered_multiset<std::size_t> c;
+ c.reserve(n);
+ std::size_t buckets = c.bucket_count();
+ for (std::size_t j = 0; j < i; ++j) {
+ c.insert(i);
+ assert(buckets == c.bucket_count());
}
+ }
}
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<int> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- test(c);
- assert(c.bucket_count() >= 7);
- c.reserve(3);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- test(c);
- c.max_load_factor(2);
- c.reserve(3);
- LIBCPP_ASSERT(c.bucket_count() == 3);
- test(c);
- c.reserve(31);
- assert(c.bucket_count() >= 16);
- test(c);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<int> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ test(c);
+ assert(c.bucket_count() >= 7);
+ c.reserve(3);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ test(c);
+ c.max_load_factor(2);
+ c.reserve(3);
+ LIBCPP_ASSERT(c.bucket_count() == 3);
+ test(c);
+ c.reserve(31);
+ assert(c.bucket_count() >= 16);
+ test(c);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multiset<int, std::hash<int>,
- std::equal_to<int>, min_allocator<int>> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- test(c);
- assert(c.bucket_count() >= 7);
- c.reserve(3);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- test(c);
- c.max_load_factor(2);
- c.reserve(3);
- LIBCPP_ASSERT(c.bucket_count() == 3);
- test(c);
- c.reserve(31);
- assert(c.bucket_count() >= 16);
- test(c);
- }
+ {
+ typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ test(c);
+ assert(c.bucket_count() >= 7);
+ c.reserve(3);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ test(c);
+ c.max_load_factor(2);
+ c.reserve(3);
+ LIBCPP_ASSERT(c.bucket_count() == 3);
+ test(c);
+ c.reserve(31);
+ assert(c.bucket_count() >= 16);
+ test(c);
+ }
#endif
- reserve_invariant(20);
+ reserve_invariant(20);
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/scary.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/scary.pass.cpp
index 9c9a16c7b043c2b..89f575bc2d7904f 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/scary.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/scary.pass.cpp
@@ -16,13 +16,12 @@
#include "test_macros.h"
-int main(int, char**)
-{
- typedef std::unordered_set<int> M1;
- typedef std::unordered_multiset<int> M2;
- M2::iterator i;
- M1::iterator j = i;
- ((void)j);
+int main(int, char**) {
+ typedef std::unordered_set<int> M1;
+ typedef std::unordered_multiset<int> M2;
+ M2::iterator i;
+ M1::iterator j = i;
+ ((void)j);
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/size.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/size.pass.cpp
index 12a4733ccb19229..59473fe085e0876 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/size.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/size.pass.cpp
@@ -18,9 +18,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::unordered_multiset<int> M;
M m;
ASSERT_NOEXCEPT(m.size());
@@ -37,9 +36,9 @@ int main(int, char**)
assert(m.size() == 1);
m.erase(m.begin());
assert(m.size() == 0);
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> M;
M m;
ASSERT_NOEXCEPT(m.size());
@@ -56,7 +55,7 @@ int main(int, char**)
assert(m.size() == 1);
m.erase(m.begin());
assert(m.size() == 0);
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multiset/swap_member.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/swap_member.pass.cpp
index 59acb07d7cf17ff..770cbfd21e40079 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/swap_member.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/swap_member.pass.cpp
@@ -24,547 +24,438 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef test_allocator<int> Alloc;
- typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
- C c1(0, Hash(1), Compare(1), Alloc(1, 1));
- C c2(0, Hash(2), Compare(2), Alloc(1, 2));
- c2.max_load_factor(2);
- c1.swap(c2);
-
- LIBCPP_ASSERT(c1.bucket_count() == 0);
- assert(c1.size() == 0);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator().get_id() == 1);
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- LIBCPP_ASSERT(c2.bucket_count() == 0);
- assert(c2.size() == 0);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator().get_id() == 2);
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef test_allocator<int> Alloc;
- typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
- typedef int P;
- P a2[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- C c1(0, Hash(1), Compare(1), Alloc(1, 1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
- c2.max_load_factor(2);
- c1.swap(c2);
-
- assert(c1.bucket_count() >= 8);
- assert(c1.size() == 8);
- assert(*c1.find(10) == 10);
- assert(*c1.find(20) == 20);
- assert(*c1.find(30) == 30);
- assert(*c1.find(40) == 40);
- assert(*c1.find(50) == 50);
- assert(*c1.find(60) == 60);
- assert(*c1.find(70) == 70);
- assert(*c1.find(80) == 80);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator().get_id() == 1);
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- LIBCPP_ASSERT(c2.bucket_count() == 0);
- assert(c2.size() == 0);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator().get_id() == 2);
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef test_allocator<int> Alloc;
- typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
- typedef int P;
- P a1[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
- C c2(0, Hash(2), Compare(2), Alloc(1, 2));
- c2.max_load_factor(2);
- c1.swap(c2);
-
- LIBCPP_ASSERT(c1.bucket_count() == 0);
- assert(c1.size() == 0);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator().get_id() == 1);
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- assert(c2.bucket_count() >= 6);
- assert(c2.size() == 6);
- assert(c2.count(1) == 2);
- assert(c2.count(2) == 2);
- assert(c2.count(3) == 1);
- assert(c2.count(4) == 1);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator().get_id() == 2);
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef test_allocator<int> Alloc;
- typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
- typedef int P;
- P a1[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- P a2[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
- c2.max_load_factor(2);
- c1.swap(c2);
-
- assert(c1.bucket_count() >= 8);
- assert(c1.size() == 8);
- assert(*c1.find(10) == 10);
- assert(*c1.find(20) == 20);
- assert(*c1.find(30) == 30);
- assert(*c1.find(40) == 40);
- assert(*c1.find(50) == 50);
- assert(*c1.find(60) == 60);
- assert(*c1.find(70) == 70);
- assert(*c1.find(80) == 80);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator().get_id() == 1);
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- assert(c2.bucket_count() >= 6);
- assert(c2.size() == 6);
- assert(c2.count(1) == 2);
- assert(c2.count(2) == 2);
- assert(c2.count(3) == 1);
- assert(c2.count(4) == 1);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator().get_id() == 2);
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
-
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef other_allocator<int> Alloc;
- typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
- C c1(0, Hash(1), Compare(1), Alloc(1));
- C c2(0, Hash(2), Compare(2), Alloc(2));
- c2.max_load_factor(2);
- c1.swap(c2);
-
- LIBCPP_ASSERT(c1.bucket_count() == 0);
- assert(c1.size() == 0);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(2));
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- LIBCPP_ASSERT(c2.bucket_count() == 0);
- assert(c2.size() == 0);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(1));
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef other_allocator<int> Alloc;
- typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
- typedef int P;
- P a2[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- C c1(0, Hash(1), Compare(1), Alloc(1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
- c2.max_load_factor(2);
- c1.swap(c2);
-
- assert(c1.bucket_count() >= 8);
- assert(c1.size() == 8);
- assert(*c1.find(10) == 10);
- assert(*c1.find(20) == 20);
- assert(*c1.find(30) == 30);
- assert(*c1.find(40) == 40);
- assert(*c1.find(50) == 50);
- assert(*c1.find(60) == 60);
- assert(*c1.find(70) == 70);
- assert(*c1.find(80) == 80);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(2));
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- LIBCPP_ASSERT(c2.bucket_count() == 0);
- assert(c2.size() == 0);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(1));
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef other_allocator<int> Alloc;
- typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
- typedef int P;
- P a1[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
- C c2(0, Hash(2), Compare(2), Alloc(2));
- c2.max_load_factor(2);
- c1.swap(c2);
-
- LIBCPP_ASSERT(c1.bucket_count() == 0);
- assert(c1.size() == 0);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(2));
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- assert(c2.bucket_count() >= 6);
- assert(c2.size() == 6);
- assert(c2.count(1) == 2);
- assert(c2.count(2) == 2);
- assert(c2.count(3) == 1);
- assert(c2.count(4) == 1);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(1));
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef other_allocator<int> Alloc;
- typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
- typedef int P;
- P a1[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- P a2[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
- c2.max_load_factor(2);
- c1.swap(c2);
-
- assert(c1.bucket_count() >= 8);
- assert(c1.size() == 8);
- assert(*c1.find(10) == 10);
- assert(*c1.find(20) == 20);
- assert(*c1.find(30) == 30);
- assert(*c1.find(40) == 40);
- assert(*c1.find(50) == 50);
- assert(*c1.find(60) == 60);
- assert(*c1.find(70) == 70);
- assert(*c1.find(80) == 80);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(2));
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- assert(c2.bucket_count() >= 6);
- assert(c2.size() == 6);
- assert(c2.count(1) == 2);
- assert(c2.count(2) == 2);
- assert(c2.count(3) == 1);
- assert(c2.count(4) == 1);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(1));
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef test_allocator<int> Alloc;
+ typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
+ C c1(0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(0, Hash(2), Compare(2), Alloc(1, 2));
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ LIBCPP_ASSERT(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ LIBCPP_ASSERT(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef test_allocator<int> Alloc;
+ typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ P a2[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)};
+ C c1(0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ assert(c1.bucket_count() >= 8);
+ assert(c1.size() == 8);
+ assert(*c1.find(10) == 10);
+ assert(*c1.find(20) == 20);
+ assert(*c1.find(30) == 30);
+ assert(*c1.find(40) == 40);
+ assert(*c1.find(50) == 50);
+ assert(*c1.find(60) == 60);
+ assert(*c1.find(70) == 70);
+ assert(*c1.find(80) == 80);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ LIBCPP_ASSERT(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef test_allocator<int> Alloc;
+ typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ P a1[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(0, Hash(2), Compare(2), Alloc(1, 2));
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ LIBCPP_ASSERT(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 6);
+ assert(c2.size() == 6);
+ assert(c2.count(1) == 2);
+ assert(c2.count(2) == 2);
+ assert(c2.count(3) == 1);
+ assert(c2.count(4) == 1);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef test_allocator<int> Alloc;
+ typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ P a1[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ P a2[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)};
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ assert(c1.bucket_count() >= 8);
+ assert(c1.size() == 8);
+ assert(*c1.find(10) == 10);
+ assert(*c1.find(20) == 20);
+ assert(*c1.find(30) == 30);
+ assert(*c1.find(40) == 40);
+ assert(*c1.find(50) == 50);
+ assert(*c1.find(60) == 60);
+ assert(*c1.find(70) == 70);
+ assert(*c1.find(80) == 80);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 6);
+ assert(c2.size() == 6);
+ assert(c2.count(1) == 2);
+ assert(c2.count(2) == 2);
+ assert(c2.count(3) == 1);
+ assert(c2.count(4) == 1);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef other_allocator<int> Alloc;
+ typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
+ C c1(0, Hash(1), Compare(1), Alloc(1));
+ C c2(0, Hash(2), Compare(2), Alloc(2));
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ LIBCPP_ASSERT(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc(2));
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ LIBCPP_ASSERT(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc(1));
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef other_allocator<int> Alloc;
+ typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ P a2[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)};
+ C c1(0, Hash(1), Compare(1), Alloc(1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ assert(c1.bucket_count() >= 8);
+ assert(c1.size() == 8);
+ assert(*c1.find(10) == 10);
+ assert(*c1.find(20) == 20);
+ assert(*c1.find(30) == 30);
+ assert(*c1.find(40) == 40);
+ assert(*c1.find(50) == 50);
+ assert(*c1.find(60) == 60);
+ assert(*c1.find(70) == 70);
+ assert(*c1.find(80) == 80);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc(2));
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ LIBCPP_ASSERT(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc(1));
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef other_allocator<int> Alloc;
+ typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ P a1[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
+ C c2(0, Hash(2), Compare(2), Alloc(2));
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ LIBCPP_ASSERT(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc(2));
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 6);
+ assert(c2.size() == 6);
+ assert(c2.count(1) == 2);
+ assert(c2.count(2) == 2);
+ assert(c2.count(3) == 1);
+ assert(c2.count(4) == 1);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc(1));
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef other_allocator<int> Alloc;
+ typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ P a1[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ P a2[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)};
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ assert(c1.bucket_count() >= 8);
+ assert(c1.size() == 8);
+ assert(*c1.find(10) == 10);
+ assert(*c1.find(20) == 20);
+ assert(*c1.find(30) == 30);
+ assert(*c1.find(40) == 40);
+ assert(*c1.find(50) == 50);
+ assert(*c1.find(60) == 60);
+ assert(*c1.find(70) == 70);
+ assert(*c1.find(80) == 80);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc(2));
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 6);
+ assert(c2.size() == 6);
+ assert(c2.count(1) == 2);
+ assert(c2.count(2) == 2);
+ assert(c2.count(3) == 1);
+ assert(c2.count(4) == 1);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc(1));
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef min_allocator<int> Alloc;
- typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
- C c1(0, Hash(1), Compare(1), Alloc());
- C c2(0, Hash(2), Compare(2), Alloc());
- c2.max_load_factor(2);
- c1.swap(c2);
-
- LIBCPP_ASSERT(c1.bucket_count() == 0);
- assert(c1.size() == 0);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- LIBCPP_ASSERT(c2.bucket_count() == 0);
- assert(c2.size() == 0);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef min_allocator<int> Alloc;
- typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
- typedef int P;
- P a2[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- C c1(0, Hash(1), Compare(1), Alloc());
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
- c2.max_load_factor(2);
- c1.swap(c2);
-
- assert(c1.bucket_count() >= 8);
- assert(c1.size() == 8);
- assert(*c1.find(10) == 10);
- assert(*c1.find(20) == 20);
- assert(*c1.find(30) == 30);
- assert(*c1.find(40) == 40);
- assert(*c1.find(50) == 50);
- assert(*c1.find(60) == 60);
- assert(*c1.find(70) == 70);
- assert(*c1.find(80) == 80);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- LIBCPP_ASSERT(c2.bucket_count() == 0);
- assert(c2.size() == 0);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef min_allocator<int> Alloc;
- typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
- typedef int P;
- P a1[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
- C c2(0, Hash(2), Compare(2), Alloc());
- c2.max_load_factor(2);
- c1.swap(c2);
-
- LIBCPP_ASSERT(c1.bucket_count() == 0);
- assert(c1.size() == 0);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- assert(c2.bucket_count() >= 6);
- assert(c2.size() == 6);
- assert(c2.count(1) == 2);
- assert(c2.count(2) == 2);
- assert(c2.count(3) == 1);
- assert(c2.count(4) == 1);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef min_allocator<int> Alloc;
- typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
- typedef int P;
- P a1[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- P a2[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
- c2.max_load_factor(2);
- c1.swap(c2);
-
- assert(c1.bucket_count() >= 8);
- assert(c1.size() == 8);
- assert(*c1.find(10) == 10);
- assert(*c1.find(20) == 20);
- assert(*c1.find(30) == 30);
- assert(*c1.find(40) == 40);
- assert(*c1.find(50) == 50);
- assert(*c1.find(60) == 60);
- assert(*c1.find(70) == 70);
- assert(*c1.find(80) == 80);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- assert(c2.bucket_count() >= 6);
- assert(c2.size() == 6);
- assert(c2.count(1) == 2);
- assert(c2.count(2) == 2);
- assert(c2.count(3) == 1);
- assert(c2.count(4) == 1);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef min_allocator<int> Alloc;
+ typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
+ C c1(0, Hash(1), Compare(1), Alloc());
+ C c2(0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ LIBCPP_ASSERT(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ LIBCPP_ASSERT(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef min_allocator<int> Alloc;
+ typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ P a2[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)};
+ C c1(0, Hash(1), Compare(1), Alloc());
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ assert(c1.bucket_count() >= 8);
+ assert(c1.size() == 8);
+ assert(*c1.find(10) == 10);
+ assert(*c1.find(20) == 20);
+ assert(*c1.find(30) == 30);
+ assert(*c1.find(40) == 40);
+ assert(*c1.find(50) == 50);
+ assert(*c1.find(60) == 60);
+ assert(*c1.find(70) == 70);
+ assert(*c1.find(80) == 80);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ LIBCPP_ASSERT(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef min_allocator<int> Alloc;
+ typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ P a1[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
+ C c2(0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ LIBCPP_ASSERT(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 6);
+ assert(c2.size() == 6);
+ assert(c2.count(1) == 2);
+ assert(c2.count(2) == 2);
+ assert(c2.count(3) == 1);
+ assert(c2.count(4) == 1);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef min_allocator<int> Alloc;
+ typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ P a1[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ P a2[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)};
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ assert(c1.bucket_count() >= 8);
+ assert(c1.size() == 8);
+ assert(*c1.find(10) == 10);
+ assert(*c1.find(20) == 20);
+ assert(*c1.find(30) == 30);
+ assert(*c1.find(40) == 40);
+ assert(*c1.find(50) == 50);
+ assert(*c1.find(60) == 60);
+ assert(*c1.find(70) == 70);
+ assert(*c1.find(80) == 80);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 6);
+ assert(c2.size() == 6);
+ assert(c2.count(1) == 2);
+ assert(c2.count(2) == 2);
+ assert(c2.count(3) == 1);
+ assert(c2.count(4) == 1);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multiset/types.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/types.pass.cpp
index 2c229a8680d50be..4e5b0e0ce69810d 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/types.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/types.pass.cpp
@@ -32,39 +32,37 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<short> C;
- static_assert((std::is_same<C::value_type, short>::value), "");
- static_assert((std::is_same<C::key_type, short>::value), "");
- static_assert((std::is_same<C::hasher, std::hash<C::key_type> >::value), "");
- static_assert((std::is_same<C::key_equal, std::equal_to<C::key_type> >::value), "");
- static_assert((std::is_same<C::allocator_type, std::allocator<C::value_type> >::value), "");
- static_assert((std::is_same<C::reference, C::value_type&>::value), "");
- static_assert((std::is_same<C::const_reference, const C::value_type&>::value), "");
- static_assert((std::is_same<C::pointer, C::value_type*>::value), "");
- static_assert((std::is_same<C::const_pointer, const C::value_type*>::value), "");
- static_assert((std::is_same<C::size_type, std::size_t>::value), "");
- static_assert((std::is_same<C::
diff erence_type, std::ptr
diff _t>::value), "");
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<short> C;
+ static_assert((std::is_same<C::value_type, short>::value), "");
+ static_assert((std::is_same<C::key_type, short>::value), "");
+ static_assert((std::is_same<C::hasher, std::hash<C::key_type> >::value), "");
+ static_assert((std::is_same<C::key_equal, std::equal_to<C::key_type> >::value), "");
+ static_assert((std::is_same<C::allocator_type, std::allocator<C::value_type> >::value), "");
+ static_assert((std::is_same<C::reference, C::value_type&>::value), "");
+ static_assert((std::is_same<C::const_reference, const C::value_type&>::value), "");
+ static_assert((std::is_same<C::pointer, C::value_type*>::value), "");
+ static_assert((std::is_same<C::const_pointer, const C::value_type*>::value), "");
+ static_assert((std::is_same<C::size_type, std::size_t>::value), "");
+ static_assert((std::is_same<C::
diff erence_type, std::ptr
diff _t>::value), "");
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multiset<short, std::hash<short>,
- std::equal_to<short>, min_allocator<short>> C;
- static_assert((std::is_same<C::value_type, short>::value), "");
- static_assert((std::is_same<C::key_type, short>::value), "");
- static_assert((std::is_same<C::hasher, std::hash<C::key_type> >::value), "");
- static_assert((std::is_same<C::key_equal, std::equal_to<C::key_type> >::value), "");
- static_assert((std::is_same<C::allocator_type, min_allocator<C::value_type> >::value), "");
- static_assert((std::is_same<C::reference, C::value_type&>::value), "");
- static_assert((std::is_same<C::const_reference, const C::value_type&>::value), "");
- static_assert((std::is_same<C::pointer, min_pointer<C::value_type>>::value), "");
- static_assert((std::is_same<C::const_pointer, min_pointer<const C::value_type>>::value), "");
+ {
+ typedef std::unordered_multiset<short, std::hash<short>, std::equal_to<short>, min_allocator<short>> C;
+ static_assert((std::is_same<C::value_type, short>::value), "");
+ static_assert((std::is_same<C::key_type, short>::value), "");
+ static_assert((std::is_same<C::hasher, std::hash<C::key_type> >::value), "");
+ static_assert((std::is_same<C::key_equal, std::equal_to<C::key_type> >::value), "");
+ static_assert((std::is_same<C::allocator_type, min_allocator<C::value_type> >::value), "");
+ static_assert((std::is_same<C::reference, C::value_type&>::value), "");
+ static_assert((std::is_same<C::const_reference, const C::value_type&>::value), "");
+ static_assert((std::is_same<C::pointer, min_pointer<C::value_type>>::value), "");
+ static_assert((std::is_same<C::const_pointer, min_pointer<const C::value_type>>::value), "");
// min_allocator doesn't have a size_type, so one gets synthesized
- static_assert((std::is_same<C::size_type, std::make_unsigned<C::
diff erence_type>::type>::value), "");
- static_assert((std::is_same<C::
diff erence_type, std::ptr
diff _t>::value), "");
- }
+ static_assert((std::is_same<C::size_type, std::make_unsigned<C::
diff erence_type>::type>::value), "");
+ static_assert((std::is_same<C::
diff erence_type, std::ptr
diff _t>::value), "");
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/allocator.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/allocator.pass.cpp
index bb2a9bf1a58e120..73b22c0a81f0ed9 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/allocator.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/allocator.pass.cpp
@@ -24,87 +24,86 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- test_allocator<NotConstructible>
- > C;
- C c(test_allocator<NotConstructible>(10));
- LIBCPP_ASSERT(c.bucket_count() == 0);
- assert(c.hash_function() == test_hash<NotConstructible>());
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() == test_allocator<NotConstructible>(10));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ test_allocator<NotConstructible> >
+ C;
+ C c(test_allocator<NotConstructible>(10));
+ LIBCPP_ASSERT(c.bucket_count() == 0);
+ assert(c.hash_function() == test_hash<NotConstructible>());
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == test_allocator<NotConstructible>(10));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multiset<NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- min_allocator<NotConstructible>
- > C;
- C c(min_allocator<NotConstructible>{});
- LIBCPP_ASSERT(c.bucket_count() == 0);
- assert(c.hash_function() == test_hash<NotConstructible>());
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() == min_allocator<NotConstructible>());
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
-#if TEST_STD_VER > 11
- {
- typedef NotConstructible T;
- typedef test_hash<T> HF;
- typedef test_equal_to<T> Comp;
- typedef test_allocator<T> A;
- typedef std::unordered_multiset<T, HF, Comp, A> C;
+ {
+ typedef std::unordered_multiset<NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ min_allocator<NotConstructible> >
+ C;
+ C c(min_allocator<NotConstructible>{});
+ LIBCPP_ASSERT(c.bucket_count() == 0);
+ assert(c.hash_function() == test_hash<NotConstructible>());
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == min_allocator<NotConstructible>());
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+# if TEST_STD_VER > 11
+ {
+ typedef NotConstructible T;
+ typedef test_hash<T> HF;
+ typedef test_equal_to<T> Comp;
+ typedef test_allocator<T> A;
+ typedef std::unordered_multiset<T, HF, Comp, A> C;
- A a(43);
- C c(3, a);
- LIBCPP_ASSERT(c.bucket_count() == 3);
- assert(c.hash_function() == HF());
- assert(c.key_eq() == Comp ());
- assert(c.get_allocator() == a);
- assert(!(c.get_allocator() == A()));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef NotConstructible T;
- typedef test_hash<T> HF;
- typedef test_equal_to<T> Comp;
- typedef test_allocator<T> A;
- typedef std::unordered_multiset<T, HF, Comp, A> C;
+ A a(43);
+ C c(3, a);
+ LIBCPP_ASSERT(c.bucket_count() == 3);
+ assert(c.hash_function() == HF());
+ assert(c.key_eq() == Comp());
+ assert(c.get_allocator() == a);
+ assert(!(c.get_allocator() == A()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef NotConstructible T;
+ typedef test_hash<T> HF;
+ typedef test_equal_to<T> Comp;
+ typedef test_allocator<T> A;
+ typedef std::unordered_multiset<T, HF, Comp, A> C;
- HF hf(42);
- A a(43);
- C c(4, hf, a);
- LIBCPP_ASSERT(c.bucket_count() == 4);
- assert(c.hash_function() == hf);
- assert(!(c.hash_function() == HF()));
- assert(c.key_eq() == Comp ());
- assert(c.get_allocator() == a);
- assert(!(c.get_allocator() == A()));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
-#endif
+ HF hf(42);
+ A a(43);
+ C c(4, hf, a);
+ LIBCPP_ASSERT(c.bucket_count() == 4);
+ assert(c.hash_function() == hf);
+ assert(!(c.hash_function() == HF()));
+ assert(c.key_eq() == Comp());
+ assert(c.get_allocator() == a);
+ assert(!(c.get_allocator() == A()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+# endif
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_copy.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_copy.pass.cpp
index 91aa0f4d390cd01..248d446b92eb7fd 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_copy.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_copy.pass.cpp
@@ -28,163 +28,88 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef test_allocator<int> A;
- typedef std::unordered_multiset<int,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A(10)
- );
- C c(a, a + 2,
- 7,
- test_hash<int>(2),
- test_equal_to<int>(3),
- A(4)
- );
- c = c0;
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- CheckConsecutiveValues<C::const_iterator>(c.find(1), c.end(), 1, 2);
- CheckConsecutiveValues<C::const_iterator>(c.find(2), c.end(), 2, 2);
- CheckConsecutiveValues<C::const_iterator>(c.find(3), c.end(), 3, 1);
- CheckConsecutiveValues<C::const_iterator>(c.find(4), c.end(), 4, 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == A(4));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef std::unordered_multiset<int> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- C *p = &c;
- c = *p;
+int main(int, char**) {
+ {
+ typedef test_allocator<int> A;
+ typedef std::unordered_multiset<int, test_hash<int>, test_equal_to<int>, A > C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), A(10));
+ C c(a, a + 2, 7, test_hash<int>(2), test_equal_to<int>(3), A(4));
+ c = c0;
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ CheckConsecutiveValues<C::const_iterator>(c.find(1), c.end(), 1, 2);
+ CheckConsecutiveValues<C::const_iterator>(c.find(2), c.end(), 2, 2);
+ CheckConsecutiveValues<C::const_iterator>(c.find(3), c.end(), 3, 1);
+ CheckConsecutiveValues<C::const_iterator>(c.find(4), c.end(), 4, 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == A(4));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef std::unordered_multiset<int> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ C* p = &c;
+ c = *p;
- assert(c.size() == 6);
- assert(std::is_permutation(c.begin(), c.end(), a));
- }
- {
- typedef other_allocator<int> A;
- typedef std::unordered_multiset<int,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A(10)
- );
- C c(a, a + 2,
- 7,
- test_hash<int>(2),
- test_equal_to<int>(3),
- A(4)
- );
- c = c0;
- assert(c.bucket_count() >= 7);
- assert(c.size() == 6);
- CheckConsecutiveValues<C::const_iterator>(c.find(1), c.end(), 1, 2);
- CheckConsecutiveValues<C::const_iterator>(c.find(2), c.end(), 2, 2);
- CheckConsecutiveValues<C::const_iterator>(c.find(3), c.end(), 3, 1);
- CheckConsecutiveValues<C::const_iterator>(c.find(4), c.end(), 4, 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == A(10));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+ assert(c.size() == 6);
+ assert(std::is_permutation(c.begin(), c.end(), a));
+ }
+ {
+ typedef other_allocator<int> A;
+ typedef std::unordered_multiset<int, test_hash<int>, test_equal_to<int>, A > C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), A(10));
+ C c(a, a + 2, 7, test_hash<int>(2), test_equal_to<int>(3), A(4));
+ c = c0;
+ assert(c.bucket_count() >= 7);
+ assert(c.size() == 6);
+ CheckConsecutiveValues<C::const_iterator>(c.find(1), c.end(), 1, 2);
+ CheckConsecutiveValues<C::const_iterator>(c.find(2), c.end(), 2, 2);
+ CheckConsecutiveValues<C::const_iterator>(c.find(3), c.end(), 3, 1);
+ CheckConsecutiveValues<C::const_iterator>(c.find(4), c.end(), 4, 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == A(10));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef min_allocator<int> A;
- typedef std::unordered_multiset<int,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A()
- );
- C c(a, a + 2,
- 7,
- test_hash<int>(2),
- test_equal_to<int>(3),
- A()
- );
- c = c0;
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- CheckConsecutiveValues<C::const_iterator>(c.find(1), c.end(), 1, 2);
- CheckConsecutiveValues<C::const_iterator>(c.find(2), c.end(), 2, 2);
- CheckConsecutiveValues<C::const_iterator>(c.find(3), c.end(), 3, 1);
- CheckConsecutiveValues<C::const_iterator>(c.find(4), c.end(), 4, 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == A());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+ {
+ typedef min_allocator<int> A;
+ typedef std::unordered_multiset<int, test_hash<int>, test_equal_to<int>, A > C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), A());
+ C c(a, a + 2, 7, test_hash<int>(2), test_equal_to<int>(3), A());
+ c = c0;
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ CheckConsecutiveValues<C::const_iterator>(c.find(1), c.end(), 1, 2);
+ CheckConsecutiveValues<C::const_iterator>(c.find(2), c.end(), 2, 2);
+ CheckConsecutiveValues<C::const_iterator>(c.find(3), c.end(), 3, 1);
+ CheckConsecutiveValues<C::const_iterator>(c.find(4), c.end(), 4, 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == A());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_init.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_init.pass.cpp
index b27e535cf16cede..840991a6095b1b6 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_init.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_init.pass.cpp
@@ -28,72 +28,41 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef test_allocator<int> A;
- typedef std::unordered_multiset<int,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- typedef int P;
- C c = {
- P(4),
- P(1),
- P(2)
- };
- c = {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- assert(c.bucket_count() >= 7);
- assert(c.size() == 6);
- assert(c.count(1) == 2);
- assert(c.count(2) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef min_allocator<int> A;
- typedef std::unordered_multiset<int,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- typedef int P;
- C c = {
- P(4),
- P(1),
- P(2)
- };
- c = {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- assert(c.bucket_count() >= 7);
- assert(c.size() == 6);
- assert(c.count(1) == 2);
- assert(c.count(2) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef test_allocator<int> A;
+ typedef std::unordered_multiset<int, test_hash<int>, test_equal_to<int>, A > C;
+ typedef int P;
+ C c = {P(4), P(1), P(2)};
+ c = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ assert(c.bucket_count() >= 7);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef min_allocator<int> A;
+ typedef std::unordered_multiset<int, test_hash<int>, test_equal_to<int>, A > C;
+ typedef int P;
+ C c = {P(4), P(1), P(2)};
+ c = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ assert(c.bucket_count() >= 7);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp
index 32575f4eec23ea5..c07d02ebb067afe 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp
@@ -29,241 +29,130 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef test_allocator<int> A;
- typedef std::unordered_multiset<int,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A(10)
- );
- C c(a, a + 2,
- 7,
- test_hash<int>(2),
- test_equal_to<int>(3),
- A(4)
- );
- c = std::move(c0);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- CheckConsecutiveValues<C::const_iterator>(c.find(1), c.end(), 1, 2);
- CheckConsecutiveValues<C::const_iterator>(c.find(2), c.end(), 2, 2);
- CheckConsecutiveValues<C::const_iterator>(c.find(3), c.end(), 3, 1);
- CheckConsecutiveValues<C::const_iterator>(c.find(4), c.end(), 4, 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == A(4));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef test_allocator<int> A;
- typedef std::unordered_multiset<int,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A(10)
- );
- C c(a, a + 2,
- 7,
- test_hash<int>(2),
- test_equal_to<int>(3),
- A(10)
- );
- C::iterator it0 = c0.begin();
- c = std::move(c0);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- assert(c.count(1) == 2);
- assert(c.count(2) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == A(10));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- assert(it0 == c.begin()); // Iterators remain valid
- }
- {
- typedef other_allocator<int> A;
- typedef std::unordered_multiset<int,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A(10)
- );
- C c(a, a + 2,
- 7,
- test_hash<int>(2),
- test_equal_to<int>(3),
- A(4)
- );
- C::iterator it0 = c0.begin();
- c = std::move(c0);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- assert(c.count(1) == 2);
- assert(c.count(2) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == A(10));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- assert(it0 == c.begin()); // Iterators remain valid
- }
- {
- typedef test_allocator<int> A;
- typedef std::unordered_multiset<int,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A()
- );
- C c(a, a + 2,
- 7,
- test_hash<int>(2),
- test_equal_to<int>(3),
- A()
- );
- C::iterator it0 = c0.begin();
- c = std::move(c0);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- assert(c.count(1) == 2);
- assert(c.count(2) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == A());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- assert(it0 == c.begin()); // Iterators remain valid
- }
- {
- typedef min_allocator<int> A;
- typedef std::unordered_multiset<int,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A()
- );
- C c(a, a + 2,
- 7,
- test_hash<int>(2),
- test_equal_to<int>(3),
- A()
- );
- C::iterator it0 = c0.begin();
- c = std::move(c0);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- assert(c.count(1) == 2);
- assert(c.count(2) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == A());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- assert(it0 == c.begin()); // Iterators remain valid
- }
+int main(int, char**) {
+ {
+ typedef test_allocator<int> A;
+ typedef std::unordered_multiset<int, test_hash<int>, test_equal_to<int>, A > C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), A(10));
+ C c(a, a + 2, 7, test_hash<int>(2), test_equal_to<int>(3), A(4));
+ c = std::move(c0);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ CheckConsecutiveValues<C::const_iterator>(c.find(1), c.end(), 1, 2);
+ CheckConsecutiveValues<C::const_iterator>(c.find(2), c.end(), 2, 2);
+ CheckConsecutiveValues<C::const_iterator>(c.find(3), c.end(), 3, 1);
+ CheckConsecutiveValues<C::const_iterator>(c.find(4), c.end(), 4, 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == A(4));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef test_allocator<int> A;
+ typedef std::unordered_multiset<int, test_hash<int>, test_equal_to<int>, A > C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), A(10));
+ C c(a, a + 2, 7, test_hash<int>(2), test_equal_to<int>(3), A(10));
+ C::iterator it0 = c0.begin();
+ c = std::move(c0);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == A(10));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(it0 == c.begin()); // Iterators remain valid
+ }
+ {
+ typedef other_allocator<int> A;
+ typedef std::unordered_multiset<int, test_hash<int>, test_equal_to<int>, A > C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), A(10));
+ C c(a, a + 2, 7, test_hash<int>(2), test_equal_to<int>(3), A(4));
+ C::iterator it0 = c0.begin();
+ c = std::move(c0);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == A(10));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(it0 == c.begin()); // Iterators remain valid
+ }
+ {
+ typedef test_allocator<int> A;
+ typedef std::unordered_multiset<int, test_hash<int>, test_equal_to<int>, A > C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), A());
+ C c(a, a + 2, 7, test_hash<int>(2), test_equal_to<int>(3), A());
+ C::iterator it0 = c0.begin();
+ c = std::move(c0);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == A());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(it0 == c.begin()); // Iterators remain valid
+ }
+ {
+ typedef min_allocator<int> A;
+ typedef std::unordered_multiset<int, test_hash<int>, test_equal_to<int>, A > C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), A());
+ C c(a, a + 2, 7, test_hash<int>(2), test_equal_to<int>(3), A());
+ C::iterator it0 = c0.begin();
+ c = std::move(c0);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == A());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(it0 == c.begin()); // Iterators remain valid
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/compare_copy_constructible.compile.fail.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/compare_copy_constructible.compile.fail.cpp
index 24816ab09e25af7..b70892459485b64 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/compare_copy_constructible.compile.fail.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/compare_copy_constructible.compile.fail.cpp
@@ -6,7 +6,6 @@
//
//===----------------------------------------------------------------------===//
-
// <unordered_set>
// Check that std::unordered_set fails to instantiate if the comparison predicate is
@@ -16,16 +15,16 @@
template <class T>
struct Comp {
- bool operator () (const T& lhs, const T& rhs) const { return lhs == rhs; }
+ bool operator()(const T& lhs, const T& rhs) const { return lhs == rhs; }
- Comp () {}
-private:
- Comp (const Comp &); // declared but not defined
- };
+ Comp() {}
+private:
+ Comp(const Comp&); // declared but not defined
+};
int main(int, char**) {
- std::unordered_multiset<int, std::hash<int>, Comp<int> > m;
+ std::unordered_multiset<int, std::hash<int>, Comp<int> > m;
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/copy.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/copy.pass.cpp
index 8ae0be01eb5b506..fc577f323e43b4a 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/copy.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/copy.pass.cpp
@@ -27,123 +27,71 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<int,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<int>
- > C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- test_allocator<int>(10)
- );
- C c = c0;
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- CheckConsecutiveValues<C::const_iterator>(c.find(1), c.end(), 1, 2);
- CheckConsecutiveValues<C::const_iterator>(c.find(2), c.end(), 2, 2);
- CheckConsecutiveValues<C::const_iterator>(c.find(3), c.end(), 3, 1);
- CheckConsecutiveValues<C::const_iterator>(c.find(4), c.end(), 4, 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == test_allocator<int>(10));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<int, test_hash<int>, test_equal_to<int>, test_allocator<int> > C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), test_allocator<int>(10));
+ C c = c0;
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ CheckConsecutiveValues<C::const_iterator>(c.find(1), c.end(), 1, 2);
+ CheckConsecutiveValues<C::const_iterator>(c.find(2), c.end(), 2, 2);
+ CheckConsecutiveValues<C::const_iterator>(c.find(3), c.end(), 3, 1);
+ CheckConsecutiveValues<C::const_iterator>(c.find(4), c.end(), 4, 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == test_allocator<int>(10));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multiset<int,
- test_hash<int>,
- test_equal_to<int>,
- other_allocator<int>
- > C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- other_allocator<int>(10)
- );
- C c = c0;
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- CheckConsecutiveValues<C::const_iterator>(c.find(1), c.end(), 1, 2);
- CheckConsecutiveValues<C::const_iterator>(c.find(2), c.end(), 2, 2);
- CheckConsecutiveValues<C::const_iterator>(c.find(3), c.end(), 3, 1);
- CheckConsecutiveValues<C::const_iterator>(c.find(4), c.end(), 4, 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == other_allocator<int>(-2));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef std::unordered_multiset<int,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<int>
- > C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- min_allocator<int>()
- );
- C c = c0;
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- CheckConsecutiveValues<C::const_iterator>(c.find(1), c.end(), 1, 2);
- CheckConsecutiveValues<C::const_iterator>(c.find(2), c.end(), 2, 2);
- CheckConsecutiveValues<C::const_iterator>(c.find(3), c.end(), 3, 1);
- CheckConsecutiveValues<C::const_iterator>(c.find(4), c.end(), 4, 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == min_allocator<int>());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+ {
+ typedef std::unordered_multiset<int, test_hash<int>, test_equal_to<int>, other_allocator<int> > C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), other_allocator<int>(10));
+ C c = c0;
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ CheckConsecutiveValues<C::const_iterator>(c.find(1), c.end(), 1, 2);
+ CheckConsecutiveValues<C::const_iterator>(c.find(2), c.end(), 2, 2);
+ CheckConsecutiveValues<C::const_iterator>(c.find(3), c.end(), 3, 1);
+ CheckConsecutiveValues<C::const_iterator>(c.find(4), c.end(), 4, 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == other_allocator<int>(-2));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef std::unordered_multiset<int, test_hash<int>, test_equal_to<int>, min_allocator<int> > C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), min_allocator<int>());
+ C c = c0;
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ CheckConsecutiveValues<C::const_iterator>(c.find(1), c.end(), 1, 2);
+ CheckConsecutiveValues<C::const_iterator>(c.find(2), c.end(), 2, 2);
+ CheckConsecutiveValues<C::const_iterator>(c.find(3), c.end(), 3, 1);
+ CheckConsecutiveValues<C::const_iterator>(c.find(4), c.end(), 4, 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/copy_alloc.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/copy_alloc.pass.cpp
index 5c920b91f747cbc..7f45a3f2e4bd4b5 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/copy_alloc.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/copy_alloc.pass.cpp
@@ -27,85 +27,50 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<int,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<int>
- > C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- test_allocator<int>(10)
- );
- C c(c0, test_allocator<int>(5));
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- CheckConsecutiveValues<C::const_iterator>(c.find(1), c.end(), 1, 2);
- CheckConsecutiveValues<C::const_iterator>(c.find(2), c.end(), 2, 2);
- CheckConsecutiveValues<C::const_iterator>(c.find(3), c.end(), 3, 1);
- CheckConsecutiveValues<C::const_iterator>(c.find(4), c.end(), 4, 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == test_allocator<int>(5));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<int, test_hash<int>, test_equal_to<int>, test_allocator<int> > C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), test_allocator<int>(10));
+ C c(c0, test_allocator<int>(5));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ CheckConsecutiveValues<C::const_iterator>(c.find(1), c.end(), 1, 2);
+ CheckConsecutiveValues<C::const_iterator>(c.find(2), c.end(), 2, 2);
+ CheckConsecutiveValues<C::const_iterator>(c.find(3), c.end(), 3, 1);
+ CheckConsecutiveValues<C::const_iterator>(c.find(4), c.end(), 4, 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == test_allocator<int>(5));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multiset<int,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<int>
- > C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- min_allocator<int>()
- );
- C c(c0, min_allocator<int>());
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- CheckConsecutiveValues<C::const_iterator>(c.find(1), c.end(), 1, 2);
- CheckConsecutiveValues<C::const_iterator>(c.find(2), c.end(), 2, 2);
- CheckConsecutiveValues<C::const_iterator>(c.find(3), c.end(), 3, 1);
- CheckConsecutiveValues<C::const_iterator>(c.find(4), c.end(), 4, 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == min_allocator<int>());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+ {
+ typedef std::unordered_multiset<int, test_hash<int>, test_equal_to<int>, min_allocator<int> > C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), min_allocator<int>());
+ C c(c0, min_allocator<int>());
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ CheckConsecutiveValues<C::const_iterator>(c.find(1), c.end(), 1, 2);
+ CheckConsecutiveValues<C::const_iterator>(c.find(2), c.end(), 2, 2);
+ CheckConsecutiveValues<C::const_iterator>(c.find(3), c.end(), 3, 1);
+ CheckConsecutiveValues<C::const_iterator>(c.find(4), c.end(), 4, 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/deduct.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/deduct.pass.cpp
index 72448875cda758b..b5520bd21890b19 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/deduct.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/deduct.pass.cpp
@@ -81,195 +81,201 @@
#include "deduction_guides_sfinae_checks.h"
#include "test_allocator.h"
-int main(int, char**)
-{
- const int expected_s[] = {1, 1, 2, 3, INT_MAX};
+int main(int, char**) {
+ const int expected_s[] = {1, 1, 2, 3, INT_MAX};
- {
- const int arr[] = { 1, 2, 1, INT_MAX, 3 };
+ {
+ const int arr[] = {1, 2, 1, INT_MAX, 3};
std::unordered_multiset s(std::begin(arr), std::end(arr));
ASSERT_SAME_TYPE(decltype(s), std::unordered_multiset<int>);
assert(std::is_permutation(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s)));
- }
+ }
- {
- const int arr[] = { 1, 2, 1, INT_MAX, 3 };
+ {
+ const int arr[] = {1, 2, 1, INT_MAX, 3};
std::unordered_multiset s(std::begin(arr), std::end(arr), 42);
ASSERT_SAME_TYPE(decltype(s), std::unordered_multiset<int>);
assert(std::is_permutation(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s)));
- }
+ }
- {
- const int arr[] = { 1, 2, 1, INT_MAX, 3 };
+ {
+ const int arr[] = {1, 2, 1, INT_MAX, 3};
std::unordered_multiset s(std::begin(arr), std::end(arr), 42, std::hash<long long>());
ASSERT_SAME_TYPE(decltype(s), std::unordered_multiset<int, std::hash<long long>>);
assert(std::is_permutation(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s)));
- }
+ }
- {
- const int arr[] = { 1, 2, 1, INT_MAX, 3 };
+ {
+ const int arr[] = {1, 2, 1, INT_MAX, 3};
std::unordered_multiset s(std::begin(arr), std::end(arr), 42, std::hash<long long>(), test_allocator<int>(0, 40));
- ASSERT_SAME_TYPE(decltype(s), std::unordered_multiset<int, std::hash<long long>, std::equal_to<int>, test_allocator<int>>);
+ ASSERT_SAME_TYPE(
+ decltype(s), std::unordered_multiset<int, std::hash<long long>, std::equal_to<int>, test_allocator<int>>);
assert(std::is_permutation(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s)));
assert(s.get_allocator().get_id() == 40);
- }
+ }
- {
+ {
std::unordered_multiset<int, std::hash<long long>, std::equal_to<>, test_allocator<int>> source;
std::unordered_multiset s(source);
ASSERT_SAME_TYPE(decltype(s), decltype(source));
assert(s.size() == 0);
- }
+ }
- {
+ {
std::unordered_multiset<int, std::hash<long long>, std::equal_to<>, test_allocator<int>> source;
- std::unordered_multiset s{source}; // braces instead of parens
+ std::unordered_multiset s{source}; // braces instead of parens
ASSERT_SAME_TYPE(decltype(s), decltype(source));
assert(s.size() == 0);
- }
+ }
- {
+ {
std::unordered_multiset<int, std::hash<long long>, std::equal_to<>, test_allocator<int>> source;
std::unordered_multiset s(source, test_allocator<int>(0, 41));
ASSERT_SAME_TYPE(decltype(s), decltype(source));
assert(s.size() == 0);
assert(s.get_allocator().get_id() == 41);
- }
+ }
- {
+ {
std::unordered_multiset<int, std::hash<long long>, std::equal_to<>, test_allocator<int>> source;
- std::unordered_multiset s{source, test_allocator<int>(0, 42)}; // braces instead of parens
+ std::unordered_multiset s{source, test_allocator<int>(0, 42)}; // braces instead of parens
ASSERT_SAME_TYPE(decltype(s), decltype(source));
assert(s.size() == 0);
assert(s.get_allocator().get_id() == 42);
- }
+ }
- {
- std::unordered_multiset s{ 1, 2, 1, INT_MAX, 3 };
+ {
+ std::unordered_multiset s{1, 2, 1, INT_MAX, 3};
ASSERT_SAME_TYPE(decltype(s), std::unordered_multiset<int>);
assert(std::is_permutation(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s)));
- }
+ }
- {
- std::unordered_multiset s({ 1, 2, 1, INT_MAX, 3 }, 42);
+ {
+ std::unordered_multiset s({1, 2, 1, INT_MAX, 3}, 42);
ASSERT_SAME_TYPE(decltype(s), std::unordered_multiset<int>);
assert(std::is_permutation(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s)));
- }
+ }
- {
- std::unordered_multiset s({ 1, 2, 1, INT_MAX, 3 }, 42, std::hash<long long>());
+ {
+ std::unordered_multiset s({1, 2, 1, INT_MAX, 3}, 42, std::hash<long long>());
ASSERT_SAME_TYPE(decltype(s), std::unordered_multiset<int, std::hash<long long>>);
assert(std::is_permutation(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s)));
- }
+ }
- {
- std::unordered_multiset s({ 1, 2, 1, INT_MAX, 3 }, 42, std::hash<long long>(), std::equal_to<>());
+ {
+ std::unordered_multiset s({1, 2, 1, INT_MAX, 3}, 42, std::hash<long long>(), std::equal_to<>());
ASSERT_SAME_TYPE(decltype(s), std::unordered_multiset<int, std::hash<long long>, std::equal_to<>>);
assert(std::is_permutation(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s)));
- }
+ }
- {
- std::unordered_multiset s({ 1, 2, 1, INT_MAX, 3 }, 42, std::hash<long long>(), std::equal_to<>(), test_allocator<int>(0, 43));
+ {
+ std::unordered_multiset s(
+ {1, 2, 1, INT_MAX, 3}, 42, std::hash<long long>(), std::equal_to<>(), test_allocator<int>(0, 43));
- ASSERT_SAME_TYPE(decltype(s), std::unordered_multiset<int, std::hash<long long>, std::equal_to<>, test_allocator<int>>);
+ ASSERT_SAME_TYPE(
+ decltype(s), std::unordered_multiset<int, std::hash<long long>, std::equal_to<>, test_allocator<int>>);
assert(std::is_permutation(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s)));
assert(s.get_allocator().get_id() == 43);
- }
+ }
- {
- const int arr[] = { 1, 2, 1, INT_MAX, 3 };
+ {
+ const int arr[] = {1, 2, 1, INT_MAX, 3};
std::unordered_multiset s(std::begin(arr), std::end(arr), 42, test_allocator<int>(0, 44));
- ASSERT_SAME_TYPE(decltype(s), std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, test_allocator<int>>);
+ ASSERT_SAME_TYPE(
+ decltype(s), std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, test_allocator<int>>);
assert(std::is_permutation(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s)));
assert(s.get_allocator().get_id() == 44);
- }
+ }
- {
- const int arr[] = { 1, 2, 1, INT_MAX, 3 };
+ {
+ const int arr[] = {1, 2, 1, INT_MAX, 3};
std::unordered_multiset s(std::begin(arr), std::end(arr), 42, std::hash<long long>(), test_allocator<int>(0, 44));
- ASSERT_SAME_TYPE(decltype(s), std::unordered_multiset<int, std::hash<long long>, std::equal_to<int>, test_allocator<int>>);
+ ASSERT_SAME_TYPE(
+ decltype(s), std::unordered_multiset<int, std::hash<long long>, std::equal_to<int>, test_allocator<int>>);
assert(std::is_permutation(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s)));
assert(s.get_allocator().get_id() == 44);
- }
+ }
- {
- std::unordered_multiset s({ 1, 2, 1, INT_MAX, 3 }, 42, test_allocator<int>(0, 43));
+ {
+ std::unordered_multiset s({1, 2, 1, INT_MAX, 3}, 42, test_allocator<int>(0, 43));
- ASSERT_SAME_TYPE(decltype(s), std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, test_allocator<int>>);
+ ASSERT_SAME_TYPE(
+ decltype(s), std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, test_allocator<int>>);
assert(std::is_permutation(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s)));
assert(s.get_allocator().get_id() == 43);
- }
+ }
- {
- std::unordered_multiset s({ 1, 2, 1, INT_MAX, 3 }, 42, std::hash<long long>(), test_allocator<int>(0, 42));
+ {
+ std::unordered_multiset s({1, 2, 1, INT_MAX, 3}, 42, std::hash<long long>(), test_allocator<int>(0, 42));
- ASSERT_SAME_TYPE(decltype(s), std::unordered_multiset<int, std::hash<long long>, std::equal_to<int>, test_allocator<int>>);
+ ASSERT_SAME_TYPE(
+ decltype(s), std::unordered_multiset<int, std::hash<long long>, std::equal_to<int>, test_allocator<int>>);
assert(std::is_permutation(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s)));
assert(s.get_allocator().get_id() == 42);
- }
+ }
#if TEST_STD_VER >= 23
- {
- using Range = std::array<int, 0>;
- using Pred = test_equal_to<int>;
- using DefaultPred = std::equal_to<int>;
- using Hash = test_hash<int>;
- using DefaultHash = std::hash<int>;
- using Alloc = test_allocator<int>;
-
- { // (from_range, range)
- std::unordered_multiset c(std::from_range, Range());
- static_assert(std::is_same_v<decltype(c), std::unordered_multiset<int>>);
- }
-
- { // (from_range, range, n)
- std::unordered_multiset c(std::from_range, Range(), std::size_t());
- static_assert(std::is_same_v<decltype(c), std::unordered_multiset<int>>);
- }
-
- { // (from_range, range, n, hash)
- std::unordered_multiset c(std::from_range, Range(), std::size_t(), Hash());
- static_assert(std::is_same_v<decltype(c), std::unordered_multiset<int, Hash>>);
- }
-
- { // (from_range, range, n, hash, pred)
- std::unordered_multiset c(std::from_range, Range(), std::size_t(), Hash(), Pred());
- static_assert(std::is_same_v<decltype(c), std::unordered_multiset<int, Hash, Pred>>);
- }
-
- { // (from_range, range, n, hash, pred, alloc)
- std::unordered_multiset c(std::from_range, Range(), std::size_t(), Hash(), Pred(), Alloc());
- static_assert(std::is_same_v<decltype(c), std::unordered_multiset<int, Hash, Pred, Alloc>>);
- }
-
- { // (from_range, range, n, alloc)
- std::unordered_multiset c(std::from_range, Range(), std::size_t(), Alloc());
- static_assert(std::is_same_v<decltype(c), std::unordered_multiset<int, DefaultHash, DefaultPred, Alloc>>);
- }
-
- // TODO(LWG 2713): uncomment this test once the constructor is added.
- { // (from_range, range, alloc)
- //std::unordered_multiset c(std::from_range, Range(), Alloc());
- //static_assert(std::is_same_v<decltype(c), std::unordered_multiset<int, DefaultHash, DefaultPred, Alloc>>);
- }
-
- { // (from_range, range, n, hash, alloc)
- std::unordered_multiset c(std::from_range, Range(), std::size_t(), Hash(), Alloc());
- static_assert(std::is_same_v<decltype(c), std::unordered_multiset<int, Hash, DefaultPred, Alloc>>);
- }
+ {
+ using Range = std::array<int, 0>;
+ using Pred = test_equal_to<int>;
+ using DefaultPred = std::equal_to<int>;
+ using Hash = test_hash<int>;
+ using DefaultHash = std::hash<int>;
+ using Alloc = test_allocator<int>;
+
+ { // (from_range, range)
+ std::unordered_multiset c(std::from_range, Range());
+ static_assert(std::is_same_v<decltype(c), std::unordered_multiset<int>>);
+ }
+
+ { // (from_range, range, n)
+ std::unordered_multiset c(std::from_range, Range(), std::size_t());
+ static_assert(std::is_same_v<decltype(c), std::unordered_multiset<int>>);
+ }
+
+ { // (from_range, range, n, hash)
+ std::unordered_multiset c(std::from_range, Range(), std::size_t(), Hash());
+ static_assert(std::is_same_v<decltype(c), std::unordered_multiset<int, Hash>>);
+ }
+
+ { // (from_range, range, n, hash, pred)
+ std::unordered_multiset c(std::from_range, Range(), std::size_t(), Hash(), Pred());
+ static_assert(std::is_same_v<decltype(c), std::unordered_multiset<int, Hash, Pred>>);
+ }
+
+ { // (from_range, range, n, hash, pred, alloc)
+ std::unordered_multiset c(std::from_range, Range(), std::size_t(), Hash(), Pred(), Alloc());
+ static_assert(std::is_same_v<decltype(c), std::unordered_multiset<int, Hash, Pred, Alloc>>);
+ }
+
+ { // (from_range, range, n, alloc)
+ std::unordered_multiset c(std::from_range, Range(), std::size_t(), Alloc());
+ static_assert(std::is_same_v<decltype(c), std::unordered_multiset<int, DefaultHash, DefaultPred, Alloc>>);
+ }
+
+ // TODO(LWG 2713): uncomment this test once the constructor is added.
+ { // (from_range, range, alloc)
+ //std::unordered_multiset c(std::from_range, Range(), Alloc());
+ //static_assert(std::is_same_v<decltype(c), std::unordered_multiset<int, DefaultHash, DefaultPred, Alloc>>);
+ }
+
+ { // (from_range, range, n, hash, alloc)
+ std::unordered_multiset c(std::from_range, Range(), std::size_t(), Hash(), Alloc());
+ static_assert(std::is_same_v<decltype(c), std::unordered_multiset<int, Hash, DefaultPred, Alloc>>);
}
+ }
#endif
- UnorderedContainerDeductionGuidesSfinaeAway<std::unordered_multiset, std::unordered_multiset<int>>();
+ UnorderedContainerDeductionGuidesSfinaeAway<std::unordered_multiset, std::unordered_multiset<int>>();
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/deduct.verify.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/deduct.verify.cpp
index 8fd7d1d6c20efa7..9a1ec2c0241eab9 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/deduct.verify.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/deduct.verify.cpp
@@ -50,48 +50,47 @@
#include <functional>
#include <unordered_set>
-int main(int, char**)
-{
- {
- // cannot deduce Key from nothing
- std::unordered_multiset s;
- // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_multiset'}}
- }
- {
- // cannot deduce Key from just (Size)
- std::unordered_multiset s(42);
- // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_multiset'}}
- }
- {
- // cannot deduce Key from just (Size, Hash)
- std::unordered_multiset s(42, std::hash<int>());
- // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_multiset'}}
- }
- {
- // cannot deduce Key from just (Size, Hash, Pred)
- std::unordered_multiset s(42, std::hash<int>(), std::equal_to<>());
- // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_multiset'}}
- }
- {
- // cannot deduce Key from just (Size, Hash, Pred, Allocator)
- std::unordered_multiset s(42, std::hash<int>(), std::equal_to<>(), std::allocator<int>());
- // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_multiset'}}
- }
- {
- // cannot deduce Key from just (Allocator)
- std::unordered_multiset s(std::allocator<int>{});
- // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_multiset'}}
- }
- {
- // cannot deduce Key from just (Size, Allocator)
- std::unordered_multiset s(42, std::allocator<int>());
- // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_multiset'}}
- }
- {
- // cannot deduce Key from just (Size, Hash, Allocator)
- std::unordered_multiset s(42, std::hash<short>(), std::allocator<int>());
- // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_multiset'}}
- }
+int main(int, char**) {
+ {
+ // cannot deduce Key from nothing
+ std::unordered_multiset s;
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_multiset'}}
+ }
+ {
+ // cannot deduce Key from just (Size)
+ std::unordered_multiset s(42);
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_multiset'}}
+ }
+ {
+ // cannot deduce Key from just (Size, Hash)
+ std::unordered_multiset s(42, std::hash<int>());
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_multiset'}}
+ }
+ {
+ // cannot deduce Key from just (Size, Hash, Pred)
+ std::unordered_multiset s(42, std::hash<int>(), std::equal_to<>());
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_multiset'}}
+ }
+ {
+ // cannot deduce Key from just (Size, Hash, Pred, Allocator)
+ std::unordered_multiset s(42, std::hash<int>(), std::equal_to<>(), std::allocator<int>());
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_multiset'}}
+ }
+ {
+ // cannot deduce Key from just (Allocator)
+ std::unordered_multiset s(std::allocator<int>{});
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_multiset'}}
+ }
+ {
+ // cannot deduce Key from just (Size, Allocator)
+ std::unordered_multiset s(42, std::allocator<int>());
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_multiset'}}
+ }
+ {
+ // cannot deduce Key from just (Size, Hash, Allocator)
+ std::unordered_multiset s(42, std::hash<short>(), std::allocator<int>());
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_multiset'}}
+ }
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/default.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/default.pass.cpp
index 00d8c6f59eebab5..4e182180f948680 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/default.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/default.pass.cpp
@@ -24,85 +24,81 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- test_allocator<NotConstructible>
- > C;
- C c;
- LIBCPP_ASSERT(c.bucket_count() == 0);
- assert(c.hash_function() == test_hash<NotConstructible>());
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() == (test_allocator<NotConstructible>()));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ test_allocator<NotConstructible> >
+ C;
+ C c;
+ LIBCPP_ASSERT(c.bucket_count() == 0);
+ assert(c.hash_function() == test_hash<NotConstructible>());
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == (test_allocator<NotConstructible>()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
+ {
+ typedef std::unordered_multiset<NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ min_allocator<NotConstructible> >
+ C;
+ C c;
+ LIBCPP_ASSERT(c.bucket_count() == 0);
+ assert(c.hash_function() == test_hash<NotConstructible>());
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == (min_allocator<NotConstructible>()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef explicit_allocator<NotConstructible> A;
+ typedef std::unordered_multiset<NotConstructible, test_hash<NotConstructible>, test_equal_to<NotConstructible>, A >
+ C;
{
- typedef std::unordered_multiset<NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- min_allocator<NotConstructible>
- > C;
- C c;
- LIBCPP_ASSERT(c.bucket_count() == 0);
- assert(c.hash_function() == test_hash<NotConstructible>());
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() == (min_allocator<NotConstructible>()));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef explicit_allocator<NotConstructible> A;
- typedef std::unordered_multiset<NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- A
- > C;
- {
- C c;
- LIBCPP_ASSERT(c.bucket_count() == 0);
- assert(c.hash_function() == test_hash<NotConstructible>());
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() == A());
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
- {
- A a;
- C c(a);
- LIBCPP_ASSERT(c.bucket_count() == 0);
- assert(c.hash_function() == test_hash<NotConstructible>());
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() == a);
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+ C c;
+ LIBCPP_ASSERT(c.bucket_count() == 0);
+ assert(c.hash_function() == test_hash<NotConstructible>());
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == A());
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
}
{
- std::unordered_multiset<int> c = {};
- LIBCPP_ASSERT(c.bucket_count() == 0);
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
+ A a;
+ C c(a);
+ LIBCPP_ASSERT(c.bucket_count() == 0);
+ assert(c.hash_function() == test_hash<NotConstructible>());
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == a);
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
}
+ }
+ {
+ std::unordered_multiset<int> c = {};
+ LIBCPP_ASSERT(c.bucket_count() == 0);
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/default_noexcept.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/default_noexcept.pass.cpp
index 1c64692d85653a1..6bf666371ddb7af 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/default_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/default_noexcept.pass.cpp
@@ -27,50 +27,45 @@
#include "../../../test_hash.h"
template <class T>
-struct some_comp
-{
- typedef T value_type;
- some_comp();
- some_comp(const some_comp&);
- bool operator()(const T&, const T&) const { return false; }
+struct some_comp {
+ typedef T value_type;
+ some_comp();
+ some_comp(const some_comp&);
+ bool operator()(const T&, const T&) const { return false; }
};
template <class T>
-struct some_hash
-{
- typedef T value_type;
- some_hash();
- some_hash(const some_hash&);
- std::size_t operator()(T const&) const;
+struct some_hash {
+ typedef T value_type;
+ some_hash();
+ some_hash(const some_hash&);
+ std::size_t operator()(T const&) const;
};
-int main(int, char**)
-{
+int main(int, char**) {
#if defined(_LIBCPP_VERSION)
- {
- typedef std::unordered_multiset<MoveOnly> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
- }
- {
- typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, test_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
- }
+ {
+ typedef std::unordered_multiset<MoveOnly> C;
+ static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ }
+ {
+ typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>, std::equal_to<MoveOnly>, test_allocator<MoveOnly>> C;
+ static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ }
#endif // _LIBCPP_VERSION
- {
- typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, other_allocator<MoveOnly>> C;
- static_assert(!std::is_nothrow_default_constructible<C>::value, "");
- }
- {
- typedef std::unordered_multiset<MoveOnly, some_hash<MoveOnly>> C;
- static_assert(!std::is_nothrow_default_constructible<C>::value, "");
- }
- {
- typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>,
- some_comp<MoveOnly>> C;
- static_assert(!std::is_nothrow_default_constructible<C>::value, "");
- }
+ {
+ typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>, std::equal_to<MoveOnly>, other_allocator<MoveOnly>>
+ C;
+ static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+ }
+ {
+ typedef std::unordered_multiset<MoveOnly, some_hash<MoveOnly>> C;
+ static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+ }
+ {
+ typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>, some_comp<MoveOnly>> C;
+ static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/dtor_noexcept.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/dtor_noexcept.pass.cpp
index 41f68c6c47b59dc..32c757e16d3443b 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/dtor_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/dtor_noexcept.pass.cpp
@@ -20,49 +20,44 @@
#include "test_allocator.h"
template <class T>
-struct some_comp
-{
- typedef T value_type;
- ~some_comp() noexcept(false);
- bool operator()(const T&, const T&) const { return false; }
+struct some_comp {
+ typedef T value_type;
+ ~some_comp() noexcept(false);
+ bool operator()(const T&, const T&) const { return false; }
};
template <class T>
-struct some_hash
-{
- typedef T value_type;
- some_hash();
- some_hash(const some_hash&);
- ~some_hash() noexcept(false);
- std::size_t operator()(T const&) const;
+struct some_hash {
+ typedef T value_type;
+ some_hash();
+ some_hash(const some_hash&);
+ ~some_hash() noexcept(false);
+ std::size_t operator()(T const&) const;
};
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<MoveOnly> C;
- static_assert(std::is_nothrow_destructible<C>::value, "");
- }
- {
- typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, test_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_destructible<C>::value, "");
- }
- {
- typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, other_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_destructible<C>::value, "");
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<MoveOnly> C;
+ static_assert(std::is_nothrow_destructible<C>::value, "");
+ }
+ {
+ typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>, std::equal_to<MoveOnly>, test_allocator<MoveOnly>> C;
+ static_assert(std::is_nothrow_destructible<C>::value, "");
+ }
+ {
+ typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>, std::equal_to<MoveOnly>, other_allocator<MoveOnly>>
+ C;
+ static_assert(std::is_nothrow_destructible<C>::value, "");
+ }
#if defined(_LIBCPP_VERSION)
- {
- typedef std::unordered_multiset<MoveOnly, some_hash<MoveOnly>> C;
- static_assert(!std::is_nothrow_destructible<C>::value, "");
- }
- {
- typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>,
- some_comp<MoveOnly>> C;
- static_assert(!std::is_nothrow_destructible<C>::value, "");
- }
+ {
+ typedef std::unordered_multiset<MoveOnly, some_hash<MoveOnly>> C;
+ static_assert(!std::is_nothrow_destructible<C>::value, "");
+ }
+ {
+ typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>, some_comp<MoveOnly>> C;
+ static_assert(!std::is_nothrow_destructible<C>::value, "");
+ }
#endif // _LIBCPP_VERSION
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/from_range.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/from_range.pass.cpp
index 918e7d85e99eb03..e5672e577f95c8f 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/from_range.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/from_range.pass.cpp
@@ -29,7 +29,7 @@
void test_duplicates() {
std::array input = {1, 2, 3, 3, 3, 4, 2, 1, 2};
- auto c = std::unordered_multiset<int>(std::from_range, input);
+ auto c = std::unordered_multiset<int>(std::from_range, input);
assert(std::ranges::is_permutation(input, c));
}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/hash_copy_constructible.compile.fail.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/hash_copy_constructible.compile.fail.cpp
index 1f2ee87afd46fce..d0db3f10cc3d05a 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/hash_copy_constructible.compile.fail.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/hash_copy_constructible.compile.fail.cpp
@@ -6,7 +6,6 @@
//
//===----------------------------------------------------------------------===//
-
// <unordered_set>
// Check that std::unordered_multiset fails to instantiate if the hash function is
@@ -16,16 +15,16 @@
template <class T>
struct Hash {
- std::size_t operator () (const T& lhs) const { return 0; }
+ std::size_t operator()(const T& lhs) const { return 0; }
- Hash () {}
-private:
- Hash (const Hash &); // declared but not defined
- };
+ Hash() {}
+private:
+ Hash(const Hash&); // declared but not defined
+};
int main(int, char**) {
- std::unordered_multiset<int, Hash<int> > m;
+ std::unordered_multiset<int, Hash<int> > m;
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init.pass.cpp
index bd5cef7a4931edf..d0ebce70cde2225 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init.pass.cpp
@@ -28,137 +28,100 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<int,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<int>
- > C;
- typedef int P;
- C c = {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- assert(c.bucket_count() >= 7);
- assert(c.size() == 6);
- assert(c.count(1) == 2);
- assert(c.count(2) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>());
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() == test_allocator<int>());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef std::unordered_multiset<int,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<int>
- > C;
- typedef int P;
- C c = {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- assert(c.bucket_count() >= 7);
- assert(c.size() == 6);
- assert(c.count(1) == 2);
- assert(c.count(2) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>());
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() == min_allocator<int>());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<int, test_hash<int>, test_equal_to<int>, test_allocator<int> > C;
+ typedef int P;
+ C c = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ assert(c.bucket_count() >= 7);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>());
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == test_allocator<int>());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef std::unordered_multiset<int, test_hash<int>, test_equal_to<int>, min_allocator<int> > C;
+ typedef int P;
+ C c = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ assert(c.bucket_count() >= 7);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>());
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER > 11
- {
- typedef int T;
- typedef test_hash<T> HF;
- typedef test_equal_to<T> Comp;
- typedef test_allocator<T> A;
- typedef std::unordered_multiset<T, HF, Comp, A> C;
+ {
+ typedef int T;
+ typedef test_hash<T> HF;
+ typedef test_equal_to<T> Comp;
+ typedef test_allocator<T> A;
+ typedef std::unordered_multiset<T, HF, Comp, A> C;
- A a(42);
- C c({
- T(1),
- T(2),
- T(3),
- T(4),
- T(1),
- T(2)
- }, 12, a);
+ A a(42);
+ C c({T(1), T(2), T(3), T(4), T(1), T(2)}, 12, a);
- assert(c.bucket_count() >= 12);
- assert(c.size() == 6);
- assert(c.count(1) == 2);
- assert(c.count(2) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == HF());
- assert(c.key_eq() == Comp());
- assert(c.get_allocator() == a);
- assert(!(c.get_allocator() == A()));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef int T;
- typedef test_hash<T> HF;
- typedef test_equal_to<T> Comp;
- typedef test_allocator<T> A;
- typedef std::unordered_multiset<T, HF, Comp, A> C;
+ assert(c.bucket_count() >= 12);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == HF());
+ assert(c.key_eq() == Comp());
+ assert(c.get_allocator() == a);
+ assert(!(c.get_allocator() == A()));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef int T;
+ typedef test_hash<T> HF;
+ typedef test_equal_to<T> Comp;
+ typedef test_allocator<T> A;
+ typedef std::unordered_multiset<T, HF, Comp, A> C;
- A a(42);
- HF hf(43);
- C c({
- T(1),
- T(2),
- T(3),
- T(4),
- T(1),
- T(2)
- }, 12, hf, a);
+ A a(42);
+ HF hf(43);
+ C c({T(1), T(2), T(3), T(4), T(1), T(2)}, 12, hf, a);
- assert(c.bucket_count() >= 12);
- assert(c.size() == 6);
- assert(c.count(1) == 2);
- assert(c.count(2) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == hf);
- assert(!(c.hash_function() == HF()));
- assert(c.key_eq() == Comp());
- assert(c.get_allocator() == a);
- assert(!(c.get_allocator() == A()));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+ assert(c.bucket_count() >= 12);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == hf);
+ assert(!(c.hash_function() == HF()));
+ assert(c.key_eq() == Comp());
+ assert(c.get_allocator() == a);
+ assert(!(c.get_allocator() == A()));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#endif // TEST_STD_VER > 11
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size.pass.cpp
index 80123b159b9ab32..3b358c123bcfd98 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size.pass.cpp
@@ -28,72 +28,45 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<int,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<int>
- > C;
- typedef int P;
- C c({
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- },
- 7
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- assert(c.count(1) == 2);
- assert(c.count(2) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>());
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() == test_allocator<int>());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef std::unordered_multiset<int,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<int>
- > C;
- typedef int P;
- C c({
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- },
- 7
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- assert(c.count(1) == 2);
- assert(c.count(2) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>());
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() == min_allocator<int>());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<int, test_hash<int>, test_equal_to<int>, test_allocator<int> > C;
+ typedef int P;
+ C c({P(1), P(2), P(3), P(4), P(1), P(2)}, 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>());
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == test_allocator<int>());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef std::unordered_multiset<int, test_hash<int>, test_equal_to<int>, min_allocator<int> > C;
+ typedef int P;
+ C c({P(1), P(2), P(3), P(4), P(1), P(2)}, 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>());
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_allocator.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_allocator.pass.cpp
index 4551de8a931fb83..bb0cc2441bfb719 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_allocator.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_allocator.pass.cpp
@@ -30,43 +30,29 @@
#include "min_allocator.h"
template <class Allocator>
-void test(const Allocator& alloc)
-{
- typedef std::unordered_multiset<int,
- test_hash<int>,
- test_equal_to<int>,
- Allocator> C;
- C c({
- 1,
- 2,
- 3,
- 4,
- 1,
- 2
- },
- 7,
- alloc);
-
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- assert(c.count(1) == 2);
- assert(c.count(2) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>());
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() == alloc);
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
+void test(const Allocator& alloc) {
+ typedef std::unordered_multiset<int, test_hash<int>, test_equal_to<int>, Allocator> C;
+ C c({1, 2, 3, 4, 1, 2}, 7, alloc);
+
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>());
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == alloc);
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
}
-int main(int, char**)
-{
- test(test_allocator<int>(10));
- test(min_allocator<int>());
- test(explicit_allocator<int>());
+int main(int, char**) {
+ test(test_allocator<int>(10));
+ test(min_allocator<int>());
+ test(explicit_allocator<int>());
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash.pass.cpp
index ae8ef8d813aa6a5..cea5247c31f7677 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash.pass.cpp
@@ -29,74 +29,45 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<int,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<int>
- > C;
- typedef int P;
- C c({
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- },
- 7,
- test_hash<int>(8)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- assert(c.count(1) == 2);
- assert(c.count(2) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() == test_allocator<int>());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef std::unordered_multiset<int,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<int>
- > C;
- typedef int P;
- C c({
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- },
- 7,
- test_hash<int>(8)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- assert(c.count(1) == 2);
- assert(c.count(2) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() == min_allocator<int>());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<int, test_hash<int>, test_equal_to<int>, test_allocator<int> > C;
+ typedef int P;
+ C c({P(1), P(2), P(3), P(4), P(1), P(2)}, 7, test_hash<int>(8));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == test_allocator<int>());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef std::unordered_multiset<int, test_hash<int>, test_equal_to<int>, min_allocator<int> > C;
+ typedef int P;
+ C c({P(1), P(2), P(3), P(4), P(1), P(2)}, 7, test_hash<int>(8));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_allocator.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_allocator.pass.cpp
index 01e51b1951aaeba..24b802f4fcca24f 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_allocator.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_allocator.pass.cpp
@@ -31,44 +31,29 @@
#include "min_allocator.h"
template <class Allocator>
-void test(const Allocator& alloc)
-{
- typedef std::unordered_multiset<int,
- test_hash<int>,
- test_equal_to<int>,
- Allocator> C;
- C c({
- 1,
- 2,
- 3,
- 4,
- 1,
- 2
- },
- 7,
- test_hash<int>(5),
- alloc);
-
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- assert(c.count(1) == 2);
- assert(c.count(2) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(5));
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() == alloc);
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
+void test(const Allocator& alloc) {
+ typedef std::unordered_multiset<int, test_hash<int>, test_equal_to<int>, Allocator> C;
+ C c({1, 2, 3, 4, 1, 2}, 7, test_hash<int>(5), alloc);
+
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(5));
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == alloc);
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
}
-int main(int, char**)
-{
- test(test_allocator<int>(10));
- test(min_allocator<int>());
- test(explicit_allocator<int>());
+int main(int, char**) {
+ test(test_allocator<int>(10));
+ test(min_allocator<int>());
+ test(explicit_allocator<int>());
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal.pass.cpp
index ee10f31fd77562e..d4f227b3b5dd93f 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal.pass.cpp
@@ -29,76 +29,45 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<int,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<int>
- > C;
- typedef int P;
- C c({
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- },
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- assert(c.count(1) == 2);
- assert(c.count(2) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == test_allocator<int>());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef std::unordered_multiset<int,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<int>
- > C;
- typedef int P;
- C c({
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- },
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- assert(c.count(1) == 2);
- assert(c.count(2) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == min_allocator<int>());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<int, test_hash<int>, test_equal_to<int>, test_allocator<int> > C;
+ typedef int P;
+ C c({P(1), P(2), P(3), P(4), P(1), P(2)}, 7, test_hash<int>(8), test_equal_to<int>(9));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == test_allocator<int>());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef std::unordered_multiset<int, test_hash<int>, test_equal_to<int>, min_allocator<int> > C;
+ typedef int P;
+ C c({P(1), P(2), P(3), P(4), P(1), P(2)}, 7, test_hash<int>(8), test_equal_to<int>(9));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal_allocator.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal_allocator.pass.cpp
index 9ca37e318cfaaa6..16096977795c0a3 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal_allocator.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal_allocator.pass.cpp
@@ -29,78 +29,45 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<int,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<int>
- > C;
- typedef int P;
- C c({
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- },
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- test_allocator<int>(10)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- assert(c.count(1) == 2);
- assert(c.count(2) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == test_allocator<int>(10));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef std::unordered_multiset<int,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<int>
- > C;
- typedef int P;
- C c({
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- },
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- min_allocator<int>()
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- assert(c.count(1) == 2);
- assert(c.count(2) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == min_allocator<int>());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<int, test_hash<int>, test_equal_to<int>, test_allocator<int> > C;
+ typedef int P;
+ C c({P(1), P(2), P(3), P(4), P(1), P(2)}, 7, test_hash<int>(8), test_equal_to<int>(9), test_allocator<int>(10));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == test_allocator<int>(10));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef std::unordered_multiset<int, test_hash<int>, test_equal_to<int>, min_allocator<int> > C;
+ typedef int P;
+ C c({P(1), P(2), P(3), P(4), P(1), P(2)}, 7, test_hash<int>(8), test_equal_to<int>(9), min_allocator<int>());
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/iter_iter.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/iter_iter.pass.cpp
index 5fe3a02e4af580c..e01ab17e34dff1a 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/iter_iter.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/iter_iter.pass.cpp
@@ -28,143 +28,102 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<int,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<int>
- > C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])));
- assert(c.bucket_count() >= 7);
- assert(c.size() == 6);
- assert(c.count(1) == 2);
- assert(c.count(2) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>());
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() == test_allocator<int>());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<int, test_hash<int>, test_equal_to<int>, test_allocator<int> > C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])));
+ assert(c.bucket_count() >= 7);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>());
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == test_allocator<int>());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multiset<int,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<int>
- > C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])));
- assert(c.bucket_count() >= 7);
- assert(c.size() == 6);
- assert(c.count(1) == 2);
- assert(c.count(2) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>());
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() == min_allocator<int>());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
-#if TEST_STD_VER > 11
- {
- typedef int T;
- typedef test_hash<T> HF;
- typedef test_equal_to<T> Comp;
- typedef test_allocator<T> A;
- typedef std::unordered_multiset<T, HF, Comp, A> C;
- T arr[] =
- {
- T(1),
- T(2),
- T(3),
- T(4),
- T(1),
- T(2)
- };
- A a(42);
- C c(cpp17_input_iterator<T*>(arr), cpp17_input_iterator<T*>(arr + sizeof(arr)/sizeof(arr[0])), 12, a);
- assert(c.bucket_count() >= 12);
- assert(c.size() == 6);
- assert(c.count(1) == 2);
- assert(c.count(2) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == HF());
- assert(c.key_eq() == Comp());
- assert(c.get_allocator() == a);
- assert(!(c.get_allocator() == A()));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef int T;
- typedef test_hash<T> HF;
- typedef test_equal_to<T> Comp;
- typedef test_allocator<T> A;
- typedef std::unordered_multiset<T, HF, Comp, A> C;
- T arr[] =
- {
- T(1),
- T(2),
- T(3),
- T(4),
- T(1),
- T(2)
- };
- HF hf(43);
- A a(42);
- C c(cpp17_input_iterator<T*>(arr), cpp17_input_iterator<T*>(arr + sizeof(arr)/sizeof(arr[0])), 16, hf, a);
- assert(c.bucket_count() >= 16);
- assert(c.size() == 6);
- assert(c.count(1) == 2);
- assert(c.count(2) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == hf);
- assert(!(c.hash_function() == HF()));
- assert(c.key_eq() == Comp());
- assert(c.get_allocator() == a);
- assert(!(c.get_allocator() == A()));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
-#endif
+ {
+ typedef std::unordered_multiset<int, test_hash<int>, test_equal_to<int>, min_allocator<int> > C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])));
+ assert(c.bucket_count() >= 7);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>());
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+# if TEST_STD_VER > 11
+ {
+ typedef int T;
+ typedef test_hash<T> HF;
+ typedef test_equal_to<T> Comp;
+ typedef test_allocator<T> A;
+ typedef std::unordered_multiset<T, HF, Comp, A> C;
+ T arr[] = {T(1), T(2), T(3), T(4), T(1), T(2)};
+ A a(42);
+ C c(cpp17_input_iterator<T*>(arr), cpp17_input_iterator<T*>(arr + sizeof(arr) / sizeof(arr[0])), 12, a);
+ assert(c.bucket_count() >= 12);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == HF());
+ assert(c.key_eq() == Comp());
+ assert(c.get_allocator() == a);
+ assert(!(c.get_allocator() == A()));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef int T;
+ typedef test_hash<T> HF;
+ typedef test_equal_to<T> Comp;
+ typedef test_allocator<T> A;
+ typedef std::unordered_multiset<T, HF, Comp, A> C;
+ T arr[] = {T(1), T(2), T(3), T(4), T(1), T(2)};
+ HF hf(43);
+ A a(42);
+ C c(cpp17_input_iterator<T*>(arr), cpp17_input_iterator<T*>(arr + sizeof(arr) / sizeof(arr[0])), 16, hf, a);
+ assert(c.bucket_count() >= 16);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == hf);
+ assert(!(c.hash_function() == HF()));
+ assert(c.key_eq() == Comp());
+ assert(c.get_allocator() == a);
+ assert(!(c.get_allocator() == A()));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+# endif
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/iter_iter_size.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/iter_iter_size.pass.cpp
index 4ce70a4b475d180..a232d4c4a241567 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/iter_iter_size.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/iter_iter_size.pass.cpp
@@ -28,77 +28,48 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<int,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<int>
- > C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
- 7
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- assert(c.count(1) == 2);
- assert(c.count(2) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>());
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() == test_allocator<int>());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<int, test_hash<int>, test_equal_to<int>, test_allocator<int> > C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])), 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>());
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == test_allocator<int>());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multiset<int,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<int>
- > C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
- 7
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- assert(c.count(1) == 2);
- assert(c.count(2) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>());
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() == min_allocator<int>());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+ {
+ typedef std::unordered_multiset<int, test_hash<int>, test_equal_to<int>, min_allocator<int> > C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])), 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>());
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/iter_iter_size_allocator.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/iter_iter_size_allocator.pass.cpp
index 3d9509e76417d52..994ec058fae94be 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/iter_iter_size_allocator.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/iter_iter_size_allocator.pass.cpp
@@ -33,45 +33,29 @@
#include "min_allocator.h"
template <class Allocator>
-void test(const Allocator& alloc)
-{
- typedef std::unordered_multiset<int,
- test_hash<int>,
- test_equal_to<int>,
- Allocator> C;
- int a[] =
- {
- 1,
- 2,
- 3,
- 4,
- 1,
- 2
- };
- C c(cpp17_input_iterator<int*>(a), cpp17_input_iterator<int*>(a + sizeof(a)/sizeof(a[0])),
- 7,
- alloc
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- assert(c.count(1) == 2);
- assert(c.count(2) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>());
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() == alloc);
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
+void test(const Allocator& alloc) {
+ typedef std::unordered_multiset<int, test_hash<int>, test_equal_to<int>, Allocator> C;
+ int a[] = {1, 2, 3, 4, 1, 2};
+ C c(cpp17_input_iterator<int*>(a), cpp17_input_iterator<int*>(a + sizeof(a) / sizeof(a[0])), 7, alloc);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>());
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == alloc);
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
}
-int main(int, char**)
-{
- test(test_allocator<int>(10));
- test(min_allocator<int>());
- test(explicit_allocator<int>());
+int main(int, char**) {
+ test(test_allocator<int>(10));
+ test(min_allocator<int>());
+ test(explicit_allocator<int>());
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/iter_iter_size_hash.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/iter_iter_size_hash.pass.cpp
index 7db30cf91dc73a6..667b026e23259fd 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/iter_iter_size_hash.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/iter_iter_size_hash.pass.cpp
@@ -29,79 +29,48 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<int,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<int>
- > C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
- 7,
- test_hash<int>(8)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- assert(c.count(1) == 2);
- assert(c.count(2) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() == test_allocator<int>());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<int, test_hash<int>, test_equal_to<int>, test_allocator<int> > C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])), 7, test_hash<int>(8));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == test_allocator<int>());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multiset<int,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<int>
- > C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
- 7,
- test_hash<int>(8)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- assert(c.count(1) == 2);
- assert(c.count(2) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() == min_allocator<int>());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+ {
+ typedef std::unordered_multiset<int, test_hash<int>, test_equal_to<int>, min_allocator<int> > C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])), 7, test_hash<int>(8));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/iter_iter_size_hash_allocator.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/iter_iter_size_hash_allocator.pass.cpp
index 34341b26a79a6bc..138af889d5978ba 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/iter_iter_size_hash_allocator.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/iter_iter_size_hash_allocator.pass.cpp
@@ -33,46 +33,33 @@
#include "min_allocator.h"
template <class Allocator>
-void test(const Allocator& alloc)
-{
- typedef std::unordered_multiset<int,
- test_hash<int>,
- test_equal_to<int>,
- Allocator> C;
- int a[] =
- {
- 1,
- 2,
- 3,
- 4,
- 1,
- 2
- };
- C c(cpp17_input_iterator<int*>(a), cpp17_input_iterator<int*>(a + sizeof(a)/sizeof(a[0])),
- 7,
- test_hash<int>(5),
- alloc
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- assert(c.count(1) == 2);
- assert(c.count(2) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(5));
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() == alloc);
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
+void test(const Allocator& alloc) {
+ typedef std::unordered_multiset<int, test_hash<int>, test_equal_to<int>, Allocator> C;
+ int a[] = {1, 2, 3, 4, 1, 2};
+ C c(cpp17_input_iterator<int*>(a),
+ cpp17_input_iterator<int*>(a + sizeof(a) / sizeof(a[0])),
+ 7,
+ test_hash<int>(5),
+ alloc);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(5));
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == alloc);
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
}
-int main(int, char**)
-{
- test(test_allocator<int>(10));
- test(min_allocator<int>());
- test(explicit_allocator<int>());
+int main(int, char**) {
+ test(test_allocator<int>(10));
+ test(min_allocator<int>());
+ test(explicit_allocator<int>());
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/iter_iter_size_hash_equal.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/iter_iter_size_hash_equal.pass.cpp
index dd2c09a7fcf9c2f..5de1ee93eb8665d 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/iter_iter_size_hash_equal.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/iter_iter_size_hash_equal.pass.cpp
@@ -29,81 +29,56 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<int,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<int>
- > C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- assert(c.count(1) == 2);
- assert(c.count(2) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == test_allocator<int>());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<int, test_hash<int>, test_equal_to<int>, test_allocator<int> > C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(cpp17_input_iterator<P*>(a),
+ cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])),
+ 7,
+ test_hash<int>(8),
+ test_equal_to<int>(9));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == test_allocator<int>());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multiset<int,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<int>
- > C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- assert(c.count(1) == 2);
- assert(c.count(2) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == min_allocator<int>());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+ {
+ typedef std::unordered_multiset<int, test_hash<int>, test_equal_to<int>, min_allocator<int> > C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(cpp17_input_iterator<P*>(a),
+ cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])),
+ 7,
+ test_hash<int>(8),
+ test_equal_to<int>(9));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/iter_iter_size_hash_equal_allocator.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/iter_iter_size_hash_equal_allocator.pass.cpp
index 996ebb873ce2e5b..2beb5125eb427e0 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/iter_iter_size_hash_equal_allocator.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/iter_iter_size_hash_equal_allocator.pass.cpp
@@ -30,83 +30,58 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<int,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<int>
- > C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- test_allocator<int>(10)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- assert(c.count(1) == 2);
- assert(c.count(2) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == test_allocator<int>(10));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<int, test_hash<int>, test_equal_to<int>, test_allocator<int> > C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(cpp17_input_iterator<P*>(a),
+ cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])),
+ 7,
+ test_hash<int>(8),
+ test_equal_to<int>(9),
+ test_allocator<int>(10));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == test_allocator<int>(10));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multiset<int,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<int>
- > C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- min_allocator<int>()
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- assert(c.count(1) == 2);
- assert(c.count(2) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == min_allocator<int>());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+ {
+ typedef std::unordered_multiset<int, test_hash<int>, test_equal_to<int>, min_allocator<int> > C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(cpp17_input_iterator<P*>(a),
+ cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])),
+ 7,
+ test_hash<int>(8),
+ test_equal_to<int>(9),
+ min_allocator<int>());
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move.pass.cpp
index 4d4881b61f34950..09a9b424389f89d 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move.pass.cpp
@@ -28,142 +28,91 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<int,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<int>
- > C;
- C c0(7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- test_allocator<int>(10)
- );
- C c = std::move(c0);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 0);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == test_allocator<int>(10));
- assert(c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<int, test_hash<int>, test_equal_to<int>, test_allocator<int> > C;
+ C c0(7, test_hash<int>(8), test_equal_to<int>(9), test_allocator<int>(10));
+ C c = std::move(c0);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 0);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == test_allocator<int>(10));
+ assert(c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
- assert(c0.empty());
- }
- {
- typedef std::unordered_multiset<int,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<int>
- > C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- test_allocator<int>(10)
- );
- C::iterator it0 = c0.begin();
- C c = std::move(c0);
- assert(it0 == c.begin()); // Iterators remain valid
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- assert(c.count(1) == 2);
- assert(c.count(2) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == test_allocator<int>(10));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
+ assert(c0.empty());
+ }
+ {
+ typedef std::unordered_multiset<int, test_hash<int>, test_equal_to<int>, test_allocator<int> > C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), test_allocator<int>(10));
+ C::iterator it0 = c0.begin();
+ C c = std::move(c0);
+ assert(it0 == c.begin()); // Iterators remain valid
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == test_allocator<int>(10));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
- assert(c0.empty());
- }
- {
- typedef std::unordered_multiset<int,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<int>
- > C;
- C c0(7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- min_allocator<int>()
- );
- C c = std::move(c0);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 0);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == min_allocator<int>());
- assert(c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
+ assert(c0.empty());
+ }
+ {
+ typedef std::unordered_multiset<int, test_hash<int>, test_equal_to<int>, min_allocator<int> > C;
+ C c0(7, test_hash<int>(8), test_equal_to<int>(9), min_allocator<int>());
+ C c = std::move(c0);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 0);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
- assert(c0.empty());
- }
- {
- typedef std::unordered_multiset<int,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<int>
- > C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- min_allocator<int>()
- );
- C::iterator it0 = c0.begin();
- C c = std::move(c0);
- assert(it0 == c.begin()); // Iterators remain valid
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- assert(c.count(1) == 2);
- assert(c.count(2) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == min_allocator<int>());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
+ assert(c0.empty());
+ }
+ {
+ typedef std::unordered_multiset<int, test_hash<int>, test_equal_to<int>, min_allocator<int> > C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), min_allocator<int>());
+ C::iterator it0 = c0.begin();
+ C c = std::move(c0);
+ assert(it0 == c.begin()); // Iterators remain valid
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
- assert(c0.empty());
- }
+ assert(c0.empty());
+ }
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_alloc.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_alloc.pass.cpp
index a2b6c3f7bb1c6f6..10143d8745017c0 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_alloc.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_alloc.pass.cpp
@@ -29,172 +29,103 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef int P;
- typedef test_allocator<int> A;
- typedef std::unordered_multiset<int,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A(10)
- );
- C c(std::move(c0), A(12));
- assert(c.bucket_count() >= 7);
- assert(c.size() == 6);
- CheckConsecutiveValues<C::const_iterator>(c.find(1), c.end(), 1, 2);
- CheckConsecutiveValues<C::const_iterator>(c.find(2), c.end(), 2, 2);
- CheckConsecutiveValues<C::const_iterator>(c.find(3), c.end(), 3, 1);
- CheckConsecutiveValues<C::const_iterator>(c.find(4), c.end(), 4, 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == A(12));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
+int main(int, char**) {
+ {
+ typedef int P;
+ typedef test_allocator<int> A;
+ typedef std::unordered_multiset<int, test_hash<int>, test_equal_to<int>, A > C;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), A(10));
+ C c(std::move(c0), A(12));
+ assert(c.bucket_count() >= 7);
+ assert(c.size() == 6);
+ CheckConsecutiveValues<C::const_iterator>(c.find(1), c.end(), 1, 2);
+ CheckConsecutiveValues<C::const_iterator>(c.find(2), c.end(), 2, 2);
+ CheckConsecutiveValues<C::const_iterator>(c.find(3), c.end(), 3, 1);
+ CheckConsecutiveValues<C::const_iterator>(c.find(4), c.end(), 4, 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == A(12));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
- assert(c0.empty());
- }
- {
- typedef int P;
- typedef test_allocator<int> A;
- typedef std::unordered_multiset<int,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A(10)
- );
- C c(std::move(c0), A(10));
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- assert(c.count(1) == 2);
- assert(c.count(2) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == A(10));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
+ assert(c0.empty());
+ }
+ {
+ typedef int P;
+ typedef test_allocator<int> A;
+ typedef std::unordered_multiset<int, test_hash<int>, test_equal_to<int>, A > C;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), A(10));
+ C c(std::move(c0), A(10));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == A(10));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
- assert(c0.empty());
- }
- {
- typedef int P;
- typedef min_allocator<int> A;
- typedef std::unordered_multiset<int,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A()
- );
- C c(std::move(c0), A());
- assert(c.bucket_count() >= 7);
- assert(c.size() == 6);
- assert(c.count(1) == 2);
- assert(c.count(2) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == A());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
+ assert(c0.empty());
+ }
+ {
+ typedef int P;
+ typedef min_allocator<int> A;
+ typedef std::unordered_multiset<int, test_hash<int>, test_equal_to<int>, A > C;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), A());
+ C c(std::move(c0), A());
+ assert(c.bucket_count() >= 7);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == A());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
- assert(c0.empty());
- }
- {
- typedef int P;
- typedef min_allocator<int> A;
- typedef std::unordered_multiset<int,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A()
- );
- C c(std::move(c0), A());
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 6);
- assert(c.count(1) == 2);
- assert(c.count(2) == 2);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == A());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
+ assert(c0.empty());
+ }
+ {
+ typedef int P;
+ typedef min_allocator<int> A;
+ typedef std::unordered_multiset<int, test_hash<int>, test_equal_to<int>, A > C;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), A());
+ C c(std::move(c0), A());
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == A());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
- assert(c0.empty());
- }
+ assert(c0.empty());
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_noexcept.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_noexcept.pass.cpp
index 8e6e4643c88b3ad..4024fd68622c41f 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_noexcept.pass.cpp
@@ -24,49 +24,44 @@
#include "test_allocator.h"
template <class T>
-struct some_comp
-{
- typedef T value_type;
- some_comp(const some_comp&);
- bool operator()(const T&, const T&) const { return false; }
+struct some_comp {
+ typedef T value_type;
+ some_comp(const some_comp&);
+ bool operator()(const T&, const T&) const { return false; }
};
template <class T>
-struct some_hash
-{
- typedef T value_type;
- some_hash();
- some_hash(const some_hash&);
- std::size_t operator()(T const&) const;
+struct some_hash {
+ typedef T value_type;
+ some_hash();
+ some_hash(const some_hash&);
+ std::size_t operator()(T const&) const;
};
-int main(int, char**)
-{
+int main(int, char**) {
#if defined(_LIBCPP_VERSION)
- {
- typedef std::unordered_multiset<MoveOnly> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
- }
- {
- typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, test_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
- }
- {
- typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, other_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
- }
+ {
+ typedef std::unordered_multiset<MoveOnly> C;
+ static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ }
+ {
+ typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>, std::equal_to<MoveOnly>, test_allocator<MoveOnly>> C;
+ static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ }
+ {
+ typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>, std::equal_to<MoveOnly>, other_allocator<MoveOnly>>
+ C;
+ static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ }
#endif // _LIBCPP_VERSION
- {
- typedef std::unordered_multiset<MoveOnly, some_hash<MoveOnly>> C;
- static_assert(!std::is_nothrow_move_constructible<C>::value, "");
- }
- {
- typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>,
- some_comp<MoveOnly>> C;
- static_assert(!std::is_nothrow_move_constructible<C>::value, "");
- }
+ {
+ typedef std::unordered_multiset<MoveOnly, some_hash<MoveOnly>> C;
+ static_assert(!std::is_nothrow_move_constructible<C>::value, "");
+ }
+ {
+ typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>, some_comp<MoveOnly>> C;
+ static_assert(!std::is_nothrow_move_constructible<C>::value, "");
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size.compile.fail.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size.compile.fail.cpp
index bd41c6d97543530..09448fe6be7e4c9 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size.compile.fail.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size.compile.fail.cpp
@@ -24,43 +24,42 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- test_allocator<NotConstructible>
- > C;
- C c = 7;
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.hash_function() == test_hash<NotConstructible>());
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() == (test_allocator<NotConstructible>()));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ test_allocator<NotConstructible> >
+ C;
+ C c = 7;
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<NotConstructible>());
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == (test_allocator<NotConstructible>()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multiset<NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- min_allocator<NotConstructible>
- > C;
- C c = 7;
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.hash_function() == test_hash<NotConstructible>());
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() == (min_allocator<NotConstructible>()));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+ {
+ typedef std::unordered_multiset<NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ min_allocator<NotConstructible> >
+ C;
+ C c = 7;
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<NotConstructible>());
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == (min_allocator<NotConstructible>()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size.pass.cpp
index 8d40f478cfeae23..870a0bce2ad731b 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size.pass.cpp
@@ -24,43 +24,42 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- test_allocator<NotConstructible>
- > C;
- C c(7);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.hash_function() == test_hash<NotConstructible>());
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() == (test_allocator<NotConstructible>()));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ test_allocator<NotConstructible> >
+ C;
+ C c(7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<NotConstructible>());
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == (test_allocator<NotConstructible>()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multiset<NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- min_allocator<NotConstructible>
- > C;
- C c(7);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.hash_function() == test_hash<NotConstructible>());
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() == (min_allocator<NotConstructible>()));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+ {
+ typedef std::unordered_multiset<NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ min_allocator<NotConstructible> >
+ C;
+ C c(7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<NotConstructible>());
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == (min_allocator<NotConstructible>()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_allocator.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_allocator.pass.cpp
index 2855487d32062ce..e536644470122cc 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_allocator.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_allocator.pass.cpp
@@ -28,29 +28,26 @@
#include "min_allocator.h"
template <class Allocator>
-void test(const Allocator& alloc)
-{
- typedef std::unordered_multiset<NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- Allocator> C;
- C c(7, alloc);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.hash_function() == test_hash<NotConstructible>());
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() == alloc);
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
+void test(const Allocator& alloc) {
+ typedef std::
+ unordered_multiset<NotConstructible, test_hash<NotConstructible>, test_equal_to<NotConstructible>, Allocator>
+ C;
+ C c(7, alloc);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<NotConstructible>());
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == alloc);
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
}
-int main(int, char**)
-{
- test(test_allocator<NotConstructible>(10));
- test(min_allocator<NotConstructible>());
- test(explicit_allocator<NotConstructible>());
+int main(int, char**) {
+ test(test_allocator<NotConstructible>(10));
+ test(min_allocator<NotConstructible>());
+ test(explicit_allocator<NotConstructible>());
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash.pass.cpp
index 58f84dfd02b61f4..def11f4a0cde7b8 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash.pass.cpp
@@ -24,47 +24,42 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- test_allocator<NotConstructible>
- > C;
- C c(7,
- test_hash<NotConstructible>(8)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.hash_function() == test_hash<NotConstructible>(8));
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() == (test_allocator<NotConstructible>()));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ test_allocator<NotConstructible> >
+ C;
+ C c(7, test_hash<NotConstructible>(8));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<NotConstructible>(8));
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == (test_allocator<NotConstructible>()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multiset<NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- min_allocator<NotConstructible>
- > C;
- C c(7,
- test_hash<NotConstructible>(8)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.hash_function() == test_hash<NotConstructible>(8));
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() == (min_allocator<NotConstructible>()));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+ {
+ typedef std::unordered_multiset<NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ min_allocator<NotConstructible> >
+ C;
+ C c(7, test_hash<NotConstructible>(8));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<NotConstructible>(8));
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == (min_allocator<NotConstructible>()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash_allocator.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash_allocator.pass.cpp
index 2c20093579b1522..6ea22dab1aac9a2 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash_allocator.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash_allocator.pass.cpp
@@ -28,29 +28,26 @@
#include "min_allocator.h"
template <class Allocator>
-void test(const Allocator& alloc)
-{
- typedef std::unordered_multiset<NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- Allocator> C;
- C c(7, test_hash<NotConstructible>(5), alloc);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.hash_function() == test_hash<NotConstructible>(5));
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() == alloc);
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
+void test(const Allocator& alloc) {
+ typedef std::
+ unordered_multiset<NotConstructible, test_hash<NotConstructible>, test_equal_to<NotConstructible>, Allocator>
+ C;
+ C c(7, test_hash<NotConstructible>(5), alloc);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<NotConstructible>(5));
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == alloc);
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
}
-int main(int, char**)
-{
- test(test_allocator<NotConstructible>(10));
- test(min_allocator<NotConstructible>());
- test(explicit_allocator<NotConstructible>());
+int main(int, char**) {
+ test(test_allocator<NotConstructible>(10));
+ test(min_allocator<NotConstructible>());
+ test(explicit_allocator<NotConstructible>());
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash_equal.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash_equal.pass.cpp
index 3e6130aff2cee21..1d3b6903e4d4227 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash_equal.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash_equal.pass.cpp
@@ -24,49 +24,42 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- test_allocator<NotConstructible>
- > C;
- C c(7,
- test_hash<NotConstructible>(8),
- test_equal_to<NotConstructible>(9)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.hash_function() == test_hash<NotConstructible>(8));
- assert(c.key_eq() == test_equal_to<NotConstructible>(9));
- assert(c.get_allocator() == (test_allocator<NotConstructible>()));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ test_allocator<NotConstructible> >
+ C;
+ C c(7, test_hash<NotConstructible>(8), test_equal_to<NotConstructible>(9));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<NotConstructible>(8));
+ assert(c.key_eq() == test_equal_to<NotConstructible>(9));
+ assert(c.get_allocator() == (test_allocator<NotConstructible>()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multiset<NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- min_allocator<NotConstructible>
- > C;
- C c(7,
- test_hash<NotConstructible>(8),
- test_equal_to<NotConstructible>(9)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.hash_function() == test_hash<NotConstructible>(8));
- assert(c.key_eq() == test_equal_to<NotConstructible>(9));
- assert(c.get_allocator() == (min_allocator<NotConstructible>()));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+ {
+ typedef std::unordered_multiset<NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ min_allocator<NotConstructible> >
+ C;
+ C c(7, test_hash<NotConstructible>(8), test_equal_to<NotConstructible>(9));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<NotConstructible>(8));
+ assert(c.key_eq() == test_equal_to<NotConstructible>(9));
+ assert(c.get_allocator() == (min_allocator<NotConstructible>()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash_equal_allocator.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash_equal_allocator.pass.cpp
index c64fb8d33a0b3f2..ebe6df57f480ebe 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash_equal_allocator.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash_equal_allocator.pass.cpp
@@ -24,51 +24,48 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- test_allocator<NotConstructible>
- > C;
- C c(7,
- test_hash<NotConstructible>(8),
- test_equal_to<NotConstructible>(9),
- test_allocator<std::pair<const NotConstructible, NotConstructible> >(10)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.hash_function() == test_hash<NotConstructible>(8));
- assert(c.key_eq() == test_equal_to<NotConstructible>(9));
- assert(c.get_allocator() == (test_allocator<NotConstructible>(10)));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ test_allocator<NotConstructible> >
+ C;
+ C c(7,
+ test_hash<NotConstructible>(8),
+ test_equal_to<NotConstructible>(9),
+ test_allocator<std::pair<const NotConstructible, NotConstructible> >(10));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<NotConstructible>(8));
+ assert(c.key_eq() == test_equal_to<NotConstructible>(9));
+ assert(c.get_allocator() == (test_allocator<NotConstructible>(10)));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_multiset<NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- min_allocator<NotConstructible>
- > C;
- C c(7,
- test_hash<NotConstructible>(8),
- test_equal_to<NotConstructible>(9),
- min_allocator<std::pair<const NotConstructible, NotConstructible> >()
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.hash_function() == test_hash<NotConstructible>(8));
- assert(c.key_eq() == test_equal_to<NotConstructible>(9));
- assert(c.get_allocator() == (min_allocator<NotConstructible>()));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+ {
+ typedef std::unordered_multiset<NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ min_allocator<NotConstructible> >
+ C;
+ C c(7,
+ test_hash<NotConstructible>(8),
+ test_equal_to<NotConstructible>(9),
+ min_allocator<std::pair<const NotConstructible, NotConstructible> >());
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<NotConstructible>(8));
+ assert(c.key_eq() == test_equal_to<NotConstructible>(9));
+ assert(c.get_allocator() == (min_allocator<NotConstructible>()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_noexcept.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_noexcept.pass.cpp
index 057e5bb32ace75b..c510d70f090c22f 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_noexcept.pass.cpp
@@ -33,23 +33,21 @@
#include "test_allocator.h"
template <class T>
-struct some_comp
-{
- typedef T value_type;
+struct some_comp {
+ typedef T value_type;
- some_comp() {}
- some_comp(const some_comp&) {}
- bool operator()(const T&, const T&) const { return false; }
+ some_comp() {}
+ some_comp(const some_comp&) {}
+ bool operator()(const T&, const T&) const { return false; }
};
template <class T>
-struct some_comp2
-{
- typedef T value_type;
+struct some_comp2 {
+ typedef T value_type;
- some_comp2() {}
- some_comp2(const some_comp2&) {}
- bool operator()(const T&, const T&) const { return false; }
+ some_comp2() {}
+ some_comp2(const some_comp2&) {}
+ bool operator()(const T&, const T&) const { return false; }
};
#if TEST_STD_VER >= 14
@@ -58,21 +56,19 @@ void swap(some_comp2<T>&, some_comp2<T>&) noexcept {}
#endif
template <class T>
-struct some_hash
-{
- typedef T value_type;
- some_hash() {}
- some_hash(const some_hash&);
- std::size_t operator()(const T&) const { return 0; }
+struct some_hash {
+ typedef T value_type;
+ some_hash() {}
+ some_hash(const some_hash&);
+ std::size_t operator()(const T&) const { return 0; }
};
template <class T>
-struct some_hash2
-{
- typedef T value_type;
- some_hash2() {}
- some_hash2(const some_hash2&);
- std::size_t operator()(const T&) const { return 0; }
+struct some_hash2 {
+ typedef T value_type;
+ some_hash2() {}
+ some_hash2(const some_hash2&);
+ std::size_t operator()(const T&) const { return 0; }
};
#if TEST_STD_VER >= 14
@@ -81,110 +77,104 @@ void swap(some_hash2<T>&, some_hash2<T>&) noexcept {}
#endif
template <class T>
-struct some_alloc
-{
- typedef T value_type;
+struct some_alloc {
+ typedef T value_type;
- some_alloc() {}
- some_alloc(const some_alloc&);
- void deallocate(void*, unsigned) {}
+ some_alloc() {}
+ some_alloc(const some_alloc&);
+ void deallocate(void*, unsigned) {}
- typedef std::true_type propagate_on_container_swap;
+ typedef std::true_type propagate_on_container_swap;
};
template <class T>
-struct some_alloc2
-{
- typedef T value_type;
+struct some_alloc2 {
+ typedef T value_type;
- some_alloc2() {}
- some_alloc2(const some_alloc2&);
- void deallocate(void*, unsigned) {}
+ some_alloc2() {}
+ some_alloc2(const some_alloc2&);
+ void deallocate(void*, unsigned) {}
- typedef std::false_type propagate_on_container_swap;
- typedef std::true_type is_always_equal;
+ typedef std::false_type propagate_on_container_swap;
+ typedef std::true_type is_always_equal;
};
template <class T>
-struct some_alloc3
-{
- typedef T value_type;
+struct some_alloc3 {
+ typedef T value_type;
- some_alloc3() {}
- some_alloc3(const some_alloc3&);
- void deallocate(void*, unsigned) {}
+ some_alloc3() {}
+ some_alloc3(const some_alloc3&);
+ void deallocate(void*, unsigned) {}
- typedef std::false_type propagate_on_container_swap;
- typedef std::false_type is_always_equal;
+ typedef std::false_type propagate_on_container_swap;
+ typedef std::false_type is_always_equal;
};
-int main(int, char**)
-{
- {
- typedef std::unordered_multiset<MoveOnly> C;
- static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_multiset<MoveOnly> C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
#if defined(_LIBCPP_VERSION)
- {
- typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, test_allocator<MoveOnly>> C;
- static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- {
- typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, other_allocator<MoveOnly>> C;
- static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
+ {
+ typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>, std::equal_to<MoveOnly>, test_allocator<MoveOnly>> C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
+ {
+ typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>, std::equal_to<MoveOnly>, other_allocator<MoveOnly>>
+ C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
#endif // _LIBCPP_VERSION
- {
- typedef std::unordered_multiset<MoveOnly, some_hash<MoveOnly>> C;
- static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- {
- typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>,
- some_comp<MoveOnly>> C;
- static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
+ {
+ typedef std::unordered_multiset<MoveOnly, some_hash<MoveOnly>> C;
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
+ {
+ typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>, some_comp<MoveOnly>> C;
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
#if TEST_STD_VER >= 14
- { // POCS allocator, throwable swap for hash, throwable swap for comp
- typedef std::unordered_multiset<MoveOnly, some_hash<MoveOnly>, some_comp <MoveOnly>, some_alloc <MoveOnly>> C;
+ { // POCS allocator, throwable swap for hash, throwable swap for comp
+ typedef std::unordered_multiset<MoveOnly, some_hash<MoveOnly>, some_comp<MoveOnly>, some_alloc<MoveOnly>> C;
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- { // always equal allocator, throwable swap for hash, throwable swap for comp
- typedef std::unordered_multiset<MoveOnly, some_hash<MoveOnly>, some_comp <MoveOnly>, some_alloc2<MoveOnly>> C;
+ }
+ { // always equal allocator, throwable swap for hash, throwable swap for comp
+ typedef std::unordered_multiset<MoveOnly, some_hash<MoveOnly>, some_comp<MoveOnly>, some_alloc2<MoveOnly>> C;
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- { // POCS allocator, throwable swap for hash, nothrow swap for comp
- typedef std::unordered_multiset<MoveOnly, some_hash<MoveOnly>, some_comp2<MoveOnly>, some_alloc <MoveOnly>> C;
+ }
+ { // POCS allocator, throwable swap for hash, nothrow swap for comp
+ typedef std::unordered_multiset<MoveOnly, some_hash<MoveOnly>, some_comp2<MoveOnly>, some_alloc<MoveOnly>> C;
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- { // always equal allocator, throwable swap for hash, nothrow swap for comp
+ }
+ { // always equal allocator, throwable swap for hash, nothrow swap for comp
typedef std::unordered_multiset<MoveOnly, some_hash<MoveOnly>, some_comp2<MoveOnly>, some_alloc2<MoveOnly>> C;
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- { // POCS allocator, nothrow swap for hash, throwable swap for comp
- typedef std::unordered_multiset<MoveOnly, some_hash2<MoveOnly>, some_comp <MoveOnly>, some_alloc <MoveOnly>> C;
+ }
+ { // POCS allocator, nothrow swap for hash, throwable swap for comp
+ typedef std::unordered_multiset<MoveOnly, some_hash2<MoveOnly>, some_comp<MoveOnly>, some_alloc<MoveOnly>> C;
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- { // always equal allocator, nothrow swap for hash, throwable swap for comp
- typedef std::unordered_multiset<MoveOnly, some_hash2<MoveOnly>, some_comp <MoveOnly>, some_alloc2<MoveOnly>> C;
+ }
+ { // always equal allocator, nothrow swap for hash, throwable swap for comp
+ typedef std::unordered_multiset<MoveOnly, some_hash2<MoveOnly>, some_comp<MoveOnly>, some_alloc2<MoveOnly>> C;
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- { // POCS allocator, nothrow swap for hash, nothrow swap for comp
- typedef std::unordered_multiset<MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc <MoveOnly>> C;
- static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- { // always equal allocator, nothrow swap for hash, nothrow swap for comp
+ }
+ { // POCS allocator, nothrow swap for hash, nothrow swap for comp
+ typedef std::unordered_multiset<MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc<MoveOnly>> C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
+ { // always equal allocator, nothrow swap for hash, nothrow swap for comp
typedef std::unordered_multiset<MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc2<MoveOnly>> C;
- static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
-#if defined(_LIBCPP_VERSION)
- { // NOT always equal allocator, nothrow swap for hash, nothrow swap for comp
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
+# if defined(_LIBCPP_VERSION)
+ { // NOT always equal allocator, nothrow swap for hash, nothrow swap for comp
typedef std::unordered_multiset<MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc3<MoveOnly>> C;
- static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
-#endif // _LIBCPP_VERSION
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
+# endif // _LIBCPP_VERSION
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_non_member.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_non_member.pass.cpp
index 3b8aad272256c62..0665ad7dbfd1462 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_non_member.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_non_member.pass.cpp
@@ -24,555 +24,446 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef test_allocator<int> Alloc;
- typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
- C c1(0, Hash(1), Compare(1), Alloc(1, 1));
- C c2(0, Hash(2), Compare(2), Alloc(1, 2));
- c2.max_load_factor(2);
- swap(c1, c2);
-
- LIBCPP_ASSERT(c1.bucket_count() == 0);
- assert(c1.size() == 0);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator().get_id() == 1);
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- LIBCPP_ASSERT(c2.bucket_count() == 0);
- assert(c2.size() == 0);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator().get_id() == 2);
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef test_allocator<int> Alloc;
- typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
- typedef int P;
- P a2[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- C c1(0, Hash(1), Compare(1), Alloc(1, 1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
- c2.max_load_factor(2);
- C::iterator it2 = c2.begin();
- swap(c1, c2);
-
- assert(c1.bucket_count() >= 8);
- assert(c1.size() == 8);
- assert(*c1.find(10) == 10);
- assert(*c1.find(20) == 20);
- assert(*c1.find(30) == 30);
- assert(*c1.find(40) == 40);
- assert(*c1.find(50) == 50);
- assert(*c1.find(60) == 60);
- assert(*c1.find(70) == 70);
- assert(*c1.find(80) == 80);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator().get_id() == 1);
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
- assert(it2 == c1.begin()); // Iterators are not invalidated
-
- LIBCPP_ASSERT(c2.bucket_count() == 0);
- assert(c2.size() == 0);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator().get_id() == 2);
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef test_allocator<int> Alloc;
- typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
- typedef int P;
- P a1[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
- C c2(0, Hash(2), Compare(2), Alloc(1, 2));
- c2.max_load_factor(2);
- C::iterator it1 = c1.begin();
- swap(c1, c2);
-
- LIBCPP_ASSERT(c1.bucket_count() == 0);
- assert(c1.size() == 0);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator().get_id() == 1);
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- assert(c2.bucket_count() >= 6);
- assert(c2.size() == 6);
- assert(c2.count(1) == 2);
- assert(c2.count(2) == 2);
- assert(c2.count(3) == 1);
- assert(c2.count(4) == 1);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator().get_id() == 2);
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- assert(it1 == c2.begin()); // Iterators are not invalidated
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef test_allocator<int> Alloc;
- typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
- typedef int P;
- P a1[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- P a2[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
- c2.max_load_factor(2);
- C::iterator it1 = c1.begin();
- C::iterator it2 = c2.begin();
- swap(c1, c2);
-
- assert(c1.bucket_count() >= 8);
- assert(c1.size() == 8);
- assert(*c1.find(10) == 10);
- assert(*c1.find(20) == 20);
- assert(*c1.find(30) == 30);
- assert(*c1.find(40) == 40);
- assert(*c1.find(50) == 50);
- assert(*c1.find(60) == 60);
- assert(*c1.find(70) == 70);
- assert(*c1.find(80) == 80);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator().get_id() == 1);
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
- assert(it2 == c1.begin()); // Iterators are not invalidated
-
- assert(c2.bucket_count() >= 6);
- assert(c2.size() == 6);
- assert(c2.count(1) == 2);
- assert(c2.count(2) == 2);
- assert(c2.count(3) == 1);
- assert(c2.count(4) == 1);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator().get_id() == 2);
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- assert(it1 == c2.begin()); // Iterators are not invalidated
- }
-
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef other_allocator<int> Alloc;
- typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
- C c1(0, Hash(1), Compare(1), Alloc(1));
- C c2(0, Hash(2), Compare(2), Alloc(2));
- c2.max_load_factor(2);
- swap(c1, c2);
-
- LIBCPP_ASSERT(c1.bucket_count() == 0);
- assert(c1.size() == 0);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(2));
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- LIBCPP_ASSERT(c2.bucket_count() == 0);
- assert(c2.size() == 0);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(1));
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef other_allocator<int> Alloc;
- typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
- typedef int P;
- P a2[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- C c1(0, Hash(1), Compare(1), Alloc(1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
- c2.max_load_factor(2);
- swap(c1, c2);
-
- assert(c1.bucket_count() >= 8);
- assert(c1.size() == 8);
- assert(*c1.find(10) == 10);
- assert(*c1.find(20) == 20);
- assert(*c1.find(30) == 30);
- assert(*c1.find(40) == 40);
- assert(*c1.find(50) == 50);
- assert(*c1.find(60) == 60);
- assert(*c1.find(70) == 70);
- assert(*c1.find(80) == 80);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(2));
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- LIBCPP_ASSERT(c2.bucket_count() == 0);
- assert(c2.size() == 0);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(1));
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef other_allocator<int> Alloc;
- typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
- typedef int P;
- P a1[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
- C c2(0, Hash(2), Compare(2), Alloc(2));
- c2.max_load_factor(2);
- swap(c1, c2);
-
- LIBCPP_ASSERT(c1.bucket_count() == 0);
- assert(c1.size() == 0);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(2));
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- assert(c2.bucket_count() >= 6);
- assert(c2.size() == 6);
- assert(c2.count(1) == 2);
- assert(c2.count(2) == 2);
- assert(c2.count(3) == 1);
- assert(c2.count(4) == 1);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(1));
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef other_allocator<int> Alloc;
- typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
- typedef int P;
- P a1[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- P a2[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
- c2.max_load_factor(2);
- swap(c1, c2);
-
- assert(c1.bucket_count() >= 8);
- assert(c1.size() == 8);
- assert(*c1.find(10) == 10);
- assert(*c1.find(20) == 20);
- assert(*c1.find(30) == 30);
- assert(*c1.find(40) == 40);
- assert(*c1.find(50) == 50);
- assert(*c1.find(60) == 60);
- assert(*c1.find(70) == 70);
- assert(*c1.find(80) == 80);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(2));
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- assert(c2.bucket_count() >= 6);
- assert(c2.size() == 6);
- assert(c2.count(1) == 2);
- assert(c2.count(2) == 2);
- assert(c2.count(3) == 1);
- assert(c2.count(4) == 1);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(1));
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef test_allocator<int> Alloc;
+ typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
+ C c1(0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(0, Hash(2), Compare(2), Alloc(1, 2));
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ LIBCPP_ASSERT(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ LIBCPP_ASSERT(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef test_allocator<int> Alloc;
+ typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ P a2[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)};
+ C c1(0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
+ c2.max_load_factor(2);
+ C::iterator it2 = c2.begin();
+ swap(c1, c2);
+
+ assert(c1.bucket_count() >= 8);
+ assert(c1.size() == 8);
+ assert(*c1.find(10) == 10);
+ assert(*c1.find(20) == 20);
+ assert(*c1.find(30) == 30);
+ assert(*c1.find(40) == 40);
+ assert(*c1.find(50) == 50);
+ assert(*c1.find(60) == 60);
+ assert(*c1.find(70) == 70);
+ assert(*c1.find(80) == 80);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+ assert(it2 == c1.begin()); // Iterators are not invalidated
+
+ LIBCPP_ASSERT(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef test_allocator<int> Alloc;
+ typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ P a1[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(0, Hash(2), Compare(2), Alloc(1, 2));
+ c2.max_load_factor(2);
+ C::iterator it1 = c1.begin();
+ swap(c1, c2);
+
+ LIBCPP_ASSERT(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 6);
+ assert(c2.size() == 6);
+ assert(c2.count(1) == 2);
+ assert(c2.count(2) == 2);
+ assert(c2.count(3) == 1);
+ assert(c2.count(4) == 1);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ assert(it1 == c2.begin()); // Iterators are not invalidated
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef test_allocator<int> Alloc;
+ typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ P a1[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ P a2[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)};
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
+ c2.max_load_factor(2);
+ C::iterator it1 = c1.begin();
+ C::iterator it2 = c2.begin();
+ swap(c1, c2);
+
+ assert(c1.bucket_count() >= 8);
+ assert(c1.size() == 8);
+ assert(*c1.find(10) == 10);
+ assert(*c1.find(20) == 20);
+ assert(*c1.find(30) == 30);
+ assert(*c1.find(40) == 40);
+ assert(*c1.find(50) == 50);
+ assert(*c1.find(60) == 60);
+ assert(*c1.find(70) == 70);
+ assert(*c1.find(80) == 80);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+ assert(it2 == c1.begin()); // Iterators are not invalidated
+
+ assert(c2.bucket_count() >= 6);
+ assert(c2.size() == 6);
+ assert(c2.count(1) == 2);
+ assert(c2.count(2) == 2);
+ assert(c2.count(3) == 1);
+ assert(c2.count(4) == 1);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ assert(it1 == c2.begin()); // Iterators are not invalidated
+ }
+
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef other_allocator<int> Alloc;
+ typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
+ C c1(0, Hash(1), Compare(1), Alloc(1));
+ C c2(0, Hash(2), Compare(2), Alloc(2));
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ LIBCPP_ASSERT(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc(2));
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ LIBCPP_ASSERT(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc(1));
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef other_allocator<int> Alloc;
+ typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ P a2[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)};
+ C c1(0, Hash(1), Compare(1), Alloc(1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ assert(c1.bucket_count() >= 8);
+ assert(c1.size() == 8);
+ assert(*c1.find(10) == 10);
+ assert(*c1.find(20) == 20);
+ assert(*c1.find(30) == 30);
+ assert(*c1.find(40) == 40);
+ assert(*c1.find(50) == 50);
+ assert(*c1.find(60) == 60);
+ assert(*c1.find(70) == 70);
+ assert(*c1.find(80) == 80);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc(2));
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ LIBCPP_ASSERT(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc(1));
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef other_allocator<int> Alloc;
+ typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ P a1[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
+ C c2(0, Hash(2), Compare(2), Alloc(2));
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ LIBCPP_ASSERT(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc(2));
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 6);
+ assert(c2.size() == 6);
+ assert(c2.count(1) == 2);
+ assert(c2.count(2) == 2);
+ assert(c2.count(3) == 1);
+ assert(c2.count(4) == 1);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc(1));
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef other_allocator<int> Alloc;
+ typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ P a1[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ P a2[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)};
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ assert(c1.bucket_count() >= 8);
+ assert(c1.size() == 8);
+ assert(*c1.find(10) == 10);
+ assert(*c1.find(20) == 20);
+ assert(*c1.find(30) == 30);
+ assert(*c1.find(40) == 40);
+ assert(*c1.find(50) == 50);
+ assert(*c1.find(60) == 60);
+ assert(*c1.find(70) == 70);
+ assert(*c1.find(80) == 80);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc(2));
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 6);
+ assert(c2.size() == 6);
+ assert(c2.count(1) == 2);
+ assert(c2.count(2) == 2);
+ assert(c2.count(3) == 1);
+ assert(c2.count(4) == 1);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc(1));
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef min_allocator<int> Alloc;
- typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
- C c1(0, Hash(1), Compare(1), Alloc());
- C c2(0, Hash(2), Compare(2), Alloc());
- c2.max_load_factor(2);
- swap(c1, c2);
-
- LIBCPP_ASSERT(c1.bucket_count() == 0);
- assert(c1.size() == 0);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- LIBCPP_ASSERT(c2.bucket_count() == 0);
- assert(c2.size() == 0);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef min_allocator<int> Alloc;
- typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
- typedef int P;
- P a2[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- C c1(0, Hash(1), Compare(1), Alloc());
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
- c2.max_load_factor(2);
- swap(c1, c2);
-
- assert(c1.bucket_count() >= 8);
- assert(c1.size() == 8);
- assert(*c1.find(10) == 10);
- assert(*c1.find(20) == 20);
- assert(*c1.find(30) == 30);
- assert(*c1.find(40) == 40);
- assert(*c1.find(50) == 50);
- assert(*c1.find(60) == 60);
- assert(*c1.find(70) == 70);
- assert(*c1.find(80) == 80);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- LIBCPP_ASSERT(c2.bucket_count() == 0);
- assert(c2.size() == 0);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef min_allocator<int> Alloc;
- typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
- typedef int P;
- P a1[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
- C c2(0, Hash(2), Compare(2), Alloc());
- c2.max_load_factor(2);
- swap(c1, c2);
-
- LIBCPP_ASSERT(c1.bucket_count() == 0);
- assert(c1.size() == 0);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- assert(c2.bucket_count() >= 6);
- assert(c2.size() == 6);
- assert(c2.count(1) == 2);
- assert(c2.count(2) == 2);
- assert(c2.count(3) == 1);
- assert(c2.count(4) == 1);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef min_allocator<int> Alloc;
- typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
- typedef int P;
- P a1[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- P a2[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
- c2.max_load_factor(2);
- swap(c1, c2);
-
- assert(c1.bucket_count() >= 8);
- assert(c1.size() == 8);
- assert(*c1.find(10) == 10);
- assert(*c1.find(20) == 20);
- assert(*c1.find(30) == 30);
- assert(*c1.find(40) == 40);
- assert(*c1.find(50) == 50);
- assert(*c1.find(60) == 60);
- assert(*c1.find(70) == 70);
- assert(*c1.find(80) == 80);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- assert(c2.bucket_count() >= 6);
- assert(c2.size() == 6);
- assert(c2.count(1) == 2);
- assert(c2.count(2) == 2);
- assert(c2.count(3) == 1);
- assert(c2.count(4) == 1);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef min_allocator<int> Alloc;
+ typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
+ C c1(0, Hash(1), Compare(1), Alloc());
+ C c2(0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ LIBCPP_ASSERT(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ LIBCPP_ASSERT(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef min_allocator<int> Alloc;
+ typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ P a2[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)};
+ C c1(0, Hash(1), Compare(1), Alloc());
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ assert(c1.bucket_count() >= 8);
+ assert(c1.size() == 8);
+ assert(*c1.find(10) == 10);
+ assert(*c1.find(20) == 20);
+ assert(*c1.find(30) == 30);
+ assert(*c1.find(40) == 40);
+ assert(*c1.find(50) == 50);
+ assert(*c1.find(60) == 60);
+ assert(*c1.find(70) == 70);
+ assert(*c1.find(80) == 80);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ LIBCPP_ASSERT(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef min_allocator<int> Alloc;
+ typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ P a1[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
+ C c2(0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ LIBCPP_ASSERT(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 6);
+ assert(c2.size() == 6);
+ assert(c2.count(1) == 2);
+ assert(c2.count(2) == 2);
+ assert(c2.count(3) == 1);
+ assert(c2.count(4) == 1);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef min_allocator<int> Alloc;
+ typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ P a1[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ P a2[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)};
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ assert(c1.bucket_count() >= 8);
+ assert(c1.size() == 8);
+ assert(*c1.find(10) == 10);
+ assert(*c1.find(20) == 20);
+ assert(*c1.find(30) == 30);
+ assert(*c1.find(40) == 40);
+ assert(*c1.find(50) == 50);
+ assert(*c1.find(60) == 60);
+ assert(*c1.find(70) == 70);
+ assert(*c1.find(80) == 80);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 6);
+ assert(c2.size() == 6);
+ assert(c2.count(1) == 2);
+ assert(c2.count(2) == 2);
+ assert(c2.count(3) == 1);
+ assert(c2.count(4) == 1);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.set/allocator_mismatch.verify.cpp b/libcxx/test/std/containers/unord/unord.set/allocator_mismatch.verify.cpp
index 81469059a22711f..8b6cc8e93c8bc61 100644
--- a/libcxx/test/std/containers/unord/unord.set/allocator_mismatch.verify.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/allocator_mismatch.verify.cpp
@@ -12,4 +12,4 @@
#include <unordered_set>
std::unordered_set<int, std::hash<int>, std::less<int>, std::allocator<long> > v;
- // expected-error-re@*:* {{static assertion failed{{.*}}Allocator::value_type must be same type as value_type}}
+// expected-error-re@*:* {{static assertion failed{{.*}}Allocator::value_type must be same type as value_type}}
diff --git a/libcxx/test/std/containers/unord/unord.set/bucket.pass.cpp b/libcxx/test/std/containers/unord/unord.set/bucket.pass.cpp
index 969c3f6b93e74de..b7bb0153f19302f 100644
--- a/libcxx/test/std/containers/unord/unord.set/bucket.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/bucket.pass.cpp
@@ -20,46 +20,29 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_set<int> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- const C c(std::begin(a), std::end(a));
- std::size_t bc = c.bucket_count();
- assert(bc >= 5);
- for (std::size_t i = 0; i < 13; ++i)
- LIBCPP_ASSERT(c.bucket(i) == i % bc);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_set<int> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ const C c(std::begin(a), std::end(a));
+ std::size_t bc = c.bucket_count();
+ assert(bc >= 5);
+ for (std::size_t i = 0; i < 13; ++i)
+ LIBCPP_ASSERT(c.bucket(i) == i % bc);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- const C c(std::begin(a), std::end(a));
- std::size_t bc = c.bucket_count();
- assert(bc >= 5);
- for (std::size_t i = 0; i < 13; ++i)
- LIBCPP_ASSERT(c.bucket(i) == i % bc);
- }
+ {
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ const C c(std::begin(a), std::end(a));
+ std::size_t bc = c.bucket_count();
+ assert(bc >= 5);
+ for (std::size_t i = 0; i < 13; ++i)
+ LIBCPP_ASSERT(c.bucket(i) == i % bc);
+ }
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.set/bucket_count.pass.cpp b/libcxx/test/std/containers/unord/unord.set/bucket_count.pass.cpp
index 3a1a78cb3d80aa8..4d03857581bf243 100644
--- a/libcxx/test/std/containers/unord/unord.set/bucket_count.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/bucket_count.pass.cpp
@@ -20,53 +20,32 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_set<int> C;
- const C c;
- LIBCPP_ASSERT(c.bucket_count() == 0);
- }
- {
- typedef std::unordered_set<int> C;
- typedef int P;
- P a[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- const C c(std::begin(a), std::end(a));
- assert(c.bucket_count() >= 8);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_set<int> C;
+ const C c;
+ LIBCPP_ASSERT(c.bucket_count() == 0);
+ }
+ {
+ typedef std::unordered_set<int> C;
+ typedef int P;
+ P a[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)};
+ const C c(std::begin(a), std::end(a));
+ assert(c.bucket_count() >= 8);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
- const C c;
- LIBCPP_ASSERT(c.bucket_count() == 0);
- }
- {
- typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
- typedef int P;
- P a[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- const C c(std::begin(a), std::end(a));
- assert(c.bucket_count() >= 8);
- }
+ {
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ const C c;
+ LIBCPP_ASSERT(c.bucket_count() == 0);
+ }
+ {
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)};
+ const C c(std::begin(a), std::end(a));
+ assert(c.bucket_count() >= 8);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.set/bucket_size.pass.cpp b/libcxx/test/std/containers/unord/unord.set/bucket_size.pass.cpp
index 1016c499d6745f7..d44943fcdb272de 100644
--- a/libcxx/test/std/containers/unord/unord.set/bucket_size.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/bucket_size.pass.cpp
@@ -20,50 +20,33 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_set<int> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- const C c(std::begin(a), std::end(a));
- assert(c.bucket_count() >= 5);
- LIBCPP_ASSERT(c.bucket_size(0) == 0);
- LIBCPP_ASSERT(c.bucket_size(1) == 1);
- LIBCPP_ASSERT(c.bucket_size(2) == 1);
- LIBCPP_ASSERT(c.bucket_size(3) == 1);
- LIBCPP_ASSERT(c.bucket_size(4) == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_set<int> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ const C c(std::begin(a), std::end(a));
+ assert(c.bucket_count() >= 5);
+ LIBCPP_ASSERT(c.bucket_size(0) == 0);
+ LIBCPP_ASSERT(c.bucket_size(1) == 1);
+ LIBCPP_ASSERT(c.bucket_size(2) == 1);
+ LIBCPP_ASSERT(c.bucket_size(3) == 1);
+ LIBCPP_ASSERT(c.bucket_size(4) == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- const C c(std::begin(a), std::end(a));
- assert(c.bucket_count() >= 5);
- LIBCPP_ASSERT(c.bucket_size(0) == 0);
- LIBCPP_ASSERT(c.bucket_size(1) == 1);
- LIBCPP_ASSERT(c.bucket_size(2) == 1);
- LIBCPP_ASSERT(c.bucket_size(3) == 1);
- LIBCPP_ASSERT(c.bucket_size(4) == 1);
- }
+ {
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ const C c(std::begin(a), std::end(a));
+ assert(c.bucket_count() >= 5);
+ LIBCPP_ASSERT(c.bucket_size(0) == 0);
+ LIBCPP_ASSERT(c.bucket_size(1) == 1);
+ LIBCPP_ASSERT(c.bucket_size(2) == 1);
+ LIBCPP_ASSERT(c.bucket_size(3) == 1);
+ LIBCPP_ASSERT(c.bucket_size(4) == 1);
+ }
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.set/clear.pass.cpp b/libcxx/test/std/containers/unord/unord.set/clear.pass.cpp
index ab04cdd91059935..868790428707027 100644
--- a/libcxx/test/std/containers/unord/unord.set/clear.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/clear.pass.cpp
@@ -20,43 +20,26 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_set<int> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- ASSERT_NOEXCEPT(c.clear());
- c.clear();
- assert(c.size() == 0);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_set<int> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ ASSERT_NOEXCEPT(c.clear());
+ c.clear();
+ assert(c.size() == 0);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- ASSERT_NOEXCEPT(c.clear());
- c.clear();
- assert(c.size() == 0);
- }
+ {
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ ASSERT_NOEXCEPT(c.clear());
+ c.clear();
+ assert(c.size() == 0);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.set/contains.pass.cpp b/libcxx/test/std/containers/unord/unord.set/contains.pass.cpp
index c9b78368431df9b..7a4532f10f132c3 100644
--- a/libcxx/test/std/containers/unord/unord.set/contains.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/contains.pass.cpp
@@ -17,27 +17,32 @@
template <typename T, typename V, typename B, typename... Vals>
void test(B bad, Vals... args) {
- T set;
- V vals[] = {args...};
+ T set;
+ V vals[] = {args...};
- for (auto& v : vals) set.insert(v);
- for (auto& v : vals) assert(set.contains(v));
+ for (auto& v : vals)
+ set.insert(v);
+ for (auto& v : vals)
+ assert(set.contains(v));
- assert(!set.contains(bad));
+ assert(!set.contains(bad));
}
-struct E { int a = 1; double b = 1; char c = 1; };
-
-int main(int, char**)
-{
- {
- test<std::unordered_set<int>, int>(14, 10, 11, 12, 13);
- test<std::unordered_set<char>, char>('e', 'a', 'b', 'c', 'd');
- }
- {
- test<std::unordered_multiset<int>, int>(14, 10, 11, 12, 13);
- test<std::unordered_multiset<char>, char>('e', 'a', 'b', 'c', 'd');
- }
-
- return 0;
+struct E {
+ int a = 1;
+ double b = 1;
+ char c = 1;
+};
+
+int main(int, char**) {
+ {
+ test<std::unordered_set<int>, int>(14, 10, 11, 12, 13);
+ test<std::unordered_set<char>, char>('e', 'a', 'b', 'c', 'd');
+ }
+ {
+ test<std::unordered_multiset<int>, int>(14, 10, 11, 12, 13);
+ test<std::unordered_multiset<char>, char>('e', 'a', 'b', 'c', 'd');
+ }
+
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.set/contains.transparent.pass.cpp b/libcxx/test/std/containers/unord/unord.set/contains.transparent.pass.cpp
index 78908053aa2f5ed..5b685dad1c37653 100644
--- a/libcxx/test/std/containers/unord/unord.set/contains.transparent.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/contains.transparent.pass.cpp
@@ -20,44 +20,43 @@
#include <unordered_set>
#include "test_transparent_unordered.h"
-int main(int, char**)
-{
- using key_type = StoredType<int>;
-
- {
- // Make sure conversions don't happen for transparent non-final hasher and key_equal
- using S = unord_set_type<std::unordered_set, transparent_hash, std::equal_to<>>;
- test_transparent_contains<S>({1, 2});
- test_transparent_contains<const S>({1, 2});
- }
-
- {
- // Make sure conversions don't happen for transparent final hasher and key_equal
- using S = unord_set_type<std::unordered_set, transparent_hash_final, transparent_equal_final>;
- test_transparent_contains<S>({1, 2});
- test_transparent_contains<const S>({1, 2});
- }
-
- {
- // Make sure conversions do happen for non-transparent hasher
- using S = unord_set_type<std::unordered_set, non_transparent_hash, std::equal_to<>>;
- test_non_transparent_contains<S>({1, 2});
- test_non_transparent_contains<const S>({1, 2});
- }
-
- {
- // Make sure conversions do happen for non-transparent key_equal
- using S = unord_set_type<std::unordered_set, transparent_hash, std::equal_to<key_type>>;
- test_non_transparent_contains<S>({1, 2});
- test_non_transparent_contains<const S>({1, 2});
- }
-
- {
- // Make sure conversions do happen for both non-transparent hasher and key_equal
- using S = unord_set_type<std::unordered_set, non_transparent_hash, std::equal_to<key_type>>;
- test_non_transparent_contains<S>({1, 2});
- test_non_transparent_contains<const S>({1, 2});
- }
-
- return 0;
+int main(int, char**) {
+ using key_type = StoredType<int>;
+
+ {
+ // Make sure conversions don't happen for transparent non-final hasher and key_equal
+ using S = unord_set_type<std::unordered_set, transparent_hash, std::equal_to<>>;
+ test_transparent_contains<S>({1, 2});
+ test_transparent_contains<const S>({1, 2});
+ }
+
+ {
+ // Make sure conversions don't happen for transparent final hasher and key_equal
+ using S = unord_set_type<std::unordered_set, transparent_hash_final, transparent_equal_final>;
+ test_transparent_contains<S>({1, 2});
+ test_transparent_contains<const S>({1, 2});
+ }
+
+ {
+ // Make sure conversions do happen for non-transparent hasher
+ using S = unord_set_type<std::unordered_set, non_transparent_hash, std::equal_to<>>;
+ test_non_transparent_contains<S>({1, 2});
+ test_non_transparent_contains<const S>({1, 2});
+ }
+
+ {
+ // Make sure conversions do happen for non-transparent key_equal
+ using S = unord_set_type<std::unordered_set, transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_contains<S>({1, 2});
+ test_non_transparent_contains<const S>({1, 2});
+ }
+
+ {
+ // Make sure conversions do happen for both non-transparent hasher and key_equal
+ using S = unord_set_type<std::unordered_set, non_transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_contains<S>({1, 2});
+ test_non_transparent_contains<const S>({1, 2});
+ }
+
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.set/count.pass.cpp b/libcxx/test/std/containers/unord/unord.set/count.pass.cpp
index fc9fce5991d1366..56df9a1693f54ed 100644
--- a/libcxx/test/std/containers/unord/unord.set/count.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/count.pass.cpp
@@ -20,51 +20,26 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_set<int> C;
- typedef int P;
- P a[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(50),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- const C c(std::begin(a), std::end(a));
- assert(c.count(30) == 1);
- assert(c.count(50) == 1);
- assert(c.count(5) == 0);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_set<int> C;
+ typedef int P;
+ P a[] = {P(10), P(20), P(30), P(40), P(50), P(50), P(50), P(60), P(70), P(80)};
+ const C c(std::begin(a), std::end(a));
+ assert(c.count(30) == 1);
+ assert(c.count(50) == 1);
+ assert(c.count(5) == 0);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
- typedef int P;
- P a[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(50),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- const C c(std::begin(a), std::end(a));
- assert(c.count(30) == 1);
- assert(c.count(50) == 1);
- assert(c.count(5) == 0);
- }
+ {
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] = {P(10), P(20), P(30), P(40), P(50), P(50), P(50), P(60), P(70), P(80)};
+ const C c(std::begin(a), std::end(a));
+ assert(c.count(30) == 1);
+ assert(c.count(50) == 1);
+ assert(c.count(5) == 0);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.set/count.transparent.pass.cpp b/libcxx/test/std/containers/unord/unord.set/count.transparent.pass.cpp
index 32af0a54cc5b50d..95362a45e289181 100644
--- a/libcxx/test/std/containers/unord/unord.set/count.transparent.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/count.transparent.pass.cpp
@@ -21,44 +21,43 @@
#include "test_transparent_unordered.h"
-int main(int, char**)
-{
- using key_type = StoredType<int>;
-
- {
- // Make sure conversions don't happen for transparent non-final hasher and key_equal
- using S = unord_set_type<std::unordered_set, transparent_hash, std::equal_to<>>;
- test_transparent_count<S>({1, 2});
- test_transparent_count<const S>({1, 2});
- }
-
- {
- // Make sure conversions don't happen for transparent final hasher and key_equal
- using S = unord_set_type<std::unordered_set, transparent_hash_final, transparent_equal_final>;
- test_transparent_count<S>({1, 2});
- test_transparent_count<const S>({1, 2});
- }
-
- {
- // Make sure conversions do happen for non-transparent hasher
- using S = unord_set_type<std::unordered_set, non_transparent_hash, std::equal_to<>>;
- test_non_transparent_count<S>({1, 2});
- test_non_transparent_count<const S>({1, 2});
- }
-
- {
- // Make sure conversions do happen for non-transparent key_equal
- using S = unord_set_type<std::unordered_set, transparent_hash, std::equal_to<key_type>>;
- test_non_transparent_count<S>({1, 2});
- test_non_transparent_count<const S>({1, 2});
- }
-
- {
- // Make sure conversions do happen for both non-transparent hasher and key_equal
- using S = unord_set_type<std::unordered_set, non_transparent_hash, std::equal_to<key_type>>;
- test_non_transparent_count<S>({1, 2});
- test_non_transparent_count<const S>({1, 2});
- }
-
- return 0;
+int main(int, char**) {
+ using key_type = StoredType<int>;
+
+ {
+ // Make sure conversions don't happen for transparent non-final hasher and key_equal
+ using S = unord_set_type<std::unordered_set, transparent_hash, std::equal_to<>>;
+ test_transparent_count<S>({1, 2});
+ test_transparent_count<const S>({1, 2});
+ }
+
+ {
+ // Make sure conversions don't happen for transparent final hasher and key_equal
+ using S = unord_set_type<std::unordered_set, transparent_hash_final, transparent_equal_final>;
+ test_transparent_count<S>({1, 2});
+ test_transparent_count<const S>({1, 2});
+ }
+
+ {
+ // Make sure conversions do happen for non-transparent hasher
+ using S = unord_set_type<std::unordered_set, non_transparent_hash, std::equal_to<>>;
+ test_non_transparent_count<S>({1, 2});
+ test_non_transparent_count<const S>({1, 2});
+ }
+
+ {
+ // Make sure conversions do happen for non-transparent key_equal
+ using S = unord_set_type<std::unordered_set, transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_count<S>({1, 2});
+ test_non_transparent_count<const S>({1, 2});
+ }
+
+ {
+ // Make sure conversions do happen for both non-transparent hasher and key_equal
+ using S = unord_set_type<std::unordered_set, non_transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_count<S>({1, 2});
+ test_non_transparent_count<const S>({1, 2});
+ }
+
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.set/emplace.pass.cpp b/libcxx/test/std/containers/unord/unord.set/emplace.pass.cpp
index c247b0b91411046..8972f03f2d2a8b4 100644
--- a/libcxx/test/std/containers/unord/unord.set/emplace.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/emplace.pass.cpp
@@ -24,47 +24,47 @@
#include "../../Emplaceable.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_set<Emplaceable> C;
- typedef std::pair<C::iterator, bool> R;
- C c;
- R r = c.emplace();
- assert(c.size() == 1);
- assert(*r.first == Emplaceable());
- assert(r.second);
+int main(int, char**) {
+ {
+ typedef std::unordered_set<Emplaceable> C;
+ typedef std::pair<C::iterator, bool> R;
+ C c;
+ R r = c.emplace();
+ assert(c.size() == 1);
+ assert(*r.first == Emplaceable());
+ assert(r.second);
- r = c.emplace(Emplaceable(5, 6));
- assert(c.size() == 2);
- assert(*r.first == Emplaceable(5, 6));
- assert(r.second);
+ r = c.emplace(Emplaceable(5, 6));
+ assert(c.size() == 2);
+ assert(*r.first == Emplaceable(5, 6));
+ assert(r.second);
- r = c.emplace(5, 6);
- assert(c.size() == 2);
- assert(*r.first == Emplaceable(5, 6));
- assert(!r.second);
- }
- {
- typedef std::unordered_set<Emplaceable, std::hash<Emplaceable>,
- std::equal_to<Emplaceable>, min_allocator<Emplaceable>> C;
- typedef std::pair<C::iterator, bool> R;
- C c;
- R r = c.emplace();
- assert(c.size() == 1);
- assert(*r.first == Emplaceable());
- assert(r.second);
+ r = c.emplace(5, 6);
+ assert(c.size() == 2);
+ assert(*r.first == Emplaceable(5, 6));
+ assert(!r.second);
+ }
+ {
+ typedef std::
+ unordered_set<Emplaceable, std::hash<Emplaceable>, std::equal_to<Emplaceable>, min_allocator<Emplaceable>>
+ C;
+ typedef std::pair<C::iterator, bool> R;
+ C c;
+ R r = c.emplace();
+ assert(c.size() == 1);
+ assert(*r.first == Emplaceable());
+ assert(r.second);
- r = c.emplace(Emplaceable(5, 6));
- assert(c.size() == 2);
- assert(*r.first == Emplaceable(5, 6));
- assert(r.second);
+ r = c.emplace(Emplaceable(5, 6));
+ assert(c.size() == 2);
+ assert(*r.first == Emplaceable(5, 6));
+ assert(r.second);
- r = c.emplace(5, 6);
- assert(c.size() == 2);
- assert(*r.first == Emplaceable(5, 6));
- assert(!r.second);
- }
+ r = c.emplace(5, 6);
+ assert(c.size() == 2);
+ assert(*r.first == Emplaceable(5, 6));
+ assert(!r.second);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.set/emplace_hint.pass.cpp b/libcxx/test/std/containers/unord/unord.set/emplace_hint.pass.cpp
index a078a5fb62005d2..0abf522d38b4c8e 100644
--- a/libcxx/test/std/containers/unord/unord.set/emplace_hint.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/emplace_hint.pass.cpp
@@ -17,7 +17,6 @@
// template <class... Args>
// iterator emplace_hint(const_iterator p, Args&&... args);
-
#include <unordered_set>
#include <cassert>
@@ -25,41 +24,41 @@
#include "../../Emplaceable.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_set<Emplaceable> C;
- typedef C::iterator R;
- C c;
- R r = c.emplace_hint(c.end());
- assert(c.size() == 1);
- assert(*r == Emplaceable());
+int main(int, char**) {
+ {
+ typedef std::unordered_set<Emplaceable> C;
+ typedef C::iterator R;
+ C c;
+ R r = c.emplace_hint(c.end());
+ assert(c.size() == 1);
+ assert(*r == Emplaceable());
- r = c.emplace_hint(c.end(), Emplaceable(5, 6));
- assert(c.size() == 2);
- assert(*r == Emplaceable(5, 6));
+ r = c.emplace_hint(c.end(), Emplaceable(5, 6));
+ assert(c.size() == 2);
+ assert(*r == Emplaceable(5, 6));
- r = c.emplace_hint(r, 5, 6);
- assert(c.size() == 2);
- assert(*r == Emplaceable(5, 6));
- }
- {
- typedef std::unordered_set<Emplaceable, std::hash<Emplaceable>,
- std::equal_to<Emplaceable>, min_allocator<Emplaceable>> C;
- typedef C::iterator R;
- C c;
- R r = c.emplace_hint(c.end());
- assert(c.size() == 1);
- assert(*r == Emplaceable());
+ r = c.emplace_hint(r, 5, 6);
+ assert(c.size() == 2);
+ assert(*r == Emplaceable(5, 6));
+ }
+ {
+ typedef std::
+ unordered_set<Emplaceable, std::hash<Emplaceable>, std::equal_to<Emplaceable>, min_allocator<Emplaceable>>
+ C;
+ typedef C::iterator R;
+ C c;
+ R r = c.emplace_hint(c.end());
+ assert(c.size() == 1);
+ assert(*r == Emplaceable());
- r = c.emplace_hint(c.end(), Emplaceable(5, 6));
- assert(c.size() == 2);
- assert(*r == Emplaceable(5, 6));
+ r = c.emplace_hint(c.end(), Emplaceable(5, 6));
+ assert(c.size() == 2);
+ assert(*r == Emplaceable(5, 6));
- r = c.emplace_hint(r, 5, 6);
- assert(c.size() == 2);
- assert(*r == Emplaceable(5, 6));
- }
+ r = c.emplace_hint(r, 5, 6);
+ assert(c.size() == 2);
+ assert(*r == Emplaceable(5, 6));
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.set/empty.pass.cpp b/libcxx/test/std/containers/unord/unord.set/empty.pass.cpp
index ce9cfdcf5f479ff..51414ec9a6f2f93 100644
--- a/libcxx/test/std/containers/unord/unord.set/empty.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/empty.pass.cpp
@@ -18,9 +18,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::unordered_set<int> M;
M m;
ASSERT_NOEXCEPT(m.empty());
@@ -29,9 +28,9 @@ int main(int, char**)
assert(!m.empty());
m.clear();
assert(m.empty());
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> M;
M m;
ASSERT_NOEXCEPT(m.empty());
@@ -40,7 +39,7 @@ int main(int, char**)
assert(!m.empty());
m.clear();
assert(m.empty());
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.set/empty.verify.cpp b/libcxx/test/std/containers/unord/unord.set/empty.verify.cpp
index e2164415aa182ed..5d8e2cf62d16356 100644
--- a/libcxx/test/std/containers/unord/unord.set/empty.verify.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/empty.verify.cpp
@@ -17,6 +17,6 @@
#include <unordered_set>
void f() {
- std::unordered_set<int> c;
- c.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::unordered_set<int> c;
+ c.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}
diff --git a/libcxx/test/std/containers/unord/unord.set/eq.pass.cpp b/libcxx/test/std/containers/unord/unord.set/eq.pass.cpp
index a0ea30fae070558..5d40042a91d20db 100644
--- a/libcxx/test/std/containers/unord/unord.set/eq.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/eq.pass.cpp
@@ -24,137 +24,76 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_set<int> C;
- typedef int P;
- P a[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- const C c1(std::begin(a), std::end(a));
- const C c2;
- assert(!(c1 == c2));
- assert( (c1 != c2));
- }
- {
- typedef std::unordered_set<int> C;
- typedef int P;
- P a[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- const C c1(std::begin(a), std::end(a));
- const C c2 = c1;
- assert( (c1 == c2));
- assert(!(c1 != c2));
- }
- {
- typedef std::unordered_set<int> C;
- typedef int P;
- P a[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- C c1(std::begin(a), std::end(a));
- C c2 = c1;
- c2.rehash(30);
- assert( (c1 == c2));
- assert(!(c1 != c2));
- c2.insert(P(90));
- assert(!(c1 == c2));
- assert( (c1 != c2));
- c1.insert(P(90));
- assert( (c1 == c2));
- assert(!(c1 != c2));
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_set<int> C;
+ typedef int P;
+ P a[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)};
+ const C c1(std::begin(a), std::end(a));
+ const C c2;
+ assert(!(c1 == c2));
+ assert((c1 != c2));
+ }
+ {
+ typedef std::unordered_set<int> C;
+ typedef int P;
+ P a[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)};
+ const C c1(std::begin(a), std::end(a));
+ const C c2 = c1;
+ assert((c1 == c2));
+ assert(!(c1 != c2));
+ }
+ {
+ typedef std::unordered_set<int> C;
+ typedef int P;
+ P a[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)};
+ C c1(std::begin(a), std::end(a));
+ C c2 = c1;
+ c2.rehash(30);
+ assert((c1 == c2));
+ assert(!(c1 != c2));
+ c2.insert(P(90));
+ assert(!(c1 == c2));
+ assert((c1 != c2));
+ c1.insert(P(90));
+ assert((c1 == c2));
+ assert(!(c1 != c2));
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
- typedef int P;
- P a[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- const C c1(std::begin(a), std::end(a));
- const C c2;
- assert(!(c1 == c2));
- assert( (c1 != c2));
- }
- {
- typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
- typedef int P;
- P a[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- const C c1(std::begin(a), std::end(a));
- const C c2 = c1;
- assert( (c1 == c2));
- assert(!(c1 != c2));
- }
- {
- typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
- typedef int P;
- P a[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- C c1(std::begin(a), std::end(a));
- C c2 = c1;
- c2.rehash(30);
- assert( (c1 == c2));
- assert(!(c1 != c2));
- c2.insert(P(90));
- assert(!(c1 == c2));
- assert( (c1 != c2));
- c1.insert(P(90));
- assert( (c1 == c2));
- assert(!(c1 != c2));
- }
+ {
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)};
+ const C c1(std::begin(a), std::end(a));
+ const C c2;
+ assert(!(c1 == c2));
+ assert((c1 != c2));
+ }
+ {
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)};
+ const C c1(std::begin(a), std::end(a));
+ const C c2 = c1;
+ assert((c1 == c2));
+ assert(!(c1 != c2));
+ }
+ {
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)};
+ C c1(std::begin(a), std::end(a));
+ C c2 = c1;
+ c2.rehash(30);
+ assert((c1 == c2));
+ assert(!(c1 != c2));
+ c2.insert(P(90));
+ assert(!(c1 == c2));
+ assert((c1 != c2));
+ c1.insert(P(90));
+ assert((c1 == c2));
+ assert(!(c1 != c2));
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.set/equal_range.transparent.pass.cpp b/libcxx/test/std/containers/unord/unord.set/equal_range.transparent.pass.cpp
index 9844d83cda46581..c1a1353b88790a8 100644
--- a/libcxx/test/std/containers/unord/unord.set/equal_range.transparent.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/equal_range.transparent.pass.cpp
@@ -21,44 +21,43 @@
#include "test_transparent_unordered.h"
-int main(int, char**)
-{
- using key_type = StoredType<int>;
-
- {
- // Make sure conversions don't happen for transparent non-final hasher and key_equal
- using S = unord_set_type<std::unordered_set, transparent_hash, std::equal_to<>>;
- test_transparent_equal_range<S>({1, 2});
- test_transparent_equal_range<const S>({1, 2});
- }
-
- {
- // Make sure conversions don't happen for transparent final hasher and key_equal
- using S = unord_set_type<std::unordered_set, transparent_hash_final, transparent_equal_final>;
- test_transparent_equal_range<S>({1, 2});
- test_transparent_equal_range<const S>({1, 2});
- }
-
- {
- // Make sure conversions do happen for non-transparent hasher
- using S = unord_set_type<std::unordered_set, non_transparent_hash, std::equal_to<>>;
- test_non_transparent_equal_range<S>({1, 2});
- test_non_transparent_equal_range<const S>({1, 2});
- }
-
- {
- // Make sure conversions do happen for non-transparent key_equal
- using S = unord_set_type<std::unordered_set, transparent_hash, std::equal_to<key_type>>;
- test_non_transparent_equal_range<S>({1, 2});
- test_non_transparent_equal_range<const S>({1, 2});
- }
-
- {
- // Make sure conversions do happen for both non-transparent hasher and key_equal
- using S = unord_set_type<std::unordered_set, non_transparent_hash, std::equal_to<key_type>>;
- test_non_transparent_equal_range<S>({1, 2});
- test_non_transparent_equal_range<const S>({1, 2});
- }
-
- return 0;
+int main(int, char**) {
+ using key_type = StoredType<int>;
+
+ {
+ // Make sure conversions don't happen for transparent non-final hasher and key_equal
+ using S = unord_set_type<std::unordered_set, transparent_hash, std::equal_to<>>;
+ test_transparent_equal_range<S>({1, 2});
+ test_transparent_equal_range<const S>({1, 2});
+ }
+
+ {
+ // Make sure conversions don't happen for transparent final hasher and key_equal
+ using S = unord_set_type<std::unordered_set, transparent_hash_final, transparent_equal_final>;
+ test_transparent_equal_range<S>({1, 2});
+ test_transparent_equal_range<const S>({1, 2});
+ }
+
+ {
+ // Make sure conversions do happen for non-transparent hasher
+ using S = unord_set_type<std::unordered_set, non_transparent_hash, std::equal_to<>>;
+ test_non_transparent_equal_range<S>({1, 2});
+ test_non_transparent_equal_range<const S>({1, 2});
+ }
+
+ {
+ // Make sure conversions do happen for non-transparent key_equal
+ using S = unord_set_type<std::unordered_set, transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_equal_range<S>({1, 2});
+ test_non_transparent_equal_range<const S>({1, 2});
+ }
+
+ {
+ // Make sure conversions do happen for both non-transparent hasher and key_equal
+ using S = unord_set_type<std::unordered_set, non_transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_equal_range<S>({1, 2});
+ test_non_transparent_equal_range<const S>({1, 2});
+ }
+
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.set/equal_range_const.pass.cpp b/libcxx/test/std/containers/unord/unord.set/equal_range_const.pass.cpp
index 707b3721cb23558..1689b83060747ed 100644
--- a/libcxx/test/std/containers/unord/unord.set/equal_range_const.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/equal_range_const.pass.cpp
@@ -20,63 +20,38 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_set<int> C;
- typedef C::const_iterator I;
- typedef int P;
- P a[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(50),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- const C c(std::begin(a), std::end(a));
- std::pair<I, I> r = c.equal_range(30);
- assert(std::distance(r.first, r.second) == 1);
- assert(*r.first == 30);
- r = c.equal_range(5);
- assert(std::distance(r.first, r.second) == 0);
- r = c.equal_range(50);
- assert(std::distance(r.first, r.second) == 1);
- assert(*r.first == 50);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_set<int> C;
+ typedef C::const_iterator I;
+ typedef int P;
+ P a[] = {P(10), P(20), P(30), P(40), P(50), P(50), P(50), P(60), P(70), P(80)};
+ const C c(std::begin(a), std::end(a));
+ std::pair<I, I> r = c.equal_range(30);
+ assert(std::distance(r.first, r.second) == 1);
+ assert(*r.first == 30);
+ r = c.equal_range(5);
+ assert(std::distance(r.first, r.second) == 0);
+ r = c.equal_range(50);
+ assert(std::distance(r.first, r.second) == 1);
+ assert(*r.first == 50);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
- typedef C::const_iterator I;
- typedef int P;
- P a[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(50),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- const C c(std::begin(a), std::end(a));
- std::pair<I, I> r = c.equal_range(30);
- assert(std::distance(r.first, r.second) == 1);
- assert(*r.first == 30);
- r = c.equal_range(5);
- assert(std::distance(r.first, r.second) == 0);
- r = c.equal_range(50);
- assert(std::distance(r.first, r.second) == 1);
- assert(*r.first == 50);
- }
+ {
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef C::const_iterator I;
+ typedef int P;
+ P a[] = {P(10), P(20), P(30), P(40), P(50), P(50), P(50), P(60), P(70), P(80)};
+ const C c(std::begin(a), std::end(a));
+ std::pair<I, I> r = c.equal_range(30);
+ assert(std::distance(r.first, r.second) == 1);
+ assert(*r.first == 30);
+ r = c.equal_range(5);
+ assert(std::distance(r.first, r.second) == 0);
+ r = c.equal_range(50);
+ assert(std::distance(r.first, r.second) == 1);
+ assert(*r.first == 50);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.set/equal_range_non_const.pass.cpp b/libcxx/test/std/containers/unord/unord.set/equal_range_non_const.pass.cpp
index a2872fedd2ce8a7..2b7acce993c3eef 100644
--- a/libcxx/test/std/containers/unord/unord.set/equal_range_non_const.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/equal_range_non_const.pass.cpp
@@ -20,63 +20,38 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_set<int> C;
- typedef C::iterator I;
- typedef int P;
- P a[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(50),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- C c(std::begin(a), std::end(a));
- std::pair<I, I> r = c.equal_range(30);
- assert(std::distance(r.first, r.second) == 1);
- assert(*r.first == 30);
- r = c.equal_range(5);
- assert(std::distance(r.first, r.second) == 0);
- r = c.equal_range(50);
- assert(std::distance(r.first, r.second) == 1);
- assert(*r.first == 50);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_set<int> C;
+ typedef C::iterator I;
+ typedef int P;
+ P a[] = {P(10), P(20), P(30), P(40), P(50), P(50), P(50), P(60), P(70), P(80)};
+ C c(std::begin(a), std::end(a));
+ std::pair<I, I> r = c.equal_range(30);
+ assert(std::distance(r.first, r.second) == 1);
+ assert(*r.first == 30);
+ r = c.equal_range(5);
+ assert(std::distance(r.first, r.second) == 0);
+ r = c.equal_range(50);
+ assert(std::distance(r.first, r.second) == 1);
+ assert(*r.first == 50);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
- typedef C::iterator I;
- typedef int P;
- P a[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(50),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- C c(std::begin(a), std::end(a));
- std::pair<I, I> r = c.equal_range(30);
- assert(std::distance(r.first, r.second) == 1);
- assert(*r.first == 30);
- r = c.equal_range(5);
- assert(std::distance(r.first, r.second) == 0);
- r = c.equal_range(50);
- assert(std::distance(r.first, r.second) == 1);
- assert(*r.first == 50);
- }
+ {
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef C::iterator I;
+ typedef int P;
+ P a[] = {P(10), P(20), P(30), P(40), P(50), P(50), P(50), P(60), P(70), P(80)};
+ C c(std::begin(a), std::end(a));
+ std::pair<I, I> r = c.equal_range(30);
+ assert(std::distance(r.first, r.second) == 1);
+ assert(*r.first == 30);
+ r = c.equal_range(5);
+ assert(std::distance(r.first, r.second) == 0);
+ r = c.equal_range(50);
+ assert(std::distance(r.first, r.second) == 1);
+ assert(*r.first == 50);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.set/erase_const_iter.pass.cpp b/libcxx/test/std/containers/unord/unord.set/erase_const_iter.pass.cpp
index 4a66329d5717787..46cdda9fb769696 100644
--- a/libcxx/test/std/containers/unord/unord.set/erase_const_iter.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/erase_const_iter.pass.cpp
@@ -20,80 +20,64 @@
#include "test_macros.h"
#include "min_allocator.h"
-struct TemplateConstructor
-{
- template<typename T>
- TemplateConstructor (const T&) {}
+struct TemplateConstructor {
+ template <typename T>
+ TemplateConstructor(const T&) {}
};
bool operator==(const TemplateConstructor&, const TemplateConstructor&) { return false; }
-struct Hash { std::size_t operator() (const TemplateConstructor &) const { return 0; } };
+struct Hash {
+ std::size_t operator()(const TemplateConstructor&) const { return 0; }
+};
-int main(int, char**)
-{
- {
- typedef std::unordered_set<int> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- C::const_iterator i = c.find(2);
- C::const_iterator i_next = i;
- ++i_next;
- C::iterator j = c.erase(i);
- assert(j == i_next);
+int main(int, char**) {
+ {
+ typedef std::unordered_set<int> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ C::const_iterator i = c.find(2);
+ C::const_iterator i_next = i;
+ ++i_next;
+ C::iterator j = c.erase(i);
+ assert(j == i_next);
- assert(c.size() == 3);
- assert(c.count(1) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- }
+ assert(c.size() == 3);
+ assert(c.count(1) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- C::const_iterator i = c.find(2);
- C::const_iterator i_next = i;
- ++i_next;
- C::iterator j = c.erase(i);
- assert(j == i_next);
+ {
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ C::const_iterator i = c.find(2);
+ C::const_iterator i_next = i;
+ ++i_next;
+ C::iterator j = c.erase(i);
+ assert(j == i_next);
- assert(c.size() == 3);
- assert(c.count(1) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- }
+ assert(c.size() == 3);
+ assert(c.count(1) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ }
#endif
#if TEST_STD_VER >= 14
- {
+ {
// This is LWG #2059
- typedef TemplateConstructor T;
- typedef std::unordered_set<T, Hash> C;
- typedef C::iterator I;
+ typedef TemplateConstructor T;
+ typedef std::unordered_set<T, Hash> C;
+ typedef C::iterator I;
- C m;
- T a{0};
- I it = m.find(a);
- if (it != m.end())
- m.erase(it);
- }
+ C m;
+ T a{0};
+ I it = m.find(a);
+ if (it != m.end())
+ m.erase(it);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.set/erase_if.pass.cpp b/libcxx/test/std/containers/unord/unord.set/erase_if.pass.cpp
index ba5f3bfe181fc5c..103d41972029d20 100644
--- a/libcxx/test/std/containers/unord/unord.set/erase_if.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/erase_if.pass.cpp
@@ -23,12 +23,11 @@
using Init = std::initializer_list<int>;
template <typename M>
-M make (Init vals)
-{
- M ret;
- for (int v : vals)
- ret.insert(v);
- return ret;
+M make(Init vals) {
+ M ret;
+ for (int v : vals)
+ ret.insert(v);
+ return ret;
}
template <typename M, typename Pred>
@@ -41,41 +40,39 @@ void test0(Init vals, Pred p, Init expected, std::size_t expected_erased_count)
}
template <typename S>
-void test()
-{
- auto is1 = [](auto v) { return v == 1;};
- auto is2 = [](auto v) { return v == 2;};
- auto is3 = [](auto v) { return v == 3;};
- auto is4 = [](auto v) { return v == 4;};
- auto True = [](auto) { return true; };
- auto False = [](auto) { return false; };
-
- test0<S>({}, is1, {}, 0);
-
- test0<S>({1}, is1, {}, 1);
- test0<S>({1}, is2, {1}, 0);
-
- test0<S>({1, 2}, is1, {2}, 1);
- test0<S>({1, 2}, is2, {1}, 1);
- test0<S>({1, 2}, is3, {1, 2}, 0);
-
- test0<S>({1, 2, 3}, is1, {2, 3}, 1);
- test0<S>({1, 2, 3}, is2, {1, 3}, 1);
- test0<S>({1, 2, 3}, is3, {1, 2}, 1);
- test0<S>({1, 2, 3}, is4, {1, 2, 3}, 0);
-
- test0<S>({1, 2, 3}, True, {}, 3);
- test0<S>({1, 2, 3}, False, {1, 2, 3}, 0);
+void test() {
+ auto is1 = [](auto v) { return v == 1; };
+ auto is2 = [](auto v) { return v == 2; };
+ auto is3 = [](auto v) { return v == 3; };
+ auto is4 = [](auto v) { return v == 4; };
+ auto True = [](auto) { return true; };
+ auto False = [](auto) { return false; };
+
+ test0<S>({}, is1, {}, 0);
+
+ test0<S>({1}, is1, {}, 1);
+ test0<S>({1}, is2, {1}, 0);
+
+ test0<S>({1, 2}, is1, {2}, 1);
+ test0<S>({1, 2}, is2, {1}, 1);
+ test0<S>({1, 2}, is3, {1, 2}, 0);
+
+ test0<S>({1, 2, 3}, is1, {2, 3}, 1);
+ test0<S>({1, 2, 3}, is2, {1, 3}, 1);
+ test0<S>({1, 2, 3}, is3, {1, 2}, 1);
+ test0<S>({1, 2, 3}, is4, {1, 2, 3}, 0);
+
+ test0<S>({1, 2, 3}, True, {}, 3);
+ test0<S>({1, 2, 3}, False, {1, 2, 3}, 0);
}
-int main(int, char**)
-{
- test<std::unordered_set<int>>();
- test<std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>>> ();
- test<std::unordered_set<int, std::hash<int>, std::equal_to<int>, test_allocator<int>>> ();
+int main(int, char**) {
+ test<std::unordered_set<int>>();
+ test<std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>>>();
+ test<std::unordered_set<int, std::hash<int>, std::equal_to<int>, test_allocator<int>>>();
- test<std::unordered_set<long>>();
- test<std::unordered_set<double>>();
+ test<std::unordered_set<long>>();
+ test<std::unordered_set<double>>();
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.set/erase_key.pass.cpp b/libcxx/test/std/containers/unord/unord.set/erase_key.pass.cpp
index a50f56b0a3232e5..80a24ba8b77f86d 100644
--- a/libcxx/test/std/containers/unord/unord.set/erase_key.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/erase_key.pass.cpp
@@ -23,154 +23,137 @@
#if TEST_STD_VER >= 11
template <typename Unordered>
-bool only_deletions ( const Unordered &whole, const Unordered &part ) {
- typename Unordered::const_iterator w = whole.begin();
- typename Unordered::const_iterator p = part.begin();
+bool only_deletions(const Unordered& whole, const Unordered& part) {
+ typename Unordered::const_iterator w = whole.begin();
+ typename Unordered::const_iterator p = part.begin();
- while ( w != whole.end () && p != part.end()) {
- if ( *w == *p )
- p++;
- w++;
- }
+ while (w != whole.end() && p != part.end()) {
+ if (*w == *p)
+ p++;
+ w++;
+ }
- return p == part.end();
+ return p == part.end();
}
#endif
-int main(int, char**)
-{
- {
- typedef std::unordered_set<int> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.erase(5) == 0);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
-
- assert(c.erase(2) == 1);
- assert(c.size() == 3);
- assert(c.count(1) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
-
- assert(c.erase(2) == 0);
- assert(c.size() == 3);
- assert(c.count(1) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
-
- assert(c.erase(4) == 1);
- assert(c.size() == 2);
- assert(c.count(1) == 1);
- assert(c.count(3) == 1);
-
- assert(c.erase(4) == 0);
- assert(c.size() == 2);
- assert(c.count(1) == 1);
- assert(c.count(3) == 1);
-
- assert(c.erase(1) == 1);
- assert(c.size() == 1);
- assert(c.count(3) == 1);
-
- assert(c.erase(1) == 0);
- assert(c.size() == 1);
- assert(c.count(3) == 1);
-
- assert(c.erase(3) == 1);
- assert(c.size() == 0);
-
- assert(c.erase(3) == 0);
- assert(c.size() == 0);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_set<int> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.erase(5) == 0);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+
+ assert(c.erase(2) == 1);
+ assert(c.size() == 3);
+ assert(c.count(1) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+
+ assert(c.erase(2) == 0);
+ assert(c.size() == 3);
+ assert(c.count(1) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+
+ assert(c.erase(4) == 1);
+ assert(c.size() == 2);
+ assert(c.count(1) == 1);
+ assert(c.count(3) == 1);
+
+ assert(c.erase(4) == 0);
+ assert(c.size() == 2);
+ assert(c.count(1) == 1);
+ assert(c.count(3) == 1);
+
+ assert(c.erase(1) == 1);
+ assert(c.size() == 1);
+ assert(c.count(3) == 1);
+
+ assert(c.erase(1) == 0);
+ assert(c.size() == 1);
+ assert(c.count(3) == 1);
+
+ assert(c.erase(3) == 1);
+ assert(c.size() == 0);
+
+ assert(c.erase(3) == 0);
+ assert(c.size() == 0);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.erase(5) == 0);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
-
- assert(c.erase(2) == 1);
- assert(c.size() == 3);
- assert(c.count(1) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
-
- assert(c.erase(2) == 0);
- assert(c.size() == 3);
- assert(c.count(1) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
-
- assert(c.erase(4) == 1);
- assert(c.size() == 2);
- assert(c.count(1) == 1);
- assert(c.count(3) == 1);
-
- assert(c.erase(4) == 0);
- assert(c.size() == 2);
- assert(c.count(1) == 1);
- assert(c.count(3) == 1);
-
- assert(c.erase(1) == 1);
- assert(c.size() == 1);
- assert(c.count(3) == 1);
-
- assert(c.erase(1) == 0);
- assert(c.size() == 1);
- assert(c.count(3) == 1);
-
- assert(c.erase(3) == 1);
- assert(c.size() == 0);
-
- assert(c.erase(3) == 0);
- assert(c.size() == 0);
- }
- {
+ {
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.erase(5) == 0);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+
+ assert(c.erase(2) == 1);
+ assert(c.size() == 3);
+ assert(c.count(1) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+
+ assert(c.erase(2) == 0);
+ assert(c.size() == 3);
+ assert(c.count(1) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+
+ assert(c.erase(4) == 1);
+ assert(c.size() == 2);
+ assert(c.count(1) == 1);
+ assert(c.count(3) == 1);
+
+ assert(c.erase(4) == 0);
+ assert(c.size() == 2);
+ assert(c.count(1) == 1);
+ assert(c.count(3) == 1);
+
+ assert(c.erase(1) == 1);
+ assert(c.size() == 1);
+ assert(c.count(3) == 1);
+
+ assert(c.erase(1) == 0);
+ assert(c.size() == 1);
+ assert(c.count(3) == 1);
+
+ assert(c.erase(3) == 1);
+ assert(c.size() == 0);
+
+ assert(c.erase(3) == 0);
+ assert(c.size() == 0);
+ }
+ {
typedef std::unordered_set<int> C;
C m, m2;
- for ( int i = 0; i < 10; ++i ) {
- m.insert(i);
- m2.insert(i);
- }
+ for (int i = 0; i < 10; ++i) {
+ m.insert(i);
+ m2.insert(i);
+ }
C::iterator i = m2.begin();
- int ctr = 0;
+ int ctr = 0;
while (i != m2.end()) {
- if (ctr++ % 2 == 0)
- m2.erase(i++);
- else
- ++i;
- }
-
- assert (only_deletions (m, m2));
+ if (ctr++ % 2 == 0)
+ m2.erase(i++);
+ else
+ ++i;
}
+
+ assert(only_deletions(m, m2));
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.set/erase_range.pass.cpp b/libcxx/test/std/containers/unord/unord.set/erase_range.pass.cpp
index 8e0110a8b263eb2..5fa6e4199f756b8 100644
--- a/libcxx/test/std/containers/unord/unord.set/erase_range.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/erase_range.pass.cpp
@@ -21,75 +21,58 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_set<int> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- C::const_iterator i = c.find(2);
- C::const_iterator j = std::next(i);
- C::iterator k = c.erase(i, i);
- assert(k == i);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
+int main(int, char**) {
+ {
+ typedef std::unordered_set<int> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ C::const_iterator i = c.find(2);
+ C::const_iterator j = std::next(i);
+ C::iterator k = c.erase(i, i);
+ assert(k == i);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
- k = c.erase(i, j);
- assert(c.size() == 3);
- assert(c.count(1) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
+ k = c.erase(i, j);
+ assert(c.size() == 3);
+ assert(c.count(1) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
- k = c.erase(c.cbegin(), c.cend());
- assert(c.size() == 0);
- assert(k == c.end());
- }
+ k = c.erase(c.cbegin(), c.cend());
+ assert(c.size() == 0);
+ assert(k == c.end());
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- C::const_iterator i = c.find(2);
- C::const_iterator j = std::next(i);
- C::iterator k = c.erase(i, i);
- assert(k == i);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
+ {
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ C::const_iterator i = c.find(2);
+ C::const_iterator j = std::next(i);
+ C::iterator k = c.erase(i, i);
+ assert(k == i);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
- k = c.erase(i, j);
- assert(c.size() == 3);
- assert(c.count(1) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
+ k = c.erase(i, j);
+ assert(c.size() == 3);
+ assert(c.count(1) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
- k = c.erase(c.cbegin(), c.cend());
- assert(c.size() == 0);
- assert(k == c.end());
- }
+ k = c.erase(c.cbegin(), c.cend());
+ assert(c.size() == 0);
+ assert(k == c.end());
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.set/extract_iterator.pass.cpp b/libcxx/test/std/containers/unord/unord.set/extract_iterator.pass.cpp
index f6382502e63547e..7f5a34d9cb64ce6 100644
--- a/libcxx/test/std/containers/unord/unord.set/extract_iterator.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/extract_iterator.pass.cpp
@@ -20,43 +20,40 @@
#include "Counter.h"
template <class Container>
-void test(Container& c)
-{
- std::size_t sz = c.size();
-
- for (auto first = c.cbegin(); first != c.cend();)
- {
- auto key_value = *first;
- typename Container::node_type t = c.extract(first++);
- --sz;
- assert(t.value() == key_value);
- assert(t.get_allocator() == c.get_allocator());
- assert(sz == c.size());
- }
-
- assert(c.size() == 0);
+void test(Container& c) {
+ std::size_t sz = c.size();
+
+ for (auto first = c.cbegin(); first != c.cend();) {
+ auto key_value = *first;
+ typename Container::node_type t = c.extract(first++);
+ --sz;
+ assert(t.value() == key_value);
+ assert(t.get_allocator() == c.get_allocator());
+ assert(sz == c.size());
+ }
+
+ assert(c.size() == 0);
}
-int main(int, char**)
-{
- {
- using set_type = std::unordered_set<int>;
- set_type m = {1, 2, 3, 4, 5, 6};
- test(m);
- }
-
- {
- std::unordered_set<Counter<int>> m = {1, 2, 3, 4, 5, 6};
- assert(Counter_base::gConstructed == 6);
- test(m);
- assert(Counter_base::gConstructed == 0);
- }
-
- {
- using min_alloc_set = std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>>;
- min_alloc_set m = {1, 2, 3, 4, 5, 6};
- test(m);
- }
+int main(int, char**) {
+ {
+ using set_type = std::unordered_set<int>;
+ set_type m = {1, 2, 3, 4, 5, 6};
+ test(m);
+ }
+
+ {
+ std::unordered_set<Counter<int>> m = {1, 2, 3, 4, 5, 6};
+ assert(Counter_base::gConstructed == 6);
+ test(m);
+ assert(Counter_base::gConstructed == 0);
+ }
+
+ {
+ using min_alloc_set = std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>>;
+ min_alloc_set m = {1, 2, 3, 4, 5, 6};
+ test(m);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.set/extract_key.pass.cpp b/libcxx/test/std/containers/unord/unord.set/extract_key.pass.cpp
index 3bfb6c358c8b699..dac309787b75b90 100644
--- a/libcxx/test/std/containers/unord/unord.set/extract_key.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/extract_key.pass.cpp
@@ -20,54 +20,50 @@
#include "Counter.h"
template <class Container, class KeyTypeIter>
-void test(Container& c, KeyTypeIter first, KeyTypeIter last)
-{
- std::size_t sz = c.size();
- assert((std::size_t)std::distance(first, last) == sz);
+void test(Container& c, KeyTypeIter first, KeyTypeIter last) {
+ std::size_t sz = c.size();
+ assert((std::size_t)std::distance(first, last) == sz);
- for (KeyTypeIter copy = first; copy != last; ++copy)
- {
- typename Container::node_type t = c.extract(*copy);
- assert(!t.empty());
- --sz;
- assert(t.value() == *copy);
- assert(t.get_allocator() == c.get_allocator());
- assert(sz == c.size());
- }
+ for (KeyTypeIter copy = first; copy != last; ++copy) {
+ typename Container::node_type t = c.extract(*copy);
+ assert(!t.empty());
+ --sz;
+ assert(t.value() == *copy);
+ assert(t.get_allocator() == c.get_allocator());
+ assert(sz == c.size());
+ }
- assert(c.size() == 0);
+ assert(c.size() == 0);
- for (KeyTypeIter copy = first; copy != last; ++copy)
- {
- typename Container::node_type t = c.extract(*copy);
- assert(t.empty());
- }
+ for (KeyTypeIter copy = first; copy != last; ++copy) {
+ typename Container::node_type t = c.extract(*copy);
+ assert(t.empty());
+ }
}
-int main(int, char**)
-{
- {
- std::unordered_set<int> m = {1, 2, 3, 4, 5, 6};
- int keys[] = {1, 2, 3, 4, 5, 6};
- test(m, std::begin(keys), std::end(keys));
- }
+int main(int, char**) {
+ {
+ std::unordered_set<int> m = {1, 2, 3, 4, 5, 6};
+ int keys[] = {1, 2, 3, 4, 5, 6};
+ test(m, std::begin(keys), std::end(keys));
+ }
+ {
+ std::unordered_set<Counter<int>> m = {1, 2, 3, 4, 5, 6};
{
- std::unordered_set<Counter<int>> m = {1, 2, 3, 4, 5, 6};
- {
- Counter<int> keys[] = {1, 2, 3, 4, 5, 6};
- assert(Counter_base::gConstructed == 6+6);
- test(m, std::begin(keys), std::end(keys));
- }
- assert(Counter_base::gConstructed == 0);
+ Counter<int> keys[] = {1, 2, 3, 4, 5, 6};
+ assert(Counter_base::gConstructed == 6 + 6);
+ test(m, std::begin(keys), std::end(keys));
}
+ assert(Counter_base::gConstructed == 0);
+ }
- {
- using min_alloc_set = std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>>;
- min_alloc_set m = {1, 2, 3, 4, 5, 6};
- int keys[] = {1, 2, 3, 4, 5, 6};
- test(m, std::begin(keys), std::end(keys));
- }
+ {
+ using min_alloc_set = std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>>;
+ min_alloc_set m = {1, 2, 3, 4, 5, 6};
+ int keys[] = {1, 2, 3, 4, 5, 6};
+ test(m, std::begin(keys), std::end(keys));
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.set/find.transparent.pass.cpp b/libcxx/test/std/containers/unord/unord.set/find.transparent.pass.cpp
index 7510dd3514e6531..503c2d07cd8f043 100644
--- a/libcxx/test/std/containers/unord/unord.set/find.transparent.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/find.transparent.pass.cpp
@@ -21,44 +21,43 @@
#include "test_transparent_unordered.h"
-int main(int, char**)
-{
- using key_type = StoredType<int>;
-
- {
- // Make sure conversions don't happen for transparent non-final hasher and key_equal
- using S = unord_set_type<std::unordered_set, transparent_hash, std::equal_to<>>;
- test_transparent_find<S>({1, 2});
- test_transparent_find<const S>({1, 2});
- }
-
- {
- // Make sure conversions don't happen for transparent final hasher and key_equal
- using S = unord_set_type<std::unordered_set, transparent_hash_final, transparent_equal_final>;
- test_transparent_find<S>({1, 2});
- test_transparent_find<const S>({1, 2});
- }
-
- {
- // Make sure conversions do happen for non-transparent hasher
- using S = unord_set_type<std::unordered_set, non_transparent_hash, std::equal_to<>>;
- test_non_transparent_find<S>({1, 2});
- test_non_transparent_find<const S>({1, 2});
- }
-
- {
- // Make sure conversions do happen for non-transparent key_equal
- using S = unord_set_type<std::unordered_set, transparent_hash, std::equal_to<key_type>>;
- test_non_transparent_find<S>({1, 2});
- test_non_transparent_find<const S>({1, 2});
- }
-
- {
- // Make sure conversions do happen for both non-transparent hasher and key_equal
- using S = unord_set_type<std::unordered_set, non_transparent_hash, std::equal_to<key_type>>;
- test_non_transparent_find<S>({1, 2});
- test_non_transparent_find<const S>({1, 2});
- }
-
- return 0;
+int main(int, char**) {
+ using key_type = StoredType<int>;
+
+ {
+ // Make sure conversions don't happen for transparent non-final hasher and key_equal
+ using S = unord_set_type<std::unordered_set, transparent_hash, std::equal_to<>>;
+ test_transparent_find<S>({1, 2});
+ test_transparent_find<const S>({1, 2});
+ }
+
+ {
+ // Make sure conversions don't happen for transparent final hasher and key_equal
+ using S = unord_set_type<std::unordered_set, transparent_hash_final, transparent_equal_final>;
+ test_transparent_find<S>({1, 2});
+ test_transparent_find<const S>({1, 2});
+ }
+
+ {
+ // Make sure conversions do happen for non-transparent hasher
+ using S = unord_set_type<std::unordered_set, non_transparent_hash, std::equal_to<>>;
+ test_non_transparent_find<S>({1, 2});
+ test_non_transparent_find<const S>({1, 2});
+ }
+
+ {
+ // Make sure conversions do happen for non-transparent key_equal
+ using S = unord_set_type<std::unordered_set, transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_find<S>({1, 2});
+ test_non_transparent_find<const S>({1, 2});
+ }
+
+ {
+ // Make sure conversions do happen for both non-transparent hasher and key_equal
+ using S = unord_set_type<std::unordered_set, non_transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_find<S>({1, 2});
+ test_non_transparent_find<const S>({1, 2});
+ }
+
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.set/find_const.pass.cpp b/libcxx/test/std/containers/unord/unord.set/find_const.pass.cpp
index 96d17873ba697ba..16805b26edaa5be 100644
--- a/libcxx/test/std/containers/unord/unord.set/find_const.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/find_const.pass.cpp
@@ -20,49 +20,28 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_set<int> C;
- typedef int P;
- P a[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- const C c(std::begin(a), std::end(a));
- C::const_iterator i = c.find(30);
- assert(*i == 30);
- i = c.find(5);
- assert(i == c.cend());
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_set<int> C;
+ typedef int P;
+ P a[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)};
+ const C c(std::begin(a), std::end(a));
+ C::const_iterator i = c.find(30);
+ assert(*i == 30);
+ i = c.find(5);
+ assert(i == c.cend());
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
- typedef int P;
- P a[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- const C c(std::begin(a), std::end(a));
- C::const_iterator i = c.find(30);
- assert(*i == 30);
- i = c.find(5);
- assert(i == c.cend());
- }
+ {
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)};
+ const C c(std::begin(a), std::end(a));
+ C::const_iterator i = c.find(30);
+ assert(*i == 30);
+ i = c.find(5);
+ assert(i == c.cend());
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.set/find_non_const.pass.cpp b/libcxx/test/std/containers/unord/unord.set/find_non_const.pass.cpp
index d49efd7eea41405..40f41ab40732d4d 100644
--- a/libcxx/test/std/containers/unord/unord.set/find_non_const.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/find_non_const.pass.cpp
@@ -20,49 +20,28 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_set<int> C;
- typedef int P;
- P a[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- C c(std::begin(a), std::end(a));
- C::iterator i = c.find(30);
- assert(*i == 30);
- i = c.find(5);
- assert(i == c.cend());
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_set<int> C;
+ typedef int P;
+ P a[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)};
+ C c(std::begin(a), std::end(a));
+ C::iterator i = c.find(30);
+ assert(*i == 30);
+ i = c.find(5);
+ assert(i == c.cend());
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
- typedef int P;
- P a[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- C c(std::begin(a), std::end(a));
- C::iterator i = c.find(30);
- assert(*i == 30);
- i = c.find(5);
- assert(i == c.cend());
- }
+ {
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)};
+ C c(std::begin(a), std::end(a));
+ C::iterator i = c.find(30);
+ assert(*i == 30);
+ i = c.find(5);
+ assert(i == c.cend());
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.set/get_allocator.pass.cpp b/libcxx/test/std/containers/unord/unord.set/get_allocator.pass.cpp
index 1b0a6520da0437e..bd3bd00872801df 100644
--- a/libcxx/test/std/containers/unord/unord.set/get_allocator.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/get_allocator.pass.cpp
@@ -19,18 +19,16 @@
#include "test_macros.h"
int main(int, char**) {
- {
- std::allocator<int> alloc;
- const std::unordered_set<int> s(alloc);
- assert(s.get_allocator() == alloc);
- }
- {
- other_allocator<int> alloc(1);
- const std::unordered_set<int, std::hash<int>,
- std::equal_to<int>,
- other_allocator<int> > s(alloc);
- assert(s.get_allocator() == alloc);
- }
+ {
+ std::allocator<int> alloc;
+ const std::unordered_set<int> s(alloc);
+ assert(s.get_allocator() == alloc);
+ }
+ {
+ other_allocator<int> alloc(1);
+ const std::unordered_set<int, std::hash<int>, std::equal_to<int>, other_allocator<int> > s(alloc);
+ assert(s.get_allocator() == alloc);
+ }
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.set/incomplete.pass.cpp b/libcxx/test/std/containers/unord/unord.set/incomplete.pass.cpp
index d87d080555e2349..cdd8bb3542abff2 100644
--- a/libcxx/test/std/containers/unord/unord.set/incomplete.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/incomplete.pass.cpp
@@ -20,22 +20,22 @@
template <class Tp>
struct MyHash {
MyHash() {}
- std::size_t operator()(Tp const&) const {return 42;}
+ std::size_t operator()(Tp const&) const { return 42; }
};
struct A {
- typedef std::unordered_set<A, MyHash<A> > Map;
- Map m;
- Map::iterator it;
- Map::const_iterator cit;
- Map::local_iterator lit;
- Map::const_local_iterator clit;
+ typedef std::unordered_set<A, MyHash<A> > Map;
+ Map m;
+ Map::iterator it;
+ Map::const_iterator cit;
+ Map::local_iterator lit;
+ Map::const_local_iterator clit;
};
inline bool operator==(A const& L, A const& R) { return &L == &R; }
int main(int, char**) {
- A a;
+ A a;
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.set/insert_and_emplace_allocator_requirements.pass.cpp b/libcxx/test/std/containers/unord/unord.set/insert_and_emplace_allocator_requirements.pass.cpp
index 0ca0e935965f6eb..41eed705abaae47 100644
--- a/libcxx/test/std/containers/unord/unord.set/insert_and_emplace_allocator_requirements.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/insert_and_emplace_allocator_requirements.pass.cpp
@@ -21,9 +21,7 @@
#include "container_test_types.h"
#include "../../set_allocator_requirement_test_templates.h"
-
-int main(int, char**)
-{
+int main(int, char**) {
testSetInsert<TCT::unordered_set<> >();
testSetEmplace<TCT::unordered_set<> >();
diff --git a/libcxx/test/std/containers/unord/unord.set/insert_const_lvalue.pass.cpp b/libcxx/test/std/containers/unord/unord.set/insert_const_lvalue.pass.cpp
index a0f5ed6c98cd987..15c617acfbe8853 100644
--- a/libcxx/test/std/containers/unord/unord.set/insert_const_lvalue.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/insert_const_lvalue.pass.cpp
@@ -20,46 +20,43 @@
#include "test_macros.h"
#include "min_allocator.h"
-template<class Container>
-void do_insert_const_lvalue_test()
-{
- typedef Container C;
- typedef std::pair<typename C::iterator, bool> R;
- typedef typename C::value_type VT;
- C c;
- const VT v1(3.5);
- R r = c.insert(v1);
- assert(c.size() == 1);
- assert(*r.first == 3.5);
- assert(r.second);
-
- r = c.insert(v1);
- assert(c.size() == 1);
- assert(*r.first == 3.5);
- assert(!r.second);
-
- const VT v2(4.5);
- r = c.insert(v2);
- assert(c.size() == 2);
- assert(*r.first == 4.5);
- assert(r.second);
-
- const VT v3(5.5);
- r = c.insert(v3);
- assert(c.size() == 3);
- assert(*r.first == 5.5);
- assert(r.second);
+template <class Container>
+void do_insert_const_lvalue_test() {
+ typedef Container C;
+ typedef std::pair<typename C::iterator, bool> R;
+ typedef typename C::value_type VT;
+ C c;
+ const VT v1(3.5);
+ R r = c.insert(v1);
+ assert(c.size() == 1);
+ assert(*r.first == 3.5);
+ assert(r.second);
+
+ r = c.insert(v1);
+ assert(c.size() == 1);
+ assert(*r.first == 3.5);
+ assert(!r.second);
+
+ const VT v2(4.5);
+ r = c.insert(v2);
+ assert(c.size() == 2);
+ assert(*r.first == 4.5);
+ assert(r.second);
+
+ const VT v3(5.5);
+ r = c.insert(v3);
+ assert(c.size() == 3);
+ assert(*r.first == 5.5);
+ assert(r.second);
}
-int main(int, char**)
-{
- do_insert_const_lvalue_test<std::unordered_set<double> >();
+int main(int, char**) {
+ do_insert_const_lvalue_test<std::unordered_set<double> >();
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_set<double, std::hash<double>,
- std::equal_to<double>, min_allocator<double>> C;
- do_insert_const_lvalue_test<C>();
- }
+ {
+ typedef std::unordered_set<double, std::hash<double>, std::equal_to<double>, min_allocator<double>> C;
+ do_insert_const_lvalue_test<C>();
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.set/insert_hint_const_lvalue.pass.cpp b/libcxx/test/std/containers/unord/unord.set/insert_hint_const_lvalue.pass.cpp
index 16a9766e5f6e065..45569c7d7a5222c 100644
--- a/libcxx/test/std/containers/unord/unord.set/insert_hint_const_lvalue.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/insert_hint_const_lvalue.pass.cpp
@@ -20,44 +20,41 @@
#include "test_macros.h"
#include "min_allocator.h"
-template<class Container>
-void do_insert_hint_const_lvalue_test()
-{
- typedef Container C;
- typedef typename C::iterator R;
- typedef typename C::value_type VT;
- C c;
- typename C::const_iterator e = c.end();
- const VT v1(3.5);
- R r = c.insert(e, v1);
- assert(c.size() == 1);
- assert(*r == 3.5);
-
- r = c.insert(r, v1);
- assert(c.size() == 1);
- assert(*r == 3.5);
-
- const VT v2(4.5);
- r = c.insert(c.end(), v2);
- assert(c.size() == 2);
- assert(*r == 4.5);
-
- const VT v3(5.5);
- r = c.insert(c.end(), v3);
- assert(c.size() == 3);
- assert(*r == 5.5);
+template <class Container>
+void do_insert_hint_const_lvalue_test() {
+ typedef Container C;
+ typedef typename C::iterator R;
+ typedef typename C::value_type VT;
+ C c;
+ typename C::const_iterator e = c.end();
+ const VT v1(3.5);
+ R r = c.insert(e, v1);
+ assert(c.size() == 1);
+ assert(*r == 3.5);
+
+ r = c.insert(r, v1);
+ assert(c.size() == 1);
+ assert(*r == 3.5);
+
+ const VT v2(4.5);
+ r = c.insert(c.end(), v2);
+ assert(c.size() == 2);
+ assert(*r == 4.5);
+
+ const VT v3(5.5);
+ r = c.insert(c.end(), v3);
+ assert(c.size() == 3);
+ assert(*r == 5.5);
}
-int main(int, char**)
-{
- do_insert_hint_const_lvalue_test<std::unordered_set<double> >();
+int main(int, char**) {
+ do_insert_hint_const_lvalue_test<std::unordered_set<double> >();
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_set<double, std::hash<double>,
- std::equal_to<double>, min_allocator<double>> C;
- do_insert_hint_const_lvalue_test<C>();
- }
+ {
+ typedef std::unordered_set<double, std::hash<double>, std::equal_to<double>, min_allocator<double>> C;
+ do_insert_hint_const_lvalue_test<C>();
+ }
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.set/insert_hint_rvalue.pass.cpp b/libcxx/test/std/containers/unord/unord.set/insert_hint_rvalue.pass.cpp
index de67a912dc92ca0..c8098c420eb84ff 100644
--- a/libcxx/test/std/containers/unord/unord.set/insert_hint_rvalue.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/insert_hint_rvalue.pass.cpp
@@ -21,99 +21,96 @@
#include "MoveOnly.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_set<double> C;
- typedef C::iterator R;
- typedef double P;
- C c;
- typename C::const_iterator e = c.end();
- R r = c.insert(e, P(3.5));
- assert(c.size() == 1);
- assert(*r == 3.5);
-
- r = c.insert(r, P(3.5));
- assert(c.size() == 1);
- assert(*r == 3.5);
-
- r = c.insert(c.end(), P(4.5));
- assert(c.size() == 2);
- assert(*r == 4.5);
-
- r = c.insert(c.end(), P(5.5));
- assert(c.size() == 3);
- assert(*r == 5.5);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_set<double> C;
+ typedef C::iterator R;
+ typedef double P;
+ C c;
+ typename C::const_iterator e = c.end();
+ R r = c.insert(e, P(3.5));
+ assert(c.size() == 1);
+ assert(*r == 3.5);
+
+ r = c.insert(r, P(3.5));
+ assert(c.size() == 1);
+ assert(*r == 3.5);
+
+ r = c.insert(c.end(), P(4.5));
+ assert(c.size() == 2);
+ assert(*r == 4.5);
+
+ r = c.insert(c.end(), P(5.5));
+ assert(c.size() == 3);
+ assert(*r == 5.5);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_set<MoveOnly> C;
- typedef C::iterator R;
- typedef MoveOnly P;
- C c;
- typename C::const_iterator e = c.end();
- R r = c.insert(e, P(3));
- assert(c.size() == 1);
- assert(*r == 3);
-
- r = c.insert(r, P(3));
- assert(c.size() == 1);
- assert(*r == 3);
-
- r = c.insert(c.end(), P(4));
- assert(c.size() == 2);
- assert(*r == 4);
-
- r = c.insert(c.end(), P(5));
- assert(c.size() == 3);
- assert(*r == 5);
- }
- {
- typedef std::unordered_set<double, std::hash<double>,
- std::equal_to<double>, min_allocator<double>> C;
- typedef C::iterator R;
- typedef double P;
- C c;
- typename C::const_iterator e = c.end();
- R r = c.insert(e, P(3.5));
- assert(c.size() == 1);
- assert(*r == 3.5);
-
- r = c.insert(r, P(3.5));
- assert(c.size() == 1);
- assert(*r == 3.5);
-
- r = c.insert(c.end(), P(4.5));
- assert(c.size() == 2);
- assert(*r == 4.5);
-
- r = c.insert(c.end(), P(5.5));
- assert(c.size() == 3);
- assert(*r == 5.5);
- }
- {
- typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, min_allocator<MoveOnly>> C;
- typedef C::iterator R;
- typedef MoveOnly P;
- C c;
- typename C::const_iterator e = c.end();
- R r = c.insert(e, P(3));
- assert(c.size() == 1);
- assert(*r == 3);
-
- r = c.insert(r, P(3));
- assert(c.size() == 1);
- assert(*r == 3);
-
- r = c.insert(c.end(), P(4));
- assert(c.size() == 2);
- assert(*r == 4);
-
- r = c.insert(c.end(), P(5));
- assert(c.size() == 3);
- assert(*r == 5);
- }
+ {
+ typedef std::unordered_set<MoveOnly> C;
+ typedef C::iterator R;
+ typedef MoveOnly P;
+ C c;
+ typename C::const_iterator e = c.end();
+ R r = c.insert(e, P(3));
+ assert(c.size() == 1);
+ assert(*r == 3);
+
+ r = c.insert(r, P(3));
+ assert(c.size() == 1);
+ assert(*r == 3);
+
+ r = c.insert(c.end(), P(4));
+ assert(c.size() == 2);
+ assert(*r == 4);
+
+ r = c.insert(c.end(), P(5));
+ assert(c.size() == 3);
+ assert(*r == 5);
+ }
+ {
+ typedef std::unordered_set<double, std::hash<double>, std::equal_to<double>, min_allocator<double>> C;
+ typedef C::iterator R;
+ typedef double P;
+ C c;
+ typename C::const_iterator e = c.end();
+ R r = c.insert(e, P(3.5));
+ assert(c.size() == 1);
+ assert(*r == 3.5);
+
+ r = c.insert(r, P(3.5));
+ assert(c.size() == 1);
+ assert(*r == 3.5);
+
+ r = c.insert(c.end(), P(4.5));
+ assert(c.size() == 2);
+ assert(*r == 4.5);
+
+ r = c.insert(c.end(), P(5.5));
+ assert(c.size() == 3);
+ assert(*r == 5.5);
+ }
+ {
+ typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>, std::equal_to<MoveOnly>, min_allocator<MoveOnly>> C;
+ typedef C::iterator R;
+ typedef MoveOnly P;
+ C c;
+ typename C::const_iterator e = c.end();
+ R r = c.insert(e, P(3));
+ assert(c.size() == 1);
+ assert(*r == 3);
+
+ r = c.insert(r, P(3));
+ assert(c.size() == 1);
+ assert(*r == 3);
+
+ r = c.insert(c.end(), P(4));
+ assert(c.size() == 2);
+ assert(*r == 4);
+
+ r = c.insert(c.end(), P(5));
+ assert(c.size() == 3);
+ assert(*r == 5);
+ }
#endif // TEST_STD_VER >= 11
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.set/insert_init.pass.cpp b/libcxx/test/std/containers/unord/unord.set/insert_init.pass.cpp
index 63331efe387dde6..56036caa9c445e2 100644
--- a/libcxx/test/std/containers/unord/unord.set/insert_init.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/insert_init.pass.cpp
@@ -23,49 +23,29 @@
#include "test_iterators.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_set<int> C;
- typedef int P;
- C c;
- c.insert(
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- }
- );
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- }
- {
- typedef std::unordered_set<int, std::hash<int>,
- std::equal_to<int>, min_allocator<int>> C;
- typedef int P;
- C c;
- c.insert(
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- }
- );
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_set<int> C;
+ typedef int P;
+ C c;
+ c.insert({P(1), P(2), P(3), P(4), P(1), P(2)});
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ }
+ {
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ C c;
+ c.insert({P(1), P(2), P(3), P(4), P(1), P(2)});
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.set/insert_iter_iter.pass.cpp b/libcxx/test/std/containers/unord/unord.set/insert_iter_iter.pass.cpp
index 451ee6767100a54..a0592b2d4b51045 100644
--- a/libcxx/test/std/containers/unord/unord.set/insert_iter_iter.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/insert_iter_iter.pass.cpp
@@ -22,50 +22,32 @@
#include "test_iterators.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_set<int> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c;
- c.insert(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])));
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_set<int> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c;
+ c.insert(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])));
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_set<int, std::hash<int>,
- std::equal_to<int>, min_allocator<int>> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c;
- c.insert(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])));
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- }
+ {
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c;
+ c.insert(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])));
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.set/insert_node_type.pass.cpp b/libcxx/test/std/containers/unord/unord.set/insert_node_type.pass.cpp
index 16f52f456fbff42..5db9bcb8bd59c51 100644
--- a/libcxx/test/std/containers/unord/unord.set/insert_node_type.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/insert_node_type.pass.cpp
@@ -42,69 +42,63 @@ void verify_insert_return_type(T&& t) {
}
template <class Container>
-typename Container::node_type
-node_factory(typename Container::key_type const& key)
-{
- static Container c;
- auto p = c.insert(key);
- assert(p.second);
- return c.extract(p.first);
+typename Container::node_type node_factory(typename Container::key_type const& key) {
+ static Container c;
+ auto p = c.insert(key);
+ assert(p.second);
+ return c.extract(p.first);
}
template <class Container>
-void test(Container& c)
-{
- auto* nf = &node_factory<Container>;
-
- for (int i = 0; i != 10; ++i)
- {
- typename Container::node_type node = nf(i);
- assert(!node.empty());
- typename Container::insert_return_type irt = c.insert(std::move(node));
- assert(node.empty());
- assert(irt.inserted);
- assert(irt.node.empty());
- assert(*irt.position == i);
- verify_insert_return_type<Container>(irt);
- }
-
- assert(c.size() == 10);
-
- { // Insert empty node.
- typename Container::node_type def;
- auto irt = c.insert(std::move(def));
- assert(def.empty());
- assert(!irt.inserted);
- assert(irt.node.empty());
- assert(irt.position == c.end());
- verify_insert_return_type<Container>(irt);
- }
-
- { // Insert duplicate node.
- typename Container::node_type dupl = nf(0);
- auto irt = c.insert(std::move(dupl));
- assert(dupl.empty());
- assert(!irt.inserted);
- assert(!irt.node.empty());
- assert(irt.position == c.find(0));
- assert(irt.node.value() == 0);
- verify_insert_return_type<Container>(irt);
- }
-
- assert(c.size() == 10);
-
- for (int i = 0; i != 10; ++i)
- {
- assert(c.count(i) == 1);
- }
+void test(Container& c) {
+ auto* nf = &node_factory<Container>;
+
+ for (int i = 0; i != 10; ++i) {
+ typename Container::node_type node = nf(i);
+ assert(!node.empty());
+ typename Container::insert_return_type irt = c.insert(std::move(node));
+ assert(node.empty());
+ assert(irt.inserted);
+ assert(irt.node.empty());
+ assert(*irt.position == i);
+ verify_insert_return_type<Container>(irt);
+ }
+
+ assert(c.size() == 10);
+
+ { // Insert empty node.
+ typename Container::node_type def;
+ auto irt = c.insert(std::move(def));
+ assert(def.empty());
+ assert(!irt.inserted);
+ assert(irt.node.empty());
+ assert(irt.position == c.end());
+ verify_insert_return_type<Container>(irt);
+ }
+
+ { // Insert duplicate node.
+ typename Container::node_type dupl = nf(0);
+ auto irt = c.insert(std::move(dupl));
+ assert(dupl.empty());
+ assert(!irt.inserted);
+ assert(!irt.node.empty());
+ assert(irt.position == c.find(0));
+ assert(irt.node.value() == 0);
+ verify_insert_return_type<Container>(irt);
+ }
+
+ assert(c.size() == 10);
+
+ for (int i = 0; i != 10; ++i) {
+ assert(c.count(i) == 1);
+ }
}
-int main(int, char**)
-{
- std::unordered_set<int> m;
- test(m);
- std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> m2;
- test(m2);
+int main(int, char**) {
+ std::unordered_set<int> m;
+ test(m);
+ std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> m2;
+ test(m2);
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.set/insert_node_type_hint.pass.cpp b/libcxx/test/std/containers/unord/unord.set/insert_node_type_hint.pass.cpp
index b4b3d8822592c0f..851aa7a932727f1 100644
--- a/libcxx/test/std/containers/unord/unord.set/insert_node_type_hint.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/insert_node_type_hint.pass.cpp
@@ -19,45 +19,39 @@
#include "min_allocator.h"
template <class Container>
-typename Container::node_type
-node_factory(typename Container::key_type const& key)
-{
- static Container c;
- auto p = c.insert(key);
- assert(p.second);
- return c.extract(p.first);
+typename Container::node_type node_factory(typename Container::key_type const& key) {
+ static Container c;
+ auto p = c.insert(key);
+ assert(p.second);
+ return c.extract(p.first);
}
template <class Container>
-void test(Container& c)
-{
- auto* nf = &node_factory<Container>;
-
- for (int i = 0; i != 10; ++i)
- {
- typename Container::node_type node = nf(i);
- assert(!node.empty());
- std::size_t prev = c.size();
- auto it = c.insert(c.end(), std::move(node));
- assert(node.empty());
- assert(prev + 1 == c.size());
- assert(*it == i);
- }
-
- assert(c.size() == 10);
-
- for (int i = 0; i != 10; ++i)
- {
- assert(c.count(i) == 1);
- }
+void test(Container& c) {
+ auto* nf = &node_factory<Container>;
+
+ for (int i = 0; i != 10; ++i) {
+ typename Container::node_type node = nf(i);
+ assert(!node.empty());
+ std::size_t prev = c.size();
+ auto it = c.insert(c.end(), std::move(node));
+ assert(node.empty());
+ assert(prev + 1 == c.size());
+ assert(*it == i);
+ }
+
+ assert(c.size() == 10);
+
+ for (int i = 0; i != 10; ++i) {
+ assert(c.count(i) == 1);
+ }
}
-int main(int, char**)
-{
- std::unordered_set<int> m;
- test(m);
- std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> m2;
- test(m2);
+int main(int, char**) {
+ std::unordered_set<int> m;
+ test(m);
+ std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> m2;
+ test(m2);
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.set/insert_rvalue.pass.cpp b/libcxx/test/std/containers/unord/unord.set/insert_rvalue.pass.cpp
index 9edab2740415576..34e70f2701b3339 100644
--- a/libcxx/test/std/containers/unord/unord.set/insert_rvalue.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/insert_rvalue.pass.cpp
@@ -21,111 +21,108 @@
#include "MoveOnly.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_set<double> C;
- typedef std::pair<C::iterator, bool> R;
- typedef double P;
- C c;
- R r = c.insert(P(3.5));
- assert(c.size() == 1);
- assert(*r.first == 3.5);
- assert(r.second);
-
- r = c.insert(P(3.5));
- assert(c.size() == 1);
- assert(*r.first == 3.5);
- assert(!r.second);
-
- r = c.insert(P(4.5));
- assert(c.size() == 2);
- assert(*r.first == 4.5);
- assert(r.second);
-
- r = c.insert(P(5.5));
- assert(c.size() == 3);
- assert(*r.first == 5.5);
- assert(r.second);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_set<double> C;
+ typedef std::pair<C::iterator, bool> R;
+ typedef double P;
+ C c;
+ R r = c.insert(P(3.5));
+ assert(c.size() == 1);
+ assert(*r.first == 3.5);
+ assert(r.second);
+
+ r = c.insert(P(3.5));
+ assert(c.size() == 1);
+ assert(*r.first == 3.5);
+ assert(!r.second);
+
+ r = c.insert(P(4.5));
+ assert(c.size() == 2);
+ assert(*r.first == 4.5);
+ assert(r.second);
+
+ r = c.insert(P(5.5));
+ assert(c.size() == 3);
+ assert(*r.first == 5.5);
+ assert(r.second);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_set<MoveOnly> C;
- typedef std::pair<C::iterator, bool> R;
- typedef MoveOnly P;
- C c;
- R r = c.insert(P(3));
- assert(c.size() == 1);
- assert(*r.first == 3);
- assert(r.second);
-
- r = c.insert(P(3));
- assert(c.size() == 1);
- assert(*r.first == 3);
- assert(!r.second);
-
- r = c.insert(P(4));
- assert(c.size() == 2);
- assert(*r.first == 4);
- assert(r.second);
-
- r = c.insert(P(5));
- assert(c.size() == 3);
- assert(*r.first == 5);
- assert(r.second);
- }
- {
- typedef std::unordered_set<double, std::hash<double>,
- std::equal_to<double>, min_allocator<double>> C;
- typedef std::pair<C::iterator, bool> R;
- typedef double P;
- C c;
- R r = c.insert(P(3.5));
- assert(c.size() == 1);
- assert(*r.first == 3.5);
- assert(r.second);
-
- r = c.insert(P(3.5));
- assert(c.size() == 1);
- assert(*r.first == 3.5);
- assert(!r.second);
-
- r = c.insert(P(4.5));
- assert(c.size() == 2);
- assert(*r.first == 4.5);
- assert(r.second);
-
- r = c.insert(P(5.5));
- assert(c.size() == 3);
- assert(*r.first == 5.5);
- assert(r.second);
- }
- {
- typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, min_allocator<MoveOnly>> C;
- typedef std::pair<C::iterator, bool> R;
- typedef MoveOnly P;
- C c;
- R r = c.insert(P(3));
- assert(c.size() == 1);
- assert(*r.first == 3);
- assert(r.second);
-
- r = c.insert(P(3));
- assert(c.size() == 1);
- assert(*r.first == 3);
- assert(!r.second);
-
- r = c.insert(P(4));
- assert(c.size() == 2);
- assert(*r.first == 4);
- assert(r.second);
-
- r = c.insert(P(5));
- assert(c.size() == 3);
- assert(*r.first == 5);
- assert(r.second);
- }
+ {
+ typedef std::unordered_set<MoveOnly> C;
+ typedef std::pair<C::iterator, bool> R;
+ typedef MoveOnly P;
+ C c;
+ R r = c.insert(P(3));
+ assert(c.size() == 1);
+ assert(*r.first == 3);
+ assert(r.second);
+
+ r = c.insert(P(3));
+ assert(c.size() == 1);
+ assert(*r.first == 3);
+ assert(!r.second);
+
+ r = c.insert(P(4));
+ assert(c.size() == 2);
+ assert(*r.first == 4);
+ assert(r.second);
+
+ r = c.insert(P(5));
+ assert(c.size() == 3);
+ assert(*r.first == 5);
+ assert(r.second);
+ }
+ {
+ typedef std::unordered_set<double, std::hash<double>, std::equal_to<double>, min_allocator<double>> C;
+ typedef std::pair<C::iterator, bool> R;
+ typedef double P;
+ C c;
+ R r = c.insert(P(3.5));
+ assert(c.size() == 1);
+ assert(*r.first == 3.5);
+ assert(r.second);
+
+ r = c.insert(P(3.5));
+ assert(c.size() == 1);
+ assert(*r.first == 3.5);
+ assert(!r.second);
+
+ r = c.insert(P(4.5));
+ assert(c.size() == 2);
+ assert(*r.first == 4.5);
+ assert(r.second);
+
+ r = c.insert(P(5.5));
+ assert(c.size() == 3);
+ assert(*r.first == 5.5);
+ assert(r.second);
+ }
+ {
+ typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>, std::equal_to<MoveOnly>, min_allocator<MoveOnly>> C;
+ typedef std::pair<C::iterator, bool> R;
+ typedef MoveOnly P;
+ C c;
+ R r = c.insert(P(3));
+ assert(c.size() == 1);
+ assert(*r.first == 3);
+ assert(r.second);
+
+ r = c.insert(P(3));
+ assert(c.size() == 1);
+ assert(*r.first == 3);
+ assert(!r.second);
+
+ r = c.insert(P(4));
+ assert(c.size() == 2);
+ assert(*r.first == 4);
+ assert(r.second);
+
+ r = c.insert(P(5));
+ assert(c.size() == 3);
+ assert(*r.first == 5);
+ assert(r.second);
+ }
#endif // TEST_STD_VER >= 11
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.set/iterator.operators.addressof.compile.pass.cpp b/libcxx/test/std/containers/unord/unord.set/iterator.operators.addressof.compile.pass.cpp
index 457172d11f6bd96..759077ec6ff39ca 100644
--- a/libcxx/test/std/containers/unord/unord.set/iterator.operators.addressof.compile.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/iterator.operators.addressof.compile.pass.cpp
@@ -31,14 +31,14 @@ void test() {
void test() {
{
- using I = std::unordered_set<operator_hijacker>::iterator;
+ using I = std::unordered_set<operator_hijacker>::iterator;
using CI = std::unordered_set<operator_hijacker>::const_iterator;
test<I, I>();
test<CI, I>();
test<CI, CI>();
}
{
- using IL = std::unordered_set<operator_hijacker>::local_iterator;
+ using IL = std::unordered_set<operator_hijacker>::local_iterator;
using CIL = std::unordered_set<operator_hijacker>::const_local_iterator;
test<IL, IL>();
test<CIL, IL>();
diff --git a/libcxx/test/std/containers/unord/unord.set/iterator_concept_conformance.compile.pass.cpp b/libcxx/test/std/containers/unord/unord.set/iterator_concept_conformance.compile.pass.cpp
index 70490c828a11a7f..216b59655a826f1 100644
--- a/libcxx/test/std/containers/unord/unord.set/iterator_concept_conformance.compile.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/iterator_concept_conformance.compile.pass.cpp
@@ -16,11 +16,11 @@
#include "test_macros.h"
-using iterator = std::unordered_set<int>::iterator;
-using const_iterator = std::unordered_set<int>::const_iterator;
-using local_iterator = std::unordered_set<int>::local_iterator;
+using iterator = std::unordered_set<int>::iterator;
+using const_iterator = std::unordered_set<int>::const_iterator;
+using local_iterator = std::unordered_set<int>::local_iterator;
using const_local_iterator = std::unordered_set<int>::const_local_iterator;
-using value_type = int;
+using value_type = int;
static_assert(std::forward_iterator<iterator>);
LIBCPP_STATIC_ASSERT(!std::bidirectional_iterator<iterator>);
diff --git a/libcxx/test/std/containers/unord/unord.set/iterators.compile.fail.cpp b/libcxx/test/std/containers/unord/unord.set/iterators.compile.fail.cpp
index de5f88e792fedfa..bf4eee2640cfc70 100644
--- a/libcxx/test/std/containers/unord/unord.set/iterators.compile.fail.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/iterators.compile.fail.cpp
@@ -22,47 +22,30 @@
#include <unordered_set>
#include <cassert>
-int main(int, char**)
-{
- {
- typedef std::unordered_set<int> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 5);
- assert(c.size() == 6);
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
- C::iterator i = c.begin();
- assert(*i == 1);
- *i = 2;
- }
- {
- typedef std::unordered_set<int> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- const C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 5);
- assert(c.size() == 6);
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_set<int> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 5);
+ assert(c.size() == 6);
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ C::iterator i = c.begin();
+ assert(*i == 1);
+ *i = 2;
+ }
+ {
+ typedef std::unordered_set<int> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ const C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 5);
+ assert(c.size() == 6);
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.set/iterators.pass.cpp b/libcxx/test/std/containers/unord/unord.set/iterators.pass.cpp
index eb8459101b2a289..abf20f194635063 100644
--- a/libcxx/test/std/containers/unord/unord.set/iterators.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/iterators.pass.cpp
@@ -26,104 +26,69 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_set<int> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 5);
- assert(c.size() == 4);
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- C::iterator i;
- }
- {
- typedef std::unordered_set<int> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- const C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 5);
- assert(c.size() == 4);
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- C::const_iterator i;
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_set<int> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 5);
+ assert(c.size() == 4);
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ C::iterator i;
+ }
+ {
+ typedef std::unordered_set<int> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ const C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 5);
+ assert(c.size() == 4);
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ C::const_iterator i;
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_set<int, std::hash<int>,
- std::equal_to<int>, min_allocator<int>> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 5);
- assert(c.size() == 4);
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- C::iterator i;
- }
- {
- typedef std::unordered_set<int, std::hash<int>,
- std::equal_to<int>, min_allocator<int>> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- const C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 5);
- assert(c.size() == 4);
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- C::const_iterator i;
- }
+ {
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 5);
+ assert(c.size() == 4);
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ C::iterator i;
+ }
+ {
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ const C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 5);
+ assert(c.size() == 4);
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ C::const_iterator i;
+ }
#endif
#if TEST_STD_VER > 11
- { // N3644 testing
- typedef std::unordered_set<int> C;
- C::iterator ii1{}, ii2{};
- C::iterator ii4 = ii1;
- C::const_iterator cii{};
- assert ( ii1 == ii2 );
- assert ( ii1 == ii4 );
+ { // N3644 testing
+ typedef std::unordered_set<int> C;
+ C::iterator ii1{}, ii2{};
+ C::iterator ii4 = ii1;
+ C::const_iterator cii{};
+ assert(ii1 == ii2);
+ assert(ii1 == ii4);
- assert (!(ii1 != ii2 ));
+ assert(!(ii1 != ii2));
- assert ( (ii1 == cii ));
- assert ( (cii == ii1 ));
- assert (!(ii1 != cii ));
- assert (!(cii != ii1 ));
- }
+ assert((ii1 == cii));
+ assert((cii == ii1));
+ assert(!(ii1 != cii));
+ assert(!(cii != ii1));
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.set/load_factor.pass.cpp b/libcxx/test/std/containers/unord/unord.set/load_factor.pass.cpp
index 0952a4c3f2134b1..0e4294311237da9 100644
--- a/libcxx/test/std/containers/unord/unord.set/load_factor.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/load_factor.pass.cpp
@@ -22,55 +22,32 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_set<int> C;
- typedef int P;
- P a[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- const C c(std::begin(a), std::end(a));
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- }
- {
- typedef std::unordered_set<int> C;
- const C c;
- assert(c.load_factor() == 0);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_set<int> C;
+ typedef int P;
+ P a[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)};
+ const C c(std::begin(a), std::end(a));
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ }
+ {
+ typedef std::unordered_set<int> C;
+ const C c;
+ assert(c.load_factor() == 0);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_set<int, std::hash<int>,
- std::equal_to<int>, min_allocator<int>> C;
- typedef int P;
- P a[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- const C c(std::begin(a), std::end(a));
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- }
- {
- typedef std::unordered_set<int, std::hash<int>,
- std::equal_to<int>, min_allocator<int>> C;
- const C c;
- assert(c.load_factor() == 0);
- }
+ {
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)};
+ const C c(std::begin(a), std::end(a));
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ }
+ {
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ const C c;
+ assert(c.load_factor() == 0);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.set/local_iterators.compile.fail.cpp b/libcxx/test/std/containers/unord/unord.set/local_iterators.compile.fail.cpp
index 7bacd2f6f765395..9f7aca15c334397 100644
--- a/libcxx/test/std/containers/unord/unord.set/local_iterators.compile.fail.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/local_iterators.compile.fail.cpp
@@ -22,241 +22,208 @@
#include <unordered_set>
#include <cassert>
-int main(int, char**)
-{
- {
- typedef std::unordered_set<int> C;
- typedef int P;
- typedef C::local_iterator I;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 5);
- C::size_type b = c.bucket(0);
- I i = c.begin(b);
- I j = c.end(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(1);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 2);
- assert(*i == 1);
- ++i;
- assert(*i == 1);
- *i = 2;
-
- b = c.bucket(2);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 2);
- assert(*i == 2);
- ++i;
- assert(*i == 2);
-
- b = c.bucket(3);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 3);
-
- b = c.bucket(4);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 4);
-
- b = c.bucket(5);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(6);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 0);
- }
- {
- typedef std::unordered_set<int> C;
- typedef int P;
- typedef C::const_local_iterator I;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- const C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 5);
- C::size_type b = c.bucket(0);
- I i = c.begin(b);
- I j = c.end(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(1);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 2);
- assert(*i == 1);
- ++i;
- assert(*i == 1);
-
- b = c.bucket(2);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 2);
- assert(*i == 2);
- ++i;
- assert(*i == 2);
-
- b = c.bucket(3);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 3);
-
- b = c.bucket(4);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 4);
-
- b = c.bucket(5);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(6);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 0);
- }
- {
- typedef std::unordered_set<int> C;
- typedef int P;
- typedef C::const_local_iterator I;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 5);
- C::size_type b = c.bucket(0);
- I i = c.cbegin(b);
- I j = c.cend(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(1);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 2);
- assert(*i == 1);
- ++i;
- assert(*i == 1);
-
- b = c.bucket(2);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 2);
- assert(*i == 2);
- ++i;
- assert(*i == 2);
-
- b = c.bucket(3);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 3);
-
- b = c.bucket(4);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 4);
-
- b = c.bucket(5);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(6);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 0);
- }
- {
- typedef std::unordered_set<int> C;
- typedef int P;
- typedef C::const_local_iterator I;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- const C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 5);
- C::size_type b = c.bucket(0);
- I i = c.cbegin(b);
- I j = c.cend(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(1);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 2);
- assert(*i == 1);
- ++i;
- assert(*i == 1);
-
- b = c.bucket(2);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 2);
- assert(*i == 2);
- ++i;
- assert(*i == 2);
-
- b = c.bucket(3);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 3);
-
- b = c.bucket(4);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 4);
-
- b = c.bucket(5);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(6);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 0);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_set<int> C;
+ typedef int P;
+ typedef C::local_iterator I;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 5);
+ C::size_type b = c.bucket(0);
+ I i = c.begin(b);
+ I j = c.end(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 2);
+ assert(*i == 1);
+ ++i;
+ assert(*i == 1);
+ *i = 2;
+
+ b = c.bucket(2);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 2);
+ assert(*i == 2);
+ ++i;
+ assert(*i == 2);
+
+ b = c.bucket(3);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 3);
+
+ b = c.bucket(4);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 4);
+
+ b = c.bucket(5);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(6);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 0);
+ }
+ {
+ typedef std::unordered_set<int> C;
+ typedef int P;
+ typedef C::const_local_iterator I;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ const C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 5);
+ C::size_type b = c.bucket(0);
+ I i = c.begin(b);
+ I j = c.end(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 2);
+ assert(*i == 1);
+ ++i;
+ assert(*i == 1);
+
+ b = c.bucket(2);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 2);
+ assert(*i == 2);
+ ++i;
+ assert(*i == 2);
+
+ b = c.bucket(3);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 3);
+
+ b = c.bucket(4);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 4);
+
+ b = c.bucket(5);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(6);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 0);
+ }
+ {
+ typedef std::unordered_set<int> C;
+ typedef int P;
+ typedef C::const_local_iterator I;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 5);
+ C::size_type b = c.bucket(0);
+ I i = c.cbegin(b);
+ I j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 2);
+ assert(*i == 1);
+ ++i;
+ assert(*i == 1);
+
+ b = c.bucket(2);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 2);
+ assert(*i == 2);
+ ++i;
+ assert(*i == 2);
+
+ b = c.bucket(3);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 3);
+
+ b = c.bucket(4);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 4);
+
+ b = c.bucket(5);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(6);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+ }
+ {
+ typedef std::unordered_set<int> C;
+ typedef int P;
+ typedef C::const_local_iterator I;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ const C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 5);
+ C::size_type b = c.bucket(0);
+ I i = c.cbegin(b);
+ I j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 2);
+ assert(*i == 1);
+ ++i;
+ assert(*i == 1);
+
+ b = c.bucket(2);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 2);
+ assert(*i == 2);
+ ++i;
+ assert(*i == 2);
+
+ b = c.bucket(3);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 3);
+
+ b = c.bucket(4);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 4);
+
+ b = c.bucket(5);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(6);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.set/local_iterators.pass.cpp b/libcxx/test/std/containers/unord/unord.set/local_iterators.pass.cpp
index adc0164947bb94d..8c9b5722efa0c93 100644
--- a/libcxx/test/std/containers/unord/unord.set/local_iterators.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/local_iterators.pass.cpp
@@ -25,365 +25,296 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_set<int> C;
- typedef int P;
- typedef C::local_iterator I;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 5);
- C::size_type b = c.bucket(0);
- I i = c.begin(b);
- I j = c.end(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(1);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 1);
-
- b = c.bucket(2);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 2);
-
- b = c.bucket(3);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 3);
-
- b = c.bucket(4);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 4);
- }
- {
- typedef std::unordered_set<int> C;
- typedef int P;
- typedef C::const_local_iterator I;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- const C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 5);
- C::size_type b = c.bucket(0);
- I i = c.begin(b);
- I j = c.end(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(1);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 1);
-
- b = c.bucket(2);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 2);
-
- b = c.bucket(3);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 3);
-
- b = c.bucket(4);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 4);
- }
- {
- typedef std::unordered_set<int> C;
- typedef int P;
- typedef C::const_local_iterator I;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 5);
- C::size_type b = c.bucket(0);
- I i = c.cbegin(b);
- I j = c.cend(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(1);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 1);
-
- b = c.bucket(2);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 2);
-
- b = c.bucket(3);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 3);
-
- b = c.bucket(4);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 4);
- }
- {
- typedef std::unordered_set<int> C;
- typedef int P;
- typedef C::const_local_iterator I;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- const C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 5);
- C::size_type b = c.bucket(0);
- I i = c.cbegin(b);
- I j = c.cend(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(1);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 1);
-
- b = c.bucket(2);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 2);
-
- b = c.bucket(3);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 3);
-
- b = c.bucket(4);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 4);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_set<int> C;
+ typedef int P;
+ typedef C::local_iterator I;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 5);
+ C::size_type b = c.bucket(0);
+ I i = c.begin(b);
+ I j = c.end(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 1);
+
+ b = c.bucket(2);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 2);
+
+ b = c.bucket(3);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 3);
+
+ b = c.bucket(4);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 4);
+ }
+ {
+ typedef std::unordered_set<int> C;
+ typedef int P;
+ typedef C::const_local_iterator I;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ const C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 5);
+ C::size_type b = c.bucket(0);
+ I i = c.begin(b);
+ I j = c.end(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 1);
+
+ b = c.bucket(2);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 2);
+
+ b = c.bucket(3);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 3);
+
+ b = c.bucket(4);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 4);
+ }
+ {
+ typedef std::unordered_set<int> C;
+ typedef int P;
+ typedef C::const_local_iterator I;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 5);
+ C::size_type b = c.bucket(0);
+ I i = c.cbegin(b);
+ I j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 1);
+
+ b = c.bucket(2);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 2);
+
+ b = c.bucket(3);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 3);
+
+ b = c.bucket(4);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 4);
+ }
+ {
+ typedef std::unordered_set<int> C;
+ typedef int P;
+ typedef C::const_local_iterator I;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ const C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 5);
+ C::size_type b = c.bucket(0);
+ I i = c.cbegin(b);
+ I j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 1);
+
+ b = c.bucket(2);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 2);
+
+ b = c.bucket(3);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 3);
+
+ b = c.bucket(4);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 4);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_set<int, std::hash<int>,
- std::equal_to<int>, min_allocator<int>> C;
- typedef int P;
- typedef C::local_iterator I;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 5);
- C::size_type b = c.bucket(0);
- I i = c.begin(b);
- I j = c.end(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(1);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 1);
-
- b = c.bucket(2);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 2);
-
- b = c.bucket(3);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 3);
-
- b = c.bucket(4);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 4);
- }
- {
- typedef std::unordered_set<int, std::hash<int>,
- std::equal_to<int>, min_allocator<int>> C;
- typedef int P;
- typedef C::const_local_iterator I;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- const C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 5);
- C::size_type b = c.bucket(0);
- I i = c.begin(b);
- I j = c.end(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(1);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 1);
-
- b = c.bucket(2);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 2);
-
- b = c.bucket(3);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 3);
-
- b = c.bucket(4);
- i = c.begin(b);
- j = c.end(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 4);
- }
- {
- typedef std::unordered_set<int, std::hash<int>,
- std::equal_to<int>, min_allocator<int>> C;
- typedef int P;
- typedef C::const_local_iterator I;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 5);
- C::size_type b = c.bucket(0);
- I i = c.cbegin(b);
- I j = c.cend(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(1);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 1);
-
- b = c.bucket(2);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 2);
-
- b = c.bucket(3);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 3);
-
- b = c.bucket(4);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 4);
- }
- {
- typedef std::unordered_set<int, std::hash<int>,
- std::equal_to<int>, min_allocator<int>> C;
- typedef int P;
- typedef C::const_local_iterator I;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- const C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() >= 5);
- C::size_type b = c.bucket(0);
- I i = c.cbegin(b);
- I j = c.cend(b);
- assert(std::distance(i, j) == 0);
-
- b = c.bucket(1);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 1);
-
- b = c.bucket(2);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 2);
-
- b = c.bucket(3);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 3);
-
- b = c.bucket(4);
- i = c.cbegin(b);
- j = c.cend(b);
- assert(std::distance(i, j) == 1);
- assert(*i == 4);
- }
+ {
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ typedef C::local_iterator I;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 5);
+ C::size_type b = c.bucket(0);
+ I i = c.begin(b);
+ I j = c.end(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 1);
+
+ b = c.bucket(2);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 2);
+
+ b = c.bucket(3);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 3);
+
+ b = c.bucket(4);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 4);
+ }
+ {
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ typedef C::const_local_iterator I;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ const C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 5);
+ C::size_type b = c.bucket(0);
+ I i = c.begin(b);
+ I j = c.end(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 1);
+
+ b = c.bucket(2);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 2);
+
+ b = c.bucket(3);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 3);
+
+ b = c.bucket(4);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 4);
+ }
+ {
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ typedef C::const_local_iterator I;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 5);
+ C::size_type b = c.bucket(0);
+ I i = c.cbegin(b);
+ I j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 1);
+
+ b = c.bucket(2);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 2);
+
+ b = c.bucket(3);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 3);
+
+ b = c.bucket(4);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 4);
+ }
+ {
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ typedef C::const_local_iterator I;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ const C c(a, a + sizeof(a) / sizeof(a[0]));
+ assert(c.bucket_count() >= 5);
+ C::size_type b = c.bucket(0);
+ I i = c.cbegin(b);
+ I j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 1);
+
+ b = c.bucket(2);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 2);
+
+ b = c.bucket(3);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 3);
+
+ b = c.bucket(4);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 4);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.set/max_bucket_count.pass.cpp b/libcxx/test/std/containers/unord/unord.set/max_bucket_count.pass.cpp
index c830f444bbaee17..2ac65b06f8b29e3 100644
--- a/libcxx/test/std/containers/unord/unord.set/max_bucket_count.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/max_bucket_count.pass.cpp
@@ -20,20 +20,18 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_set<int> C;
- const C c;
- assert(c.max_bucket_count() > 0);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_set<int> C;
+ const C c;
+ assert(c.max_bucket_count() > 0);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_set<int, std::hash<int>,
- std::equal_to<int>, min_allocator<int>> C;
- const C c;
- assert(c.max_bucket_count() > 0);
- }
+ {
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ const C c;
+ assert(c.max_bucket_count() > 0);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.set/max_load_factor.pass.cpp b/libcxx/test/std/containers/unord/unord.set/max_load_factor.pass.cpp
index 9951956da66d71c..ba8d9aa6619bbbc 100644
--- a/libcxx/test/std/containers/unord/unord.set/max_load_factor.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/max_load_factor.pass.cpp
@@ -21,36 +21,33 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_set<int> C;
- const C c;
- assert(c.max_load_factor() == 1);
- }
- {
- typedef std::unordered_set<int> C;
- C c;
- assert(c.max_load_factor() == 1);
- c.max_load_factor(2.5);
- assert(c.max_load_factor() == 2.5);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_set<int> C;
+ const C c;
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef std::unordered_set<int> C;
+ C c;
+ assert(c.max_load_factor() == 1);
+ c.max_load_factor(2.5);
+ assert(c.max_load_factor() == 2.5);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_set<int, std::hash<int>,
- std::equal_to<int>, min_allocator<int>> C;
- const C c;
- assert(c.max_load_factor() == 1);
- }
- {
- typedef std::unordered_set<int, std::hash<int>,
- std::equal_to<int>, min_allocator<int>> C;
- C c;
- assert(c.max_load_factor() == 1);
- c.max_load_factor(2.5);
- assert(c.max_load_factor() == 2.5);
- }
+ {
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ const C c;
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ C c;
+ assert(c.max_load_factor() == 1);
+ c.max_load_factor(2.5);
+ assert(c.max_load_factor() == 2.5);
+ }
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.set/max_size.pass.cpp b/libcxx/test/std/containers/unord/unord.set/max_size.pass.cpp
index 289c4d323174979..978a6ac6ba601b8 100644
--- a/libcxx/test/std/containers/unord/unord.set/max_size.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/max_size.pass.cpp
@@ -20,32 +20,29 @@
#include "test_allocator.h"
#include "test_macros.h"
-int main(int, char**)
-{
- {
- typedef limited_allocator<int, 10> A;
- typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, A> C;
- C c;
- assert(c.max_size() <= 10);
- LIBCPP_ASSERT(c.max_size() == 10);
- }
- {
- typedef limited_allocator<int, (std::size_t)-1> A;
- typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, A> C;
- const C::size_type max_dist =
- static_cast<C::size_type>(std::numeric_limits<C::
diff erence_type>::max());
- C c;
- assert(c.max_size() <= max_dist);
- LIBCPP_ASSERT(c.max_size() == max_dist);
- }
- {
- typedef std::unordered_set<char> C;
- const C::size_type max_dist =
- static_cast<C::size_type>(std::numeric_limits<C::
diff erence_type>::max());
- C c;
- assert(c.max_size() <= max_dist);
- assert(c.max_size() <= alloc_max_size(c.get_allocator()));
- }
+int main(int, char**) {
+ {
+ typedef limited_allocator<int, 10> A;
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, A> C;
+ C c;
+ assert(c.max_size() <= 10);
+ LIBCPP_ASSERT(c.max_size() == 10);
+ }
+ {
+ typedef limited_allocator<int, (std::size_t)-1> A;
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, A> C;
+ const C::size_type max_dist = static_cast<C::size_type>(std::numeric_limits<C::
diff erence_type>::max());
+ C c;
+ assert(c.max_size() <= max_dist);
+ LIBCPP_ASSERT(c.max_size() == max_dist);
+ }
+ {
+ typedef std::unordered_set<char> C;
+ const C::size_type max_dist = static_cast<C::size_type>(std::numeric_limits<C::
diff erence_type>::max());
+ C c;
+ assert(c.max_size() <= max_dist);
+ assert(c.max_size() <= alloc_max_size(c.get_allocator()));
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.set/merge.pass.cpp b/libcxx/test/std/containers/unord/unord.set/merge.pass.cpp
index c1b0e174cc0c18f..966875b3e6c1a4e 100644
--- a/libcxx/test/std/containers/unord/unord.set/merge.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/merge.pass.cpp
@@ -27,128 +27,116 @@
#include "Counter.h"
template <class Set>
-bool set_equal(const Set& set, Set other)
-{
- return set == other;
+bool set_equal(const Set& set, Set other) {
+ return set == other;
}
#ifndef TEST_HAS_NO_EXCEPTIONS
template <class T>
-struct throw_hasher
-{
- bool& should_throw_;
+struct throw_hasher {
+ bool& should_throw_;
- throw_hasher(bool& should_throw) : should_throw_(should_throw) {}
+ throw_hasher(bool& should_throw) : should_throw_(should_throw) {}
- std::size_t operator()(const T& p) const
- {
- if (should_throw_)
- throw 0;
- return std::hash<T>()(p);
- }
+ std::size_t operator()(const T& p) const {
+ if (should_throw_)
+ throw 0;
+ return std::hash<T>()(p);
+ }
};
#endif
-int main(int, char**)
-{
- {
- std::unordered_set<int> src{1, 3, 5};
- std::unordered_set<int> dst{2, 4, 5};
- dst.merge(src);
- assert(set_equal(src, {5}));
- assert(set_equal(dst, {1, 2, 3, 4, 5}));
- }
+int main(int, char**) {
+ {
+ std::unordered_set<int> src{1, 3, 5};
+ std::unordered_set<int> dst{2, 4, 5};
+ dst.merge(src);
+ assert(set_equal(src, {5}));
+ assert(set_equal(dst, {1, 2, 3, 4, 5}));
+ }
#ifndef TEST_HAS_NO_EXCEPTIONS
- {
- bool do_throw = false;
- typedef std::unordered_set<Counter<int>, throw_hasher<Counter<int>>> set_type;
- set_type src({1, 3, 5}, 0, throw_hasher<Counter<int>>(do_throw));
- set_type dst({2, 4, 5}, 0, throw_hasher<Counter<int>>(do_throw));
-
- assert(Counter_base::gConstructed == 6);
-
- do_throw = true;
- try
- {
- dst.merge(src);
- }
- catch (int)
- {
- do_throw = false;
- }
- assert(!do_throw);
- assert(set_equal(src, set_type({1, 3, 5}, 0, throw_hasher<Counter<int>>(do_throw))));
- assert(set_equal(dst, set_type({2, 4, 5}, 0, throw_hasher<Counter<int>>(do_throw))));
+ {
+ bool do_throw = false;
+ typedef std::unordered_set<Counter<int>, throw_hasher<Counter<int>>> set_type;
+ set_type src({1, 3, 5}, 0, throw_hasher<Counter<int>>(do_throw));
+ set_type dst({2, 4, 5}, 0, throw_hasher<Counter<int>>(do_throw));
+
+ assert(Counter_base::gConstructed == 6);
+
+ do_throw = true;
+ try {
+ dst.merge(src);
+ } catch (int) {
+ do_throw = false;
}
+ assert(!do_throw);
+ assert(set_equal(src, set_type({1, 3, 5}, 0, throw_hasher<Counter<int>>(do_throw))));
+ assert(set_equal(dst, set_type({2, 4, 5}, 0, throw_hasher<Counter<int>>(do_throw))));
+ }
#endif
- assert(Counter_base::gConstructed == 0);
- struct equal
- {
- equal() = default;
-
- bool operator()(const Counter<int>& lhs, const Counter<int>& rhs) const
- {
- return lhs == rhs;
- }
- };
- struct hasher
- {
- hasher() = default;
- std::size_t operator()(const Counter<int>& p) const { return std::hash<Counter<int>>()(p); }
- };
- {
- typedef std::unordered_set<Counter<int>, std::hash<Counter<int>>, std::equal_to<Counter<int>>> first_set_type;
- typedef std::unordered_set<Counter<int>, hasher, equal> second_set_type;
- typedef std::unordered_multiset<Counter<int>, hasher, equal> third_set_type;
+ assert(Counter_base::gConstructed == 0);
+ struct equal {
+ equal() = default;
+
+ bool operator()(const Counter<int>& lhs, const Counter<int>& rhs) const { return lhs == rhs; }
+ };
+ struct hasher {
+ hasher() = default;
+ std::size_t operator()(const Counter<int>& p) const { return std::hash<Counter<int>>()(p); }
+ };
+ {
+ typedef std::unordered_set<Counter<int>, std::hash<Counter<int>>, std::equal_to<Counter<int>>> first_set_type;
+ typedef std::unordered_set<Counter<int>, hasher, equal> second_set_type;
+ typedef std::unordered_multiset<Counter<int>, hasher, equal> third_set_type;
- {
- first_set_type first{1, 2, 3};
- second_set_type second{2, 3, 4};
- third_set_type third{1, 3};
+ {
+ first_set_type first{1, 2, 3};
+ second_set_type second{2, 3, 4};
+ third_set_type third{1, 3};
- assert(Counter_base::gConstructed == 8);
+ assert(Counter_base::gConstructed == 8);
- first.merge(second);
- first.merge(third);
+ first.merge(second);
+ first.merge(third);
- assert(set_equal(first, {1, 2, 3, 4}));
- assert(set_equal(second, {2, 3}));
- assert(set_equal(third, {1, 3}));
+ assert(set_equal(first, {1, 2, 3, 4}));
+ assert(set_equal(second, {2, 3}));
+ assert(set_equal(third, {1, 3}));
- assert(Counter_base::gConstructed == 8);
- }
- assert(Counter_base::gConstructed == 0);
- {
- first_set_type first{1, 2, 3};
- second_set_type second{2, 3, 4};
- third_set_type third{1, 3};
+ assert(Counter_base::gConstructed == 8);
+ }
+ assert(Counter_base::gConstructed == 0);
+ {
+ first_set_type first{1, 2, 3};
+ second_set_type second{2, 3, 4};
+ third_set_type third{1, 3};
- assert(Counter_base::gConstructed == 8);
+ assert(Counter_base::gConstructed == 8);
- first.merge(std::move(second));
- first.merge(std::move(third));
+ first.merge(std::move(second));
+ first.merge(std::move(third));
- assert(set_equal(first, {1, 2, 3, 4}));
- assert(set_equal(second, {2, 3}));
- assert(set_equal(third, {1, 3}));
+ assert(set_equal(first, {1, 2, 3, 4}));
+ assert(set_equal(second, {2, 3}));
+ assert(set_equal(third, {1, 3}));
- assert(Counter_base::gConstructed == 8);
- }
- assert(Counter_base::gConstructed == 0);
+ assert(Counter_base::gConstructed == 8);
+ }
+ assert(Counter_base::gConstructed == 0);
+ }
+ {
+ std::unordered_set<int> first;
+ {
+ std::unordered_set<int> second;
+ first.merge(second);
+ first.merge(std::move(second));
}
{
- std::unordered_set<int> first;
- {
- std::unordered_set<int> second;
- first.merge(second);
- first.merge(std::move(second));
- }
- {
- std::unordered_multiset<int> second;
- first.merge(second);
- first.merge(std::move(second));
- }
+ std::unordered_multiset<int> second;
+ first.merge(second);
+ first.merge(std::move(second));
}
- return 0;
+ }
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.set/range_concept_conformance.compile.pass.cpp b/libcxx/test/std/containers/unord/unord.set/range_concept_conformance.compile.pass.cpp
index 1094e5ae67ee1a2..428b5abefc6cc4f 100644
--- a/libcxx/test/std/containers/unord/unord.set/range_concept_conformance.compile.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/range_concept_conformance.compile.pass.cpp
@@ -19,7 +19,6 @@
using range = std::unordered_set<int>;
-
static_assert(std::same_as<std::ranges::iterator_t<range>, range::iterator>);
static_assert(std::ranges::common_range<range>);
static_assert(std::ranges::forward_range<range>);
diff --git a/libcxx/test/std/containers/unord/unord.set/rehash.pass.cpp b/libcxx/test/std/containers/unord/unord.set/rehash.pass.cpp
index a0482fc2db70610..cba4aeb33e585c7 100644
--- a/libcxx/test/std/containers/unord/unord.set/rehash.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/rehash.pass.cpp
@@ -21,83 +21,63 @@
#include "min_allocator.h"
template <class C>
-void rehash_postcondition(const C& c, std::size_t n)
-{
- assert(c.bucket_count() >= c.size() / c.max_load_factor() && c.bucket_count() >= n);
+void rehash_postcondition(const C& c, std::size_t n) {
+ assert(c.bucket_count() >= c.size() / c.max_load_factor() && c.bucket_count() >= n);
}
template <class C>
-void test(const C& c)
-{
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
+void test(const C& c) {
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
}
-int main(int, char**)
-{
- {
- typedef std::unordered_set<int> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- test(c);
- assert(c.bucket_count() >= 5);
- c.rehash(3);
- rehash_postcondition(c, 3);
- LIBCPP_ASSERT(c.bucket_count() == 5);
- test(c);
- c.max_load_factor(2);
- c.rehash(3);
- rehash_postcondition(c, 3);
- LIBCPP_ASSERT(c.bucket_count() == 3);
- test(c);
- c.rehash(31);
- rehash_postcondition(c, 31);
- LIBCPP_ASSERT(c.bucket_count() == 31);
- test(c);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_set<int> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ test(c);
+ assert(c.bucket_count() >= 5);
+ c.rehash(3);
+ rehash_postcondition(c, 3);
+ LIBCPP_ASSERT(c.bucket_count() == 5);
+ test(c);
+ c.max_load_factor(2);
+ c.rehash(3);
+ rehash_postcondition(c, 3);
+ LIBCPP_ASSERT(c.bucket_count() == 3);
+ test(c);
+ c.rehash(31);
+ rehash_postcondition(c, 31);
+ LIBCPP_ASSERT(c.bucket_count() == 31);
+ test(c);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_set<int, std::hash<int>,
- std::equal_to<int>, min_allocator<int>> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- test(c);
- assert(c.bucket_count() >= 5);
- c.rehash(3);
- rehash_postcondition(c, 3);
- LIBCPP_ASSERT(c.bucket_count() == 5);
- test(c);
- c.max_load_factor(2);
- c.rehash(3);
- rehash_postcondition(c, 3);
- LIBCPP_ASSERT(c.bucket_count() == 3);
- test(c);
- c.rehash(31);
- rehash_postcondition(c, 31);
- LIBCPP_ASSERT(c.bucket_count() == 31);
- test(c);
- }
+ {
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ test(c);
+ assert(c.bucket_count() >= 5);
+ c.rehash(3);
+ rehash_postcondition(c, 3);
+ LIBCPP_ASSERT(c.bucket_count() == 5);
+ test(c);
+ c.max_load_factor(2);
+ c.rehash(3);
+ rehash_postcondition(c, 3);
+ LIBCPP_ASSERT(c.bucket_count() == 3);
+ test(c);
+ c.rehash(31);
+ rehash_postcondition(c, 31);
+ LIBCPP_ASSERT(c.bucket_count() == 31);
+ test(c);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.set/reserve.pass.cpp b/libcxx/test/std/containers/unord/unord.set/reserve.pass.cpp
index afcccf9e037957e..cd4b670a9c7971d 100644
--- a/libcxx/test/std/containers/unord/unord.set/reserve.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/reserve.pass.cpp
@@ -21,88 +21,67 @@
#include "min_allocator.h"
template <class C>
-void test(const C& c)
-{
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
+void test(const C& c) {
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
}
void reserve_invariant(std::size_t n) // LWG #2156
{
- for (std::size_t i = 0; i < n; ++i)
- {
- std::unordered_set<std::size_t> c;
- c.reserve(n);
- std::size_t buckets = c.bucket_count();
- for (std::size_t j = 0; j < i; ++j)
- {
- c.insert(i);
- assert(buckets == c.bucket_count());
- }
+ for (std::size_t i = 0; i < n; ++i) {
+ std::unordered_set<std::size_t> c;
+ c.reserve(n);
+ std::size_t buckets = c.bucket_count();
+ for (std::size_t j = 0; j < i; ++j) {
+ c.insert(i);
+ assert(buckets == c.bucket_count());
}
+ }
}
-int main(int, char**)
-{
- {
- typedef std::unordered_set<int> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- test(c);
- assert(c.bucket_count() >= 5);
- c.reserve(3);
- LIBCPP_ASSERT(c.bucket_count() == 5);
- test(c);
- c.max_load_factor(2);
- c.reserve(3);
- assert(c.bucket_count() >= 2);
- test(c);
- c.reserve(31);
- assert(c.bucket_count() >= 16);
- test(c);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_set<int> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ test(c);
+ assert(c.bucket_count() >= 5);
+ c.reserve(3);
+ LIBCPP_ASSERT(c.bucket_count() == 5);
+ test(c);
+ c.max_load_factor(2);
+ c.reserve(3);
+ assert(c.bucket_count() >= 2);
+ test(c);
+ c.reserve(31);
+ assert(c.bucket_count() >= 16);
+ test(c);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_set<int, std::hash<int>,
- std::equal_to<int>, min_allocator<int>> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- test(c);
- assert(c.bucket_count() >= 5);
- c.reserve(3);
- LIBCPP_ASSERT(c.bucket_count() == 5);
- test(c);
- c.max_load_factor(2);
- c.reserve(3);
- assert(c.bucket_count() >= 2);
- test(c);
- c.reserve(31);
- assert(c.bucket_count() >= 16);
- test(c);
- }
+ {
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ test(c);
+ assert(c.bucket_count() >= 5);
+ c.reserve(3);
+ LIBCPP_ASSERT(c.bucket_count() == 5);
+ test(c);
+ c.max_load_factor(2);
+ c.reserve(3);
+ assert(c.bucket_count() >= 2);
+ test(c);
+ c.reserve(31);
+ assert(c.bucket_count() >= 16);
+ test(c);
+ }
#endif
- reserve_invariant(20);
+ reserve_invariant(20);
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.set/size.pass.cpp b/libcxx/test/std/containers/unord/unord.set/size.pass.cpp
index f7967fcd5f7a5fb..4b2e8f3814d862a 100644
--- a/libcxx/test/std/containers/unord/unord.set/size.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/size.pass.cpp
@@ -18,9 +18,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
typedef std::unordered_set<int> M;
M m;
ASSERT_NOEXCEPT(m.size());
@@ -37,9 +36,9 @@ int main(int, char**)
assert(m.size() == 1);
m.erase(m.begin());
assert(m.size() == 0);
- }
+ }
#if TEST_STD_VER >= 11
- {
+ {
typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> M;
M m;
ASSERT_NOEXCEPT(m.size());
@@ -56,7 +55,7 @@ int main(int, char**)
assert(m.size() == 1);
m.erase(m.begin());
assert(m.size() == 0);
- }
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.set/swap_member.pass.cpp b/libcxx/test/std/containers/unord/unord.set/swap_member.pass.cpp
index d5adfbb2462cfe2..be8a96f0d45691b 100644
--- a/libcxx/test/std/containers/unord/unord.set/swap_member.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/swap_member.pass.cpp
@@ -24,547 +24,438 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef test_allocator<int> Alloc;
- typedef std::unordered_set<int, Hash, Compare, Alloc> C;
- C c1(0, Hash(1), Compare(1), Alloc(1, 1));
- C c2(0, Hash(2), Compare(2), Alloc(1, 2));
- c2.max_load_factor(2);
- c1.swap(c2);
-
- LIBCPP_ASSERT(c1.bucket_count() == 0);
- assert(c1.size() == 0);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator().get_id() == 1);
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- LIBCPP_ASSERT(c2.bucket_count() == 0);
- assert(c2.size() == 0);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator().get_id() == 2);
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef test_allocator<int> Alloc;
- typedef std::unordered_set<int, Hash, Compare, Alloc> C;
- typedef int P;
- P a2[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- C c1(0, Hash(1), Compare(1), Alloc(1, 1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
- c2.max_load_factor(2);
- c1.swap(c2);
-
- assert(c1.bucket_count() >= 8);
- assert(c1.size() == 8);
- assert(*c1.find(10) == 10);
- assert(*c1.find(20) == 20);
- assert(*c1.find(30) == 30);
- assert(*c1.find(40) == 40);
- assert(*c1.find(50) == 50);
- assert(*c1.find(60) == 60);
- assert(*c1.find(70) == 70);
- assert(*c1.find(80) == 80);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator().get_id() == 1);
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- LIBCPP_ASSERT(c2.bucket_count() == 0);
- assert(c2.size() == 0);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator().get_id() == 2);
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef test_allocator<int> Alloc;
- typedef std::unordered_set<int, Hash, Compare, Alloc> C;
- typedef int P;
- P a1[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
- C c2(0, Hash(2), Compare(2), Alloc(1, 2));
- c2.max_load_factor(2);
- c1.swap(c2);
-
- LIBCPP_ASSERT(c1.bucket_count() == 0);
- assert(c1.size() == 0);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator().get_id() == 1);
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- assert(c2.bucket_count() >= 4);
- assert(c2.size() == 4);
- assert(c2.count(1) == 1);
- assert(c2.count(2) == 1);
- assert(c2.count(3) == 1);
- assert(c2.count(4) == 1);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator().get_id() == 2);
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef test_allocator<int> Alloc;
- typedef std::unordered_set<int, Hash, Compare, Alloc> C;
- typedef int P;
- P a1[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- P a2[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
- c2.max_load_factor(2);
- c1.swap(c2);
-
- assert(c1.bucket_count() >= 8);
- assert(c1.size() == 8);
- assert(*c1.find(10) == 10);
- assert(*c1.find(20) == 20);
- assert(*c1.find(30) == 30);
- assert(*c1.find(40) == 40);
- assert(*c1.find(50) == 50);
- assert(*c1.find(60) == 60);
- assert(*c1.find(70) == 70);
- assert(*c1.find(80) == 80);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator().get_id() == 1);
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- assert(c2.bucket_count() >= 4);
- assert(c2.size() == 4);
- assert(c2.count(1) == 1);
- assert(c2.count(2) == 1);
- assert(c2.count(3) == 1);
- assert(c2.count(4) == 1);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator().get_id() == 2);
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
-
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef other_allocator<int> Alloc;
- typedef std::unordered_set<int, Hash, Compare, Alloc> C;
- C c1(0, Hash(1), Compare(1), Alloc(1));
- C c2(0, Hash(2), Compare(2), Alloc(2));
- c2.max_load_factor(2);
- c1.swap(c2);
-
- LIBCPP_ASSERT(c1.bucket_count() == 0);
- assert(c1.size() == 0);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(2));
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- LIBCPP_ASSERT(c2.bucket_count() == 0);
- assert(c2.size() == 0);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(1));
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef other_allocator<int> Alloc;
- typedef std::unordered_set<int, Hash, Compare, Alloc> C;
- typedef int P;
- P a2[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- C c1(0, Hash(1), Compare(1), Alloc(1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
- c2.max_load_factor(2);
- c1.swap(c2);
-
- assert(c1.bucket_count() >= 8);
- assert(c1.size() == 8);
- assert(*c1.find(10) == 10);
- assert(*c1.find(20) == 20);
- assert(*c1.find(30) == 30);
- assert(*c1.find(40) == 40);
- assert(*c1.find(50) == 50);
- assert(*c1.find(60) == 60);
- assert(*c1.find(70) == 70);
- assert(*c1.find(80) == 80);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(2));
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- LIBCPP_ASSERT(c2.bucket_count() == 0);
- assert(c2.size() == 0);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(1));
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef other_allocator<int> Alloc;
- typedef std::unordered_set<int, Hash, Compare, Alloc> C;
- typedef int P;
- P a1[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
- C c2(0, Hash(2), Compare(2), Alloc(2));
- c2.max_load_factor(2);
- c1.swap(c2);
-
- LIBCPP_ASSERT(c1.bucket_count() == 0);
- assert(c1.size() == 0);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(2));
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- assert(c2.bucket_count() >= 4);
- assert(c2.size() == 4);
- assert(c2.count(1) == 1);
- assert(c2.count(2) == 1);
- assert(c2.count(3) == 1);
- assert(c2.count(4) == 1);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(1));
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef other_allocator<int> Alloc;
- typedef std::unordered_set<int, Hash, Compare, Alloc> C;
- typedef int P;
- P a1[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- P a2[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
- c2.max_load_factor(2);
- c1.swap(c2);
-
- assert(c1.bucket_count() >= 8);
- assert(c1.size() == 8);
- assert(*c1.find(10) == 10);
- assert(*c1.find(20) == 20);
- assert(*c1.find(30) == 30);
- assert(*c1.find(40) == 40);
- assert(*c1.find(50) == 50);
- assert(*c1.find(60) == 60);
- assert(*c1.find(70) == 70);
- assert(*c1.find(80) == 80);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(2));
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- assert(c2.bucket_count() >= 4);
- assert(c2.size() == 4);
- assert(c2.count(1) == 1);
- assert(c2.count(2) == 1);
- assert(c2.count(3) == 1);
- assert(c2.count(4) == 1);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(1));
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef test_allocator<int> Alloc;
+ typedef std::unordered_set<int, Hash, Compare, Alloc> C;
+ C c1(0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(0, Hash(2), Compare(2), Alloc(1, 2));
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ LIBCPP_ASSERT(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ LIBCPP_ASSERT(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef test_allocator<int> Alloc;
+ typedef std::unordered_set<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ P a2[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)};
+ C c1(0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ assert(c1.bucket_count() >= 8);
+ assert(c1.size() == 8);
+ assert(*c1.find(10) == 10);
+ assert(*c1.find(20) == 20);
+ assert(*c1.find(30) == 30);
+ assert(*c1.find(40) == 40);
+ assert(*c1.find(50) == 50);
+ assert(*c1.find(60) == 60);
+ assert(*c1.find(70) == 70);
+ assert(*c1.find(80) == 80);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ LIBCPP_ASSERT(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef test_allocator<int> Alloc;
+ typedef std::unordered_set<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ P a1[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(0, Hash(2), Compare(2), Alloc(1, 2));
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ LIBCPP_ASSERT(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 4);
+ assert(c2.size() == 4);
+ assert(c2.count(1) == 1);
+ assert(c2.count(2) == 1);
+ assert(c2.count(3) == 1);
+ assert(c2.count(4) == 1);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef test_allocator<int> Alloc;
+ typedef std::unordered_set<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ P a1[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ P a2[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)};
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ assert(c1.bucket_count() >= 8);
+ assert(c1.size() == 8);
+ assert(*c1.find(10) == 10);
+ assert(*c1.find(20) == 20);
+ assert(*c1.find(30) == 30);
+ assert(*c1.find(40) == 40);
+ assert(*c1.find(50) == 50);
+ assert(*c1.find(60) == 60);
+ assert(*c1.find(70) == 70);
+ assert(*c1.find(80) == 80);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 4);
+ assert(c2.size() == 4);
+ assert(c2.count(1) == 1);
+ assert(c2.count(2) == 1);
+ assert(c2.count(3) == 1);
+ assert(c2.count(4) == 1);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef other_allocator<int> Alloc;
+ typedef std::unordered_set<int, Hash, Compare, Alloc> C;
+ C c1(0, Hash(1), Compare(1), Alloc(1));
+ C c2(0, Hash(2), Compare(2), Alloc(2));
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ LIBCPP_ASSERT(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc(2));
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ LIBCPP_ASSERT(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc(1));
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef other_allocator<int> Alloc;
+ typedef std::unordered_set<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ P a2[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)};
+ C c1(0, Hash(1), Compare(1), Alloc(1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ assert(c1.bucket_count() >= 8);
+ assert(c1.size() == 8);
+ assert(*c1.find(10) == 10);
+ assert(*c1.find(20) == 20);
+ assert(*c1.find(30) == 30);
+ assert(*c1.find(40) == 40);
+ assert(*c1.find(50) == 50);
+ assert(*c1.find(60) == 60);
+ assert(*c1.find(70) == 70);
+ assert(*c1.find(80) == 80);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc(2));
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ LIBCPP_ASSERT(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc(1));
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef other_allocator<int> Alloc;
+ typedef std::unordered_set<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ P a1[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
+ C c2(0, Hash(2), Compare(2), Alloc(2));
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ LIBCPP_ASSERT(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc(2));
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 4);
+ assert(c2.size() == 4);
+ assert(c2.count(1) == 1);
+ assert(c2.count(2) == 1);
+ assert(c2.count(3) == 1);
+ assert(c2.count(4) == 1);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc(1));
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef other_allocator<int> Alloc;
+ typedef std::unordered_set<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ P a1[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ P a2[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)};
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ assert(c1.bucket_count() >= 8);
+ assert(c1.size() == 8);
+ assert(*c1.find(10) == 10);
+ assert(*c1.find(20) == 20);
+ assert(*c1.find(30) == 30);
+ assert(*c1.find(40) == 40);
+ assert(*c1.find(50) == 50);
+ assert(*c1.find(60) == 60);
+ assert(*c1.find(70) == 70);
+ assert(*c1.find(80) == 80);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc(2));
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 4);
+ assert(c2.size() == 4);
+ assert(c2.count(1) == 1);
+ assert(c2.count(2) == 1);
+ assert(c2.count(3) == 1);
+ assert(c2.count(4) == 1);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc(1));
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef min_allocator<int> Alloc;
- typedef std::unordered_set<int, Hash, Compare, Alloc> C;
- C c1(0, Hash(1), Compare(1), Alloc());
- C c2(0, Hash(2), Compare(2), Alloc());
- c2.max_load_factor(2);
- c1.swap(c2);
-
- LIBCPP_ASSERT(c1.bucket_count() == 0);
- assert(c1.size() == 0);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- LIBCPP_ASSERT(c2.bucket_count() == 0);
- assert(c2.size() == 0);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef min_allocator<int> Alloc;
- typedef std::unordered_set<int, Hash, Compare, Alloc> C;
- typedef int P;
- P a2[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- C c1(0, Hash(1), Compare(1), Alloc());
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
- c2.max_load_factor(2);
- c1.swap(c2);
-
- assert(c1.bucket_count() >= 8);
- assert(c1.size() == 8);
- assert(*c1.find(10) == 10);
- assert(*c1.find(20) == 20);
- assert(*c1.find(30) == 30);
- assert(*c1.find(40) == 40);
- assert(*c1.find(50) == 50);
- assert(*c1.find(60) == 60);
- assert(*c1.find(70) == 70);
- assert(*c1.find(80) == 80);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- LIBCPP_ASSERT(c2.bucket_count() == 0);
- assert(c2.size() == 0);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef min_allocator<int> Alloc;
- typedef std::unordered_set<int, Hash, Compare, Alloc> C;
- typedef int P;
- P a1[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
- C c2(0, Hash(2), Compare(2), Alloc());
- c2.max_load_factor(2);
- c1.swap(c2);
-
- LIBCPP_ASSERT(c1.bucket_count() == 0);
- assert(c1.size() == 0);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- assert(c2.bucket_count() >= 4);
- assert(c2.size() == 4);
- assert(c2.count(1) == 1);
- assert(c2.count(2) == 1);
- assert(c2.count(3) == 1);
- assert(c2.count(4) == 1);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef min_allocator<int> Alloc;
- typedef std::unordered_set<int, Hash, Compare, Alloc> C;
- typedef int P;
- P a1[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- P a2[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
- c2.max_load_factor(2);
- c1.swap(c2);
-
- assert(c1.bucket_count() >= 8);
- assert(c1.size() == 8);
- assert(*c1.find(10) == 10);
- assert(*c1.find(20) == 20);
- assert(*c1.find(30) == 30);
- assert(*c1.find(40) == 40);
- assert(*c1.find(50) == 50);
- assert(*c1.find(60) == 60);
- assert(*c1.find(70) == 70);
- assert(*c1.find(80) == 80);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- assert(c2.bucket_count() >= 4);
- assert(c2.size() == 4);
- assert(c2.count(1) == 1);
- assert(c2.count(2) == 1);
- assert(c2.count(3) == 1);
- assert(c2.count(4) == 1);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef min_allocator<int> Alloc;
+ typedef std::unordered_set<int, Hash, Compare, Alloc> C;
+ C c1(0, Hash(1), Compare(1), Alloc());
+ C c2(0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ LIBCPP_ASSERT(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ LIBCPP_ASSERT(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef min_allocator<int> Alloc;
+ typedef std::unordered_set<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ P a2[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)};
+ C c1(0, Hash(1), Compare(1), Alloc());
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ assert(c1.bucket_count() >= 8);
+ assert(c1.size() == 8);
+ assert(*c1.find(10) == 10);
+ assert(*c1.find(20) == 20);
+ assert(*c1.find(30) == 30);
+ assert(*c1.find(40) == 40);
+ assert(*c1.find(50) == 50);
+ assert(*c1.find(60) == 60);
+ assert(*c1.find(70) == 70);
+ assert(*c1.find(80) == 80);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ LIBCPP_ASSERT(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef min_allocator<int> Alloc;
+ typedef std::unordered_set<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ P a1[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
+ C c2(0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ LIBCPP_ASSERT(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 4);
+ assert(c2.size() == 4);
+ assert(c2.count(1) == 1);
+ assert(c2.count(2) == 1);
+ assert(c2.count(3) == 1);
+ assert(c2.count(4) == 1);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef min_allocator<int> Alloc;
+ typedef std::unordered_set<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ P a1[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ P a2[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)};
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ assert(c1.bucket_count() >= 8);
+ assert(c1.size() == 8);
+ assert(*c1.find(10) == 10);
+ assert(*c1.find(20) == 20);
+ assert(*c1.find(30) == 30);
+ assert(*c1.find(40) == 40);
+ assert(*c1.find(50) == 50);
+ assert(*c1.find(60) == 60);
+ assert(*c1.find(70) == 70);
+ assert(*c1.find(80) == 80);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 4);
+ assert(c2.size() == 4);
+ assert(c2.count(1) == 1);
+ assert(c2.count(2) == 1);
+ assert(c2.count(3) == 1);
+ assert(c2.count(4) == 1);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.set/types.pass.cpp b/libcxx/test/std/containers/unord/unord.set/types.pass.cpp
index 8d5a22fdb24cf54..623da69aba23925 100644
--- a/libcxx/test/std/containers/unord/unord.set/types.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/types.pass.cpp
@@ -32,39 +32,37 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_set<short> C;
- static_assert((std::is_same<C::value_type, short>::value), "");
- static_assert((std::is_same<C::key_type, short>::value), "");
- static_assert((std::is_same<C::hasher, std::hash<C::key_type> >::value), "");
- static_assert((std::is_same<C::key_equal, std::equal_to<C::key_type> >::value), "");
- static_assert((std::is_same<C::allocator_type, std::allocator<C::value_type> >::value), "");
- static_assert((std::is_same<C::reference, C::value_type&>::value), "");
- static_assert((std::is_same<C::const_reference, const C::value_type&>::value), "");
- static_assert((std::is_same<C::pointer, C::value_type*>::value), "");
- static_assert((std::is_same<C::const_pointer, const C::value_type*>::value), "");
- static_assert((std::is_same<C::size_type, std::size_t>::value), "");
- static_assert((std::is_same<C::
diff erence_type, std::ptr
diff _t>::value), "");
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_set<short> C;
+ static_assert((std::is_same<C::value_type, short>::value), "");
+ static_assert((std::is_same<C::key_type, short>::value), "");
+ static_assert((std::is_same<C::hasher, std::hash<C::key_type> >::value), "");
+ static_assert((std::is_same<C::key_equal, std::equal_to<C::key_type> >::value), "");
+ static_assert((std::is_same<C::allocator_type, std::allocator<C::value_type> >::value), "");
+ static_assert((std::is_same<C::reference, C::value_type&>::value), "");
+ static_assert((std::is_same<C::const_reference, const C::value_type&>::value), "");
+ static_assert((std::is_same<C::pointer, C::value_type*>::value), "");
+ static_assert((std::is_same<C::const_pointer, const C::value_type*>::value), "");
+ static_assert((std::is_same<C::size_type, std::size_t>::value), "");
+ static_assert((std::is_same<C::
diff erence_type, std::ptr
diff _t>::value), "");
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_set<short, std::hash<short>,
- std::equal_to<short>, min_allocator<short>> C;
- static_assert((std::is_same<C::value_type, short>::value), "");
- static_assert((std::is_same<C::key_type, short>::value), "");
- static_assert((std::is_same<C::hasher, std::hash<C::key_type> >::value), "");
- static_assert((std::is_same<C::key_equal, std::equal_to<C::key_type> >::value), "");
- static_assert((std::is_same<C::allocator_type, min_allocator<C::value_type> >::value), "");
- static_assert((std::is_same<C::reference, C::value_type&>::value), "");
- static_assert((std::is_same<C::const_reference, const C::value_type&>::value), "");
- static_assert((std::is_same<C::pointer, min_pointer<C::value_type>>::value), "");
- static_assert((std::is_same<C::const_pointer, min_pointer<const C::value_type>>::value), "");
+ {
+ typedef std::unordered_set<short, std::hash<short>, std::equal_to<short>, min_allocator<short>> C;
+ static_assert((std::is_same<C::value_type, short>::value), "");
+ static_assert((std::is_same<C::key_type, short>::value), "");
+ static_assert((std::is_same<C::hasher, std::hash<C::key_type> >::value), "");
+ static_assert((std::is_same<C::key_equal, std::equal_to<C::key_type> >::value), "");
+ static_assert((std::is_same<C::allocator_type, min_allocator<C::value_type> >::value), "");
+ static_assert((std::is_same<C::reference, C::value_type&>::value), "");
+ static_assert((std::is_same<C::const_reference, const C::value_type&>::value), "");
+ static_assert((std::is_same<C::pointer, min_pointer<C::value_type>>::value), "");
+ static_assert((std::is_same<C::const_pointer, min_pointer<const C::value_type>>::value), "");
// min_allocator doesn't have a size_type, so one gets synthesized
- static_assert((std::is_same<C::size_type, std::make_unsigned<C::
diff erence_type>::type>::value), "");
- static_assert((std::is_same<C::
diff erence_type, std::ptr
diff _t>::value), "");
- }
+ static_assert((std::is_same<C::size_type, std::make_unsigned<C::
diff erence_type>::type>::value), "");
+ static_assert((std::is_same<C::
diff erence_type, std::ptr
diff _t>::value), "");
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/allocator.pass.cpp b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/allocator.pass.cpp
index 7c7ce3d077bb866..e3d5979f7d13b32 100644
--- a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/allocator.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/allocator.pass.cpp
@@ -24,87 +24,86 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_set<NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- test_allocator<NotConstructible>
- > C;
- C c(test_allocator<NotConstructible>(10));
- LIBCPP_ASSERT(c.bucket_count() == 0);
- assert(c.hash_function() == test_hash<NotConstructible>());
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() == test_allocator<NotConstructible>(10));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_set<NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ test_allocator<NotConstructible> >
+ C;
+ C c(test_allocator<NotConstructible>(10));
+ LIBCPP_ASSERT(c.bucket_count() == 0);
+ assert(c.hash_function() == test_hash<NotConstructible>());
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == test_allocator<NotConstructible>(10));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_set<NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- min_allocator<NotConstructible>
- > C;
- C c(min_allocator<NotConstructible>{});
- LIBCPP_ASSERT(c.bucket_count() == 0);
- assert(c.hash_function() == test_hash<NotConstructible>());
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() == min_allocator<NotConstructible>());
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
-#if TEST_STD_VER > 11
- {
- typedef NotConstructible T;
- typedef test_hash<T> HF;
- typedef test_equal_to<T> Comp;
- typedef test_allocator<T> A;
- typedef std::unordered_set<T, HF, Comp, A> C;
+ {
+ typedef std::unordered_set<NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ min_allocator<NotConstructible> >
+ C;
+ C c(min_allocator<NotConstructible>{});
+ LIBCPP_ASSERT(c.bucket_count() == 0);
+ assert(c.hash_function() == test_hash<NotConstructible>());
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == min_allocator<NotConstructible>());
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+# if TEST_STD_VER > 11
+ {
+ typedef NotConstructible T;
+ typedef test_hash<T> HF;
+ typedef test_equal_to<T> Comp;
+ typedef test_allocator<T> A;
+ typedef std::unordered_set<T, HF, Comp, A> C;
- A a(43);
- C c(3, a);
- LIBCPP_ASSERT(c.bucket_count() == 3);
- assert(c.hash_function() == HF());
- assert(c.key_eq() == Comp ());
- assert(c.get_allocator() == a);
- assert(!(c.get_allocator() == A()));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef NotConstructible T;
- typedef test_hash<T> HF;
- typedef test_equal_to<T> Comp;
- typedef test_allocator<T> A;
- typedef std::unordered_set<T, HF, Comp, A> C;
+ A a(43);
+ C c(3, a);
+ LIBCPP_ASSERT(c.bucket_count() == 3);
+ assert(c.hash_function() == HF());
+ assert(c.key_eq() == Comp());
+ assert(c.get_allocator() == a);
+ assert(!(c.get_allocator() == A()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef NotConstructible T;
+ typedef test_hash<T> HF;
+ typedef test_equal_to<T> Comp;
+ typedef test_allocator<T> A;
+ typedef std::unordered_set<T, HF, Comp, A> C;
- HF hf(42);
- A a(43);
- C c(4, hf, a);
- LIBCPP_ASSERT(c.bucket_count() == 4);
- assert(c.hash_function() == hf);
- assert(!(c.hash_function() == HF()));
- assert(c.key_eq() == Comp ());
- assert(c.get_allocator() == a);
- assert(!(c.get_allocator() == A()));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
-#endif
+ HF hf(42);
+ A a(43);
+ C c(4, hf, a);
+ LIBCPP_ASSERT(c.bucket_count() == 4);
+ assert(c.hash_function() == hf);
+ assert(!(c.hash_function() == HF()));
+ assert(c.key_eq() == Comp());
+ assert(c.get_allocator() == a);
+ assert(!(c.get_allocator() == A()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+# endif
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/assign_copy.pass.cpp b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/assign_copy.pass.cpp
index 74b3b0744f98803..25851e941a7d1ad 100644
--- a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/assign_copy.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/assign_copy.pass.cpp
@@ -27,162 +27,87 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef test_allocator<int> A;
- typedef std::unordered_set<int,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A(10)
- );
- C c(a, a + 2,
- 7,
- test_hash<int>(2),
- test_equal_to<int>(3),
- A(4)
- );
- c = c0;
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == A(4));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef std::unordered_set<int> C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(a, a + sizeof(a)/sizeof(a[0]));
- C *p = &c;
- c = *p;
- assert(c.size() == 4);
- assert(std::is_permutation(c.begin(), c.end(), a));
- }
- {
- typedef other_allocator<int> A;
- typedef std::unordered_set<int,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A(10)
- );
- C c(a, a + 2,
- 7,
- test_hash<int>(2),
- test_equal_to<int>(3),
- A(4)
- );
- c = c0;
- assert(c.bucket_count() >= 5);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == A(10));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef test_allocator<int> A;
+ typedef std::unordered_set<int, test_hash<int>, test_equal_to<int>, A > C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), A(10));
+ C c(a, a + 2, 7, test_hash<int>(2), test_equal_to<int>(3), A(4));
+ c = c0;
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == A(4));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef std::unordered_set<int> C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(a, a + sizeof(a) / sizeof(a[0]));
+ C* p = &c;
+ c = *p;
+ assert(c.size() == 4);
+ assert(std::is_permutation(c.begin(), c.end(), a));
+ }
+ {
+ typedef other_allocator<int> A;
+ typedef std::unordered_set<int, test_hash<int>, test_equal_to<int>, A > C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), A(10));
+ C c(a, a + 2, 7, test_hash<int>(2), test_equal_to<int>(3), A(4));
+ c = c0;
+ assert(c.bucket_count() >= 5);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == A(10));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef min_allocator<int> A;
- typedef std::unordered_set<int,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A()
- );
- C c(a, a + 2,
- 7,
- test_hash<int>(2),
- test_equal_to<int>(3),
- A()
- );
- c = c0;
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == A());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+ {
+ typedef min_allocator<int> A;
+ typedef std::unordered_set<int, test_hash<int>, test_equal_to<int>, A > C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), A());
+ C c(a, a + 2, 7, test_hash<int>(2), test_equal_to<int>(3), A());
+ c = c0;
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == A());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/assign_init.pass.cpp b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/assign_init.pass.cpp
index cc35d51ef9d7bab..c2850b8e000b94c 100644
--- a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/assign_init.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/assign_init.pass.cpp
@@ -28,72 +28,41 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef test_allocator<int> A;
- typedef std::unordered_set<int,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- typedef int P;
- C c = {
- P(4),
- P(1),
- P(2)
- };
- c = {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- assert(c.bucket_count() >= 5);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef min_allocator<int> A;
- typedef std::unordered_set<int,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- typedef int P;
- C c = {
- P(4),
- P(1),
- P(2)
- };
- c = {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- assert(c.bucket_count() >= 5);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef test_allocator<int> A;
+ typedef std::unordered_set<int, test_hash<int>, test_equal_to<int>, A > C;
+ typedef int P;
+ C c = {P(4), P(1), P(2)};
+ c = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ assert(c.bucket_count() >= 5);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef min_allocator<int> A;
+ typedef std::unordered_set<int, test_hash<int>, test_equal_to<int>, A > C;
+ typedef int P;
+ C c = {P(4), P(1), P(2)};
+ c = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ assert(c.bucket_count() >= 5);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/assign_move.pass.cpp b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/assign_move.pass.cpp
index b1ec876e704f50c..8d5ae4831e3585f 100644
--- a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/assign_move.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/assign_move.pass.cpp
@@ -28,194 +28,105 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef test_allocator<int> A;
- typedef std::unordered_set<int,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A(10)
- );
- C c(a, a + 2,
- 7,
- test_hash<int>(2),
- test_equal_to<int>(3),
- A(4)
- );
- c = std::move(c0);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == A(4));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef test_allocator<int> A;
- typedef std::unordered_set<int,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A(10)
- );
- C c(a, a + 2,
- 7,
- test_hash<int>(2),
- test_equal_to<int>(3),
- A(10)
- );
- C::iterator it0 = c0.begin();
- c = std::move(c0);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == A(10));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- assert(it0 == c.begin()); // Iterators remain valid
- }
- {
- typedef other_allocator<int> A;
- typedef std::unordered_set<int,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A(10)
- );
- C c(a, a + 2,
- 7,
- test_hash<int>(2),
- test_equal_to<int>(3),
- A(4)
- );
- C::iterator it0 = c0.begin();
- c = std::move(c0);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == A(10));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- assert(it0 == c.begin()); // Iterators remain valid
- }
- {
- typedef min_allocator<int> A;
- typedef std::unordered_set<int,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A()
- );
- C c(a, a + 2,
- 7,
- test_hash<int>(2),
- test_equal_to<int>(3),
- A()
- );
- C::iterator it0 = c0.begin();
- c = std::move(c0);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == A());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- assert(it0 == c.begin()); // Iterators remain valid
- }
+int main(int, char**) {
+ {
+ typedef test_allocator<int> A;
+ typedef std::unordered_set<int, test_hash<int>, test_equal_to<int>, A > C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), A(10));
+ C c(a, a + 2, 7, test_hash<int>(2), test_equal_to<int>(3), A(4));
+ c = std::move(c0);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == A(4));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef test_allocator<int> A;
+ typedef std::unordered_set<int, test_hash<int>, test_equal_to<int>, A > C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), A(10));
+ C c(a, a + 2, 7, test_hash<int>(2), test_equal_to<int>(3), A(10));
+ C::iterator it0 = c0.begin();
+ c = std::move(c0);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == A(10));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(it0 == c.begin()); // Iterators remain valid
+ }
+ {
+ typedef other_allocator<int> A;
+ typedef std::unordered_set<int, test_hash<int>, test_equal_to<int>, A > C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), A(10));
+ C c(a, a + 2, 7, test_hash<int>(2), test_equal_to<int>(3), A(4));
+ C::iterator it0 = c0.begin();
+ c = std::move(c0);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == A(10));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(it0 == c.begin()); // Iterators remain valid
+ }
+ {
+ typedef min_allocator<int> A;
+ typedef std::unordered_set<int, test_hash<int>, test_equal_to<int>, A > C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), A());
+ C c(a, a + 2, 7, test_hash<int>(2), test_equal_to<int>(3), A());
+ C::iterator it0 = c0.begin();
+ c = std::move(c0);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == A());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(it0 == c.begin()); // Iterators remain valid
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/compare_copy_constructible.compile.fail.cpp b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/compare_copy_constructible.compile.fail.cpp
index 03258628ee26821..09df0edd00f516c 100644
--- a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/compare_copy_constructible.compile.fail.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/compare_copy_constructible.compile.fail.cpp
@@ -6,7 +6,6 @@
//
//===----------------------------------------------------------------------===//
-
// <unordered_set>
// Check that std::unordered_set fails to instantiate if the comparison predicate is
@@ -16,16 +15,16 @@
template <class T>
struct Comp {
- bool operator () (const T& lhs, const T& rhs) const { return lhs == rhs; }
+ bool operator()(const T& lhs, const T& rhs) const { return lhs == rhs; }
- Comp () {}
-private:
- Comp (const Comp &); // declared but not defined
- };
+ Comp() {}
+private:
+ Comp(const Comp&); // declared but not defined
+};
int main(int, char**) {
- std::unordered_set<int, std::hash<int>, Comp<int> > m;
+ std::unordered_set<int, std::hash<int>, Comp<int> > m;
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/copy.pass.cpp b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/copy.pass.cpp
index 8a675950d9baa04..e795d810e9fa16a 100644
--- a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/copy.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/copy.pass.cpp
@@ -26,123 +26,71 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_set<int,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<int>
- > C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- test_allocator<int>(10)
- );
- C c = c0;
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == test_allocator<int>(10));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_set<int, test_hash<int>, test_equal_to<int>, test_allocator<int> > C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), test_allocator<int>(10));
+ C c = c0;
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == test_allocator<int>(10));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_set<int,
- test_hash<int>,
- test_equal_to<int>,
- other_allocator<int>
- > C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- other_allocator<int>(10)
- );
- C c = c0;
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == other_allocator<int>(-2));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef std::unordered_set<int,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<int>
- > C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- min_allocator<int>()
- );
- C c = c0;
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == min_allocator<int>());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+ {
+ typedef std::unordered_set<int, test_hash<int>, test_equal_to<int>, other_allocator<int> > C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), other_allocator<int>(10));
+ C c = c0;
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == other_allocator<int>(-2));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef std::unordered_set<int, test_hash<int>, test_equal_to<int>, min_allocator<int> > C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), min_allocator<int>());
+ C c = c0;
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/copy_alloc.pass.cpp b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/copy_alloc.pass.cpp
index 09d22de4ed0d92d..49a5f9406e1e15a 100644
--- a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/copy_alloc.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/copy_alloc.pass.cpp
@@ -26,85 +26,50 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_set<int,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<int>
- > C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- test_allocator<int>(10)
- );
- C c(c0, test_allocator<int>(5));
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == test_allocator<int>(5));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_set<int, test_hash<int>, test_equal_to<int>, test_allocator<int> > C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), test_allocator<int>(10));
+ C c(c0, test_allocator<int>(5));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == test_allocator<int>(5));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_set<int,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<int>
- > C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- min_allocator<int>()
- );
- C c(c0, min_allocator<int>());
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == min_allocator<int>());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+ {
+ typedef std::unordered_set<int, test_hash<int>, test_equal_to<int>, min_allocator<int> > C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), min_allocator<int>());
+ C c(c0, min_allocator<int>());
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/deduct.pass.cpp b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/deduct.pass.cpp
index 13e42f37fd21f2f..c748986883eee78 100644
--- a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/deduct.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/deduct.pass.cpp
@@ -81,196 +81,199 @@
#include "deduction_guides_sfinae_checks.h"
#include "test_allocator.h"
-int main(int, char**)
-{
- const int expected_s[] = {1, 2, 3, INT_MAX};
+int main(int, char**) {
+ const int expected_s[] = {1, 2, 3, INT_MAX};
- {
- const int arr[] = { 1, 2, 1, INT_MAX, 3 };
+ {
+ const int arr[] = {1, 2, 1, INT_MAX, 3};
std::unordered_set s(std::begin(arr), std::end(arr));
ASSERT_SAME_TYPE(decltype(s), std::unordered_set<int>);
assert(std::is_permutation(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s)));
- }
+ }
- {
- const int arr[] = { 1, 2, 1, INT_MAX, 3 };
+ {
+ const int arr[] = {1, 2, 1, INT_MAX, 3};
std::unordered_set s(std::begin(arr), std::end(arr), 42);
ASSERT_SAME_TYPE(decltype(s), std::unordered_set<int>);
assert(std::is_permutation(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s)));
- }
+ }
- {
- const int arr[] = { 1, 2, 1, INT_MAX, 3 };
+ {
+ const int arr[] = {1, 2, 1, INT_MAX, 3};
std::unordered_set s(std::begin(arr), std::end(arr), 42, std::hash<long long>());
ASSERT_SAME_TYPE(decltype(s), std::unordered_set<int, std::hash<long long>>);
assert(std::is_permutation(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s)));
- }
+ }
- {
- const int arr[] = { 1, 2, 1, INT_MAX, 3 };
+ {
+ const int arr[] = {1, 2, 1, INT_MAX, 3};
std::unordered_set s(std::begin(arr), std::end(arr), 42, std::hash<long long>(), test_allocator<int>(0, 40));
- ASSERT_SAME_TYPE(decltype(s), std::unordered_set<int, std::hash<long long>, std::equal_to<int>, test_allocator<int>>);
+ ASSERT_SAME_TYPE(
+ decltype(s), std::unordered_set<int, std::hash<long long>, std::equal_to<int>, test_allocator<int>>);
assert(std::is_permutation(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s)));
assert(s.get_allocator().get_id() == 40);
- }
+ }
- {
+ {
std::unordered_set<int, std::hash<long long>, std::equal_to<>, test_allocator<int>> source;
std::unordered_set s(source);
ASSERT_SAME_TYPE(decltype(s), decltype(source));
assert(s.size() == 0);
- }
+ }
- {
+ {
std::unordered_set<int, std::hash<long long>, std::equal_to<>, test_allocator<int>> source;
- std::unordered_set s{source}; // braces instead of parens
+ std::unordered_set s{source}; // braces instead of parens
ASSERT_SAME_TYPE(decltype(s), decltype(source));
assert(s.size() == 0);
- }
+ }
- {
+ {
std::unordered_set<int, std::hash<long long>, std::equal_to<>, test_allocator<int>> source;
std::unordered_set s(source, test_allocator<int>(0, 41));
ASSERT_SAME_TYPE(decltype(s), decltype(source));
assert(s.size() == 0);
assert(s.get_allocator().get_id() == 41);
- }
+ }
- {
+ {
std::unordered_set<int, std::hash<long long>, std::equal_to<>, test_allocator<int>> source;
- std::unordered_set s{source, test_allocator<int>(0, 42)}; // braces instead of parens
+ std::unordered_set s{source, test_allocator<int>(0, 42)}; // braces instead of parens
ASSERT_SAME_TYPE(decltype(s), decltype(source));
assert(s.size() == 0);
assert(s.get_allocator().get_id() == 42);
- }
+ }
- {
- std::unordered_set s{ 1, 2, 1, INT_MAX, 3 };
+ {
+ std::unordered_set s{1, 2, 1, INT_MAX, 3};
ASSERT_SAME_TYPE(decltype(s), std::unordered_set<int>);
assert(std::is_permutation(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s)));
- }
+ }
- {
- std::unordered_set s({ 1, 2, 1, INT_MAX, 3 }, 42);
+ {
+ std::unordered_set s({1, 2, 1, INT_MAX, 3}, 42);
ASSERT_SAME_TYPE(decltype(s), std::unordered_set<int>);
assert(std::is_permutation(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s)));
- }
+ }
- {
- std::unordered_set s({ 1, 2, 1, INT_MAX, 3 }, 42, std::hash<long long>());
+ {
+ std::unordered_set s({1, 2, 1, INT_MAX, 3}, 42, std::hash<long long>());
ASSERT_SAME_TYPE(decltype(s), std::unordered_set<int, std::hash<long long>>);
assert(std::is_permutation(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s)));
- }
+ }
- {
- std::unordered_set s({ 1, 2, 1, INT_MAX, 3 }, 42, std::hash<long long>(), std::equal_to<>());
+ {
+ std::unordered_set s({1, 2, 1, INT_MAX, 3}, 42, std::hash<long long>(), std::equal_to<>());
ASSERT_SAME_TYPE(decltype(s), std::unordered_set<int, std::hash<long long>, std::equal_to<>>);
assert(std::is_permutation(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s)));
- }
+ }
- {
- std::unordered_set s({ 1, 2, 1, INT_MAX, 3 }, 42, std::hash<long long>(), std::equal_to<>(), test_allocator<int>(0, 43));
+ {
+ std::unordered_set s(
+ {1, 2, 1, INT_MAX, 3}, 42, std::hash<long long>(), std::equal_to<>(), test_allocator<int>(0, 43));
ASSERT_SAME_TYPE(decltype(s), std::unordered_set<int, std::hash<long long>, std::equal_to<>, test_allocator<int>>);
assert(std::is_permutation(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s)));
assert(s.get_allocator().get_id() == 43);
- }
+ }
- {
- const int arr[] = { 1, 2, 1, INT_MAX, 3 };
+ {
+ const int arr[] = {1, 2, 1, INT_MAX, 3};
std::unordered_set s(std::begin(arr), std::end(arr), 42, test_allocator<int>(0, 44));
ASSERT_SAME_TYPE(decltype(s), std::unordered_set<int, std::hash<int>, std::equal_to<int>, test_allocator<int>>);
assert(std::is_permutation(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s)));
assert(s.get_allocator().get_id() == 44);
- }
+ }
- {
- const int arr[] = { 1, 2, 1, INT_MAX, 3 };
+ {
+ const int arr[] = {1, 2, 1, INT_MAX, 3};
std::unordered_set s(std::begin(arr), std::end(arr), 42, std::hash<long long>(), test_allocator<int>(0, 44));
- ASSERT_SAME_TYPE(decltype(s), std::unordered_set<int, std::hash<long long>, std::equal_to<int>, test_allocator<int>>);
+ ASSERT_SAME_TYPE(
+ decltype(s), std::unordered_set<int, std::hash<long long>, std::equal_to<int>, test_allocator<int>>);
assert(std::is_permutation(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s)));
assert(s.get_allocator().get_id() == 44);
- }
+ }
- {
- std::unordered_set s({ 1, 2, 1, INT_MAX, 3 }, 42, test_allocator<int>(0, 43));
+ {
+ std::unordered_set s({1, 2, 1, INT_MAX, 3}, 42, test_allocator<int>(0, 43));
ASSERT_SAME_TYPE(decltype(s), std::unordered_set<int, std::hash<int>, std::equal_to<int>, test_allocator<int>>);
assert(std::is_permutation(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s)));
assert(s.get_allocator().get_id() == 43);
- }
+ }
- {
- std::unordered_set s({ 1, 2, 1, INT_MAX, 3 }, 42, std::hash<long long>(), test_allocator<int>(0, 42));
+ {
+ std::unordered_set s({1, 2, 1, INT_MAX, 3}, 42, std::hash<long long>(), test_allocator<int>(0, 42));
- ASSERT_SAME_TYPE(decltype(s), std::unordered_set<int, std::hash<long long>, std::equal_to<int>, test_allocator<int>>);
+ ASSERT_SAME_TYPE(
+ decltype(s), std::unordered_set<int, std::hash<long long>, std::equal_to<int>, test_allocator<int>>);
assert(std::is_permutation(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s)));
assert(s.get_allocator().get_id() == 42);
- }
+ }
#if TEST_STD_VER >= 23
- {
- using Range = std::array<int, 0>;
- using Pred = test_equal_to<int>;
- using DefaultPred = std::equal_to<int>;
- using Hash = test_hash<int>;
- using DefaultHash = std::hash<int>;
- using Alloc = test_allocator<int>;
-
- { // (from_range, range)
- std::unordered_set c(std::from_range, Range());
- static_assert(std::is_same_v<decltype(c), std::unordered_set<int>>);
- }
-
- { // (from_range, range, n)
- std::unordered_set c(std::from_range, Range(), std::size_t());
- static_assert(std::is_same_v<decltype(c), std::unordered_set<int>>);
- }
-
- { // (from_range, range, n, hash)
- std::unordered_set c(std::from_range, Range(), std::size_t(), Hash());
- static_assert(std::is_same_v<decltype(c), std::unordered_set<int, Hash>>);
- }
-
- { // (from_range, range, n, hash, pred)
- std::unordered_set c(std::from_range, Range(), std::size_t(), Hash(), Pred());
- static_assert(std::is_same_v<decltype(c), std::unordered_set<int, Hash, Pred>>);
- }
-
- { // (from_range, range, n, hash, pred, alloc)
- std::unordered_set c(std::from_range, Range(), std::size_t(), Hash(), Pred(), Alloc());
- static_assert(std::is_same_v<decltype(c), std::unordered_set<int, Hash, Pred, Alloc>>);
- }
-
- { // (from_range, range, n, alloc)
- std::unordered_set c(std::from_range, Range(), std::size_t(), Alloc());
- static_assert(std::is_same_v<decltype(c), std::unordered_set<int, DefaultHash, DefaultPred, Alloc>>);
- }
-
- // TODO(LWG 2713): uncomment this test once the constructor is added.
- { // (from_range, range, alloc)
- //std::unordered_set c(std::from_range, Range(), Alloc());
- //static_assert(std::is_same_v<decltype(c), std::unordered_set<int, DefaultHash, DefaultPred, Alloc>>);
- }
-
- { // (from_range, range, n, hash, alloc)
- std::unordered_set c(std::from_range, Range(), std::size_t(), Hash(), Alloc());
- static_assert(std::is_same_v<decltype(c), std::unordered_set<int, Hash, DefaultPred, Alloc>>);
- }
+ {
+ using Range = std::array<int, 0>;
+ using Pred = test_equal_to<int>;
+ using DefaultPred = std::equal_to<int>;
+ using Hash = test_hash<int>;
+ using DefaultHash = std::hash<int>;
+ using Alloc = test_allocator<int>;
+
+ { // (from_range, range)
+ std::unordered_set c(std::from_range, Range());
+ static_assert(std::is_same_v<decltype(c), std::unordered_set<int>>);
+ }
+
+ { // (from_range, range, n)
+ std::unordered_set c(std::from_range, Range(), std::size_t());
+ static_assert(std::is_same_v<decltype(c), std::unordered_set<int>>);
+ }
+
+ { // (from_range, range, n, hash)
+ std::unordered_set c(std::from_range, Range(), std::size_t(), Hash());
+ static_assert(std::is_same_v<decltype(c), std::unordered_set<int, Hash>>);
+ }
+
+ { // (from_range, range, n, hash, pred)
+ std::unordered_set c(std::from_range, Range(), std::size_t(), Hash(), Pred());
+ static_assert(std::is_same_v<decltype(c), std::unordered_set<int, Hash, Pred>>);
+ }
+
+ { // (from_range, range, n, hash, pred, alloc)
+ std::unordered_set c(std::from_range, Range(), std::size_t(), Hash(), Pred(), Alloc());
+ static_assert(std::is_same_v<decltype(c), std::unordered_set<int, Hash, Pred, Alloc>>);
+ }
+
+ { // (from_range, range, n, alloc)
+ std::unordered_set c(std::from_range, Range(), std::size_t(), Alloc());
+ static_assert(std::is_same_v<decltype(c), std::unordered_set<int, DefaultHash, DefaultPred, Alloc>>);
+ }
+
+ // TODO(LWG 2713): uncomment this test once the constructor is added.
+ { // (from_range, range, alloc)
+ //std::unordered_set c(std::from_range, Range(), Alloc());
+ //static_assert(std::is_same_v<decltype(c), std::unordered_set<int, DefaultHash, DefaultPred, Alloc>>);
+ }
+
+ { // (from_range, range, n, hash, alloc)
+ std::unordered_set c(std::from_range, Range(), std::size_t(), Hash(), Alloc());
+ static_assert(std::is_same_v<decltype(c), std::unordered_set<int, Hash, DefaultPred, Alloc>>);
}
+ }
#endif
- UnorderedContainerDeductionGuidesSfinaeAway<std::unordered_set, std::unordered_set<int>>();
+ UnorderedContainerDeductionGuidesSfinaeAway<std::unordered_set, std::unordered_set<int>>();
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/deduct.verify.cpp b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/deduct.verify.cpp
index 26e5f9ae6ce430b..147b1f53ceafa0c 100644
--- a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/deduct.verify.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/deduct.verify.cpp
@@ -50,48 +50,47 @@
#include <functional>
#include <unordered_set>
-int main(int, char**)
-{
- {
- // cannot deduce Key from nothing
- std::unordered_set s;
- // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_set'}}
- }
- {
- // cannot deduce Key from just (Size)
- std::unordered_set s(42);
- // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_set'}}
- }
- {
- // cannot deduce Key from just (Size, Hash)
- std::unordered_set s(42, std::hash<int>());
- // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_set'}}
- }
- {
- // cannot deduce Key from just (Size, Hash, Pred)
- std::unordered_set s(42, std::hash<int>(), std::equal_to<>());
- // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_set'}}
- }
- {
- // cannot deduce Key from just (Size, Hash, Pred, Allocator)
- std::unordered_set s(42, std::hash<int>(), std::equal_to<>(), std::allocator<int>());
- // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_set'}}
- }
- {
- // cannot deduce Key from just (Allocator)
- std::unordered_set s(std::allocator<int>{});
- // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_set'}}
- }
- {
- // cannot deduce Key from just (Size, Allocator)
- std::unordered_set s(42, std::allocator<int>());
- // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_set'}}
- }
- {
- // cannot deduce Key from just (Size, Hash, Allocator)
- std::unordered_set s(42, std::hash<short>(), std::allocator<int>());
- // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_set'}}
- }
+int main(int, char**) {
+ {
+ // cannot deduce Key from nothing
+ std::unordered_set s;
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_set'}}
+ }
+ {
+ // cannot deduce Key from just (Size)
+ std::unordered_set s(42);
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_set'}}
+ }
+ {
+ // cannot deduce Key from just (Size, Hash)
+ std::unordered_set s(42, std::hash<int>());
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_set'}}
+ }
+ {
+ // cannot deduce Key from just (Size, Hash, Pred)
+ std::unordered_set s(42, std::hash<int>(), std::equal_to<>());
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_set'}}
+ }
+ {
+ // cannot deduce Key from just (Size, Hash, Pred, Allocator)
+ std::unordered_set s(42, std::hash<int>(), std::equal_to<>(), std::allocator<int>());
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_set'}}
+ }
+ {
+ // cannot deduce Key from just (Allocator)
+ std::unordered_set s(std::allocator<int>{});
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_set'}}
+ }
+ {
+ // cannot deduce Key from just (Size, Allocator)
+ std::unordered_set s(42, std::allocator<int>());
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_set'}}
+ }
+ {
+ // cannot deduce Key from just (Size, Hash, Allocator)
+ std::unordered_set s(42, std::hash<short>(), std::allocator<int>());
+ // expected-error-re at -1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}unordered_set'}}
+ }
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/default.pass.cpp b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/default.pass.cpp
index f61d46d5fc3b6eb..6784883f2d4707a 100644
--- a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/default.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/default.pass.cpp
@@ -24,85 +24,80 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_set<NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- test_allocator<NotConstructible>
- > C;
- C c;
- LIBCPP_ASSERT(c.bucket_count() == 0);
- assert(c.hash_function() == test_hash<NotConstructible>());
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() == (test_allocator<NotConstructible>()));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_set<NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ test_allocator<NotConstructible> >
+ C;
+ C c;
+ LIBCPP_ASSERT(c.bucket_count() == 0);
+ assert(c.hash_function() == test_hash<NotConstructible>());
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == (test_allocator<NotConstructible>()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
+ {
+ typedef std::unordered_set<NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ min_allocator<NotConstructible> >
+ C;
+ C c;
+ LIBCPP_ASSERT(c.bucket_count() == 0);
+ assert(c.hash_function() == test_hash<NotConstructible>());
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == (min_allocator<NotConstructible>()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef explicit_allocator<NotConstructible> A;
+ typedef std::unordered_set<NotConstructible, test_hash<NotConstructible>, test_equal_to<NotConstructible>, A > C;
{
- typedef std::unordered_set<NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- min_allocator<NotConstructible>
- > C;
- C c;
- LIBCPP_ASSERT(c.bucket_count() == 0);
- assert(c.hash_function() == test_hash<NotConstructible>());
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() == (min_allocator<NotConstructible>()));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef explicit_allocator<NotConstructible> A;
- typedef std::unordered_set<NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- A
- > C;
- {
- C c;
- LIBCPP_ASSERT(c.bucket_count() == 0);
- assert(c.hash_function() == test_hash<NotConstructible>());
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() == A());
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
- {
- A a;
- C c(a);
- LIBCPP_ASSERT(c.bucket_count() == 0);
- assert(c.hash_function() == test_hash<NotConstructible>());
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() == a);
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+ C c;
+ LIBCPP_ASSERT(c.bucket_count() == 0);
+ assert(c.hash_function() == test_hash<NotConstructible>());
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == A());
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
}
{
- std::unordered_set<int> c = {};
- LIBCPP_ASSERT(c.bucket_count() == 0);
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
+ A a;
+ C c(a);
+ LIBCPP_ASSERT(c.bucket_count() == 0);
+ assert(c.hash_function() == test_hash<NotConstructible>());
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == a);
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
}
+ }
+ {
+ std::unordered_set<int> c = {};
+ LIBCPP_ASSERT(c.bucket_count() == 0);
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/default_noexcept.pass.cpp b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/default_noexcept.pass.cpp
index b867231fb70a9fb..2bd1e10b5413b48 100644
--- a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/default_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/default_noexcept.pass.cpp
@@ -27,50 +27,44 @@
#include "../../../test_hash.h"
template <class T>
-struct some_comp
-{
- typedef T value_type;
- some_comp();
- some_comp(const some_comp&);
- bool operator()(const T&, const T&) const { return false; }
+struct some_comp {
+ typedef T value_type;
+ some_comp();
+ some_comp(const some_comp&);
+ bool operator()(const T&, const T&) const { return false; }
};
template <class T>
-struct some_hash
-{
- typedef T value_type;
- some_hash();
- some_hash(const some_hash&);
- std::size_t operator()(T const&) const;
+struct some_hash {
+ typedef T value_type;
+ some_hash();
+ some_hash(const some_hash&);
+ std::size_t operator()(T const&) const;
};
-int main(int, char**)
-{
+int main(int, char**) {
#if defined(_LIBCPP_VERSION)
- {
- typedef std::unordered_set<MoveOnly> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
- }
- {
- typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, test_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_default_constructible<C>::value, "");
- }
+ {
+ typedef std::unordered_set<MoveOnly> C;
+ static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ }
+ {
+ typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>, std::equal_to<MoveOnly>, test_allocator<MoveOnly>> C;
+ static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ }
#endif // _LIBCPP_VERSION
- {
- typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, other_allocator<MoveOnly>> C;
- static_assert(!std::is_nothrow_default_constructible<C>::value, "");
- }
- {
- typedef std::unordered_set<MoveOnly, some_hash<MoveOnly>> C;
- static_assert(!std::is_nothrow_default_constructible<C>::value, "");
- }
- {
- typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>,
- some_comp<MoveOnly>> C;
- static_assert(!std::is_nothrow_default_constructible<C>::value, "");
- }
+ {
+ typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>, std::equal_to<MoveOnly>, other_allocator<MoveOnly>> C;
+ static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+ }
+ {
+ typedef std::unordered_set<MoveOnly, some_hash<MoveOnly>> C;
+ static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+ }
+ {
+ typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>, some_comp<MoveOnly>> C;
+ static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/dtor_noexcept.pass.cpp b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/dtor_noexcept.pass.cpp
index f0b7e28699f3613..17cfae0f989c7a8 100644
--- a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/dtor_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/dtor_noexcept.pass.cpp
@@ -20,49 +20,43 @@
#include "test_allocator.h"
template <class T>
-struct some_comp
-{
- typedef T value_type;
- ~some_comp() noexcept(false);
- bool operator()(const T&, const T&) const { return false; }
+struct some_comp {
+ typedef T value_type;
+ ~some_comp() noexcept(false);
+ bool operator()(const T&, const T&) const { return false; }
};
template <class T>
-struct some_hash
-{
- typedef T value_type;
- some_hash();
- some_hash(const some_hash&);
- ~some_hash() noexcept(false);
- std::size_t operator()(T const&) const;
+struct some_hash {
+ typedef T value_type;
+ some_hash();
+ some_hash(const some_hash&);
+ ~some_hash() noexcept(false);
+ std::size_t operator()(T const&) const;
};
-int main(int, char**)
-{
- {
- typedef std::unordered_set<MoveOnly> C;
- static_assert(std::is_nothrow_destructible<C>::value, "");
- }
- {
- typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, test_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_destructible<C>::value, "");
- }
- {
- typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, other_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_destructible<C>::value, "");
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_set<MoveOnly> C;
+ static_assert(std::is_nothrow_destructible<C>::value, "");
+ }
+ {
+ typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>, std::equal_to<MoveOnly>, test_allocator<MoveOnly>> C;
+ static_assert(std::is_nothrow_destructible<C>::value, "");
+ }
+ {
+ typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>, std::equal_to<MoveOnly>, other_allocator<MoveOnly>> C;
+ static_assert(std::is_nothrow_destructible<C>::value, "");
+ }
#if defined(_LIBCPP_VERSION)
- {
- typedef std::unordered_set<MoveOnly, some_hash<MoveOnly>> C;
- static_assert(!std::is_nothrow_destructible<C>::value, "");
- }
- {
- typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>,
- some_comp<MoveOnly>> C;
- static_assert(!std::is_nothrow_destructible<C>::value, "");
- }
+ {
+ typedef std::unordered_set<MoveOnly, some_hash<MoveOnly>> C;
+ static_assert(!std::is_nothrow_destructible<C>::value, "");
+ }
+ {
+ typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>, some_comp<MoveOnly>> C;
+ static_assert(!std::is_nothrow_destructible<C>::value, "");
+ }
#endif // _LIBCPP_VERSION
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/from_range.pass.cpp b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/from_range.pass.cpp
index 581781949365e8f..c4ce08e39176f59 100644
--- a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/from_range.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/from_range.pass.cpp
@@ -30,13 +30,9 @@
void test_duplicates() {
using T = KeyValue;
- std::array input = {
- T{1, 'a'}, T{2, 'a'}, T{3, 'a'}, T{3, 'b'}, T{3, 'c'}, T{2, 'b'}, T{4, 'a'}
- };
- std::array expected = {
- T{1, 'a'}, T{2, 'b'}, T{3, 'c'}, T{4, 'a'}
- };
- auto c = std::unordered_set<T>(std::from_range, input);
+ std::array input = {T{1, 'a'}, T{2, 'a'}, T{3, 'a'}, T{3, 'b'}, T{3, 'c'}, T{2, 'b'}, T{4, 'a'}};
+ std::array expected = {T{1, 'a'}, T{2, 'b'}, T{3, 'c'}, T{4, 'a'}};
+ auto c = std::unordered_set<T>(std::from_range, input);
assert(std::ranges::is_permutation(expected, c));
}
diff --git a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/hash_copy_constructible.compile.fail.cpp b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/hash_copy_constructible.compile.fail.cpp
index 4857f80f4548957..3e0ab51727db90e 100644
--- a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/hash_copy_constructible.compile.fail.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/hash_copy_constructible.compile.fail.cpp
@@ -6,7 +6,6 @@
//
//===----------------------------------------------------------------------===//
-
// <unordered_map>
// Check that std::unordered_set fails to instantiate if the hash function is
@@ -16,16 +15,16 @@
template <class T>
struct Hash {
- std::size_t operator () (const T& lhs) const { return 0; }
+ std::size_t operator()(const T& lhs) const { return 0; }
- Hash () {}
-private:
- Hash (const Hash &); // declared but not defined
- };
+ Hash() {}
+private:
+ Hash(const Hash&); // declared but not defined
+};
int main(int, char**) {
- std::unordered_set<int, Hash<int> > m;
+ std::unordered_set<int, Hash<int> > m;
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/init.pass.cpp b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/init.pass.cpp
index 28122424dfb4a36..7e42decbffd6c01 100644
--- a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/init.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/init.pass.cpp
@@ -28,137 +28,100 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
+int main(int, char**) {
{
- typedef std::unordered_set<int,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<int>
- > C;
- typedef int P;
- C c = {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- assert(c.bucket_count() >= 5);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>());
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() == test_allocator<int>());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef std::unordered_set<int,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<int>
- > C;
- typedef int P;
- C c = {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- assert(c.bucket_count() >= 5);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>());
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() == min_allocator<int>());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+ typedef std::unordered_set<int, test_hash<int>, test_equal_to<int>, test_allocator<int> > C;
+ typedef int P;
+ C c = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ assert(c.bucket_count() >= 5);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>());
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == test_allocator<int>());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef std::unordered_set<int, test_hash<int>, test_equal_to<int>, min_allocator<int> > C;
+ typedef int P;
+ C c = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ assert(c.bucket_count() >= 5);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>());
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER > 11
- {
- typedef int T;
- typedef test_hash<T> HF;
- typedef test_equal_to<T> Comp;
- typedef test_allocator<T> A;
- typedef std::unordered_set<T, HF, Comp, A> C;
+ {
+ typedef int T;
+ typedef test_hash<T> HF;
+ typedef test_equal_to<T> Comp;
+ typedef test_allocator<T> A;
+ typedef std::unordered_set<T, HF, Comp, A> C;
- A a(42);
- C c({
- T(1),
- T(2),
- T(3),
- T(4),
- T(1),
- T(2)
- }, 12, a);
+ A a(42);
+ C c({T(1), T(2), T(3), T(4), T(1), T(2)}, 12, a);
- assert(c.bucket_count() >= 12);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == HF());
- assert(c.key_eq() == Comp());
- assert(c.get_allocator() == a);
- assert(!(c.get_allocator() == A()));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef int T;
- typedef test_hash<T> HF;
- typedef test_equal_to<T> Comp;
- typedef test_allocator<T> A;
- typedef std::unordered_set<T, HF, Comp, A> C;
+ assert(c.bucket_count() >= 12);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == HF());
+ assert(c.key_eq() == Comp());
+ assert(c.get_allocator() == a);
+ assert(!(c.get_allocator() == A()));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef int T;
+ typedef test_hash<T> HF;
+ typedef test_equal_to<T> Comp;
+ typedef test_allocator<T> A;
+ typedef std::unordered_set<T, HF, Comp, A> C;
- A a(42);
- HF hf(43);
- C c({
- T(1),
- T(2),
- T(3),
- T(4),
- T(1),
- T(2)
- }, 12, hf, a);
+ A a(42);
+ HF hf(43);
+ C c({T(1), T(2), T(3), T(4), T(1), T(2)}, 12, hf, a);
- assert(c.bucket_count() >= 12);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == hf);
- assert(!(c.hash_function() == HF()));
- assert(c.key_eq() == Comp());
- assert(c.get_allocator() == a);
- assert(!(c.get_allocator() == A()));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+ assert(c.bucket_count() >= 12);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == hf);
+ assert(!(c.hash_function() == HF()));
+ assert(c.key_eq() == Comp());
+ assert(c.get_allocator() == a);
+ assert(!(c.get_allocator() == A()));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/init_size.pass.cpp b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/init_size.pass.cpp
index ff516a757c1cdb6..1d13b0215aa30a8 100644
--- a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/init_size.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/init_size.pass.cpp
@@ -28,72 +28,45 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_set<int,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<int>
- > C;
- typedef int P;
- C c({
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- },
- 7
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>());
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() == test_allocator<int>());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef std::unordered_set<int,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<int>
- > C;
- typedef int P;
- C c({
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- },
- 7
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>());
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() == min_allocator<int>());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_set<int, test_hash<int>, test_equal_to<int>, test_allocator<int> > C;
+ typedef int P;
+ C c({P(1), P(2), P(3), P(4), P(1), P(2)}, 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>());
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == test_allocator<int>());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef std::unordered_set<int, test_hash<int>, test_equal_to<int>, min_allocator<int> > C;
+ typedef int P;
+ C c({P(1), P(2), P(3), P(4), P(1), P(2)}, 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>());
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_allocator.pass.cpp b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_allocator.pass.cpp
index 340dbba9b49a993..7346a951b19766b 100644
--- a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_allocator.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_allocator.pass.cpp
@@ -30,43 +30,29 @@
#include "min_allocator.h"
template <class Allocator>
-void test(const Allocator& alloc)
-{
- typedef std::unordered_set<int,
- test_hash<int>,
- test_equal_to<int>,
- Allocator> C;
- C c({
- 1,
- 2,
- 3,
- 4,
- 1,
- 2
- },
- 7,
- alloc);
-
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>());
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() == alloc);
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
+void test(const Allocator& alloc) {
+ typedef std::unordered_set<int, test_hash<int>, test_equal_to<int>, Allocator> C;
+ C c({1, 2, 3, 4, 1, 2}, 7, alloc);
+
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>());
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == alloc);
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
}
-int main(int, char**)
-{
- test(test_allocator<int>(10));
- test(min_allocator<int>());
- test(explicit_allocator<int>());
+int main(int, char**) {
+ test(test_allocator<int>(10));
+ test(min_allocator<int>());
+ test(explicit_allocator<int>());
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash.pass.cpp b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash.pass.cpp
index 628b3277764c33f..5e3d869805f6bb8 100644
--- a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash.pass.cpp
@@ -29,74 +29,45 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_set<int,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<int>
- > C;
- typedef int P;
- C c({
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- },
- 7,
- test_hash<int>(8)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() == test_allocator<int>());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef std::unordered_set<int,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<int>
- > C;
- typedef int P;
- C c({
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- },
- 7,
- test_hash<int>(8)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() == min_allocator<int>());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_set<int, test_hash<int>, test_equal_to<int>, test_allocator<int> > C;
+ typedef int P;
+ C c({P(1), P(2), P(3), P(4), P(1), P(2)}, 7, test_hash<int>(8));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == test_allocator<int>());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef std::unordered_set<int, test_hash<int>, test_equal_to<int>, min_allocator<int> > C;
+ typedef int P;
+ C c({P(1), P(2), P(3), P(4), P(1), P(2)}, 7, test_hash<int>(8));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_allocator.pass.cpp b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_allocator.pass.cpp
index ab5f7d9f9b50429..704fff0f51ccac2 100644
--- a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_allocator.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_allocator.pass.cpp
@@ -31,44 +31,29 @@
#include "min_allocator.h"
template <class Allocator>
-void test(const Allocator& alloc)
-{
- typedef std::unordered_set<int,
- test_hash<int>,
- test_equal_to<int>,
- Allocator> C;
- C c({
- 1,
- 2,
- 3,
- 4,
- 1,
- 2
- },
- 7,
- test_hash<int>(5),
- alloc);
-
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(5));
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() == alloc);
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
+void test(const Allocator& alloc) {
+ typedef std::unordered_set<int, test_hash<int>, test_equal_to<int>, Allocator> C;
+ C c({1, 2, 3, 4, 1, 2}, 7, test_hash<int>(5), alloc);
+
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(5));
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == alloc);
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
}
-int main(int, char**)
-{
- test(test_allocator<int>(10));
- test(min_allocator<int>());
- test(explicit_allocator<int>());
+int main(int, char**) {
+ test(test_allocator<int>(10));
+ test(min_allocator<int>());
+ test(explicit_allocator<int>());
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal.pass.cpp b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal.pass.cpp
index af5a371bd458bd2..44d3d9b3fb20053 100644
--- a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal.pass.cpp
@@ -29,76 +29,45 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_set<int,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<int>
- > C;
- typedef int P;
- C c({
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- },
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == test_allocator<int>());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef std::unordered_set<int,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<int>
- > C;
- typedef int P;
- C c({
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- },
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == min_allocator<int>());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_set<int, test_hash<int>, test_equal_to<int>, test_allocator<int> > C;
+ typedef int P;
+ C c({P(1), P(2), P(3), P(4), P(1), P(2)}, 7, test_hash<int>(8), test_equal_to<int>(9));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == test_allocator<int>());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef std::unordered_set<int, test_hash<int>, test_equal_to<int>, min_allocator<int> > C;
+ typedef int P;
+ C c({P(1), P(2), P(3), P(4), P(1), P(2)}, 7, test_hash<int>(8), test_equal_to<int>(9));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal_allocator.pass.cpp b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal_allocator.pass.cpp
index bf8c9561e76ee90..bd21eeb16351662 100644
--- a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal_allocator.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal_allocator.pass.cpp
@@ -29,78 +29,45 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_set<int,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<int>
- > C;
- typedef int P;
- C c({
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- },
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- test_allocator<int>(10)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == test_allocator<int>(10));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef std::unordered_set<int,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<int>
- > C;
- typedef int P;
- C c({
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- },
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- min_allocator<int>()
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == min_allocator<int>());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_set<int, test_hash<int>, test_equal_to<int>, test_allocator<int> > C;
+ typedef int P;
+ C c({P(1), P(2), P(3), P(4), P(1), P(2)}, 7, test_hash<int>(8), test_equal_to<int>(9), test_allocator<int>(10));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == test_allocator<int>(10));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef std::unordered_set<int, test_hash<int>, test_equal_to<int>, min_allocator<int> > C;
+ typedef int P;
+ C c({P(1), P(2), P(3), P(4), P(1), P(2)}, 7, test_hash<int>(8), test_equal_to<int>(9), min_allocator<int>());
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/iter_iter.pass.cpp b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/iter_iter.pass.cpp
index 8934490b6c71175..76e2cee74df7138 100644
--- a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/iter_iter.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/iter_iter.pass.cpp
@@ -28,144 +28,103 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_set<int,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<int>
- > C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])));
- assert(c.bucket_count() >= 5);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>());
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() == test_allocator<int>());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_set<int, test_hash<int>, test_equal_to<int>, test_allocator<int> > C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])));
+ assert(c.bucket_count() >= 5);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>());
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == test_allocator<int>());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_set<int,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<int>
- > C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])));
- assert(c.bucket_count() >= 5);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>());
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() == min_allocator<int>());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
-#if TEST_STD_VER > 11
- {
- typedef int T;
- typedef test_hash<T> HF;
- typedef test_equal_to<T> Comp;
- typedef test_allocator<T> A;
- typedef std::unordered_set<T, HF, Comp, A> C;
- T arr[] =
- {
- T(1),
- T(2),
- T(3),
- T(4),
- T(1),
- T(2)
- };
- A a(42);
- C c(cpp17_input_iterator<T*>(arr), cpp17_input_iterator<T*>(arr + sizeof(arr)/sizeof(arr[0])), 12, a);
- assert(c.bucket_count() >= 12);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == HF());
- assert(c.key_eq() == Comp());
- assert(c.get_allocator() == a);
- assert(!(c.get_allocator() == A()));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
- {
- typedef int T;
- typedef test_hash<T> HF;
- typedef test_equal_to<T> Comp;
- typedef test_allocator<T> A;
- typedef std::unordered_set<T, HF, Comp, A> C;
- T arr[] =
- {
- T(1),
- T(2),
- T(3),
- T(4),
- T(1),
- T(2)
- };
- HF hf(43);
- A a(42);
- C c(cpp17_input_iterator<T*>(arr), cpp17_input_iterator<T*>(arr + sizeof(arr)/sizeof(arr[0])), 16, hf, a);
- assert(c.bucket_count() >= 16);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == hf);
- assert(!(c.hash_function() == HF()));
- assert(c.key_eq() == Comp());
- assert(c.get_allocator() == a);
- assert(!(c.get_allocator() == A()));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+ {
+ typedef std::unordered_set<int, test_hash<int>, test_equal_to<int>, min_allocator<int> > C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])));
+ assert(c.bucket_count() >= 5);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>());
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+# if TEST_STD_VER > 11
+ {
+ typedef int T;
+ typedef test_hash<T> HF;
+ typedef test_equal_to<T> Comp;
+ typedef test_allocator<T> A;
+ typedef std::unordered_set<T, HF, Comp, A> C;
+ T arr[] = {T(1), T(2), T(3), T(4), T(1), T(2)};
+ A a(42);
+ C c(cpp17_input_iterator<T*>(arr), cpp17_input_iterator<T*>(arr + sizeof(arr) / sizeof(arr[0])), 12, a);
+ assert(c.bucket_count() >= 12);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == HF());
+ assert(c.key_eq() == Comp());
+ assert(c.get_allocator() == a);
+ assert(!(c.get_allocator() == A()));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef int T;
+ typedef test_hash<T> HF;
+ typedef test_equal_to<T> Comp;
+ typedef test_allocator<T> A;
+ typedef std::unordered_set<T, HF, Comp, A> C;
+ T arr[] = {T(1), T(2), T(3), T(4), T(1), T(2)};
+ HF hf(43);
+ A a(42);
+ C c(cpp17_input_iterator<T*>(arr), cpp17_input_iterator<T*>(arr + sizeof(arr) / sizeof(arr[0])), 16, hf, a);
+ assert(c.bucket_count() >= 16);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == hf);
+ assert(!(c.hash_function() == HF()));
+ assert(c.key_eq() == Comp());
+ assert(c.get_allocator() == a);
+ assert(!(c.get_allocator() == A()));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
-#endif
+# endif
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/iter_iter_size.pass.cpp b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/iter_iter_size.pass.cpp
index 8b6149ac8f1f9eb..257df08e00f5791 100644
--- a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/iter_iter_size.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/iter_iter_size.pass.cpp
@@ -28,77 +28,48 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_set<int,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<int>
- > C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
- 7
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>());
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() == test_allocator<int>());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_set<int, test_hash<int>, test_equal_to<int>, test_allocator<int> > C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])), 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>());
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == test_allocator<int>());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_set<int,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<int>
- > C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
- 7
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>());
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() == min_allocator<int>());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+ {
+ typedef std::unordered_set<int, test_hash<int>, test_equal_to<int>, min_allocator<int> > C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])), 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>());
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/iter_iter_size_allocator.pass.cpp b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/iter_iter_size_allocator.pass.cpp
index cfed6dfbb36c173..414485466d71e23 100644
--- a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/iter_iter_size_allocator.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/iter_iter_size_allocator.pass.cpp
@@ -33,45 +33,29 @@
#include "min_allocator.h"
template <class Allocator>
-void test(const Allocator& alloc)
-{
- typedef std::unordered_set<int,
- test_hash<int>,
- test_equal_to<int>,
- Allocator> C;
- int a[] =
- {
- 1,
- 2,
- 3,
- 4,
- 1,
- 2
- };
- C c(cpp17_input_iterator<int*>(a), cpp17_input_iterator<int*>(a + sizeof(a)/sizeof(a[0])),
- 7,
- alloc
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>());
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() == alloc);
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
+void test(const Allocator& alloc) {
+ typedef std::unordered_set<int, test_hash<int>, test_equal_to<int>, Allocator> C;
+ int a[] = {1, 2, 3, 4, 1, 2};
+ C c(cpp17_input_iterator<int*>(a), cpp17_input_iterator<int*>(a + sizeof(a) / sizeof(a[0])), 7, alloc);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>());
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == alloc);
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
}
-int main(int, char**)
-{
- test(test_allocator<int>(10));
- test(min_allocator<int>());
- test(explicit_allocator<int>());
+int main(int, char**) {
+ test(test_allocator<int>(10));
+ test(min_allocator<int>());
+ test(explicit_allocator<int>());
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/iter_iter_size_hash.pass.cpp b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/iter_iter_size_hash.pass.cpp
index 93ff746b3e039f3..92a26608dd6ec05 100644
--- a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/iter_iter_size_hash.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/iter_iter_size_hash.pass.cpp
@@ -29,79 +29,48 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_set<int,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<int>
- > C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
- 7,
- test_hash<int>(8)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() == test_allocator<int>());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_set<int, test_hash<int>, test_equal_to<int>, test_allocator<int> > C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])), 7, test_hash<int>(8));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == test_allocator<int>());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_set<int,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<int>
- > C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
- 7,
- test_hash<int>(8)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() == min_allocator<int>());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+ {
+ typedef std::unordered_set<int, test_hash<int>, test_equal_to<int>, min_allocator<int> > C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])), 7, test_hash<int>(8));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/iter_iter_size_hash_allocator.pass.cpp b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/iter_iter_size_hash_allocator.pass.cpp
index 2c44cba3b752009..ba986eba5f71ce8 100644
--- a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/iter_iter_size_hash_allocator.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/iter_iter_size_hash_allocator.pass.cpp
@@ -33,46 +33,33 @@
#include "min_allocator.h"
template <class Allocator>
-void test(const Allocator& alloc)
-{
- typedef std::unordered_set<int,
- test_hash<int>,
- test_equal_to<int>,
- Allocator> C;
- int a[] =
- {
- 1,
- 2,
- 3,
- 4,
- 1,
- 2
- };
- C c(cpp17_input_iterator<int*>(a), cpp17_input_iterator<int*>(a + sizeof(a)/sizeof(a[0])),
- 7,
- test_hash<int>(5),
- alloc
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(5));
- assert(c.key_eq() == test_equal_to<int>());
- assert(c.get_allocator() == alloc);
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
+void test(const Allocator& alloc) {
+ typedef std::unordered_set<int, test_hash<int>, test_equal_to<int>, Allocator> C;
+ int a[] = {1, 2, 3, 4, 1, 2};
+ C c(cpp17_input_iterator<int*>(a),
+ cpp17_input_iterator<int*>(a + sizeof(a) / sizeof(a[0])),
+ 7,
+ test_hash<int>(5),
+ alloc);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(5));
+ assert(c.key_eq() == test_equal_to<int>());
+ assert(c.get_allocator() == alloc);
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
}
-int main(int, char**)
-{
- test(test_allocator<int>(10));
- test(min_allocator<int>());
- test(explicit_allocator<int>());
+int main(int, char**) {
+ test(test_allocator<int>(10));
+ test(min_allocator<int>());
+ test(explicit_allocator<int>());
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/iter_iter_size_hash_equal.pass.cpp b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/iter_iter_size_hash_equal.pass.cpp
index 272c08058353d0f..eb0c18bf78ca22f 100644
--- a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/iter_iter_size_hash_equal.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/iter_iter_size_hash_equal.pass.cpp
@@ -29,81 +29,56 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_set<int,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<int>
- > C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == test_allocator<int>());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_set<int, test_hash<int>, test_equal_to<int>, test_allocator<int> > C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(cpp17_input_iterator<P*>(a),
+ cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])),
+ 7,
+ test_hash<int>(8),
+ test_equal_to<int>(9));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == test_allocator<int>());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_set<int,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<int>
- > C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == min_allocator<int>());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+ {
+ typedef std::unordered_set<int, test_hash<int>, test_equal_to<int>, min_allocator<int> > C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(cpp17_input_iterator<P*>(a),
+ cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])),
+ 7,
+ test_hash<int>(8),
+ test_equal_to<int>(9));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/iter_iter_size_hash_equal_allocator.pass.cpp b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/iter_iter_size_hash_equal_allocator.pass.cpp
index 024dc4a47721b55..6eb7a26e19070fe 100644
--- a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/iter_iter_size_hash_equal_allocator.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/iter_iter_size_hash_equal_allocator.pass.cpp
@@ -30,83 +30,58 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_set<int,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<int>
- > C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- test_allocator<int>(10)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == test_allocator<int>(10));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_set<int, test_hash<int>, test_equal_to<int>, test_allocator<int> > C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(cpp17_input_iterator<P*>(a),
+ cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])),
+ 7,
+ test_hash<int>(8),
+ test_equal_to<int>(9),
+ test_allocator<int>(10));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == test_allocator<int>(10));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_set<int,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<int>
- > C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c(cpp17_input_iterator<P*>(a), cpp17_input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- min_allocator<int>()
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == min_allocator<int>());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
- }
+ {
+ typedef std::unordered_set<int, test_hash<int>, test_equal_to<int>, min_allocator<int> > C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c(cpp17_input_iterator<P*>(a),
+ cpp17_input_iterator<P*>(a + sizeof(a) / sizeof(a[0])),
+ 7,
+ test_hash<int>(8),
+ test_equal_to<int>(9),
+ min_allocator<int>());
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/move.pass.cpp b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/move.pass.cpp
index 80131be690d8bf2..ce05ff552470dd6 100644
--- a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/move.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/move.pass.cpp
@@ -28,142 +28,91 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_set<int,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<int>
- > C;
- C c0(7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- test_allocator<int>(10)
- );
- C c = std::move(c0);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 0);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == test_allocator<int>(10));
- assert(c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
+int main(int, char**) {
+ {
+ typedef std::unordered_set<int, test_hash<int>, test_equal_to<int>, test_allocator<int> > C;
+ C c0(7, test_hash<int>(8), test_equal_to<int>(9), test_allocator<int>(10));
+ C c = std::move(c0);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 0);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == test_allocator<int>(10));
+ assert(c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
- assert(c0.empty());
- }
- {
- typedef std::unordered_set<int,
- test_hash<int>,
- test_equal_to<int>,
- test_allocator<int>
- > C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- test_allocator<int>(10)
- );
- C::iterator it0 = c0.begin();
- C c = std::move(c0);
- assert(it0 == c.begin()); // Iterators remain valid
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == test_allocator<int>(10));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
+ assert(c0.empty());
+ }
+ {
+ typedef std::unordered_set<int, test_hash<int>, test_equal_to<int>, test_allocator<int> > C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), test_allocator<int>(10));
+ C::iterator it0 = c0.begin();
+ C c = std::move(c0);
+ assert(it0 == c.begin()); // Iterators remain valid
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == test_allocator<int>(10));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
- assert(c0.empty());
- }
- {
- typedef std::unordered_set<int,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<int>
- > C;
- C c0(7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- min_allocator<int>()
- );
- C c = std::move(c0);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 0);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == min_allocator<int>());
- assert(c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
+ assert(c0.empty());
+ }
+ {
+ typedef std::unordered_set<int, test_hash<int>, test_equal_to<int>, min_allocator<int> > C;
+ C c0(7, test_hash<int>(8), test_equal_to<int>(9), min_allocator<int>());
+ C c = std::move(c0);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 0);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
- assert(c0.empty());
- }
- {
- typedef std::unordered_set<int,
- test_hash<int>,
- test_equal_to<int>,
- min_allocator<int>
- > C;
- typedef int P;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- min_allocator<int>()
- );
- C::iterator it0 = c0.begin();
- C c = std::move(c0);
- assert(it0 == c.begin()); // Iterators remain valid
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == min_allocator<int>());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
+ assert(c0.empty());
+ }
+ {
+ typedef std::unordered_set<int, test_hash<int>, test_equal_to<int>, min_allocator<int> > C;
+ typedef int P;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), min_allocator<int>());
+ C::iterator it0 = c0.begin();
+ C c = std::move(c0);
+ assert(it0 == c.begin()); // Iterators remain valid
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
- assert(c0.empty());
- }
+ assert(c0.empty());
+ }
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/move_alloc.pass.cpp b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/move_alloc.pass.cpp
index 41bd56ba43549e8..7bcd679d012e28b 100644
--- a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/move_alloc.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/move_alloc.pass.cpp
@@ -28,131 +28,79 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef int P;
- typedef test_allocator<int> A;
- typedef std::unordered_set<int,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A(10)
- );
- C c(std::move(c0), A(12));
- assert(c.bucket_count() >= 5);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == A(12));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
+int main(int, char**) {
+ {
+ typedef int P;
+ typedef test_allocator<int> A;
+ typedef std::unordered_set<int, test_hash<int>, test_equal_to<int>, A > C;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), A(10));
+ C c(std::move(c0), A(12));
+ assert(c.bucket_count() >= 5);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == A(12));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
- assert(c0.empty());
- }
- {
- typedef int P;
- typedef test_allocator<int> A;
- typedef std::unordered_set<int,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A(10)
- );
- C c(std::move(c0), A(10));
- assert(c.bucket_count() >= 5);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == A(10));
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
+ assert(c0.empty());
+ }
+ {
+ typedef int P;
+ typedef test_allocator<int> A;
+ typedef std::unordered_set<int, test_hash<int>, test_equal_to<int>, A > C;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), A(10));
+ C c(std::move(c0), A(10));
+ assert(c.bucket_count() >= 5);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == A(10));
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
- assert(c0.empty());
- }
- {
- typedef int P;
- typedef min_allocator<int> A;
- typedef std::unordered_set<int,
- test_hash<int>,
- test_equal_to<int>,
- A
- > C;
- P a[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c0(a, a + sizeof(a)/sizeof(a[0]),
- 7,
- test_hash<int>(8),
- test_equal_to<int>(9),
- A()
- );
- C c(std::move(c0), A());
- assert(c.bucket_count() >= 5);
- assert(c.size() == 4);
- assert(c.count(1) == 1);
- assert(c.count(2) == 1);
- assert(c.count(3) == 1);
- assert(c.count(4) == 1);
- assert(c.hash_function() == test_hash<int>(8));
- assert(c.key_eq() == test_equal_to<int>(9));
- assert(c.get_allocator() == A());
- assert(!c.empty());
- assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
- assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
- assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
- assert(c.max_load_factor() == 1);
+ assert(c0.empty());
+ }
+ {
+ typedef int P;
+ typedef min_allocator<int> A;
+ typedef std::unordered_set<int, test_hash<int>, test_equal_to<int>, A > C;
+ P a[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c0(a, a + sizeof(a) / sizeof(a[0]), 7, test_hash<int>(8), test_equal_to<int>(9), A());
+ C c(std::move(c0), A());
+ assert(c.bucket_count() >= 5);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<int>(8));
+ assert(c.key_eq() == test_equal_to<int>(9));
+ assert(c.get_allocator() == A());
+ assert(!c.empty());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
+ assert(std::fabs(c.load_factor() - (float)c.size() / c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
- assert(c0.empty());
- }
+ assert(c0.empty());
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/move_noexcept.pass.cpp b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/move_noexcept.pass.cpp
index a31108ab936eb9d..e9aae1878128033 100644
--- a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/move_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/move_noexcept.pass.cpp
@@ -24,49 +24,43 @@
#include "test_allocator.h"
template <class T>
-struct some_comp
-{
- typedef T value_type;
- some_comp(const some_comp&);
- bool operator()(const T&, const T&) const { return false; }
+struct some_comp {
+ typedef T value_type;
+ some_comp(const some_comp&);
+ bool operator()(const T&, const T&) const { return false; }
};
template <class T>
-struct some_hash
-{
- typedef T value_type;
- some_hash();
- some_hash(const some_hash&);
- std::size_t operator()(T const&) const;
+struct some_hash {
+ typedef T value_type;
+ some_hash();
+ some_hash(const some_hash&);
+ std::size_t operator()(T const&) const;
};
-int main(int, char**)
-{
+int main(int, char**) {
#if defined(_LIBCPP_VERSION)
- {
- typedef std::unordered_set<MoveOnly> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
- }
- {
- typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, test_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
- }
- {
- typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, other_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
- }
+ {
+ typedef std::unordered_set<MoveOnly> C;
+ static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ }
+ {
+ typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>, std::equal_to<MoveOnly>, test_allocator<MoveOnly>> C;
+ static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ }
+ {
+ typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>, std::equal_to<MoveOnly>, other_allocator<MoveOnly>> C;
+ static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ }
#endif // _LIBCPP_VERSION
- {
- typedef std::unordered_set<MoveOnly, some_hash<MoveOnly>> C;
- static_assert(!std::is_nothrow_move_constructible<C>::value, "");
- }
- {
- typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>,
- some_comp<MoveOnly>> C;
- static_assert(!std::is_nothrow_move_constructible<C>::value, "");
- }
+ {
+ typedef std::unordered_set<MoveOnly, some_hash<MoveOnly>> C;
+ static_assert(!std::is_nothrow_move_constructible<C>::value, "");
+ }
+ {
+ typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>, some_comp<MoveOnly>> C;
+ static_assert(!std::is_nothrow_move_constructible<C>::value, "");
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/size.compile.fail.cpp b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/size.compile.fail.cpp
index f9bb88f371245b8..692ca98de1a8009 100644
--- a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/size.compile.fail.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/size.compile.fail.cpp
@@ -23,25 +23,24 @@
#include "../../../test_hash.h"
#include "test_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_set<NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- test_allocator<NotConstructible>
- > C;
- C c = 7;
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.hash_function() == test_hash<NotConstructible>());
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() == (test_allocator<NotConstructible>()));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_set<NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ test_allocator<NotConstructible> >
+ C;
+ C c = 7;
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<NotConstructible>());
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == (test_allocator<NotConstructible>()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/size.pass.cpp b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/size.pass.cpp
index 5c43179b0b1e6f6..3add76761d8b119 100644
--- a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/size.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/size.pass.cpp
@@ -24,43 +24,42 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_set<NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- test_allocator<NotConstructible>
- > C;
- C c(7);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.hash_function() == test_hash<NotConstructible>());
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() == (test_allocator<NotConstructible>()));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_set<NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ test_allocator<NotConstructible> >
+ C;
+ C c(7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<NotConstructible>());
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == (test_allocator<NotConstructible>()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_set<NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- min_allocator<NotConstructible>
- > C;
- C c(7);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.hash_function() == test_hash<NotConstructible>());
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() == (min_allocator<NotConstructible>()));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+ {
+ typedef std::unordered_set<NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ min_allocator<NotConstructible> >
+ C;
+ C c(7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<NotConstructible>());
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == (min_allocator<NotConstructible>()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/size_allocator.pass.cpp b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/size_allocator.pass.cpp
index d547ea2b4bda3a5..99abd12745ecaa2 100644
--- a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/size_allocator.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/size_allocator.pass.cpp
@@ -28,29 +28,25 @@
#include "min_allocator.h"
template <class Allocator>
-void test(const Allocator& alloc)
-{
- typedef std::unordered_set<NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- Allocator> C;
- C c(7, alloc);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.hash_function() == test_hash<NotConstructible>());
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() == alloc);
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
+void test(const Allocator& alloc) {
+ typedef std::unordered_set<NotConstructible, test_hash<NotConstructible>, test_equal_to<NotConstructible>, Allocator>
+ C;
+ C c(7, alloc);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<NotConstructible>());
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == alloc);
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
}
-int main(int, char**)
-{
- test(test_allocator<NotConstructible>(10));
- test(min_allocator<NotConstructible>());
- test(explicit_allocator<NotConstructible>());
+int main(int, char**) {
+ test(test_allocator<NotConstructible>(10));
+ test(min_allocator<NotConstructible>());
+ test(explicit_allocator<NotConstructible>());
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash.pass.cpp b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash.pass.cpp
index 6ee0f5c99f69ca9..a7d4f4d798a0b38 100644
--- a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash.pass.cpp
@@ -24,47 +24,42 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_set<NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- test_allocator<NotConstructible>
- > C;
- C c(7,
- test_hash<NotConstructible>(8)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.hash_function() == test_hash<NotConstructible>(8));
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() == (test_allocator<NotConstructible>()));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_set<NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ test_allocator<NotConstructible> >
+ C;
+ C c(7, test_hash<NotConstructible>(8));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<NotConstructible>(8));
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == (test_allocator<NotConstructible>()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_set<NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- min_allocator<NotConstructible>
- > C;
- C c(7,
- test_hash<NotConstructible>(8)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.hash_function() == test_hash<NotConstructible>(8));
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() == (min_allocator<NotConstructible>()));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+ {
+ typedef std::unordered_set<NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ min_allocator<NotConstructible> >
+ C;
+ C c(7, test_hash<NotConstructible>(8));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<NotConstructible>(8));
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == (min_allocator<NotConstructible>()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash_allocator.pass.cpp b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash_allocator.pass.cpp
index 972c0db3149d719..e44854eb0a13282 100644
--- a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash_allocator.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash_allocator.pass.cpp
@@ -28,29 +28,25 @@
#include "min_allocator.h"
template <class Allocator>
-void test(const Allocator& alloc)
-{
- typedef std::unordered_set<NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- Allocator> C;
- C c(7, test_hash<NotConstructible>(5), alloc);
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.hash_function() == test_hash<NotConstructible>(5));
- assert(c.key_eq() == test_equal_to<NotConstructible>());
- assert(c.get_allocator() == alloc);
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
+void test(const Allocator& alloc) {
+ typedef std::unordered_set<NotConstructible, test_hash<NotConstructible>, test_equal_to<NotConstructible>, Allocator>
+ C;
+ C c(7, test_hash<NotConstructible>(5), alloc);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<NotConstructible>(5));
+ assert(c.key_eq() == test_equal_to<NotConstructible>());
+ assert(c.get_allocator() == alloc);
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
}
-int main(int, char**)
-{
- test(test_allocator<NotConstructible>(10));
- test(min_allocator<NotConstructible>());
- test(explicit_allocator<NotConstructible>());
+int main(int, char**) {
+ test(test_allocator<NotConstructible>(10));
+ test(min_allocator<NotConstructible>());
+ test(explicit_allocator<NotConstructible>());
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash_equal.pass.cpp b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash_equal.pass.cpp
index a54ddaf4627f600..cbaa0ae99511517 100644
--- a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash_equal.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash_equal.pass.cpp
@@ -24,49 +24,42 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_set<NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- test_allocator<NotConstructible>
- > C;
- C c(7,
- test_hash<NotConstructible>(8),
- test_equal_to<NotConstructible>(9)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.hash_function() == test_hash<NotConstructible>(8));
- assert(c.key_eq() == test_equal_to<NotConstructible>(9));
- assert(c.get_allocator() == (test_allocator<NotConstructible>()));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_set<NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ test_allocator<NotConstructible> >
+ C;
+ C c(7, test_hash<NotConstructible>(8), test_equal_to<NotConstructible>(9));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<NotConstructible>(8));
+ assert(c.key_eq() == test_equal_to<NotConstructible>(9));
+ assert(c.get_allocator() == (test_allocator<NotConstructible>()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_set<NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- min_allocator<NotConstructible>
- > C;
- C c(7,
- test_hash<NotConstructible>(8),
- test_equal_to<NotConstructible>(9)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.hash_function() == test_hash<NotConstructible>(8));
- assert(c.key_eq() == test_equal_to<NotConstructible>(9));
- assert(c.get_allocator() == (min_allocator<NotConstructible>()));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+ {
+ typedef std::unordered_set<NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ min_allocator<NotConstructible> >
+ C;
+ C c(7, test_hash<NotConstructible>(8), test_equal_to<NotConstructible>(9));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<NotConstructible>(8));
+ assert(c.key_eq() == test_equal_to<NotConstructible>(9));
+ assert(c.get_allocator() == (min_allocator<NotConstructible>()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash_equal_allocator.pass.cpp b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash_equal_allocator.pass.cpp
index c3d97c579177ea0..f6d208f3b59b5c1 100644
--- a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash_equal_allocator.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash_equal_allocator.pass.cpp
@@ -24,51 +24,42 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef std::unordered_set<NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- test_allocator<NotConstructible>
- > C;
- C c(7,
- test_hash<NotConstructible>(8),
- test_equal_to<NotConstructible>(9),
- test_allocator<NotConstructible>(10)
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.hash_function() == test_hash<NotConstructible>(8));
- assert(c.key_eq() == test_equal_to<NotConstructible>(9));
- assert(c.get_allocator() == (test_allocator<NotConstructible>(10)));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_set<NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ test_allocator<NotConstructible> >
+ C;
+ C c(7, test_hash<NotConstructible>(8), test_equal_to<NotConstructible>(9), test_allocator<NotConstructible>(10));
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<NotConstructible>(8));
+ assert(c.key_eq() == test_equal_to<NotConstructible>(9));
+ assert(c.get_allocator() == (test_allocator<NotConstructible>(10)));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::unordered_set<NotConstructible,
- test_hash<NotConstructible>,
- test_equal_to<NotConstructible>,
- min_allocator<NotConstructible>
- > C;
- C c(7,
- test_hash<NotConstructible>(8),
- test_equal_to<NotConstructible>(9),
- min_allocator<NotConstructible>()
- );
- LIBCPP_ASSERT(c.bucket_count() == 7);
- assert(c.hash_function() == test_hash<NotConstructible>(8));
- assert(c.key_eq() == test_equal_to<NotConstructible>(9));
- assert(c.get_allocator() == (min_allocator<NotConstructible>()));
- assert(c.size() == 0);
- assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == 0);
- assert(c.load_factor() == 0);
- assert(c.max_load_factor() == 1);
- }
+ {
+ typedef std::unordered_set<NotConstructible,
+ test_hash<NotConstructible>,
+ test_equal_to<NotConstructible>,
+ min_allocator<NotConstructible> >
+ C;
+ C c(7, test_hash<NotConstructible>(8), test_equal_to<NotConstructible>(9), min_allocator<NotConstructible>());
+ LIBCPP_ASSERT(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<NotConstructible>(8));
+ assert(c.key_eq() == test_equal_to<NotConstructible>(9));
+ assert(c.get_allocator() == (min_allocator<NotConstructible>()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.set/unord.set.swap/swap_noexcept.pass.cpp b/libcxx/test/std/containers/unord/unord.set/unord.set.swap/swap_noexcept.pass.cpp
index e4d4861283f16f0..81219fe7d6dc57d 100644
--- a/libcxx/test/std/containers/unord/unord.set/unord.set.swap/swap_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/unord.set.swap/swap_noexcept.pass.cpp
@@ -33,23 +33,21 @@
#include "test_allocator.h"
template <class T>
-struct some_comp
-{
- typedef T value_type;
+struct some_comp {
+ typedef T value_type;
- some_comp() {}
- some_comp(const some_comp&) {}
- bool operator()(const T&, const T&) const { return false; }
+ some_comp() {}
+ some_comp(const some_comp&) {}
+ bool operator()(const T&, const T&) const { return false; }
};
template <class T>
-struct some_comp2
-{
- typedef T value_type;
+struct some_comp2 {
+ typedef T value_type;
- some_comp2() {}
- some_comp2(const some_comp2&) {}
- bool operator()(const T&, const T&) const { return false; }
+ some_comp2() {}
+ some_comp2(const some_comp2&) {}
+ bool operator()(const T&, const T&) const { return false; }
};
#if TEST_STD_VER >= 14
@@ -58,21 +56,19 @@ void swap(some_comp2<T>&, some_comp2<T>&) noexcept {}
#endif
template <class T>
-struct some_hash
-{
- typedef T value_type;
- some_hash() {}
- some_hash(const some_hash&);
- std::size_t operator()(const T&) const { return 0; }
+struct some_hash {
+ typedef T value_type;
+ some_hash() {}
+ some_hash(const some_hash&);
+ std::size_t operator()(const T&) const { return 0; }
};
template <class T>
-struct some_hash2
-{
- typedef T value_type;
- some_hash2() {}
- some_hash2(const some_hash2&);
- std::size_t operator()(const T&) const { return 0; }
+struct some_hash2 {
+ typedef T value_type;
+ some_hash2() {}
+ some_hash2(const some_hash2&);
+ std::size_t operator()(const T&) const { return 0; }
};
#if TEST_STD_VER >= 14
@@ -81,110 +77,103 @@ void swap(some_hash2<T>&, some_hash2<T>&) noexcept {}
#endif
template <class T>
-struct some_alloc
-{
- typedef T value_type;
+struct some_alloc {
+ typedef T value_type;
- some_alloc() {}
- some_alloc(const some_alloc&);
- void deallocate(void*, unsigned) {}
+ some_alloc() {}
+ some_alloc(const some_alloc&);
+ void deallocate(void*, unsigned) {}
- typedef std::true_type propagate_on_container_swap;
+ typedef std::true_type propagate_on_container_swap;
};
template <class T>
-struct some_alloc2
-{
- typedef T value_type;
+struct some_alloc2 {
+ typedef T value_type;
- some_alloc2() {}
- some_alloc2(const some_alloc2&);
- void deallocate(void*, unsigned) {}
+ some_alloc2() {}
+ some_alloc2(const some_alloc2&);
+ void deallocate(void*, unsigned) {}
- typedef std::false_type propagate_on_container_swap;
- typedef std::true_type is_always_equal;
+ typedef std::false_type propagate_on_container_swap;
+ typedef std::true_type is_always_equal;
};
template <class T>
-struct some_alloc3
-{
- typedef T value_type;
+struct some_alloc3 {
+ typedef T value_type;
- some_alloc3() {}
- some_alloc3(const some_alloc3&);
- void deallocate(void*, unsigned) {}
+ some_alloc3() {}
+ some_alloc3(const some_alloc3&);
+ void deallocate(void*, unsigned) {}
- typedef std::false_type propagate_on_container_swap;
- typedef std::false_type is_always_equal;
+ typedef std::false_type propagate_on_container_swap;
+ typedef std::false_type is_always_equal;
};
-int main(int, char**)
-{
- {
- typedef std::unordered_set<MoveOnly> C;
- static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
+int main(int, char**) {
+ {
+ typedef std::unordered_set<MoveOnly> C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
#if defined(_LIBCPP_VERSION)
- {
- typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, test_allocator<MoveOnly>> C;
- static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- {
- typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, other_allocator<MoveOnly>> C;
- static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
+ {
+ typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>, std::equal_to<MoveOnly>, test_allocator<MoveOnly>> C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
+ {
+ typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>, std::equal_to<MoveOnly>, other_allocator<MoveOnly>> C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
#endif // _LIBCPP_VERSION
- {
- typedef std::unordered_set<MoveOnly, some_hash<MoveOnly>> C;
- static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- {
- typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>,
- some_comp<MoveOnly>> C;
- static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
+ {
+ typedef std::unordered_set<MoveOnly, some_hash<MoveOnly>> C;
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
+ {
+ typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>, some_comp<MoveOnly>> C;
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
#if TEST_STD_VER >= 14
- { // POCS allocator, throwable swap for hash, throwable swap for comp
- typedef std::unordered_set<MoveOnly, some_hash<MoveOnly>, some_comp <MoveOnly>, some_alloc <MoveOnly>> C;
+ { // POCS allocator, throwable swap for hash, throwable swap for comp
+ typedef std::unordered_set<MoveOnly, some_hash<MoveOnly>, some_comp<MoveOnly>, some_alloc<MoveOnly>> C;
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- { // always equal allocator, throwable swap for hash, throwable swap for comp
- typedef std::unordered_set<MoveOnly, some_hash<MoveOnly>, some_comp <MoveOnly>, some_alloc2<MoveOnly>> C;
+ }
+ { // always equal allocator, throwable swap for hash, throwable swap for comp
+ typedef std::unordered_set<MoveOnly, some_hash<MoveOnly>, some_comp<MoveOnly>, some_alloc2<MoveOnly>> C;
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- { // POCS allocator, throwable swap for hash, nothrow swap for comp
- typedef std::unordered_set<MoveOnly, some_hash<MoveOnly>, some_comp2<MoveOnly>, some_alloc <MoveOnly>> C;
+ }
+ { // POCS allocator, throwable swap for hash, nothrow swap for comp
+ typedef std::unordered_set<MoveOnly, some_hash<MoveOnly>, some_comp2<MoveOnly>, some_alloc<MoveOnly>> C;
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- { // always equal allocator, throwable swap for hash, nothrow swap for comp
+ }
+ { // always equal allocator, throwable swap for hash, nothrow swap for comp
typedef std::unordered_set<MoveOnly, some_hash<MoveOnly>, some_comp2<MoveOnly>, some_alloc2<MoveOnly>> C;
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- { // POCS allocator, nothrow swap for hash, throwable swap for comp
- typedef std::unordered_set<MoveOnly, some_hash2<MoveOnly>, some_comp <MoveOnly>, some_alloc <MoveOnly>> C;
+ }
+ { // POCS allocator, nothrow swap for hash, throwable swap for comp
+ typedef std::unordered_set<MoveOnly, some_hash2<MoveOnly>, some_comp<MoveOnly>, some_alloc<MoveOnly>> C;
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- { // always equal allocator, nothrow swap for hash, throwable swap for comp
- typedef std::unordered_set<MoveOnly, some_hash2<MoveOnly>, some_comp <MoveOnly>, some_alloc2<MoveOnly>> C;
+ }
+ { // always equal allocator, nothrow swap for hash, throwable swap for comp
+ typedef std::unordered_set<MoveOnly, some_hash2<MoveOnly>, some_comp<MoveOnly>, some_alloc2<MoveOnly>> C;
static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- { // POCS allocator, nothrow swap for hash, nothrow swap for comp
- typedef std::unordered_set<MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc <MoveOnly>> C;
- static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
- { // always equal allocator, nothrow swap for hash, nothrow swap for comp
+ }
+ { // POCS allocator, nothrow swap for hash, nothrow swap for comp
+ typedef std::unordered_set<MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc<MoveOnly>> C;
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
+ { // always equal allocator, nothrow swap for hash, nothrow swap for comp
typedef std::unordered_set<MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc2<MoveOnly>> C;
- static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
-#if defined(_LIBCPP_VERSION)
- { // NOT always equal allocator, nothrow swap for hash, nothrow swap for comp
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
+# if defined(_LIBCPP_VERSION)
+ { // NOT always equal allocator, nothrow swap for hash, nothrow swap for comp
typedef std::unordered_set<MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc3<MoveOnly>> C;
- static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
- }
-#endif // _LIBCPP_VERSION
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
+ }
+# endif // _LIBCPP_VERSION
#endif
return 0;
diff --git a/libcxx/test/std/containers/unord/unord.set/unord.set.swap/swap_non_member.pass.cpp b/libcxx/test/std/containers/unord/unord.set/unord.set.swap/swap_non_member.pass.cpp
index 49c45f2ecb25b53..22184df129c7709 100644
--- a/libcxx/test/std/containers/unord/unord.set/unord.set.swap/swap_non_member.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/unord.set.swap/swap_non_member.pass.cpp
@@ -24,555 +24,446 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**)
-{
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef test_allocator<int> Alloc;
- typedef std::unordered_set<int, Hash, Compare, Alloc> C;
- C c1(0, Hash(1), Compare(1), Alloc(1, 1));
- C c2(0, Hash(2), Compare(2), Alloc(1, 2));
- c2.max_load_factor(2);
- swap(c1, c2);
-
- LIBCPP_ASSERT(c1.bucket_count() == 0);
- assert(c1.size() == 0);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator().get_id() == 1);
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- LIBCPP_ASSERT(c2.bucket_count() == 0);
- assert(c2.size() == 0);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator().get_id() == 2);
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef test_allocator<int> Alloc;
- typedef std::unordered_set<int, Hash, Compare, Alloc> C;
- typedef int P;
- P a2[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- C c1(0, Hash(1), Compare(1), Alloc(1, 1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
- c2.max_load_factor(2);
- C::iterator it2 = c2.begin();
- swap(c1, c2);
-
- assert(c1.bucket_count() >= 8);
- assert(c1.size() == 8);
- assert(*c1.find(10) == 10);
- assert(*c1.find(20) == 20);
- assert(*c1.find(30) == 30);
- assert(*c1.find(40) == 40);
- assert(*c1.find(50) == 50);
- assert(*c1.find(60) == 60);
- assert(*c1.find(70) == 70);
- assert(*c1.find(80) == 80);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator().get_id() == 1);
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
- assert(it2 == c1.begin()); // Iterators are not invalidated
-
- LIBCPP_ASSERT(c2.bucket_count() == 0);
- assert(c2.size() == 0);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator().get_id() == 2);
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef test_allocator<int> Alloc;
- typedef std::unordered_set<int, Hash, Compare, Alloc> C;
- typedef int P;
- P a1[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
- C c2(0, Hash(2), Compare(2), Alloc(1, 2));
- c2.max_load_factor(2);
- C::iterator it1 = c1.begin();
- swap(c1, c2);
-
- LIBCPP_ASSERT(c1.bucket_count() == 0);
- assert(c1.size() == 0);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator().get_id() == 1);
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- assert(c2.bucket_count() >= 4);
- assert(c2.size() == 4);
- assert(c2.count(1) == 1);
- assert(c2.count(2) == 1);
- assert(c2.count(3) == 1);
- assert(c2.count(4) == 1);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator().get_id() == 2);
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- assert(it1 == c2.begin()); // Iterators are not invalidated
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef test_allocator<int> Alloc;
- typedef std::unordered_set<int, Hash, Compare, Alloc> C;
- typedef int P;
- P a1[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- P a2[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
- c2.max_load_factor(2);
- C::iterator it1 = c1.begin();
- C::iterator it2 = c2.begin();
- swap(c1, c2);
-
- assert(c1.bucket_count() >= 8);
- assert(c1.size() == 8);
- assert(*c1.find(10) == 10);
- assert(*c1.find(20) == 20);
- assert(*c1.find(30) == 30);
- assert(*c1.find(40) == 40);
- assert(*c1.find(50) == 50);
- assert(*c1.find(60) == 60);
- assert(*c1.find(70) == 70);
- assert(*c1.find(80) == 80);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator().get_id() == 1);
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
- assert(it2 == c1.begin()); // Iterators are not invalidated
-
- assert(c2.bucket_count() >= 4);
- assert(c2.size() == 4);
- assert(c2.count(1) == 1);
- assert(c2.count(2) == 1);
- assert(c2.count(3) == 1);
- assert(c2.count(4) == 1);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator().get_id() == 2);
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- assert(it1 == c2.begin()); // Iterators are not invalidated
- }
-
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef other_allocator<int> Alloc;
- typedef std::unordered_set<int, Hash, Compare, Alloc> C;
- C c1(0, Hash(1), Compare(1), Alloc(1));
- C c2(0, Hash(2), Compare(2), Alloc(2));
- c2.max_load_factor(2);
- swap(c1, c2);
-
- LIBCPP_ASSERT(c1.bucket_count() == 0);
- assert(c1.size() == 0);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(2));
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- LIBCPP_ASSERT(c2.bucket_count() == 0);
- assert(c2.size() == 0);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(1));
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef other_allocator<int> Alloc;
- typedef std::unordered_set<int, Hash, Compare, Alloc> C;
- typedef int P;
- P a2[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- C c1(0, Hash(1), Compare(1), Alloc(1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
- c2.max_load_factor(2);
- swap(c1, c2);
-
- assert(c1.bucket_count() >= 8);
- assert(c1.size() == 8);
- assert(*c1.find(10) == 10);
- assert(*c1.find(20) == 20);
- assert(*c1.find(30) == 30);
- assert(*c1.find(40) == 40);
- assert(*c1.find(50) == 50);
- assert(*c1.find(60) == 60);
- assert(*c1.find(70) == 70);
- assert(*c1.find(80) == 80);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(2));
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- LIBCPP_ASSERT(c2.bucket_count() == 0);
- assert(c2.size() == 0);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(1));
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef other_allocator<int> Alloc;
- typedef std::unordered_set<int, Hash, Compare, Alloc> C;
- typedef int P;
- P a1[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
- C c2(0, Hash(2), Compare(2), Alloc(2));
- c2.max_load_factor(2);
- swap(c1, c2);
-
- LIBCPP_ASSERT(c1.bucket_count() == 0);
- assert(c1.size() == 0);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(2));
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- assert(c2.bucket_count() >= 4);
- assert(c2.size() == 4);
- assert(c2.count(1) == 1);
- assert(c2.count(2) == 1);
- assert(c2.count(3) == 1);
- assert(c2.count(4) == 1);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(1));
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef other_allocator<int> Alloc;
- typedef std::unordered_set<int, Hash, Compare, Alloc> C;
- typedef int P;
- P a1[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- P a2[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
- c2.max_load_factor(2);
- swap(c1, c2);
-
- assert(c1.bucket_count() >= 8);
- assert(c1.size() == 8);
- assert(*c1.find(10) == 10);
- assert(*c1.find(20) == 20);
- assert(*c1.find(30) == 30);
- assert(*c1.find(40) == 40);
- assert(*c1.find(50) == 50);
- assert(*c1.find(60) == 60);
- assert(*c1.find(70) == 70);
- assert(*c1.find(80) == 80);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(2));
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- assert(c2.bucket_count() >= 4);
- assert(c2.size() == 4);
- assert(c2.count(1) == 1);
- assert(c2.count(2) == 1);
- assert(c2.count(3) == 1);
- assert(c2.count(4) == 1);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(1));
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
+int main(int, char**) {
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef test_allocator<int> Alloc;
+ typedef std::unordered_set<int, Hash, Compare, Alloc> C;
+ C c1(0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(0, Hash(2), Compare(2), Alloc(1, 2));
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ LIBCPP_ASSERT(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ LIBCPP_ASSERT(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef test_allocator<int> Alloc;
+ typedef std::unordered_set<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ P a2[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)};
+ C c1(0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
+ c2.max_load_factor(2);
+ C::iterator it2 = c2.begin();
+ swap(c1, c2);
+
+ assert(c1.bucket_count() >= 8);
+ assert(c1.size() == 8);
+ assert(*c1.find(10) == 10);
+ assert(*c1.find(20) == 20);
+ assert(*c1.find(30) == 30);
+ assert(*c1.find(40) == 40);
+ assert(*c1.find(50) == 50);
+ assert(*c1.find(60) == 60);
+ assert(*c1.find(70) == 70);
+ assert(*c1.find(80) == 80);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+ assert(it2 == c1.begin()); // Iterators are not invalidated
+
+ LIBCPP_ASSERT(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef test_allocator<int> Alloc;
+ typedef std::unordered_set<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ P a1[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(0, Hash(2), Compare(2), Alloc(1, 2));
+ c2.max_load_factor(2);
+ C::iterator it1 = c1.begin();
+ swap(c1, c2);
+
+ LIBCPP_ASSERT(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 4);
+ assert(c2.size() == 4);
+ assert(c2.count(1) == 1);
+ assert(c2.count(2) == 1);
+ assert(c2.count(3) == 1);
+ assert(c2.count(4) == 1);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ assert(it1 == c2.begin()); // Iterators are not invalidated
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef test_allocator<int> Alloc;
+ typedef std::unordered_set<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ P a1[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ P a2[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)};
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
+ c2.max_load_factor(2);
+ C::iterator it1 = c1.begin();
+ C::iterator it2 = c2.begin();
+ swap(c1, c2);
+
+ assert(c1.bucket_count() >= 8);
+ assert(c1.size() == 8);
+ assert(*c1.find(10) == 10);
+ assert(*c1.find(20) == 20);
+ assert(*c1.find(30) == 30);
+ assert(*c1.find(40) == 40);
+ assert(*c1.find(50) == 50);
+ assert(*c1.find(60) == 60);
+ assert(*c1.find(70) == 70);
+ assert(*c1.find(80) == 80);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+ assert(it2 == c1.begin()); // Iterators are not invalidated
+
+ assert(c2.bucket_count() >= 4);
+ assert(c2.size() == 4);
+ assert(c2.count(1) == 1);
+ assert(c2.count(2) == 1);
+ assert(c2.count(3) == 1);
+ assert(c2.count(4) == 1);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ assert(it1 == c2.begin()); // Iterators are not invalidated
+ }
+
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef other_allocator<int> Alloc;
+ typedef std::unordered_set<int, Hash, Compare, Alloc> C;
+ C c1(0, Hash(1), Compare(1), Alloc(1));
+ C c2(0, Hash(2), Compare(2), Alloc(2));
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ LIBCPP_ASSERT(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc(2));
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ LIBCPP_ASSERT(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc(1));
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef other_allocator<int> Alloc;
+ typedef std::unordered_set<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ P a2[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)};
+ C c1(0, Hash(1), Compare(1), Alloc(1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ assert(c1.bucket_count() >= 8);
+ assert(c1.size() == 8);
+ assert(*c1.find(10) == 10);
+ assert(*c1.find(20) == 20);
+ assert(*c1.find(30) == 30);
+ assert(*c1.find(40) == 40);
+ assert(*c1.find(50) == 50);
+ assert(*c1.find(60) == 60);
+ assert(*c1.find(70) == 70);
+ assert(*c1.find(80) == 80);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc(2));
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ LIBCPP_ASSERT(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc(1));
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef other_allocator<int> Alloc;
+ typedef std::unordered_set<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ P a1[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
+ C c2(0, Hash(2), Compare(2), Alloc(2));
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ LIBCPP_ASSERT(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc(2));
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 4);
+ assert(c2.size() == 4);
+ assert(c2.count(1) == 1);
+ assert(c2.count(2) == 1);
+ assert(c2.count(3) == 1);
+ assert(c2.count(4) == 1);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc(1));
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef other_allocator<int> Alloc;
+ typedef std::unordered_set<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ P a1[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ P a2[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)};
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ assert(c1.bucket_count() >= 8);
+ assert(c1.size() == 8);
+ assert(*c1.find(10) == 10);
+ assert(*c1.find(20) == 20);
+ assert(*c1.find(30) == 30);
+ assert(*c1.find(40) == 40);
+ assert(*c1.find(50) == 50);
+ assert(*c1.find(60) == 60);
+ assert(*c1.find(70) == 70);
+ assert(*c1.find(80) == 80);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc(2));
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 4);
+ assert(c2.size() == 4);
+ assert(c2.count(1) == 1);
+ assert(c2.count(2) == 1);
+ assert(c2.count(3) == 1);
+ assert(c2.count(4) == 1);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc(1));
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
#if TEST_STD_VER >= 11
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef min_allocator<int> Alloc;
- typedef std::unordered_set<int, Hash, Compare, Alloc> C;
- C c1(0, Hash(1), Compare(1), Alloc());
- C c2(0, Hash(2), Compare(2), Alloc());
- c2.max_load_factor(2);
- swap(c1, c2);
-
- LIBCPP_ASSERT(c1.bucket_count() == 0);
- assert(c1.size() == 0);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- LIBCPP_ASSERT(c2.bucket_count() == 0);
- assert(c2.size() == 0);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef min_allocator<int> Alloc;
- typedef std::unordered_set<int, Hash, Compare, Alloc> C;
- typedef int P;
- P a2[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- C c1(0, Hash(1), Compare(1), Alloc());
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
- c2.max_load_factor(2);
- swap(c1, c2);
-
- assert(c1.bucket_count() >= 8);
- assert(c1.size() == 8);
- assert(*c1.find(10) == 10);
- assert(*c1.find(20) == 20);
- assert(*c1.find(30) == 30);
- assert(*c1.find(40) == 40);
- assert(*c1.find(50) == 50);
- assert(*c1.find(60) == 60);
- assert(*c1.find(70) == 70);
- assert(*c1.find(80) == 80);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- LIBCPP_ASSERT(c2.bucket_count() == 0);
- assert(c2.size() == 0);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef min_allocator<int> Alloc;
- typedef std::unordered_set<int, Hash, Compare, Alloc> C;
- typedef int P;
- P a1[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
- C c2(0, Hash(2), Compare(2), Alloc());
- c2.max_load_factor(2);
- swap(c1, c2);
-
- LIBCPP_ASSERT(c1.bucket_count() == 0);
- assert(c1.size() == 0);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- assert(c2.bucket_count() >= 4);
- assert(c2.size() == 4);
- assert(c2.count(1) == 1);
- assert(c2.count(2) == 1);
- assert(c2.count(3) == 1);
- assert(c2.count(4) == 1);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
- {
- typedef test_hash<int> Hash;
- typedef test_equal_to<int> Compare;
- typedef min_allocator<int> Alloc;
- typedef std::unordered_set<int, Hash, Compare, Alloc> C;
- typedef int P;
- P a1[] =
- {
- P(1),
- P(2),
- P(3),
- P(4),
- P(1),
- P(2)
- };
- P a2[] =
- {
- P(10),
- P(20),
- P(30),
- P(40),
- P(50),
- P(60),
- P(70),
- P(80)
- };
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
- c2.max_load_factor(2);
- swap(c1, c2);
-
- assert(c1.bucket_count() >= 8);
- assert(c1.size() == 8);
- assert(*c1.find(10) == 10);
- assert(*c1.find(20) == 20);
- assert(*c1.find(30) == 30);
- assert(*c1.find(40) == 40);
- assert(*c1.find(50) == 50);
- assert(*c1.find(60) == 60);
- assert(*c1.find(70) == 70);
- assert(*c1.find(80) == 80);
- assert(c1.hash_function() == Hash(2));
- assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
- assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
- assert(c1.max_load_factor() == 2);
-
- assert(c2.bucket_count() >= 4);
- assert(c2.size() == 4);
- assert(c2.count(1) == 1);
- assert(c2.count(2) == 1);
- assert(c2.count(3) == 1);
- assert(c2.count(4) == 1);
- assert(c2.hash_function() == Hash(1));
- assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc());
- assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
- assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
- assert(c2.max_load_factor() == 1);
- }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef min_allocator<int> Alloc;
+ typedef std::unordered_set<int, Hash, Compare, Alloc> C;
+ C c1(0, Hash(1), Compare(1), Alloc());
+ C c2(0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ LIBCPP_ASSERT(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ LIBCPP_ASSERT(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef min_allocator<int> Alloc;
+ typedef std::unordered_set<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ P a2[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)};
+ C c1(0, Hash(1), Compare(1), Alloc());
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ assert(c1.bucket_count() >= 8);
+ assert(c1.size() == 8);
+ assert(*c1.find(10) == 10);
+ assert(*c1.find(20) == 20);
+ assert(*c1.find(30) == 30);
+ assert(*c1.find(40) == 40);
+ assert(*c1.find(50) == 50);
+ assert(*c1.find(60) == 60);
+ assert(*c1.find(70) == 70);
+ assert(*c1.find(80) == 80);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ LIBCPP_ASSERT(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef min_allocator<int> Alloc;
+ typedef std::unordered_set<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ P a1[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
+ C c2(0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ LIBCPP_ASSERT(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 4);
+ assert(c2.size() == 4);
+ assert(c2.count(1) == 1);
+ assert(c2.count(2) == 1);
+ assert(c2.count(3) == 1);
+ assert(c2.count(4) == 1);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<int> Hash;
+ typedef test_equal_to<int> Compare;
+ typedef min_allocator<int> Alloc;
+ typedef std::unordered_set<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ P a1[] = {P(1), P(2), P(3), P(4), P(1), P(2)};
+ P a2[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)};
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ assert(c1.bucket_count() >= 8);
+ assert(c1.size() == 8);
+ assert(*c1.find(10) == 10);
+ assert(*c1.find(20) == 20);
+ assert(*c1.find(30) == 30);
+ assert(*c1.find(40) == 40);
+ assert(*c1.find(50) == 50);
+ assert(*c1.find(60) == 60);
+ assert(*c1.find(70) == 70);
+ assert(*c1.find(80) == 80);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 4);
+ assert(c2.size() == 4);
+ assert(c2.count(1) == 1);
+ assert(c2.count(2) == 1);
+ assert(c2.count(3) == 1);
+ assert(c2.count(4) == 1);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
#endif
return 0;
diff --git a/libcxx/test/std/containers/views/mdspan/ConvertibleToIntegral.h b/libcxx/test/std/containers/views/mdspan/ConvertibleToIntegral.h
index 0ca5c330a390e4b..7768f3c5000e351 100644
--- a/libcxx/test/std/containers/views/mdspan/ConvertibleToIntegral.h
+++ b/libcxx/test/std/containers/views/mdspan/ConvertibleToIntegral.h
@@ -33,12 +33,20 @@ struct IntTypeNC {
};
// weird configurability of convertibility to int
-template<bool conv_c, bool conv_nc, bool ctor_nt_c, bool ctor_nt_nc>
+template <bool conv_c, bool conv_nc, bool ctor_nt_c, bool ctor_nt_nc>
struct IntConfig {
int val;
- constexpr explicit IntConfig(int val_):val(val_){}
- constexpr operator int() noexcept(ctor_nt_nc) requires(conv_nc) { return val; }
- constexpr operator int() const noexcept(ctor_nt_c) requires(conv_c) { return val; }
+ constexpr explicit IntConfig(int val_) : val(val_) {}
+ constexpr operator int() noexcept(ctor_nt_nc)
+ requires(conv_nc)
+ {
+ return val;
+ }
+ constexpr operator int() const noexcept(ctor_nt_c)
+ requires(conv_c)
+ {
+ return val;
+ }
};
#endif // TEST_STD_CONTAINERS_VIEWS_MDSPAN_CONVERTIBLE_TO_INTEGRAL_H
diff --git a/libcxx/test/std/containers/views/mdspan/MinimalElementType.h b/libcxx/test/std/containers/views/mdspan/MinimalElementType.h
index 1d1a2c3752102dd..c39e502deda671b 100644
--- a/libcxx/test/std/containers/views/mdspan/MinimalElementType.h
+++ b/libcxx/test/std/containers/views/mdspan/MinimalElementType.h
@@ -17,14 +17,14 @@
// Make sure we don't assume copyable, default constructible, movable etc.
struct MinimalElementType {
int val;
- constexpr MinimalElementType() = delete;
+ constexpr MinimalElementType() = delete;
constexpr MinimalElementType(const MinimalElementType&) = delete;
- constexpr explicit MinimalElementType(int v) noexcept : val(v){}
+ constexpr explicit MinimalElementType(int v) noexcept : val(v) {}
constexpr MinimalElementType& operator=(const MinimalElementType&) = delete;
};
// Helper class to create pointer to MinimalElementType
-template<class T, size_t N>
+template <class T, size_t N>
struct ElementPool {
constexpr ElementPool() {
ptr_ = std::allocator<std::remove_const_t<T>>().allocate(N);
diff --git a/libcxx/test/std/containers/views/mdspan/default_accessor/access.pass.cpp b/libcxx/test/std/containers/views/mdspan/default_accessor/access.pass.cpp
index a15ad6895254e66..869c3b4c25361b5 100644
--- a/libcxx/test/std/containers/views/mdspan/default_accessor/access.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/default_accessor/access.pass.cpp
@@ -27,7 +27,7 @@ constexpr void test_access() {
ElementPool<std::remove_const_t<T>, 10> data;
T* ptr = data.get_ptr();
std::default_accessor<T> acc;
- for(int i = 0; i < 10; i++) {
+ for (int i = 0; i < 10; i++) {
static_assert(std::is_same_v<decltype(acc.access(ptr, i)), typename std::default_accessor<T>::reference>);
ASSERT_NOEXCEPT(acc.access(ptr, i));
assert(&acc.access(ptr, i) == ptr + i);
diff --git a/libcxx/test/std/containers/views/mdspan/default_accessor/ctor.conversion.pass.cpp b/libcxx/test/std/containers/views/mdspan/default_accessor/ctor.conversion.pass.cpp
index 299d98f0b2d01d9..b1b5806446c00b9 100644
--- a/libcxx/test/std/containers/views/mdspan/default_accessor/ctor.conversion.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/default_accessor/ctor.conversion.pass.cpp
@@ -27,7 +27,7 @@
#include "../MinimalElementType.h"
struct Base {};
-struct Derived: public Base {};
+struct Derived : public Base {};
template <class FromT, class ToT>
constexpr void test_conversion() {
@@ -52,7 +52,8 @@ constexpr bool test() {
// MinimalElementType is constructible from int, but accessors should not be convertible
static_assert(!std::is_constructible_v<std::default_accessor<MinimalElementType>, std::default_accessor<int>>);
// don't allow conversion from const elements to non-const
- static_assert(!std::is_constructible_v<std::default_accessor<MinimalElementType>, std::default_accessor<const MinimalElementType>>);
+ static_assert(!std::is_constructible_v<std::default_accessor<MinimalElementType>,
+ std::default_accessor<const MinimalElementType>>);
// don't allow conversion from Base to Derived
static_assert(!std::is_constructible_v<std::default_accessor<Derived>, std::default_accessor<Base>>);
// don't allow conversion from Derived to Base
diff --git a/libcxx/test/std/containers/views/mdspan/default_accessor/element_type.verify.cpp b/libcxx/test/std/containers/views/mdspan/default_accessor/element_type.verify.cpp
index 0ed870d9f541b54..4c0dffe84ed2478 100644
--- a/libcxx/test/std/containers/views/mdspan/default_accessor/element_type.verify.cpp
+++ b/libcxx/test/std/containers/views/mdspan/default_accessor/element_type.verify.cpp
@@ -30,4 +30,3 @@ void not_array_type() {
// expected-error-re@*:* {{static assertion failed {{.*}}default_accessor: template argument may not be an array type}}
[[maybe_unused]] std::default_accessor<int[5]> acc;
}
-
diff --git a/libcxx/test/std/containers/views/mdspan/default_accessor/offset.pass.cpp b/libcxx/test/std/containers/views/mdspan/default_accessor/offset.pass.cpp
index 5842ff917963475..b342d1a70c62a37 100644
--- a/libcxx/test/std/containers/views/mdspan/default_accessor/offset.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/default_accessor/offset.pass.cpp
@@ -27,7 +27,7 @@ constexpr void test_offset() {
ElementPool<std::remove_const_t<T>, 10> data;
T* ptr = data.get_ptr();
std::default_accessor<T> acc;
- for(int i = 0; i < 10; i++) {
+ for (int i = 0; i < 10; i++) {
static_assert(std::is_same_v<decltype(acc.offset(ptr, i)), typename std::default_accessor<T>::data_handle_type>);
ASSERT_NOEXCEPT(acc.offset(ptr, i));
assert(acc.offset(ptr, i) == ptr + i);
diff --git a/libcxx/test/std/containers/views/mdspan/default_accessor/types.pass.cpp b/libcxx/test/std/containers/views/mdspan/default_accessor/types.pass.cpp
index 025b992f97aeff6..ca65eecee8c5bbd 100644
--- a/libcxx/test/std/containers/views/mdspan/default_accessor/types.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/default_accessor/types.pass.cpp
@@ -21,7 +21,6 @@
//
// Each specialization of default_accessor is a trivially copyable type that models semiregular.
-
#include <mdspan>
#include <type_traits>
#include <concepts>
diff --git a/libcxx/test/std/containers/views/mdspan/layout_left/index_operator.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_left/index_operator.pass.cpp
index 84c3ef45c69b6ba..75fd37055ad6025 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_left/index_operator.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_left/index_operator.pass.cpp
@@ -34,22 +34,20 @@
#include "../ConvertibleToIntegral.h"
-template<class Mapping, class ... Indices>
-concept operator_constraints = requires(Mapping m, Indices ... idxs) {
- {std::is_same_v<decltype(m(idxs...)), typename Mapping::index_type>};
+template <class Mapping, class... Indices>
+concept operator_constraints = requires(Mapping m, Indices... idxs) {
+ { std::is_same_v<decltype(m(idxs...)), typename Mapping::index_type> };
};
-template<class Mapping, class ... Indices>
- requires(
- operator_constraints<Mapping, Indices...>
- )
-constexpr bool check_operator_constraints(Mapping m, Indices ... idxs) {
- (void) m(idxs...);
+template <class Mapping, class... Indices>
+ requires(operator_constraints<Mapping, Indices...>)
+constexpr bool check_operator_constraints(Mapping m, Indices... idxs) {
+ (void)m(idxs...);
return true;
}
-template<class Mapping, class ... Indices>
-constexpr bool check_operator_constraints(Mapping, Indices ...) {
+template <class Mapping, class... Indices>
+constexpr bool check_operator_constraints(Mapping, Indices...) {
return false;
}
@@ -86,15 +84,20 @@ constexpr bool test() {
test_iteration<std::extents<signed char, D, D, D, D>>(1, 1, 1, 1);
// Check operator constraint for number of arguments
- static_assert(check_operator_constraints(std::layout_left::mapping<std::extents<int, D>>(std::extents<int, D>(1)), 0));
- static_assert(!check_operator_constraints(std::layout_left::mapping<std::extents<int, D>>(std::extents<int, D>(1)), 0, 0));
+ static_assert(
+ check_operator_constraints(std::layout_left::mapping<std::extents<int, D>>(std::extents<int, D>(1)), 0));
+ static_assert(
+ !check_operator_constraints(std::layout_left::mapping<std::extents<int, D>>(std::extents<int, D>(1)), 0, 0));
// Check operator constraint for convertibility of arguments to index_type
- static_assert(check_operator_constraints(std::layout_left::mapping<std::extents<int, D>>(std::extents<int, D>(1)), IntType(0)));
- static_assert(!check_operator_constraints(std::layout_left::mapping<std::extents<unsigned, D>>(std::extents<unsigned, D>(1)), IntType(0)));
+ static_assert(
+ check_operator_constraints(std::layout_left::mapping<std::extents<int, D>>(std::extents<int, D>(1)), IntType(0)));
+ static_assert(!check_operator_constraints(
+ std::layout_left::mapping<std::extents<unsigned, D>>(std::extents<unsigned, D>(1)), IntType(0)));
// Check operator constraint for no-throw-constructibility of index_type from arguments
- static_assert(!check_operator_constraints(std::layout_left::mapping<std::extents<unsigned char, D>>(std::extents<unsigned char, D>(1)), IntType(0)));
+ static_assert(!check_operator_constraints(
+ std::layout_left::mapping<std::extents<unsigned char, D>>(std::extents<unsigned char, D>(1)), IntType(0)));
return true;
}
diff --git a/libcxx/test/std/containers/views/mdspan/layout_right/index_operator.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_right/index_operator.pass.cpp
index 42d4e9a2d24b6f0..e9362ed50df2429 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_right/index_operator.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_right/index_operator.pass.cpp
@@ -34,22 +34,20 @@
#include "../ConvertibleToIntegral.h"
-template<class Mapping, class ... Indices>
-concept operator_constraints = requires(Mapping m, Indices ... idxs) {
- {std::is_same_v<decltype(m(idxs...)), typename Mapping::index_type>};
+template <class Mapping, class... Indices>
+concept operator_constraints = requires(Mapping m, Indices... idxs) {
+ { std::is_same_v<decltype(m(idxs...)), typename Mapping::index_type> };
};
-template<class Mapping, class ... Indices>
- requires(
- operator_constraints<Mapping, Indices...>
- )
-constexpr bool check_operator_constraints(Mapping m, Indices ... idxs) {
- (void) m(idxs...);
+template <class Mapping, class... Indices>
+ requires(operator_constraints<Mapping, Indices...>)
+constexpr bool check_operator_constraints(Mapping m, Indices... idxs) {
+ (void)m(idxs...);
return true;
}
-template<class Mapping, class ... Indices>
-constexpr bool check_operator_constraints(Mapping, Indices ...) {
+template <class Mapping, class... Indices>
+constexpr bool check_operator_constraints(Mapping, Indices...) {
return false;
}
@@ -86,15 +84,20 @@ constexpr bool test() {
test_iteration<std::extents<signed char, D, D, D, D>>(1, 1, 1, 1);
// Check operator constraint for number of arguments
- static_assert(check_operator_constraints(std::layout_right::mapping<std::extents<int, D>>(std::extents<int, D>(1)), 0));
- static_assert(!check_operator_constraints(std::layout_right::mapping<std::extents<int, D>>(std::extents<int, D>(1)), 0, 0));
+ static_assert(
+ check_operator_constraints(std::layout_right::mapping<std::extents<int, D>>(std::extents<int, D>(1)), 0));
+ static_assert(
+ !check_operator_constraints(std::layout_right::mapping<std::extents<int, D>>(std::extents<int, D>(1)), 0, 0));
// Check operator constraint for convertibility of arguments to index_type
- static_assert(check_operator_constraints(std::layout_right::mapping<std::extents<int, D>>(std::extents<int, D>(1)), IntType(0)));
- static_assert(!check_operator_constraints(std::layout_right::mapping<std::extents<unsigned, D>>(std::extents<unsigned, D>(1)), IntType(0)));
+ static_assert(check_operator_constraints(
+ std::layout_right::mapping<std::extents<int, D>>(std::extents<int, D>(1)), IntType(0)));
+ static_assert(!check_operator_constraints(
+ std::layout_right::mapping<std::extents<unsigned, D>>(std::extents<unsigned, D>(1)), IntType(0)));
// Check operator constraint for no-throw-constructibility of index_type from arguments
- static_assert(!check_operator_constraints(std::layout_right::mapping<std::extents<unsigned char, D>>(std::extents<unsigned char, D>(1)), IntType(0)));
+ static_assert(!check_operator_constraints(
+ std::layout_right::mapping<std::extents<unsigned char, D>>(std::extents<unsigned char, D>(1)), IntType(0)));
return true;
}
diff --git a/libcxx/test/std/containers/views/mdspan/mdspan/assign.pass.cpp b/libcxx/test/std/containers/views/mdspan/mdspan/assign.pass.cpp
index 4c59b5b61a5a40d..e0577aeb2826d0b 100644
--- a/libcxx/test/std/containers/views/mdspan/mdspan/assign.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/mdspan/assign.pass.cpp
@@ -49,9 +49,8 @@ constexpr void test_mdspan_types(const H& handle, const M& map, const A& acc) {
assert(m.accessor() == acc);
static_assert(std::is_trivially_assignable_v<MDS, const MDS&> ==
- ((!std::is_class_v<H> ||
- std::is_trivially_assignable_v<H, const H&>)&&std::is_trivially_assignable_v<M, const M&> &&
- std::is_trivially_assignable_v<A, const A&>));
+ ((!std::is_class_v<H> || std::is_trivially_assignable_v<H, const H&>) &&
+ std::is_trivially_assignable_v<M, const M&> && std::is_trivially_assignable_v<A, const A&>));
}
template <class H, class L, class A>
diff --git a/libcxx/test/std/containers/views/mdspan/mdspan/conversion.pass.cpp b/libcxx/test/std/containers/views/mdspan/mdspan/conversion.pass.cpp
index 5fe14c1562f4d7f..1adab199b0ca695 100644
--- a/libcxx/test/std/containers/views/mdspan/mdspan/conversion.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/mdspan/conversion.pass.cpp
@@ -231,13 +231,13 @@ int main(int, char**) {
test<t, o, t, o, t, t, t, t, checked_accessor<const MinimalElementType>>(checked_accessor<MinimalElementType>(1024));
test<t, o, t, o, t, t, t, t, conv_test_accessor_c<int, t, t, t, t>>(conv_test_accessor_nc<int, t, t>());
test<t, o, t, t, t, t, t, t, conv_test_accessor_c<int, t, t, o, o>>(conv_test_accessor_nc<int, t, o>());
- // FIXME: these tests trigger what appears to be a compiler bug on MINGW32 with --target=x86_64-w64-windows-gnu
- // https://godbolt.org/z/KK8aj5bs7
- // Bug report: https://github.com/llvm/llvm-project/issues/64077
- #ifndef __MINGW32__
+// FIXME: these tests trigger what appears to be a compiler bug on MINGW32 with --target=x86_64-w64-windows-gnu
+// https://godbolt.org/z/KK8aj5bs7
+// Bug report: https://github.com/llvm/llvm-project/issues/64077
+#ifndef __MINGW32__
test<t, t, t, o, t, t, t, t, conv_test_accessor_c<int, o, t, t, t>>(conv_test_accessor_nc<int, t, t>());
test<t, t, t, t, t, t, t, t, conv_test_accessor_c<int, o, o, o, o>>(conv_test_accessor_nc<int, t, o>());
- #endif
+#endif
// ElementType convertible, but accessor not constructible
test<o, o, o, o, o, o, o, o, std::default_accessor<float>>(std::default_accessor<int>());
diff --git a/libcxx/test/std/containers/views/mdspan/mdspan/conversion.verify.cpp b/libcxx/test/std/containers/views/mdspan/mdspan/conversion.verify.cpp
index e3f03ebd07e5fa0..d46ba6ffbe5ec4f 100644
--- a/libcxx/test/std/containers/views/mdspan/mdspan/conversion.verify.cpp
+++ b/libcxx/test/std/containers/views/mdspan/mdspan/conversion.verify.cpp
@@ -45,8 +45,7 @@ void cant_construct_data_handle_type() {
// expected-error-re@*:* {{{{.*}}no matching constructor for initialization of {{.*}} (aka 'not_const_convertible_handle<const int>')}}
// expected-error-re@*:* {{static assertion failed {{.*}}mdspan: incompatible data_handle_type for mdspan construction}}
[[maybe_unused]] std::
- mdspan<const int, std::extents<int>, std::layout_right, convertible_accessor_but_not_handle<const int>>
- m_c(m_nc);
+ mdspan<const int, std::extents<int>, std::layout_right, convertible_accessor_but_not_handle<const int>> m_c(m_nc);
}
void mapping_constructible_despite_extents_compatibility() {
diff --git a/libcxx/test/std/containers/views/mdspan/mdspan/ctor.copy.pass.cpp b/libcxx/test/std/containers/views/mdspan/mdspan/ctor.copy.pass.cpp
index 9540c37cfc4b944..b35a4fb832a1a82 100644
--- a/libcxx/test/std/containers/views/mdspan/mdspan/ctor.copy.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/mdspan/ctor.copy.pass.cpp
@@ -31,7 +31,7 @@ constexpr void test_mdspan_types(const H& handle, const M& map, const A& acc) {
MDS m_org(handle, map, acc);
MDS m(m_org);
- static_assert(noexcept(MDS(m_org)) == (noexcept(H(handle))&& noexcept(M(map))&& noexcept(A(acc))));
+ static_assert(noexcept(MDS(m_org)) == (noexcept(H(handle)) && noexcept(M(map)) && noexcept(A(acc))));
static_assert(
std::is_trivially_copyable_v<MDS> ==
(std::is_trivially_copyable_v<H> && std::is_trivially_copyable_v<M> && std::is_trivially_copyable_v<A>));
diff --git a/libcxx/test/std/containers/views/mdspan/mdspan/ctor.default.pass.cpp b/libcxx/test/std/containers/views/mdspan/mdspan/ctor.default.pass.cpp
index 5b84973bc43ef57..f77dbc46285a70e 100644
--- a/libcxx/test/std/containers/views/mdspan/mdspan/ctor.default.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/mdspan/ctor.default.pass.cpp
@@ -43,7 +43,7 @@ constexpr void test_mdspan_types(const H&, const M&, const A&) {
if constexpr (MDS::rank_dynamic() > 0 && hc && mc && ac) {
MDS m;
- static_assert(noexcept(MDS()) == (noexcept(H())&& noexcept(M())&& noexcept(A())));
+ static_assert(noexcept(MDS()) == (noexcept(H()) && noexcept(M()) && noexcept(A())));
assert(m.extents() == typename MDS::extents_type());
if constexpr (std::equality_comparable<H>)
assert(m.data_handle() == H());
diff --git a/libcxx/test/std/containers/views/mdspan/mdspan/ctor.dh_array.pass.cpp b/libcxx/test/std/containers/views/mdspan/mdspan/ctor.dh_array.pass.cpp
index 9ca4fe240495c32..f9540fd99c99118 100644
--- a/libcxx/test/std/containers/views/mdspan/mdspan/ctor.dh_array.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/mdspan/ctor.dh_array.pass.cpp
@@ -48,9 +48,8 @@ constexpr auto array_from_extents(const Extents& exts, std::index_sequence<Idxs.
}
template <class MDS, class Exts>
-concept check_mdspan_ctor_implicit = requires(MDS m, typename MDS::data_handle_type h, const Exts& exts) {
- m = {h, exts};
-};
+concept check_mdspan_ctor_implicit =
+ requires(MDS m, typename MDS::data_handle_type h, const Exts& exts) { m = {h, exts}; };
template <class H, class M, class A, size_t N>
constexpr void
diff --git a/libcxx/test/std/containers/views/mdspan/mdspan/ctor.dh_span.pass.cpp b/libcxx/test/std/containers/views/mdspan/mdspan/ctor.dh_span.pass.cpp
index 2240dbe0801bebf..383a490082d7315 100644
--- a/libcxx/test/std/containers/views/mdspan/mdspan/ctor.dh_span.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/mdspan/ctor.dh_span.pass.cpp
@@ -48,9 +48,8 @@ constexpr auto array_from_extents(const Extents& exts, std::index_sequence<Idxs.
}
template <class MDS, class Exts>
-concept check_mdspan_ctor_implicit = requires(MDS m, typename MDS::data_handle_type h, const Exts& exts) {
- m = {h, exts};
-};
+concept check_mdspan_ctor_implicit =
+ requires(MDS m, typename MDS::data_handle_type h, const Exts& exts) { m = {h, exts}; };
template <class H, class M, class A, size_t N>
constexpr void
diff --git a/libcxx/test/std/containers/views/mdspan/mdspan/types.pass.cpp b/libcxx/test/std/containers/views/mdspan/mdspan/types.pass.cpp
index 934e861e78d78ef..69bce593bd36353 100644
--- a/libcxx/test/std/containers/views/mdspan/mdspan/types.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/mdspan/types.pass.cpp
@@ -41,29 +41,29 @@
// Calculated expected size of an mdspan
// Note this expects that only default_accessor is empty
-template<class MDS>
+template <class MDS>
constexpr size_t expected_size() {
size_t sizeof_dht = sizeof(typename MDS::data_handle_type);
- size_t result = sizeof_dht;
- if(MDS::rank_dynamic() > 0) {
+ size_t result = sizeof_dht;
+ if (MDS::rank_dynamic() > 0) {
size_t alignof_idx = alignof(typename MDS::index_type);
- size_t sizeof_idx = sizeof(typename MDS::index_type);
+ size_t sizeof_idx = sizeof(typename MDS::index_type);
// add alignment if necessary
- result += sizeof_dht%alignof_idx == 0?0:alignof_idx - (sizeof_dht%alignof_idx);
+ result += sizeof_dht % alignof_idx == 0 ? 0 : alignof_idx - (sizeof_dht % alignof_idx);
// add sizeof stored extents
result += MDS::rank_dynamic() * sizeof_idx;
}
using A = typename MDS::accessor_type;
- if(!std::is_same_v<A, std::default_accessor<typename MDS::element_type>>) {
+ if (!std::is_same_v<A, std::default_accessor<typename MDS::element_type>>) {
size_t alignof_acc = alignof(A);
- size_t sizeof_acc = sizeof(A);
+ size_t sizeof_acc = sizeof(A);
// add alignment if necessary
- result += result%alignof_acc == 0?0:alignof_acc - (result%alignof_acc);
+ result += result % alignof_acc == 0 ? 0 : alignof_acc - (result % alignof_acc);
// add sizeof stored accessor
result += sizeof_acc;
}
// add alignment of the mdspan itself
- result += result%alignof(MDS) == 0?0:alignof(MDS) - (result%alignof(MDS));
+ result += result % alignof(MDS) == 0 ? 0 : alignof(MDS) - (result % alignof(MDS));
return result;
}
diff --git a/libcxx/test/std/containers/views/views.span/range_concept_conformance.compile.pass.cpp b/libcxx/test/std/containers/views/views.span/range_concept_conformance.compile.pass.cpp
index fe28aeea3802b54..52f0a76dfd2cefe 100644
--- a/libcxx/test/std/containers/views/views.span/range_concept_conformance.compile.pass.cpp
+++ b/libcxx/test/std/containers/views/views.span/range_concept_conformance.compile.pass.cpp
@@ -17,7 +17,6 @@
using range = std::span<int>;
-
static_assert(std::same_as<std::ranges::iterator_t<range>, range::iterator>);
static_assert(std::ranges::common_range<range>);
static_assert(std::ranges::random_access_range<range>);
diff --git a/libcxx/test/std/containers/views/views.span/span.cons/array.pass.cpp b/libcxx/test/std/containers/views/views.span/span.cons/array.pass.cpp
index 988ecbc11af3638..ad9f44aa474c627 100644
--- a/libcxx/test/std/containers/views/views.span/span.cons/array.pass.cpp
+++ b/libcxx/test/std/containers/views/views.span/span.cons/array.pass.cpp
@@ -24,142 +24,136 @@
#include "test_macros.h"
-
-void checkCV()
-{
- int arr[] = {1,2,3};
- const int carr[] = {4,5,6};
- volatile int varr[] = {7,8,9};
- const volatile int cvarr[] = {1,3,5};
-
-// Types the same (dynamic sized)
- {
- std::span< int> s1{ arr}; // a span< int> pointing at int.
- std::span<const int> s2{ carr}; // a span<const int> pointing at const int.
- std::span< volatile int> s3{ varr}; // a span< volatile int> pointing at volatile int.
- std::span<const volatile int> s4{cvarr}; // a span<const volatile int> pointing at const volatile int.
+void checkCV() {
+ int arr[] = {1, 2, 3};
+ const int carr[] = {4, 5, 6};
+ volatile int varr[] = {7, 8, 9};
+ const volatile int cvarr[] = {1, 3, 5};
+
+ // Types the same (dynamic sized)
+ {
+ std::span< int> s1{arr}; // a span< int> pointing at int.
+ std::span<const int> s2{carr}; // a span<const int> pointing at const int.
+ std::span< volatile int> s3{varr}; // a span< volatile int> pointing at volatile int.
+ std::span<const volatile int> s4{cvarr}; // a span<const volatile int> pointing at const volatile int.
assert(s1.size() + s2.size() + s3.size() + s4.size() == 12);
- }
-
-// Types the same (static sized)
- {
- std::span< int,3> s1{ arr}; // a span< int> pointing at int.
- std::span<const int,3> s2{ carr}; // a span<const int> pointing at const int.
- std::span< volatile int,3> s3{ varr}; // a span< volatile int> pointing at volatile int.
- std::span<const volatile int,3> s4{cvarr}; // a span<const volatile int> pointing at const volatile int.
+ }
+
+ // Types the same (static sized)
+ {
+ std::span< int, 3> s1{arr}; // a span< int> pointing at int.
+ std::span<const int, 3> s2{carr}; // a span<const int> pointing at const int.
+ std::span< volatile int, 3> s3{varr}; // a span< volatile int> pointing at volatile int.
+ std::span<const volatile int, 3> s4{cvarr}; // a span<const volatile int> pointing at const volatile int.
assert(s1.size() + s2.size() + s3.size() + s4.size() == 12);
- }
-
-
-// types
diff erent (dynamic sized)
- {
- std::span<const int> s1{ arr}; // a span<const int> pointing at int.
- std::span< volatile int> s2{ arr}; // a span< volatile int> pointing at int.
- std::span< volatile int> s3{ arr}; // a span< volatile int> pointing at const int.
- std::span<const volatile int> s4{ arr}; // a span<const volatile int> pointing at int.
- std::span<const volatile int> s5{carr}; // a span<const volatile int> pointing at const int.
- std::span<const volatile int> s6{varr}; // a span<const volatile int> pointing at volatile int.
+ }
+
+ // types
diff erent (dynamic sized)
+ {
+ std::span<const int> s1{arr}; // a span<const int> pointing at int.
+ std::span< volatile int> s2{arr}; // a span< volatile int> pointing at int.
+ std::span< volatile int> s3{arr}; // a span< volatile int> pointing at const int.
+ std::span<const volatile int> s4{arr}; // a span<const volatile int> pointing at int.
+ std::span<const volatile int> s5{carr}; // a span<const volatile int> pointing at const int.
+ std::span<const volatile int> s6{varr}; // a span<const volatile int> pointing at volatile int.
assert(s1.size() + s2.size() + s3.size() + s4.size() + s5.size() + s6.size() == 18);
- }
-
-// types
diff erent (static sized)
- {
- std::span<const int,3> s1{ arr}; // a span<const int> pointing at int.
- std::span< volatile int,3> s2{ arr}; // a span< volatile int> pointing at int.
- std::span< volatile int,3> s3{ arr}; // a span< volatile int> pointing at const int.
- std::span<const volatile int,3> s4{ arr}; // a span<const volatile int> pointing at int.
- std::span<const volatile int,3> s5{carr}; // a span<const volatile int> pointing at const int.
- std::span<const volatile int,3> s6{varr}; // a span<const volatile int> pointing at volatile int.
+ }
+
+ // types
diff erent (static sized)
+ {
+ std::span<const int, 3> s1{arr}; // a span<const int> pointing at int.
+ std::span< volatile int, 3> s2{arr}; // a span< volatile int> pointing at int.
+ std::span< volatile int, 3> s3{arr}; // a span< volatile int> pointing at const int.
+ std::span<const volatile int, 3> s4{arr}; // a span<const volatile int> pointing at int.
+ std::span<const volatile int, 3> s5{carr}; // a span<const volatile int> pointing at const int.
+ std::span<const volatile int, 3> s6{varr}; // a span<const volatile int> pointing at volatile int.
assert(s1.size() + s2.size() + s3.size() + s4.size() + s5.size() + s6.size() == 18);
- }
+ }
}
-template<class T>
-constexpr bool testSpan()
-{
- T val[2] = {};
-
- ASSERT_NOEXCEPT(std::span<T>{val});
- ASSERT_NOEXCEPT(std::span<T, 2>{val});
- ASSERT_NOEXCEPT(std::span<const T>{val});
- ASSERT_NOEXCEPT(std::span<const T, 2>{val});
-
- std::span<T> s1 = val;
- std::span<T, 2> s2 = val;
- std::span<const T> s3 = val;
- std::span<const T, 2> s4 = val;
- assert(s1.data() == val && s1.size() == 2);
- assert(s2.data() == val && s2.size() == 2);
- assert(s3.data() == val && s3.size() == 2);
- assert(s4.data() == val && s4.size() == 2);
-
- TEST_DIAGNOSTIC_PUSH
- TEST_CLANG_DIAGNOSTIC_IGNORED("-Wdangling")
- std::span<const int> s5 = {{1, 2}};
+template <class T>
+constexpr bool testSpan() {
+ T val[2] = {};
+
+ ASSERT_NOEXCEPT(std::span<T>{val});
+ ASSERT_NOEXCEPT(std::span<T, 2>{val});
+ ASSERT_NOEXCEPT(std::span<const T>{val});
+ ASSERT_NOEXCEPT(std::span<const T, 2>{val});
+
+ std::span<T> s1 = val;
+ std::span<T, 2> s2 = val;
+ std::span<const T> s3 = val;
+ std::span<const T, 2> s4 = val;
+ assert(s1.data() == val && s1.size() == 2);
+ assert(s2.data() == val && s2.size() == 2);
+ assert(s3.data() == val && s3.size() == 2);
+ assert(s4.data() == val && s4.size() == 2);
+
+ TEST_DIAGNOSTIC_PUSH
+ TEST_CLANG_DIAGNOSTIC_IGNORED("-Wdangling")
+ std::span<const int> s5 = {{1, 2}};
#if TEST_STD_VER >= 26
- std::span<const int, 2> s6({1, 2});
+ std::span<const int, 2> s6({1, 2});
#else
- std::span<const int, 2> s6 = {{1,2}};
+ std::span<const int, 2> s6 = {{1, 2}};
#endif
- assert(s5.size() == 2); // and it dangles
- assert(s6.size() == 2); // and it dangles
- TEST_DIAGNOSTIC_POP
+ assert(s5.size() == 2); // and it dangles
+ assert(s6.size() == 2); // and it dangles
+ TEST_DIAGNOSTIC_POP
- return true;
+ return true;
}
-
struct A {};
-int main(int, char**)
-{
- testSpan<int>();
- testSpan<double>();
- testSpan<A>();
- testSpan<std::string>();
-
- static_assert(testSpan<int>());
- static_assert(testSpan<double>());
- static_assert(testSpan<A>());
-
- checkCV();
-
- // Size wrong
- {
- static_assert(!std::is_constructible<std::span<int, 2>, int (&)[3]>::value, "");
- }
-
- // Type wrong
- {
- static_assert(!std::is_constructible<std::span<float>, int (&)[3]>::value, "");
- static_assert(!std::is_constructible<std::span<float, 3>, int (&)[3]>::value, "");
- }
-
- // CV wrong (dynamically sized)
- {
- static_assert(!std::is_constructible<std::span<int>, const int (&)[3]>::value, "");
- static_assert(!std::is_constructible<std::span<int>, volatile int (&)[3]>::value, "");
- static_assert(!std::is_constructible<std::span<int>, const volatile int (&)[3]>::value, "");
-
- static_assert(!std::is_constructible<std::span<const int>, volatile int (&)[3]>::value, "");
- static_assert(!std::is_constructible<std::span<const int>, const volatile int (&)[3]>::value, "");
-
- static_assert(!std::is_constructible<std::span<volatile int>, const int (&)[3]>::value, "");
- static_assert(!std::is_constructible<std::span<volatile int>, const volatile int (&)[3]>::value, "");
- }
-
- // CV wrong (statically sized)
- {
- static_assert(!std::is_constructible<std::span<int, 3>, const int (&)[3]>::value, "");
- static_assert(!std::is_constructible<std::span<int, 3>, volatile int (&)[3]>::value, "");
- static_assert(!std::is_constructible<std::span<int, 3>, const volatile int (&)[3]>::value, "");
-
- static_assert(!std::is_constructible<std::span<const int, 3>, volatile int (&)[3]>::value, "");
- static_assert(!std::is_constructible<std::span<const int, 3>, const volatile int (&)[3]>::value, "");
-
- static_assert(!std::is_constructible<std::span<volatile int, 3>, const int (&)[3]>::value, "");
- static_assert(!std::is_constructible<std::span<volatile int, 3>, const volatile int (&)[3]>::value, "");
- }
-
- return 0;
+int main(int, char**) {
+ testSpan<int>();
+ testSpan<double>();
+ testSpan<A>();
+ testSpan<std::string>();
+
+ static_assert(testSpan<int>());
+ static_assert(testSpan<double>());
+ static_assert(testSpan<A>());
+
+ checkCV();
+
+ // Size wrong
+ {
+ static_assert(!std::is_constructible<std::span<int, 2>, int(&)[3]>::value, "");
+ }
+
+ // Type wrong
+ {
+ static_assert(!std::is_constructible<std::span<float>, int(&)[3]>::value, "");
+ static_assert(!std::is_constructible<std::span<float, 3>, int(&)[3]>::value, "");
+ }
+
+ // CV wrong (dynamically sized)
+ {
+ static_assert(!std::is_constructible<std::span<int>, const int(&)[3]>::value, "");
+ static_assert(!std::is_constructible<std::span<int>, volatile int(&)[3]>::value, "");
+ static_assert(!std::is_constructible<std::span<int>, const volatile int(&)[3]>::value, "");
+
+ static_assert(!std::is_constructible<std::span<const int>, volatile int(&)[3]>::value, "");
+ static_assert(!std::is_constructible<std::span<const int>, const volatile int(&)[3]>::value, "");
+
+ static_assert(!std::is_constructible<std::span<volatile int>, const int(&)[3]>::value, "");
+ static_assert(!std::is_constructible<std::span<volatile int>, const volatile int(&)[3]>::value, "");
+ }
+
+ // CV wrong (statically sized)
+ {
+ static_assert(!std::is_constructible<std::span<int, 3>, const int(&)[3]>::value, "");
+ static_assert(!std::is_constructible<std::span<int, 3>, volatile int(&)[3]>::value, "");
+ static_assert(!std::is_constructible<std::span<int, 3>, const volatile int(&)[3]>::value, "");
+
+ static_assert(!std::is_constructible<std::span<const int, 3>, volatile int(&)[3]>::value, "");
+ static_assert(!std::is_constructible<std::span<const int, 3>, const volatile int(&)[3]>::value, "");
+
+ static_assert(!std::is_constructible<std::span<volatile int, 3>, const int(&)[3]>::value, "");
+ static_assert(!std::is_constructible<std::span<volatile int, 3>, const volatile int(&)[3]>::value, "");
+ }
+
+ return 0;
}
diff --git a/libcxx/test/std/containers/views/views.span/span.cons/assign.pass.cpp b/libcxx/test/std/containers/views/views.span/span.cons/assign.pass.cpp
index 3f358116b8c6fb3..dcbf0fb36d8584c 100644
--- a/libcxx/test/std/containers/views/views.span/span.cons/assign.pass.cpp
+++ b/libcxx/test/std/containers/views/views.span/span.cons/assign.pass.cpp
@@ -20,278 +20,257 @@
#include "test_macros.h"
template <typename T>
-constexpr bool doAssign(T lhs, T rhs)
-{
- ASSERT_NOEXCEPT(std::declval<T&>() = rhs);
- lhs = rhs;
- return lhs.data() == rhs.data()
- && lhs.size() == rhs.size();
+constexpr bool doAssign(T lhs, T rhs) {
+ ASSERT_NOEXCEPT(std::declval<T&>() = rhs);
+ lhs = rhs;
+ return lhs.data() == rhs.data() && lhs.size() == rhs.size();
}
-struct A{};
-
-constexpr int carr1[] = {1,2,3,4};
-constexpr int carr2[] = {3,4,5};
-constexpr int carr3[] = {7,8};
- int arr[] = {5,6,7,9};
-std::string strs[] = {"ABC", "DEF", "GHI"};
-
-
-int main(int, char**)
-{
-
-// constexpr dynamically sized assignment
- {
-// On systems where 'ptr
diff _t' is a synonym for 'int',
-// the call span(ptr, 0) selects the (pointer, size_type) constructor.
-// On systems where 'ptr
diff _t' is NOT a synonym for 'int',
-// it is ambiguous, because of 0 also being convertible to a null pointer
-// and so the compiler can't choose between:
-// span(pointer, size_type)
-// and span(pointer, pointer)
-// We cast zero to std::ptr
diff _t to remove that ambiguity.
-// Example:
-// On darwin x86_64, ptr
diff _t is the same as long int.
-// On darwin i386, ptr
diff _t is the same as int.
- constexpr std::span<const int> spans[] = {
- {},
- {carr1, static_cast<std::size_t>(0)},
- {carr1, 1U},
- {carr1, 2U},
- {carr1, 3U},
- {carr1, 4U},
- {carr2, static_cast<std::size_t>(0)},
- {carr2, 1U},
- {carr2, 2U},
- {carr2, 3U},
- {carr3, static_cast<std::size_t>(0)},
- {carr3, 1U},
- {carr3, 2U}
- };
-
- static_assert(std::size(spans) == 13, "" );
-
-// No for loops in constexpr land :-(
- static_assert(doAssign(spans[0], spans[0]), "");
- static_assert(doAssign(spans[0], spans[1]), "");
- static_assert(doAssign(spans[0], spans[2]), "");
- static_assert(doAssign(spans[0], spans[3]), "");
- static_assert(doAssign(spans[0], spans[4]), "");
- static_assert(doAssign(spans[0], spans[5]), "");
- static_assert(doAssign(spans[0], spans[6]), "");
- static_assert(doAssign(spans[0], spans[7]), "");
- static_assert(doAssign(spans[0], spans[8]), "");
- static_assert(doAssign(spans[0], spans[9]), "");
- static_assert(doAssign(spans[0], spans[10]), "");
- static_assert(doAssign(spans[0], spans[11]), "");
- static_assert(doAssign(spans[0], spans[12]), "");
-
- static_assert(doAssign(spans[1], spans[1]), "");
- static_assert(doAssign(spans[1], spans[2]), "");
- static_assert(doAssign(spans[1], spans[3]), "");
- static_assert(doAssign(spans[1], spans[4]), "");
- static_assert(doAssign(spans[1], spans[5]), "");
- static_assert(doAssign(spans[1], spans[6]), "");
- static_assert(doAssign(spans[1], spans[7]), "");
- static_assert(doAssign(spans[1], spans[8]), "");
- static_assert(doAssign(spans[1], spans[9]), "");
- static_assert(doAssign(spans[1], spans[10]), "");
- static_assert(doAssign(spans[1], spans[11]), "");
- static_assert(doAssign(spans[1], spans[12]), "");
-
- static_assert(doAssign(spans[2], spans[2]), "");
- static_assert(doAssign(spans[2], spans[3]), "");
- static_assert(doAssign(spans[2], spans[4]), "");
- static_assert(doAssign(spans[2], spans[5]), "");
- static_assert(doAssign(spans[2], spans[6]), "");
- static_assert(doAssign(spans[2], spans[7]), "");
- static_assert(doAssign(spans[2], spans[8]), "");
- static_assert(doAssign(spans[2], spans[9]), "");
- static_assert(doAssign(spans[2], spans[10]), "");
- static_assert(doAssign(spans[2], spans[11]), "");
- static_assert(doAssign(spans[2], spans[12]), "");
-
- static_assert(doAssign(spans[3], spans[3]), "");
- static_assert(doAssign(spans[3], spans[4]), "");
- static_assert(doAssign(spans[3], spans[4]), "");
- static_assert(doAssign(spans[3], spans[4]), "");
- static_assert(doAssign(spans[3], spans[4]), "");
- static_assert(doAssign(spans[3], spans[4]), "");
- static_assert(doAssign(spans[3], spans[4]), "");
- static_assert(doAssign(spans[3], spans[4]), "");
- static_assert(doAssign(spans[3], spans[4]), "");
- static_assert(doAssign(spans[3], spans[10]), "");
- static_assert(doAssign(spans[3], spans[11]), "");
- static_assert(doAssign(spans[3], spans[12]), "");
-
- static_assert(doAssign(spans[4], spans[4]), "");
- static_assert(doAssign(spans[4], spans[5]), "");
- static_assert(doAssign(spans[4], spans[6]), "");
- static_assert(doAssign(spans[4], spans[7]), "");
- static_assert(doAssign(spans[4], spans[8]), "");
- static_assert(doAssign(spans[4], spans[9]), "");
- static_assert(doAssign(spans[4], spans[10]), "");
- static_assert(doAssign(spans[4], spans[11]), "");
- static_assert(doAssign(spans[4], spans[12]), "");
-
- static_assert(doAssign(spans[5], spans[5]), "");
- static_assert(doAssign(spans[5], spans[6]), "");
- static_assert(doAssign(spans[5], spans[7]), "");
- static_assert(doAssign(spans[5], spans[8]), "");
- static_assert(doAssign(spans[5], spans[9]), "");
- static_assert(doAssign(spans[5], spans[10]), "");
- static_assert(doAssign(spans[5], spans[11]), "");
- static_assert(doAssign(spans[5], spans[12]), "");
-
- static_assert(doAssign(spans[6], spans[6]), "");
- static_assert(doAssign(spans[6], spans[7]), "");
- static_assert(doAssign(spans[6], spans[8]), "");
- static_assert(doAssign(spans[6], spans[9]), "");
- static_assert(doAssign(spans[6], spans[10]), "");
- static_assert(doAssign(spans[6], spans[11]), "");
- static_assert(doAssign(spans[6], spans[12]), "");
-
- static_assert(doAssign(spans[7], spans[7]), "");
- static_assert(doAssign(spans[7], spans[8]), "");
- static_assert(doAssign(spans[7], spans[9]), "");
- static_assert(doAssign(spans[7], spans[10]), "");
- static_assert(doAssign(spans[7], spans[11]), "");
- static_assert(doAssign(spans[7], spans[12]), "");
-
- static_assert(doAssign(spans[8], spans[8]), "");
- static_assert(doAssign(spans[8], spans[9]), "");
- static_assert(doAssign(spans[8], spans[10]), "");
- static_assert(doAssign(spans[8], spans[11]), "");
- static_assert(doAssign(spans[8], spans[12]), "");
-
- static_assert(doAssign(spans[9], spans[9]), "");
- static_assert(doAssign(spans[9], spans[10]), "");
- static_assert(doAssign(spans[9], spans[11]), "");
- static_assert(doAssign(spans[9], spans[12]), "");
-
- static_assert(doAssign(spans[10], spans[10]), "");
- static_assert(doAssign(spans[10], spans[11]), "");
- static_assert(doAssign(spans[10], spans[12]), "");
-
- static_assert(doAssign(spans[11], spans[11]), "");
- static_assert(doAssign(spans[11], spans[12]), "");
-
- static_assert(doAssign(spans[12], spans[12]), "");
-
-// for (size_t i = 0; i < std::size(spans); ++i)
-// for (size_t j = i; j < std::size(spans); ++j)
-// static_assert(doAssign(spans[i], spans[j]), "");
- }
-
-// constexpr statically sized assignment
- {
- using spanType = std::span<const int,2>;
- constexpr spanType spans[] = {
- spanType{carr1, 2},
- spanType{carr1 + 1, 2},
- spanType{carr1 + 2, 2},
- spanType{carr2, 2},
- spanType{carr2 + 1, 2},
- spanType{carr3, 2}
- };
-
- static_assert(std::size(spans) == 6, "" );
-
-// No for loops in constexpr land :-(
- static_assert(doAssign(spans[0], spans[0]), "");
- static_assert(doAssign(spans[0], spans[1]), "");
- static_assert(doAssign(spans[0], spans[2]), "");
- static_assert(doAssign(spans[0], spans[3]), "");
- static_assert(doAssign(spans[0], spans[4]), "");
- static_assert(doAssign(spans[0], spans[5]), "");
-
- static_assert(doAssign(spans[1], spans[1]), "");
- static_assert(doAssign(spans[1], spans[2]), "");
- static_assert(doAssign(spans[1], spans[3]), "");
- static_assert(doAssign(spans[1], spans[4]), "");
- static_assert(doAssign(spans[1], spans[5]), "");
-
- static_assert(doAssign(spans[2], spans[2]), "");
- static_assert(doAssign(spans[2], spans[3]), "");
- static_assert(doAssign(spans[2], spans[4]), "");
- static_assert(doAssign(spans[2], spans[5]), "");
-
- static_assert(doAssign(spans[3], spans[3]), "");
- static_assert(doAssign(spans[3], spans[4]), "");
- static_assert(doAssign(spans[3], spans[5]), "");
-
- static_assert(doAssign(spans[4], spans[4]), "");
- static_assert(doAssign(spans[4], spans[5]), "");
-
- static_assert(doAssign(spans[5], spans[5]), "");
-
-// for (size_t i = 0; i < std::size(spans); ++i)
-// for (size_t j = i; j < std::size(spans); ++j)
-// static_assert(doAssign(spans[i], spans[j]), "");
- }
-
-
-// dynamically sized assignment
- {
- std::span<int> spans[] = {
- {},
- {arr, arr + 1},
- {arr, arr + 2},
- {arr, arr + 3},
- {arr + 1, arr + 3} // same size as s2
- };
-
- for (std::size_t i = 0; i < std::size(spans); ++i)
- for (std::size_t j = i; j < std::size(spans); ++j)
- assert((doAssign(spans[i], spans[j])));
- }
-
-// statically sized assignment
- {
- using spanType = std::span<int,2>;
- spanType spans[] = {
- spanType{arr, arr + 2},
- spanType{arr + 1, arr + 3},
- spanType{arr + 2, arr + 4}
- };
-
- for (std::size_t i = 0; i < std::size(spans); ++i)
- for (std::size_t j = i; j < std::size(spans); ++j)
- assert((doAssign(spans[i], spans[j])));
- }
-
-// dynamically sized assignment
- {
+struct A {};
+
+constexpr int carr1[] = {1, 2, 3, 4};
+constexpr int carr2[] = {3, 4, 5};
+constexpr int carr3[] = {7, 8};
+int arr[] = {5, 6, 7, 9};
+std::string strs[] = {"ABC", "DEF", "GHI"};
+
+int main(int, char**) {
+ // constexpr dynamically sized assignment
+ {
+ // On systems where 'ptr
diff _t' is a synonym for 'int',
+ // the call span(ptr, 0) selects the (pointer, size_type) constructor.
+ // On systems where 'ptr
diff _t' is NOT a synonym for 'int',
+ // it is ambiguous, because of 0 also being convertible to a null pointer
+ // and so the compiler can't choose between:
+ // span(pointer, size_type)
+ // and span(pointer, pointer)
+ // We cast zero to std::ptr
diff _t to remove that ambiguity.
+ // Example:
+ // On darwin x86_64, ptr
diff _t is the same as long int.
+ // On darwin i386, ptr
diff _t is the same as int.
+ constexpr std::span<const int> spans[] = {
+ {},
+ {carr1, static_cast<std::size_t>(0)},
+ {carr1, 1U},
+ {carr1, 2U},
+ {carr1, 3U},
+ {carr1, 4U},
+ {carr2, static_cast<std::size_t>(0)},
+ {carr2, 1U},
+ {carr2, 2U},
+ {carr2, 3U},
+ {carr3, static_cast<std::size_t>(0)},
+ {carr3, 1U},
+ {carr3, 2U}};
+
+ static_assert(std::size(spans) == 13, "");
+
+ // No for loops in constexpr land :-(
+ static_assert(doAssign(spans[0], spans[0]), "");
+ static_assert(doAssign(spans[0], spans[1]), "");
+ static_assert(doAssign(spans[0], spans[2]), "");
+ static_assert(doAssign(spans[0], spans[3]), "");
+ static_assert(doAssign(spans[0], spans[4]), "");
+ static_assert(doAssign(spans[0], spans[5]), "");
+ static_assert(doAssign(spans[0], spans[6]), "");
+ static_assert(doAssign(spans[0], spans[7]), "");
+ static_assert(doAssign(spans[0], spans[8]), "");
+ static_assert(doAssign(spans[0], spans[9]), "");
+ static_assert(doAssign(spans[0], spans[10]), "");
+ static_assert(doAssign(spans[0], spans[11]), "");
+ static_assert(doAssign(spans[0], spans[12]), "");
+
+ static_assert(doAssign(spans[1], spans[1]), "");
+ static_assert(doAssign(spans[1], spans[2]), "");
+ static_assert(doAssign(spans[1], spans[3]), "");
+ static_assert(doAssign(spans[1], spans[4]), "");
+ static_assert(doAssign(spans[1], spans[5]), "");
+ static_assert(doAssign(spans[1], spans[6]), "");
+ static_assert(doAssign(spans[1], spans[7]), "");
+ static_assert(doAssign(spans[1], spans[8]), "");
+ static_assert(doAssign(spans[1], spans[9]), "");
+ static_assert(doAssign(spans[1], spans[10]), "");
+ static_assert(doAssign(spans[1], spans[11]), "");
+ static_assert(doAssign(spans[1], spans[12]), "");
+
+ static_assert(doAssign(spans[2], spans[2]), "");
+ static_assert(doAssign(spans[2], spans[3]), "");
+ static_assert(doAssign(spans[2], spans[4]), "");
+ static_assert(doAssign(spans[2], spans[5]), "");
+ static_assert(doAssign(spans[2], spans[6]), "");
+ static_assert(doAssign(spans[2], spans[7]), "");
+ static_assert(doAssign(spans[2], spans[8]), "");
+ static_assert(doAssign(spans[2], spans[9]), "");
+ static_assert(doAssign(spans[2], spans[10]), "");
+ static_assert(doAssign(spans[2], spans[11]), "");
+ static_assert(doAssign(spans[2], spans[12]), "");
+
+ static_assert(doAssign(spans[3], spans[3]), "");
+ static_assert(doAssign(spans[3], spans[4]), "");
+ static_assert(doAssign(spans[3], spans[4]), "");
+ static_assert(doAssign(spans[3], spans[4]), "");
+ static_assert(doAssign(spans[3], spans[4]), "");
+ static_assert(doAssign(spans[3], spans[4]), "");
+ static_assert(doAssign(spans[3], spans[4]), "");
+ static_assert(doAssign(spans[3], spans[4]), "");
+ static_assert(doAssign(spans[3], spans[4]), "");
+ static_assert(doAssign(spans[3], spans[10]), "");
+ static_assert(doAssign(spans[3], spans[11]), "");
+ static_assert(doAssign(spans[3], spans[12]), "");
+
+ static_assert(doAssign(spans[4], spans[4]), "");
+ static_assert(doAssign(spans[4], spans[5]), "");
+ static_assert(doAssign(spans[4], spans[6]), "");
+ static_assert(doAssign(spans[4], spans[7]), "");
+ static_assert(doAssign(spans[4], spans[8]), "");
+ static_assert(doAssign(spans[4], spans[9]), "");
+ static_assert(doAssign(spans[4], spans[10]), "");
+ static_assert(doAssign(spans[4], spans[11]), "");
+ static_assert(doAssign(spans[4], spans[12]), "");
+
+ static_assert(doAssign(spans[5], spans[5]), "");
+ static_assert(doAssign(spans[5], spans[6]), "");
+ static_assert(doAssign(spans[5], spans[7]), "");
+ static_assert(doAssign(spans[5], spans[8]), "");
+ static_assert(doAssign(spans[5], spans[9]), "");
+ static_assert(doAssign(spans[5], spans[10]), "");
+ static_assert(doAssign(spans[5], spans[11]), "");
+ static_assert(doAssign(spans[5], spans[12]), "");
+
+ static_assert(doAssign(spans[6], spans[6]), "");
+ static_assert(doAssign(spans[6], spans[7]), "");
+ static_assert(doAssign(spans[6], spans[8]), "");
+ static_assert(doAssign(spans[6], spans[9]), "");
+ static_assert(doAssign(spans[6], spans[10]), "");
+ static_assert(doAssign(spans[6], spans[11]), "");
+ static_assert(doAssign(spans[6], spans[12]), "");
+
+ static_assert(doAssign(spans[7], spans[7]), "");
+ static_assert(doAssign(spans[7], spans[8]), "");
+ static_assert(doAssign(spans[7], spans[9]), "");
+ static_assert(doAssign(spans[7], spans[10]), "");
+ static_assert(doAssign(spans[7], spans[11]), "");
+ static_assert(doAssign(spans[7], spans[12]), "");
+
+ static_assert(doAssign(spans[8], spans[8]), "");
+ static_assert(doAssign(spans[8], spans[9]), "");
+ static_assert(doAssign(spans[8], spans[10]), "");
+ static_assert(doAssign(spans[8], spans[11]), "");
+ static_assert(doAssign(spans[8], spans[12]), "");
+
+ static_assert(doAssign(spans[9], spans[9]), "");
+ static_assert(doAssign(spans[9], spans[10]), "");
+ static_assert(doAssign(spans[9], spans[11]), "");
+ static_assert(doAssign(spans[9], spans[12]), "");
+
+ static_assert(doAssign(spans[10], spans[10]), "");
+ static_assert(doAssign(spans[10], spans[11]), "");
+ static_assert(doAssign(spans[10], spans[12]), "");
+
+ static_assert(doAssign(spans[11], spans[11]), "");
+ static_assert(doAssign(spans[11], spans[12]), "");
+
+ static_assert(doAssign(spans[12], spans[12]), "");
+
+ // for (size_t i = 0; i < std::size(spans); ++i)
+ // for (size_t j = i; j < std::size(spans); ++j)
+ // static_assert(doAssign(spans[i], spans[j]), "");
+ }
+
+ // constexpr statically sized assignment
+ {
+ using spanType = std::span<const int, 2>;
+ constexpr spanType spans[] = {
+ spanType{carr1, 2},
+ spanType{carr1 + 1, 2},
+ spanType{carr1 + 2, 2},
+ spanType{carr2, 2},
+ spanType{carr2 + 1, 2},
+ spanType{carr3, 2}};
+
+ static_assert(std::size(spans) == 6, "");
+
+ // No for loops in constexpr land :-(
+ static_assert(doAssign(spans[0], spans[0]), "");
+ static_assert(doAssign(spans[0], spans[1]), "");
+ static_assert(doAssign(spans[0], spans[2]), "");
+ static_assert(doAssign(spans[0], spans[3]), "");
+ static_assert(doAssign(spans[0], spans[4]), "");
+ static_assert(doAssign(spans[0], spans[5]), "");
+
+ static_assert(doAssign(spans[1], spans[1]), "");
+ static_assert(doAssign(spans[1], spans[2]), "");
+ static_assert(doAssign(spans[1], spans[3]), "");
+ static_assert(doAssign(spans[1], spans[4]), "");
+ static_assert(doAssign(spans[1], spans[5]), "");
+
+ static_assert(doAssign(spans[2], spans[2]), "");
+ static_assert(doAssign(spans[2], spans[3]), "");
+ static_assert(doAssign(spans[2], spans[4]), "");
+ static_assert(doAssign(spans[2], spans[5]), "");
+
+ static_assert(doAssign(spans[3], spans[3]), "");
+ static_assert(doAssign(spans[3], spans[4]), "");
+ static_assert(doAssign(spans[3], spans[5]), "");
+
+ static_assert(doAssign(spans[4], spans[4]), "");
+ static_assert(doAssign(spans[4], spans[5]), "");
+
+ static_assert(doAssign(spans[5], spans[5]), "");
+
+ // for (size_t i = 0; i < std::size(spans); ++i)
+ // for (size_t j = i; j < std::size(spans); ++j)
+ // static_assert(doAssign(spans[i], spans[j]), "");
+ }
+
+ // dynamically sized assignment
+ {
+ std::span<int> spans[] = {
+ {}, {arr, arr + 1}, {arr, arr + 2}, {arr, arr + 3}, {arr + 1, arr + 3} // same size as s2
+ };
+
+ for (std::size_t i = 0; i < std::size(spans); ++i)
+ for (std::size_t j = i; j < std::size(spans); ++j)
+ assert((doAssign(spans[i], spans[j])));
+ }
+
+ // statically sized assignment
+ {
+ using spanType = std::span<int, 2>;
+ spanType spans[] = {spanType{arr, arr + 2}, spanType{arr + 1, arr + 3}, spanType{arr + 2, arr + 4}};
+
+ for (std::size_t i = 0; i < std::size(spans); ++i)
+ for (std::size_t j = i; j < std::size(spans); ++j)
+ assert((doAssign(spans[i], spans[j])));
+ }
+
+ // dynamically sized assignment
+ {
std::span<std::string> spans[] = {
- {strs, strs},
- {strs, strs + 1},
- {strs, strs + 2},
- {strs, strs + 3},
- {strs + 1, strs + 1},
- {strs + 1, strs + 2},
- {strs + 1, strs + 3},
- {strs + 2, strs + 2},
- {strs + 2, strs + 3},
- {strs + 3, strs + 3}
- };
-
- for (std::size_t i = 0; i < std::size(spans); ++i)
- for (std::size_t j = i; j < std::size(spans); ++j)
- assert((doAssign(spans[i], spans[j])));
- }
-
- {
- using spanType = std::span<std::string, 1>;
- spanType spans[] = {
- spanType{strs, strs + 1},
- spanType{strs + 1, strs + 2},
- spanType{strs + 2, strs + 3}
- };
-
- for (std::size_t i = 0; i < std::size(spans); ++i)
- for (std::size_t j = i; j < std::size(spans); ++j)
- assert((doAssign(spans[i], spans[j])));
- }
+ {strs, strs},
+ {strs, strs + 1},
+ {strs, strs + 2},
+ {strs, strs + 3},
+ {strs + 1, strs + 1},
+ {strs + 1, strs + 2},
+ {strs + 1, strs + 3},
+ {strs + 2, strs + 2},
+ {strs + 2, strs + 3},
+ {strs + 3, strs + 3}};
+
+ for (std::size_t i = 0; i < std::size(spans); ++i)
+ for (std::size_t j = i; j < std::size(spans); ++j)
+ assert((doAssign(spans[i], spans[j])));
+ }
+
+ {
+ using spanType = std::span<std::string, 1>;
+ spanType spans[] = {spanType{strs, strs + 1}, spanType{strs + 1, strs + 2}, spanType{strs + 2, strs + 3}};
+
+ for (std::size_t i = 0; i < std::size(spans); ++i)
+ for (std::size_t j = i; j < std::size(spans); ++j)
+ assert((doAssign(spans[i], spans[j])));
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/views/views.span/span.cons/deduct.pass.cpp b/libcxx/test/std/containers/views/views.span/span.cons/deduct.pass.cpp
index 064d5c3a3fac4bc..28dda866371f5cf 100644
--- a/libcxx/test/std/containers/views/views.span/span.cons/deduct.pass.cpp
+++ b/libcxx/test/std/containers/views/views.span/span.cons/deduct.pass.cpp
@@ -24,7 +24,6 @@
// template<class R>
// span(R&&) -> span<remove_reference_t<ranges::range_reference_t<R>>>;
-
#include <span>
#include <array>
#include <cassert>
@@ -38,16 +37,16 @@
void test_iterator_sentinel() {
int arr[] = {1, 2, 3};
{
- std::span s{std::begin(arr), std::end(arr)};
- ASSERT_SAME_TYPE(decltype(s), std::span<int>);
- assert(s.size() == std::size(arr));
- assert(s.data() == std::data(arr));
+ std::span s{std::begin(arr), std::end(arr)};
+ ASSERT_SAME_TYPE(decltype(s), std::span<int>);
+ assert(s.size() == std::size(arr));
+ assert(s.data() == std::data(arr));
}
{
- std::span s{std::begin(arr), 3};
- ASSERT_SAME_TYPE(decltype(s), std::span<int>);
- assert(s.size() == std::size(arr));
- assert(s.data() == std::data(arr));
+ std::span s{std::begin(arr), 3};
+ ASSERT_SAME_TYPE(decltype(s), std::span<int>);
+ assert(s.size() == std::size(arr));
+ assert(s.data() == std::data(arr));
}
#if TEST_STD_VER >= 26
@@ -62,61 +61,60 @@ void test_iterator_sentinel() {
}
void test_c_array() {
- {
+ {
int arr[] = {1, 2, 3};
std::span s{arr};
ASSERT_SAME_TYPE(decltype(s), std::span<int, 3>);
assert(s.size() == std::size(arr));
assert(s.data() == std::data(arr));
- }
+ }
- {
- const int arr[] = {1,2,3};
+ {
+ const int arr[] = {1, 2, 3};
std::span s{arr};
ASSERT_SAME_TYPE(decltype(s), std::span<const int, 3>);
assert(s.size() == std::size(arr));
assert(s.data() == std::data(arr));
- }
+ }
}
void test_std_array() {
- {
+ {
std::array<double, 4> arr = {1.0, 2.0, 3.0, 4.0};
std::span s{arr};
ASSERT_SAME_TYPE(decltype(s), std::span<double, 4>);
assert(s.size() == arr.size());
assert(s.data() == arr.data());
- }
+ }
- {
+ {
const std::array<long, 5> arr = {4, 5, 6, 7, 8};
std::span s{arr};
ASSERT_SAME_TYPE(decltype(s), std::span<const long, 5>);
assert(s.size() == arr.size());
assert(s.data() == arr.data());
- }
+ }
}
void test_range_std_container() {
- {
+ {
std::string str{"ABCDE"};
std::span s{str};
ASSERT_SAME_TYPE(decltype(s), std::span<char>);
assert(s.size() == str.size());
assert(s.data() == str.data());
- }
+ }
- {
+ {
const std::string str{"QWERTYUIOP"};
std::span s{str};
ASSERT_SAME_TYPE(decltype(s), std::span<const char>);
assert(s.size() == str.size());
assert(s.data() == str.data());
- }
+ }
}
-int main(int, char**)
-{
+int main(int, char**) {
test_iterator_sentinel();
test_c_array();
test_std_array();
diff --git a/libcxx/test/std/containers/views/views.span/span.cons/default.pass.cpp b/libcxx/test/std/containers/views/views.span/span.cons/default.pass.cpp
index 7ae49c8c3237b57..02fc48e145b770f 100644
--- a/libcxx/test/std/containers/views/views.span/span.cons/default.pass.cpp
+++ b/libcxx/test/std/containers/views/views.span/span.cons/default.pass.cpp
@@ -18,70 +18,61 @@
#include "test_macros.h"
-void checkCV()
-{
-// Types the same (dynamic sized)
- {
- std::span< int> s1;
- std::span<const int> s2;
- std::span< volatile int> s3;
+void checkCV() {
+ // Types the same (dynamic sized)
+ {
+ std::span< int> s1;
+ std::span<const int> s2;
+ std::span< volatile int> s3;
std::span<const volatile int> s4;
assert(s1.size() + s2.size() + s3.size() + s4.size() == 0);
- }
-
-// Types the same (static sized)
- {
- std::span< int,0> s1;
- std::span<const int,0> s2;
- std::span< volatile int,0> s3;
- std::span<const volatile int,0> s4;
+ }
+
+ // Types the same (static sized)
+ {
+ std::span< int, 0> s1;
+ std::span<const int, 0> s2;
+ std::span< volatile int, 0> s3;
+ std::span<const volatile int, 0> s4;
assert(s1.size() + s2.size() + s3.size() + s4.size() == 0);
- }
+ }
}
-
template <typename T>
-constexpr bool testConstexprSpan()
-{
- std::span<const T> s1;
- std::span<const T, 0> s2;
- return
- s1.data() == nullptr && s1.size() == 0
- && s2.data() == nullptr && s2.size() == 0;
+constexpr bool testConstexprSpan() {
+ std::span<const T> s1;
+ std::span<const T, 0> s2;
+ return s1.data() == nullptr && s1.size() == 0 && s2.data() == nullptr && s2.size() == 0;
}
-
template <typename T>
-void testRuntimeSpan()
-{
- ASSERT_NOEXCEPT(T{});
- std::span<const T> s1;
- std::span<const T, 0> s2;
- assert(s1.data() == nullptr && s1.size() == 0);
- assert(s2.data() == nullptr && s2.size() == 0);
+void testRuntimeSpan() {
+ ASSERT_NOEXCEPT(T{});
+ std::span<const T> s1;
+ std::span<const T, 0> s2;
+ assert(s1.data() == nullptr && s1.size() == 0);
+ assert(s2.data() == nullptr && s2.size() == 0);
}
+struct A {};
-struct A{};
-
-int main(int, char**)
-{
- static_assert(testConstexprSpan<int>(), "");
- static_assert(testConstexprSpan<long>(), "");
- static_assert(testConstexprSpan<double>(), "");
- static_assert(testConstexprSpan<A>(), "");
+int main(int, char**) {
+ static_assert(testConstexprSpan<int>(), "");
+ static_assert(testConstexprSpan<long>(), "");
+ static_assert(testConstexprSpan<double>(), "");
+ static_assert(testConstexprSpan<A>(), "");
- testRuntimeSpan<int>();
- testRuntimeSpan<long>();
- testRuntimeSpan<double>();
- testRuntimeSpan<std::string>();
- testRuntimeSpan<A>();
+ testRuntimeSpan<int>();
+ testRuntimeSpan<long>();
+ testRuntimeSpan<double>();
+ testRuntimeSpan<std::string>();
+ testRuntimeSpan<A>();
- checkCV();
+ checkCV();
- static_assert( std::is_default_constructible_v<std::span<int, std::dynamic_extent>>, "");
- static_assert( std::is_default_constructible_v<std::span<int, 0>>, "");
- static_assert(!std::is_default_constructible_v<std::span<int, 2>>, "");
+ static_assert(std::is_default_constructible_v<std::span<int, std::dynamic_extent>>, "");
+ static_assert(std::is_default_constructible_v<std::span<int, 0>>, "");
+ static_assert(!std::is_default_constructible_v<std::span<int, 2>>, "");
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/views/views.span/span.cons/iterator_len.pass.cpp b/libcxx/test/std/containers/views/views.span/span.cons/iterator_len.pass.cpp
index fcc2625ee6596a5..3d95733e9d6c5e0 100644
--- a/libcxx/test/std/containers/views/views.span/span.cons/iterator_len.pass.cpp
+++ b/libcxx/test/std/containers/views/views.span/span.cons/iterator_len.pass.cpp
@@ -42,8 +42,8 @@ constexpr void test_constructibility() {
template <class T>
constexpr bool test_ctor() {
T val[2] = {};
- auto s1 = std::span<T>(val, 2);
- auto s2 = std::span<T, 2>(val, 2);
+ auto s1 = std::span<T>(val, 2);
+ auto s2 = std::span<T, 2>(val, 2);
assert(s1.data() == std::data(val) && s1.size() == std::size(val));
assert(s2.data() == std::data(val) && s2.size() == std::size(val));
return true;
diff --git a/libcxx/test/std/containers/views/views.span/span.cons/iterator_sentinel.verify.cpp b/libcxx/test/std/containers/views/views.span/span.cons/iterator_sentinel.verify.cpp
index 937d8d921ea0b10..b97c1a51572cbfe 100644
--- a/libcxx/test/std/containers/views/views.span/span.cons/iterator_sentinel.verify.cpp
+++ b/libcxx/test/std/containers/views/views.span/span.cons/iterator_sentinel.verify.cpp
@@ -19,9 +19,9 @@
#include <iterator>
#include <span>
-template<class T, std::size_t Extent>
+template <class T, std::size_t Extent>
std::span<T, Extent> createImplicitSpan(T* first, T* last) {
- return {first, last}; // expected-error {{chosen constructor is explicit in copy-initialization}}
+ return {first, last}; // expected-error {{chosen constructor is explicit in copy-initialization}}
}
void f() {
diff --git a/libcxx/test/std/containers/views/views.span/span.cons/range.pass.cpp b/libcxx/test/std/containers/views/views.span/span.cons/range.pass.cpp
index 71fee430f8f42be..e9f8d26ee747abd 100644
--- a/libcxx/test/std/containers/views/views.span/span.cons/range.pass.cpp
+++ b/libcxx/test/std/containers/views/views.span/span.cons/range.pass.cpp
@@ -12,7 +12,6 @@
// template<class R>
// constexpr explicit(Extent != dynamic_extent) span(R&& r);
-
#include <span>
#include <cassert>
#include <ranges>
@@ -56,10 +55,16 @@ static_assert(std::is_constructible_v<std::span<const int, 3>, std::vector<int>>
static_assert(!std::is_constructible_v<std::span<int>, std::vector<int>&&>); // non-borrowed rvalue
static_assert(!std::is_constructible_v<std::span<int, 3>, std::vector<int>&&>); // non-borrowed rvalue
-static_assert(std::is_constructible_v<std::span<int>, std::ranges::subrange<contiguous_iterator<int*>>>); // contiguous borrowed rvalue
-static_assert(std::is_constructible_v<std::span<int, 3>, std::ranges::subrange<contiguous_iterator<int*>>>); // contiguous borrowed rvalue
-static_assert(!std::is_constructible_v<std::span<int>, std::ranges::subrange<random_access_iterator<int*>>>); // non-contiguous borrowed rvalue
-static_assert(!std::is_constructible_v<std::span<int, 3>, std::ranges::subrange<random_access_iterator<int*>>>); // non-contiguous borrowed rvalue
+static_assert(std::is_constructible_v<std::span<int>,
+ std::ranges::subrange<contiguous_iterator<int*>>>); // contiguous borrowed rvalue
+static_assert(std::is_constructible_v<std::span<int, 3>,
+ std::ranges::subrange<contiguous_iterator<int*>>>); // contiguous borrowed rvalue
+static_assert(
+ !std::is_constructible_v<std::span<int>,
+ std::ranges::subrange<random_access_iterator<int*>>>); // non-contiguous borrowed rvalue
+static_assert(
+ !std::is_constructible_v<std::span<int, 3>,
+ std::ranges::subrange<random_access_iterator<int*>>>); // non-contiguous borrowed rvalue
using BorrowedContiguousSizedRange = std::string_view;
static_assert(std::is_constructible_v<std::span<const char>, BorrowedContiguousSizedRange>);
diff --git a/libcxx/test/std/containers/views/views.span/span.cons/span.verify.cpp b/libcxx/test/std/containers/views/views.span/span.cons/span.verify.cpp
index 784530ebcb106a7..0b9a88d3dc656b7 100644
--- a/libcxx/test/std/containers/views/views.span/span.cons/span.verify.cpp
+++ b/libcxx/test/std/containers/views/views.span/span.cons/span.verify.cpp
@@ -16,99 +16,113 @@
// Extent == dynamic_extent || Extent == OtherExtent is true, and
// OtherElementType(*)[] is convertible to ElementType(*)[].
-
#include <span>
#include <cassert>
#include <string>
#include "test_macros.h"
-template<class T, std::size_t extent, size_t otherExtent>
+template <class T, std::size_t extent, size_t otherExtent>
std::span<T, extent> createImplicitSpan(std::span<T, otherExtent> s) {
- return {s}; // expected-error {{chosen constructor is explicit in copy-initialization}}
+ return {s}; // expected-error {{chosen constructor is explicit in copy-initialization}}
}
-void checkCV ()
-{
-// std::span< int> sp;
- std::span<const int> csp;
- std::span< volatile int> vsp;
- std::span<const volatile int> cvsp;
-
-// std::span< int, 0> sp0;
- std::span<const int, 0> csp0;
- std::span< volatile int, 0> vsp0;
- std::span<const volatile int, 0> cvsp0;
-
-// Try to remove const and/or volatile (dynamic -> dynamic)
- {
- std::span< int> s1{ csp}; // expected-error {{no matching constructor for initialization of 'std::span<int>'}}
- std::span< int> s2{ vsp}; // expected-error {{no matching constructor for initialization of 'std::span<int>'}}
- std::span< int> s3{cvsp}; // expected-error {{no matching constructor for initialization of 'std::span<int>'}}
-
- std::span<const int> s4{ vsp}; // expected-error {{no matching constructor for initialization of 'std::span<const int>'}}
- std::span<const int> s5{cvsp}; // expected-error {{no matching constructor for initialization of 'std::span<const int>'}}
-
- std::span< volatile int> s6{ csp}; // expected-error {{no matching constructor for initialization of 'std::span<volatile int>'}}
- std::span< volatile int> s7{cvsp}; // expected-error {{no matching constructor for initialization of 'std::span<volatile int>'}}
- }
-
-// Try to remove const and/or volatile (static -> static)
- {
- std::span< int, 0> s1{ csp0}; // expected-error {{no matching constructor for initialization of 'std::span<int, 0>'}}
- std::span< int, 0> s2{ vsp0}; // expected-error {{no matching constructor for initialization of 'std::span<int, 0>'}}
- std::span< int, 0> s3{cvsp0}; // expected-error {{no matching constructor for initialization of 'std::span<int, 0>'}}
-
- std::span<const int, 0> s4{ vsp0}; // expected-error {{no matching constructor for initialization of 'std::span<const int, 0>'}}
- std::span<const int, 0> s5{cvsp0}; // expected-error {{no matching constructor for initialization of 'std::span<const int, 0>'}}
-
- std::span< volatile int, 0> s6{ csp0}; // expected-error {{no matching constructor for initialization of 'std::span<volatile int, 0>'}}
- std::span< volatile int, 0> s7{cvsp0}; // expected-error {{no matching constructor for initialization of 'std::span<volatile int, 0>'}}
- }
-
-// Try to remove const and/or volatile (static -> dynamic)
- {
- std::span< int> s1{ csp0}; // expected-error {{no matching constructor for initialization of 'std::span<int>'}}
- std::span< int> s2{ vsp0}; // expected-error {{no matching constructor for initialization of 'std::span<int>'}}
- std::span< int> s3{cvsp0}; // expected-error {{no matching constructor for initialization of 'std::span<int>'}}
-
- std::span<const int> s4{ vsp0}; // expected-error {{no matching constructor for initialization of 'std::span<const int>'}}
- std::span<const int> s5{cvsp0}; // expected-error {{no matching constructor for initialization of 'std::span<const int>'}}
-
- std::span< volatile int> s6{ csp0}; // expected-error {{no matching constructor for initialization of 'std::span<volatile int>'}}
- std::span< volatile int> s7{cvsp0}; // expected-error {{no matching constructor for initialization of 'std::span<volatile int>'}}
- }
-
-// Try to remove const and/or volatile (static -> static)
- {
- std::span< int, 0> s1{ csp}; // expected-error {{no matching constructor for initialization of 'std::span<int, 0>'}}
- std::span< int, 0> s2{ vsp}; // expected-error {{no matching constructor for initialization of 'std::span<int, 0>'}}
- std::span< int, 0> s3{cvsp}; // expected-error {{no matching constructor for initialization of 'std::span<int, 0>'}}
-
- std::span<const int, 0> s4{ vsp}; // expected-error {{no matching constructor for initialization of 'std::span<const int, 0>'}}
- std::span<const int, 0> s5{cvsp}; // expected-error {{no matching constructor for initialization of 'std::span<const int, 0>'}}
-
- std::span< volatile int, 0> s6{ csp}; // expected-error {{no matching constructor for initialization of 'std::span<volatile int, 0>'}}
- std::span< volatile int, 0> s7{cvsp}; // expected-error {{no matching constructor for initialization of 'std::span<volatile int, 0>'}}
- }
+void checkCV() {
+ // std::span< int> sp;
+ std::span<const int> csp;
+ std::span< volatile int> vsp;
+ std::span<const volatile int> cvsp;
+
+ // std::span< int, 0> sp0;
+ std::span<const int, 0> csp0;
+ std::span< volatile int, 0> vsp0;
+ std::span<const volatile int, 0> cvsp0;
+
+ // Try to remove const and/or volatile (dynamic -> dynamic)
+ {
+ std::span< int> s1{csp}; // expected-error {{no matching constructor for initialization of 'std::span<int>'}}
+ std::span< int> s2{vsp}; // expected-error {{no matching constructor for initialization of 'std::span<int>'}}
+ std::span< int> s3{cvsp}; // expected-error {{no matching constructor for initialization of 'std::span<int>'}}
+
+ std::span<const int> s4{vsp};
+ // expected-error at -1 {{no matching constructor for initialization of 'std::span<const int>'}}
+ std::span<const int> s5{cvsp};
+ // expected-error at -1 {{no matching constructor for initialization of 'std::span<const int>'}}
+
+ std::span< volatile int> s6{csp};
+ // expected-error at -1 {{no matching constructor for initialization of 'std::span<volatile int>'}}
+ std::span< volatile int> s7{cvsp};
+ // expected-error at -1 {{no matching constructor for initialization of 'std::span<volatile int>'}}
+ }
+
+ // Try to remove const and/or volatile (static -> static)
+ {
+ std::span< int, 0> s1{csp0}; // expected-error {{no matching constructor for initialization of 'std::span<int, 0>'}}
+ std::span< int, 0> s2{vsp0}; // expected-error {{no matching constructor for initialization of 'std::span<int, 0>'}}
+ std::span< int, 0> s3{cvsp0};
+ // expected-error at -1 {{no matching constructor for initialization of 'std::span<int, 0>'}}
+
+ std::span<const int, 0> s4{vsp0};
+ // expected-error at -1 {{no matching constructor for initialization of 'std::span<const int, 0>'}}
+ std::span<const int, 0> s5{cvsp0};
+ // expected-error at -1 {{no matching constructor for initialization of 'std::span<const int, 0>'}}
+
+ std::span< volatile int, 0> s6{csp0};
+ // expected-error at -1 {{no matching constructor for initialization of 'std::span<volatile int, 0>'}}
+ std::span< volatile int, 0> s7{cvsp0};
+ // expected-error at -1 {{no matching constructor for initialization of 'std::span<volatile int, 0>'}}
+ }
+
+ // Try to remove const and/or volatile (static -> dynamic)
+ {
+ std::span< int> s1{csp0}; // expected-error {{no matching constructor for initialization of 'std::span<int>'}}
+ std::span< int> s2{vsp0}; // expected-error {{no matching constructor for initialization of 'std::span<int>'}}
+ std::span< int> s3{cvsp0}; // expected-error {{no matching constructor for initialization of 'std::span<int>'}}
+
+ std::span<const int> s4{vsp0};
+ // expected-error at -1 {{no matching constructor for initialization of 'std::span<const int>'}}
+ std::span<const int> s5{cvsp0};
+ // expected-error at -1 {{no matching constructor for initialization of 'std::span<const int>'}}
+
+ std::span< volatile int> s6{csp0};
+ // expected-error at -1 {{no matching constructor for initialization of 'std::span<volatile int>'}}
+ std::span< volatile int> s7{cvsp0};
+ // expected-error at -1 {{no matching constructor for initialization of 'std::span<volatile int>'}}
+ }
+
+ // Try to remove const and/or volatile (static -> static)
+ {
+ std::span< int, 0> s1{csp}; // expected-error {{no matching constructor for initialization of 'std::span<int, 0>'}}
+ std::span< int, 0> s2{vsp}; // expected-error {{no matching constructor for initialization of 'std::span<int, 0>'}}
+ std::span< int, 0> s3{cvsp}; // expected-error {{no matching constructor for initialization of 'std::span<int, 0>'}}
+
+ std::span<const int, 0> s4{vsp};
+ // expected-error at -1 {{no matching constructor for initialization of 'std::span<const int, 0>'}}
+ std::span<const int, 0> s5{cvsp};
+ // expected-error at -1 {{no matching constructor for initialization of 'std::span<const int, 0>'}}
+
+ std::span< volatile int, 0> s6{csp};
+ // expected-error at -1 {{no matching constructor for initialization of 'std::span<volatile int, 0>'}}
+ std::span< volatile int, 0> s7{cvsp};
+ // expected-error at -1 {{no matching constructor for initialization of 'std::span<volatile int, 0>'}}
+ }
}
-int main(int, char**)
-{
- std::span<int> sp;
- std::span<int, 0> sp0;
+int main(int, char**) {
+ std::span<int> sp;
+ std::span<int, 0> sp0;
- std::span<float> s1{sp}; // expected-error {{no matching constructor for initialization of 'std::span<float>'}}
- std::span<float> s2{sp0}; // expected-error {{no matching constructor for initialization of 'std::span<float>'}}
- std::span<float, 0> s3{sp}; // expected-error {{no matching constructor for initialization of 'std::span<float, 0>'}}
- std::span<float, 0> s4{sp0}; // expected-error {{no matching constructor for initialization of 'std::span<float, 0>'}}
+ std::span<float> s1{sp}; // expected-error {{no matching constructor for initialization of 'std::span<float>'}}
+ std::span<float> s2{sp0}; // expected-error {{no matching constructor for initialization of 'std::span<float>'}}
+ std::span<float, 0> s3{sp}; // expected-error {{no matching constructor for initialization of 'std::span<float, 0>'}}
+ std::span<float, 0> s4{sp0}; // expected-error {{no matching constructor for initialization of 'std::span<float, 0>'}}
- checkCV();
+ checkCV();
- // explicit constructor necessary
- {
+ // explicit constructor necessary
+ {
createImplicitSpan<int, 1>(sp);
- }
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/views/views.span/span.cons/stdarray.pass.cpp b/libcxx/test/std/containers/views/views.span/span.cons/stdarray.pass.cpp
index 97aa349fdcbc699..1c261f4f38f74e2 100644
--- a/libcxx/test/std/containers/views/views.span/span.cons/stdarray.pass.cpp
+++ b/libcxx/test/std/containers/views/views.span/span.cons/stdarray.pass.cpp
@@ -19,7 +19,6 @@
// - remove_pointer_t<decltype(data(arr))>(*)[] is convertible to ElementType(*)[].
//
-
#include <span>
#include <array>
#include <cassert>
@@ -27,40 +26,38 @@
#include "test_macros.h"
-void checkCV()
-{
- std::array<int, 3> arr = {1,2,3};
-// STL says these are not cromulent
-// std::array<const int,3> carr = {4,5,6};
-// std::array<volatile int, 3> varr = {7,8,9};
-// std::array<const volatile int, 3> cvarr = {1,3,5};
-
-// Types the same (dynamic sized)
- {
- std::span< int> s1{ arr}; // a span< int> pointing at int.
- }
-
-// Types the same (static sized)
- {
- std::span< int,3> s1{ arr}; // a span< int> pointing at int.
- }
-
-
-// types
diff erent (dynamic sized)
- {
- std::span<const int> s1{ arr}; // a span<const int> pointing at int.
- std::span< volatile int> s2{ arr}; // a span< volatile int> pointing at int.
- std::span< volatile int> s3{ arr}; // a span< volatile int> pointing at const int.
- std::span<const volatile int> s4{ arr}; // a span<const volatile int> pointing at int.
- }
-
-// types
diff erent (static sized)
- {
- std::span<const int,3> s1{ arr}; // a span<const int> pointing at int.
- std::span< volatile int,3> s2{ arr}; // a span< volatile int> pointing at int.
- std::span< volatile int,3> s3{ arr}; // a span< volatile int> pointing at const int.
- std::span<const volatile int,3> s4{ arr}; // a span<const volatile int> pointing at int.
- }
+void checkCV() {
+ std::array<int, 3> arr = {1, 2, 3};
+ // STL says these are not cromulent
+ // std::array<const int,3> carr = {4,5,6};
+ // std::array<volatile int, 3> varr = {7,8,9};
+ // std::array<const volatile int, 3> cvarr = {1,3,5};
+
+ // Types the same (dynamic sized)
+ {
+ std::span< int> s1{arr}; // a span< int> pointing at int.
+ }
+
+ // Types the same (static sized)
+ {
+ std::span< int, 3> s1{arr}; // a span< int> pointing at int.
+ }
+
+ // types
diff erent (dynamic sized)
+ {
+ std::span<const int> s1{arr}; // a span<const int> pointing at int.
+ std::span< volatile int> s2{arr}; // a span< volatile int> pointing at int.
+ std::span< volatile int> s3{arr}; // a span< volatile int> pointing at const int.
+ std::span<const volatile int> s4{arr}; // a span<const volatile int> pointing at int.
+ }
+
+ // types
diff erent (static sized)
+ {
+ std::span<const int, 3> s1{arr}; // a span<const int> pointing at int.
+ std::span< volatile int, 3> s2{arr}; // a span< volatile int> pointing at int.
+ std::span< volatile int, 3> s3{arr}; // a span< volatile int> pointing at const int.
+ std::span<const volatile int, 3> s4{arr}; // a span<const volatile int> pointing at int.
+ }
}
template <typename T, typename U>
@@ -70,8 +67,7 @@ constexpr bool testConstructorArray() {
ASSERT_NOEXCEPT(std::span<T, 2>{val});
std::span<T> s1{val};
std::span<T, 2> s2{val};
- return s1.data() == &val[0] && s1.size() == 2 && s2.data() == &val[0] &&
- s2.size() == 2;
+ return s1.data() == &val[0] && s1.size() == 2 && s2.data() == &val[0] && s2.size() == 2;
}
template <typename T, typename U>
@@ -81,8 +77,7 @@ constexpr bool testConstructorConstArray() {
ASSERT_NOEXCEPT(std::span<const T, 2>{val});
std::span<const T> s1{val};
std::span<const T, 2> s2{val};
- return s1.data() == &val[0] && s1.size() == 2 && s2.data() == &val[0] &&
- s2.size() == 2;
+ return s1.data() == &val[0] && s1.size() == 2 && s2.data() == &val[0] && s2.size() == 2;
}
template <typename T>
@@ -94,27 +89,23 @@ constexpr bool testConstructors() {
static_assert(testConstructorConstArray<const T, const T>(), "");
static_assert(testConstructorConstArray<const T, T>(), "");
- return testConstructorArray<T, T>() &&
- testConstructorArray<const T, const T>() &&
- testConstructorArray<const T, T>() &&
- testConstructorConstArray<T, T>() &&
- testConstructorConstArray<const T, const T>() &&
- testConstructorConstArray<const T, T>();
+ return testConstructorArray<T, T>() && testConstructorArray<const T, const T>() &&
+ testConstructorArray<const T, T>() && testConstructorConstArray<T, T>() &&
+ testConstructorConstArray<const T, const T>() && testConstructorConstArray<const T, T>();
}
-struct A{};
+struct A {};
-int main(int, char**)
-{
- assert(testConstructors<int>());
- assert(testConstructors<long>());
- assert(testConstructors<double>());
- assert(testConstructors<A>());
+int main(int, char**) {
+ assert(testConstructors<int>());
+ assert(testConstructors<long>());
+ assert(testConstructors<double>());
+ assert(testConstructors<A>());
- assert(testConstructors<int*>());
- assert(testConstructors<const int*>());
+ assert(testConstructors<int*>());
+ assert(testConstructors<const int*>());
- checkCV();
+ checkCV();
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/views/views.span/span.elem/back.pass.cpp b/libcxx/test/std/containers/views/views.span/span.elem/back.pass.cpp
index dfc01d509210d4f..c5086d076798d10 100644
--- a/libcxx/test/std/containers/views/views.span/span.elem/back.pass.cpp
+++ b/libcxx/test/std/containers/views/views.span/span.elem/back.pass.cpp
@@ -14,69 +14,61 @@
// Effects: Equivalent to: return *(data() + (size() - 1));
//
-
#include <span>
#include <cassert>
#include <string>
#include "test_macros.h"
-
template <typename Span>
-constexpr bool testConstexprSpan(Span sp)
-{
- LIBCPP_ASSERT(noexcept(sp.back()));
- return std::addressof(sp.back()) == sp.data() + sp.size() - 1;
+constexpr bool testConstexprSpan(Span sp) {
+ LIBCPP_ASSERT(noexcept(sp.back()));
+ return std::addressof(sp.back()) == sp.data() + sp.size() - 1;
}
template <typename Span>
-void testRuntimeSpan(Span sp)
-{
- LIBCPP_ASSERT(noexcept(sp.back()));
- assert(std::addressof(sp.back()) == sp.data() + sp.size() - 1);
+void testRuntimeSpan(Span sp) {
+ LIBCPP_ASSERT(noexcept(sp.back()));
+ assert(std::addressof(sp.back()) == sp.data() + sp.size() - 1);
}
template <typename Span>
-void testEmptySpan(Span sp)
-{
- if (!sp.empty())
- [[maybe_unused]] auto res = sp.back();
+void testEmptySpan(Span sp) {
+ if (!sp.empty()) [[maybe_unused]]
+ auto res = sp.back();
}
-struct A{};
-constexpr int iArr1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
-
-int main(int, char**)
-{
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 1)), "");
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 2)), "");
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 3)), "");
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 4)), "");
-
- static_assert(testConstexprSpan(std::span<const int, 1>(iArr1, 1)), "");
- static_assert(testConstexprSpan(std::span<const int, 2>(iArr1, 2)), "");
- static_assert(testConstexprSpan(std::span<const int, 3>(iArr1, 3)), "");
- static_assert(testConstexprSpan(std::span<const int, 4>(iArr1, 4)), "");
+struct A {};
+constexpr int iArr1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
+int main(int, char**) {
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 1)), "");
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 2)), "");
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 3)), "");
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 4)), "");
- testRuntimeSpan(std::span<int>(iArr2, 1));
- testRuntimeSpan(std::span<int>(iArr2, 2));
- testRuntimeSpan(std::span<int>(iArr2, 3));
- testRuntimeSpan(std::span<int>(iArr2, 4));
+ static_assert(testConstexprSpan(std::span<const int, 1>(iArr1, 1)), "");
+ static_assert(testConstexprSpan(std::span<const int, 2>(iArr1, 2)), "");
+ static_assert(testConstexprSpan(std::span<const int, 3>(iArr1, 3)), "");
+ static_assert(testConstexprSpan(std::span<const int, 4>(iArr1, 4)), "");
+ testRuntimeSpan(std::span<int>(iArr2, 1));
+ testRuntimeSpan(std::span<int>(iArr2, 2));
+ testRuntimeSpan(std::span<int>(iArr2, 3));
+ testRuntimeSpan(std::span<int>(iArr2, 4));
- testRuntimeSpan(std::span<int, 1>(iArr2, 1));
- testRuntimeSpan(std::span<int, 2>(iArr2, 2));
- testRuntimeSpan(std::span<int, 3>(iArr2, 3));
- testRuntimeSpan(std::span<int, 4>(iArr2, 4));
+ testRuntimeSpan(std::span<int, 1>(iArr2, 1));
+ testRuntimeSpan(std::span<int, 2>(iArr2, 2));
+ testRuntimeSpan(std::span<int, 3>(iArr2, 3));
+ testRuntimeSpan(std::span<int, 4>(iArr2, 4));
- std::string s;
- testRuntimeSpan(std::span<std::string> (&s, 1));
- testRuntimeSpan(std::span<std::string, 1>(&s, 1));
+ std::string s;
+ testRuntimeSpan(std::span<std::string>(&s, 1));
+ testRuntimeSpan(std::span<std::string, 1>(&s, 1));
- std::span<int, 0> sp;
- testEmptySpan(sp);
+ std::span<int, 0> sp;
+ testEmptySpan(sp);
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/views/views.span/span.elem/data.pass.cpp b/libcxx/test/std/containers/views/views.span/span.elem/data.pass.cpp
index 1bf63f95de9873b..a95b9772615bad0 100644
--- a/libcxx/test/std/containers/views/views.span/span.elem/data.pass.cpp
+++ b/libcxx/test/std/containers/views/views.span/span.elem/data.pass.cpp
@@ -12,110 +12,100 @@
// constexpr pointer data() const noexcept;
//
-
#include <span>
#include <cassert>
#include <string>
#include "test_macros.h"
-
template <typename Span>
-constexpr bool testConstexprSpan(Span sp, typename Span::pointer ptr)
-{
- ASSERT_NOEXCEPT(sp.data());
- return sp.data() == ptr;
+constexpr bool testConstexprSpan(Span sp, typename Span::pointer ptr) {
+ ASSERT_NOEXCEPT(sp.data());
+ return sp.data() == ptr;
}
-
template <typename Span>
-void testRuntimeSpan(Span sp, typename Span::pointer ptr)
-{
- ASSERT_NOEXCEPT(sp.data());
- assert(sp.data() == ptr);
+void testRuntimeSpan(Span sp, typename Span::pointer ptr) {
+ ASSERT_NOEXCEPT(sp.data());
+ assert(sp.data() == ptr);
}
-struct A{};
-constexpr int iArr1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
-
-int main(int, char**)
-{
-
-// dynamic size
- static_assert(testConstexprSpan(std::span<int>(), nullptr), "");
- static_assert(testConstexprSpan(std::span<long>(), nullptr), "");
- static_assert(testConstexprSpan(std::span<double>(), nullptr), "");
- static_assert(testConstexprSpan(std::span<A>(), nullptr), "");
- static_assert(testConstexprSpan(std::span<std::string>(), nullptr), "");
-
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 1), iArr1), "");
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 2), iArr1), "");
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 3), iArr1), "");
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 4), iArr1), "");
-
- static_assert(testConstexprSpan(std::span<const int>(iArr1 + 1, 1), iArr1 + 1), "");
- static_assert(testConstexprSpan(std::span<const int>(iArr1 + 2, 2), iArr1 + 2), "");
- static_assert(testConstexprSpan(std::span<const int>(iArr1 + 3, 3), iArr1 + 3), "");
- static_assert(testConstexprSpan(std::span<const int>(iArr1 + 4, 4), iArr1 + 4), "");
-
-// static size
- static_assert(testConstexprSpan(std::span<int, 0>(), nullptr), "");
- static_assert(testConstexprSpan(std::span<long, 0>(), nullptr), "");
- static_assert(testConstexprSpan(std::span<double, 0>(), nullptr), "");
- static_assert(testConstexprSpan(std::span<A, 0>(), nullptr), "");
- static_assert(testConstexprSpan(std::span<std::string, 0>(), nullptr), "");
-
- static_assert(testConstexprSpan(std::span<const int, 1>(iArr1, 1), iArr1), "");
- static_assert(testConstexprSpan(std::span<const int, 2>(iArr1, 2), iArr1), "");
- static_assert(testConstexprSpan(std::span<const int, 3>(iArr1, 3), iArr1), "");
- static_assert(testConstexprSpan(std::span<const int, 4>(iArr1, 4), iArr1), "");
-
- static_assert(testConstexprSpan(std::span<const int, 1>(iArr1 + 1, 1), iArr1 + 1), "");
- static_assert(testConstexprSpan(std::span<const int, 2>(iArr1 + 2, 2), iArr1 + 2), "");
- static_assert(testConstexprSpan(std::span<const int, 3>(iArr1 + 3, 3), iArr1 + 3), "");
- static_assert(testConstexprSpan(std::span<const int, 4>(iArr1 + 4, 4), iArr1 + 4), "");
-
-
-// dynamic size
- testRuntimeSpan(std::span<int>(), nullptr);
- testRuntimeSpan(std::span<long>(), nullptr);
- testRuntimeSpan(std::span<double>(), nullptr);
- testRuntimeSpan(std::span<A>(), nullptr);
- testRuntimeSpan(std::span<std::string>(), nullptr);
-
- testRuntimeSpan(std::span<int>(iArr2, 1), iArr2);
- testRuntimeSpan(std::span<int>(iArr2, 2), iArr2);
- testRuntimeSpan(std::span<int>(iArr2, 3), iArr2);
- testRuntimeSpan(std::span<int>(iArr2, 4), iArr2);
-
- testRuntimeSpan(std::span<int>(iArr2 + 1, 1), iArr2 + 1);
- testRuntimeSpan(std::span<int>(iArr2 + 2, 2), iArr2 + 2);
- testRuntimeSpan(std::span<int>(iArr2 + 3, 3), iArr2 + 3);
- testRuntimeSpan(std::span<int>(iArr2 + 4, 4), iArr2 + 4);
-
-// static size
- testRuntimeSpan(std::span<int, 0>(), nullptr);
- testRuntimeSpan(std::span<long, 0>(), nullptr);
- testRuntimeSpan(std::span<double, 0>(), nullptr);
- testRuntimeSpan(std::span<A, 0>(), nullptr);
- testRuntimeSpan(std::span<std::string, 0>(), nullptr);
-
- testRuntimeSpan(std::span<int, 1>(iArr2, 1), iArr2);
- testRuntimeSpan(std::span<int, 2>(iArr2, 2), iArr2);
- testRuntimeSpan(std::span<int, 3>(iArr2, 3), iArr2);
- testRuntimeSpan(std::span<int, 4>(iArr2, 4), iArr2);
-
- testRuntimeSpan(std::span<int, 1>(iArr2 + 1, 1), iArr2 + 1);
- testRuntimeSpan(std::span<int, 2>(iArr2 + 2, 2), iArr2 + 2);
- testRuntimeSpan(std::span<int, 3>(iArr2 + 3, 3), iArr2 + 3);
- testRuntimeSpan(std::span<int, 4>(iArr2 + 4, 4), iArr2 + 4);
-
-
- std::string s;
- testRuntimeSpan(std::span<std::string>(&s, 1), &s);
- testRuntimeSpan(std::span<std::string, 1>(&s, 1), &s);
-
+struct A {};
+constexpr int iArr1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
+
+int main(int, char**) {
+ // dynamic size
+ static_assert(testConstexprSpan(std::span<int>(), nullptr), "");
+ static_assert(testConstexprSpan(std::span<long>(), nullptr), "");
+ static_assert(testConstexprSpan(std::span<double>(), nullptr), "");
+ static_assert(testConstexprSpan(std::span<A>(), nullptr), "");
+ static_assert(testConstexprSpan(std::span<std::string>(), nullptr), "");
+
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 1), iArr1), "");
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 2), iArr1), "");
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 3), iArr1), "");
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 4), iArr1), "");
+
+ static_assert(testConstexprSpan(std::span<const int>(iArr1 + 1, 1), iArr1 + 1), "");
+ static_assert(testConstexprSpan(std::span<const int>(iArr1 + 2, 2), iArr1 + 2), "");
+ static_assert(testConstexprSpan(std::span<const int>(iArr1 + 3, 3), iArr1 + 3), "");
+ static_assert(testConstexprSpan(std::span<const int>(iArr1 + 4, 4), iArr1 + 4), "");
+
+ // static size
+ static_assert(testConstexprSpan(std::span<int, 0>(), nullptr), "");
+ static_assert(testConstexprSpan(std::span<long, 0>(), nullptr), "");
+ static_assert(testConstexprSpan(std::span<double, 0>(), nullptr), "");
+ static_assert(testConstexprSpan(std::span<A, 0>(), nullptr), "");
+ static_assert(testConstexprSpan(std::span<std::string, 0>(), nullptr), "");
+
+ static_assert(testConstexprSpan(std::span<const int, 1>(iArr1, 1), iArr1), "");
+ static_assert(testConstexprSpan(std::span<const int, 2>(iArr1, 2), iArr1), "");
+ static_assert(testConstexprSpan(std::span<const int, 3>(iArr1, 3), iArr1), "");
+ static_assert(testConstexprSpan(std::span<const int, 4>(iArr1, 4), iArr1), "");
+
+ static_assert(testConstexprSpan(std::span<const int, 1>(iArr1 + 1, 1), iArr1 + 1), "");
+ static_assert(testConstexprSpan(std::span<const int, 2>(iArr1 + 2, 2), iArr1 + 2), "");
+ static_assert(testConstexprSpan(std::span<const int, 3>(iArr1 + 3, 3), iArr1 + 3), "");
+ static_assert(testConstexprSpan(std::span<const int, 4>(iArr1 + 4, 4), iArr1 + 4), "");
+
+ // dynamic size
+ testRuntimeSpan(std::span<int>(), nullptr);
+ testRuntimeSpan(std::span<long>(), nullptr);
+ testRuntimeSpan(std::span<double>(), nullptr);
+ testRuntimeSpan(std::span<A>(), nullptr);
+ testRuntimeSpan(std::span<std::string>(), nullptr);
+
+ testRuntimeSpan(std::span<int>(iArr2, 1), iArr2);
+ testRuntimeSpan(std::span<int>(iArr2, 2), iArr2);
+ testRuntimeSpan(std::span<int>(iArr2, 3), iArr2);
+ testRuntimeSpan(std::span<int>(iArr2, 4), iArr2);
+
+ testRuntimeSpan(std::span<int>(iArr2 + 1, 1), iArr2 + 1);
+ testRuntimeSpan(std::span<int>(iArr2 + 2, 2), iArr2 + 2);
+ testRuntimeSpan(std::span<int>(iArr2 + 3, 3), iArr2 + 3);
+ testRuntimeSpan(std::span<int>(iArr2 + 4, 4), iArr2 + 4);
+
+ // static size
+ testRuntimeSpan(std::span<int, 0>(), nullptr);
+ testRuntimeSpan(std::span<long, 0>(), nullptr);
+ testRuntimeSpan(std::span<double, 0>(), nullptr);
+ testRuntimeSpan(std::span<A, 0>(), nullptr);
+ testRuntimeSpan(std::span<std::string, 0>(), nullptr);
+
+ testRuntimeSpan(std::span<int, 1>(iArr2, 1), iArr2);
+ testRuntimeSpan(std::span<int, 2>(iArr2, 2), iArr2);
+ testRuntimeSpan(std::span<int, 3>(iArr2, 3), iArr2);
+ testRuntimeSpan(std::span<int, 4>(iArr2, 4), iArr2);
+
+ testRuntimeSpan(std::span<int, 1>(iArr2 + 1, 1), iArr2 + 1);
+ testRuntimeSpan(std::span<int, 2>(iArr2 + 2, 2), iArr2 + 2);
+ testRuntimeSpan(std::span<int, 3>(iArr2 + 3, 3), iArr2 + 3);
+ testRuntimeSpan(std::span<int, 4>(iArr2 + 4, 4), iArr2 + 4);
+
+ std::string s;
+ testRuntimeSpan(std::span<std::string>(&s, 1), &s);
+ testRuntimeSpan(std::span<std::string, 1>(&s, 1), &s);
return 0;
}
diff --git a/libcxx/test/std/containers/views/views.span/span.elem/front.pass.cpp b/libcxx/test/std/containers/views/views.span/span.elem/front.pass.cpp
index e1c9a0c984a2314..0a5cb0641df2124 100644
--- a/libcxx/test/std/containers/views/views.span/span.elem/front.pass.cpp
+++ b/libcxx/test/std/containers/views/views.span/span.elem/front.pass.cpp
@@ -14,70 +14,61 @@
// Effects: Equivalent to: return *data();
//
-
#include <span>
#include <cassert>
#include <string>
#include "test_macros.h"
-
template <typename Span>
-constexpr bool testConstexprSpan(Span sp)
-{
- LIBCPP_ASSERT(noexcept(sp.front()));
- return std::addressof(sp.front()) == sp.data();
+constexpr bool testConstexprSpan(Span sp) {
+ LIBCPP_ASSERT(noexcept(sp.front()));
+ return std::addressof(sp.front()) == sp.data();
}
-
template <typename Span>
-void testRuntimeSpan(Span sp)
-{
- LIBCPP_ASSERT(noexcept(sp.front()));
- assert(std::addressof(sp.front()) == sp.data());
+void testRuntimeSpan(Span sp) {
+ LIBCPP_ASSERT(noexcept(sp.front()));
+ assert(std::addressof(sp.front()) == sp.data());
}
template <typename Span>
-void testEmptySpan(Span sp)
-{
- if (!sp.empty())
- [[maybe_unused]] auto res = sp.front();
+void testEmptySpan(Span sp) {
+ if (!sp.empty()) [[maybe_unused]]
+ auto res = sp.front();
}
-struct A{};
-constexpr int iArr1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
-
-int main(int, char**)
-{
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 1)), "");
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 2)), "");
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 3)), "");
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 4)), "");
-
- static_assert(testConstexprSpan(std::span<const int, 1>(iArr1, 1)), "");
- static_assert(testConstexprSpan(std::span<const int, 2>(iArr1, 2)), "");
- static_assert(testConstexprSpan(std::span<const int, 3>(iArr1, 3)), "");
- static_assert(testConstexprSpan(std::span<const int, 4>(iArr1, 4)), "");
+struct A {};
+constexpr int iArr1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
+int main(int, char**) {
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 1)), "");
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 2)), "");
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 3)), "");
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 4)), "");
- testRuntimeSpan(std::span<int>(iArr2, 1));
- testRuntimeSpan(std::span<int>(iArr2, 2));
- testRuntimeSpan(std::span<int>(iArr2, 3));
- testRuntimeSpan(std::span<int>(iArr2, 4));
+ static_assert(testConstexprSpan(std::span<const int, 1>(iArr1, 1)), "");
+ static_assert(testConstexprSpan(std::span<const int, 2>(iArr1, 2)), "");
+ static_assert(testConstexprSpan(std::span<const int, 3>(iArr1, 3)), "");
+ static_assert(testConstexprSpan(std::span<const int, 4>(iArr1, 4)), "");
+ testRuntimeSpan(std::span<int>(iArr2, 1));
+ testRuntimeSpan(std::span<int>(iArr2, 2));
+ testRuntimeSpan(std::span<int>(iArr2, 3));
+ testRuntimeSpan(std::span<int>(iArr2, 4));
- testRuntimeSpan(std::span<int, 1>(iArr2, 1));
- testRuntimeSpan(std::span<int, 2>(iArr2, 2));
- testRuntimeSpan(std::span<int, 3>(iArr2, 3));
- testRuntimeSpan(std::span<int, 4>(iArr2, 4));
+ testRuntimeSpan(std::span<int, 1>(iArr2, 1));
+ testRuntimeSpan(std::span<int, 2>(iArr2, 2));
+ testRuntimeSpan(std::span<int, 3>(iArr2, 3));
+ testRuntimeSpan(std::span<int, 4>(iArr2, 4));
- std::string s;
- testRuntimeSpan(std::span<std::string> (&s, 1));
- testRuntimeSpan(std::span<std::string, 1>(&s, 1));
+ std::string s;
+ testRuntimeSpan(std::span<std::string>(&s, 1));
+ testRuntimeSpan(std::span<std::string, 1>(&s, 1));
- std::span<int, 0> sp;
- testEmptySpan(sp);
+ std::span<int, 0> sp;
+ testEmptySpan(sp);
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/containers/views/views.span/span.elem/op_idx.pass.cpp b/libcxx/test/std/containers/views/views.span/span.elem/op_idx.pass.cpp
index b7f36c57585881b..4ba2896553027b7 100644
--- a/libcxx/test/std/containers/views/views.span/span.elem/op_idx.pass.cpp
+++ b/libcxx/test/std/containers/views/views.span/span.elem/op_idx.pass.cpp
@@ -12,102 +12,93 @@
// constexpr reference operator[](size_type idx) const;
//
-
#include <span>
#include <cassert>
#include <string>
#include "test_macros.h"
-
template <typename Span>
-constexpr bool testConstexprSpan(Span sp, std::size_t idx)
-{
- LIBCPP_ASSERT(noexcept(sp[idx]));
+constexpr bool testConstexprSpan(Span sp, std::size_t idx) {
+ LIBCPP_ASSERT(noexcept(sp[idx]));
- typename Span::reference r1 = sp[idx];
- typename Span::reference r2 = *(sp.data() + idx);
- return r1 == r2;
+ typename Span::reference r1 = sp[idx];
+ typename Span::reference r2 = *(sp.data() + idx);
+ return r1 == r2;
}
-
template <typename Span>
-void testRuntimeSpan(Span sp, std::size_t idx)
-{
- LIBCPP_ASSERT(noexcept(sp[idx]));
+void testRuntimeSpan(Span sp, std::size_t idx) {
+ LIBCPP_ASSERT(noexcept(sp[idx]));
- typename Span::reference r1 = sp[idx];
- typename Span::reference r2 = *(sp.data() + idx);
- assert(r1 == r2);
+ typename Span::reference r1 = sp[idx];
+ typename Span::reference r2 = *(sp.data() + idx);
+ assert(r1 == r2);
}
-constexpr int iArr1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
-
-int main(int, char**)
-{
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 1), 0), "");
-
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 2), 0), "");
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 2), 1), "");
-
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 3), 0), "");
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 3), 1), "");
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 3), 2), "");
+constexpr int iArr1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 4), 0), "");
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 4), 1), "");
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 4), 2), "");
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 4), 3), "");
+int main(int, char**) {
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 1), 0), "");
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 2), 0), "");
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 2), 1), "");
- static_assert(testConstexprSpan(std::span<const int, 1>(iArr1, 1), 0), "");
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 3), 0), "");
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 3), 1), "");
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 3), 2), "");
- static_assert(testConstexprSpan(std::span<const int, 2>(iArr1, 2), 0), "");
- static_assert(testConstexprSpan(std::span<const int, 2>(iArr1, 2), 1), "");
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 4), 0), "");
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 4), 1), "");
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 4), 2), "");
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 4), 3), "");
- static_assert(testConstexprSpan(std::span<const int, 3>(iArr1, 3), 0), "");
- static_assert(testConstexprSpan(std::span<const int, 3>(iArr1, 3), 1), "");
- static_assert(testConstexprSpan(std::span<const int, 3>(iArr1, 3), 2), "");
+ static_assert(testConstexprSpan(std::span<const int, 1>(iArr1, 1), 0), "");
- static_assert(testConstexprSpan(std::span<const int, 4>(iArr1, 4), 0), "");
- static_assert(testConstexprSpan(std::span<const int, 4>(iArr1, 4), 1), "");
- static_assert(testConstexprSpan(std::span<const int, 4>(iArr1, 4), 2), "");
- static_assert(testConstexprSpan(std::span<const int, 4>(iArr1, 4), 3), "");
+ static_assert(testConstexprSpan(std::span<const int, 2>(iArr1, 2), 0), "");
+ static_assert(testConstexprSpan(std::span<const int, 2>(iArr1, 2), 1), "");
+ static_assert(testConstexprSpan(std::span<const int, 3>(iArr1, 3), 0), "");
+ static_assert(testConstexprSpan(std::span<const int, 3>(iArr1, 3), 1), "");
+ static_assert(testConstexprSpan(std::span<const int, 3>(iArr1, 3), 2), "");
- testRuntimeSpan(std::span<int>(iArr2, 1), 0);
+ static_assert(testConstexprSpan(std::span<const int, 4>(iArr1, 4), 0), "");
+ static_assert(testConstexprSpan(std::span<const int, 4>(iArr1, 4), 1), "");
+ static_assert(testConstexprSpan(std::span<const int, 4>(iArr1, 4), 2), "");
+ static_assert(testConstexprSpan(std::span<const int, 4>(iArr1, 4), 3), "");
- testRuntimeSpan(std::span<int>(iArr2, 2), 0);
- testRuntimeSpan(std::span<int>(iArr2, 2), 1);
+ testRuntimeSpan(std::span<int>(iArr2, 1), 0);
- testRuntimeSpan(std::span<int>(iArr2, 3), 0);
- testRuntimeSpan(std::span<int>(iArr2, 3), 1);
- testRuntimeSpan(std::span<int>(iArr2, 3), 2);
+ testRuntimeSpan(std::span<int>(iArr2, 2), 0);
+ testRuntimeSpan(std::span<int>(iArr2, 2), 1);
- testRuntimeSpan(std::span<int>(iArr2, 4), 0);
- testRuntimeSpan(std::span<int>(iArr2, 4), 1);
- testRuntimeSpan(std::span<int>(iArr2, 4), 2);
- testRuntimeSpan(std::span<int>(iArr2, 4), 3);
+ testRuntimeSpan(std::span<int>(iArr2, 3), 0);
+ testRuntimeSpan(std::span<int>(iArr2, 3), 1);
+ testRuntimeSpan(std::span<int>(iArr2, 3), 2);
+ testRuntimeSpan(std::span<int>(iArr2, 4), 0);
+ testRuntimeSpan(std::span<int>(iArr2, 4), 1);
+ testRuntimeSpan(std::span<int>(iArr2, 4), 2);
+ testRuntimeSpan(std::span<int>(iArr2, 4), 3);
- testRuntimeSpan(std::span<int, 1>(iArr2, 1), 0);
+ testRuntimeSpan(std::span<int, 1>(iArr2, 1), 0);
- testRuntimeSpan(std::span<int, 2>(iArr2, 2), 0);
- testRuntimeSpan(std::span<int, 2>(iArr2, 2), 1);
+ testRuntimeSpan(std::span<int, 2>(iArr2, 2), 0);
+ testRuntimeSpan(std::span<int, 2>(iArr2, 2), 1);
- testRuntimeSpan(std::span<int, 3>(iArr2, 3), 0);
- testRuntimeSpan(std::span<int, 3>(iArr2, 3), 1);
- testRuntimeSpan(std::span<int, 3>(iArr2, 3), 2);
+ testRuntimeSpan(std::span<int, 3>(iArr2, 3), 0);
+ testRuntimeSpan(std::span<int, 3>(iArr2, 3), 1);
+ testRuntimeSpan(std::span<int, 3>(iArr2, 3), 2);
- testRuntimeSpan(std::span<int, 4>(iArr2, 4), 0);
- testRuntimeSpan(std::span<int, 4>(iArr2, 4), 1);
- testRuntimeSpan(std::span<int, 4>(iArr2, 4), 2);
- testRuntimeSpan(std::span<int, 4>(iArr2, 4), 3);
+ testRuntimeSpan(std::span<int, 4>(iArr2, 4), 0);
+ testRuntimeSpan(std::span<int, 4>(iArr2, 4), 1);
+ testRuntimeSpan(std::span<int, 4>(iArr2, 4), 2);
+ testRuntimeSpan(std::span<int, 4>(iArr2, 4), 3);
- std::string s;
- testRuntimeSpan(std::span<std::string> (&s, 1), 0);
- testRuntimeSpan(std::span<std::string, 1>(&s, 1), 0);
+ std::string s;
+ testRuntimeSpan(std::span<std::string>(&s, 1), 0);
+ testRuntimeSpan(std::span<std::string, 1>(&s, 1), 0);
return 0;
}
diff --git a/libcxx/test/std/containers/views/views.span/span.iterators/begin.pass.cpp b/libcxx/test/std/containers/views/views.span/span.iterators/begin.pass.cpp
index f6b24017ffc1f99..4792b756e42dcb0 100644
--- a/libcxx/test/std/containers/views/views.span/span.iterators/begin.pass.cpp
+++ b/libcxx/test/std/containers/views/views.span/span.iterators/begin.pass.cpp
@@ -19,89 +19,77 @@
#include "test_macros.h"
template <class Span>
-constexpr bool testConstexprSpan(Span s)
-{
- bool ret = true;
- typename Span::iterator b = s.begin();
-
- if (s.empty())
- {
- ret = ret && (b == s.end());
- }
- else
- {
- ret = ret && ( *b == s[0]);
- ret = ret && (&*b == &s[0]);
- }
- return ret;
+constexpr bool testConstexprSpan(Span s) {
+ bool ret = true;
+ typename Span::iterator b = s.begin();
+
+ if (s.empty()) {
+ ret = ret && (b == s.end());
+ } else {
+ ret = ret && (*b == s[0]);
+ ret = ret && (&*b == &s[0]);
+ }
+ return ret;
}
-
template <class Span>
-void testRuntimeSpan(Span s)
-{
- typename Span::iterator b = s.begin();
-
- if (s.empty())
- {
- assert(b == s.end());
- }
- else
- {
- assert( *b == s[0]);
- assert(&*b == &s[0]);
- }
+void testRuntimeSpan(Span s) {
+ typename Span::iterator b = s.begin();
+
+ if (s.empty()) {
+ assert(b == s.end());
+ } else {
+ assert(*b == s[0]);
+ assert(&*b == &s[0]);
+ }
}
-struct A{};
-bool operator==(A, A) {return true;}
-
-constexpr int iArr1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
-
-
-int main(int, char**)
-{
- static_assert(testConstexprSpan(std::span<int>()), "");
- static_assert(testConstexprSpan(std::span<long>()), "");
- static_assert(testConstexprSpan(std::span<double>()), "");
- static_assert(testConstexprSpan(std::span<A>()), "");
- static_assert(testConstexprSpan(std::span<std::string>()), "");
-
- static_assert(testConstexprSpan(std::span<int, 0>()), "");
- static_assert(testConstexprSpan(std::span<long, 0>()), "");
- static_assert(testConstexprSpan(std::span<double, 0>()), "");
- static_assert(testConstexprSpan(std::span<A, 0>()), "");
- static_assert(testConstexprSpan(std::span<std::string, 0>()), "");
-
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 1)), "");
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 2)), "");
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 3)), "");
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 4)), "");
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 5)), "");
-
-
- testRuntimeSpan(std::span<int> ());
- testRuntimeSpan(std::span<long> ());
- testRuntimeSpan(std::span<double> ());
- testRuntimeSpan(std::span<A> ());
- testRuntimeSpan(std::span<std::string>());
-
- testRuntimeSpan(std::span<int, 0> ());
- testRuntimeSpan(std::span<long, 0> ());
- testRuntimeSpan(std::span<double, 0> ());
- testRuntimeSpan(std::span<A, 0> ());
- testRuntimeSpan(std::span<std::string, 0>());
-
- testRuntimeSpan(std::span<int>(iArr2, 1));
- testRuntimeSpan(std::span<int>(iArr2, 2));
- testRuntimeSpan(std::span<int>(iArr2, 3));
- testRuntimeSpan(std::span<int>(iArr2, 4));
- testRuntimeSpan(std::span<int>(iArr2, 5));
-
- std::string s;
- testRuntimeSpan(std::span<std::string>(&s, (std::size_t) 0));
- testRuntimeSpan(std::span<std::string>(&s, 1));
+struct A {};
+bool operator==(A, A) { return true; }
+
+constexpr int iArr1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
+
+int main(int, char**) {
+ static_assert(testConstexprSpan(std::span<int>()), "");
+ static_assert(testConstexprSpan(std::span<long>()), "");
+ static_assert(testConstexprSpan(std::span<double>()), "");
+ static_assert(testConstexprSpan(std::span<A>()), "");
+ static_assert(testConstexprSpan(std::span<std::string>()), "");
+
+ static_assert(testConstexprSpan(std::span<int, 0>()), "");
+ static_assert(testConstexprSpan(std::span<long, 0>()), "");
+ static_assert(testConstexprSpan(std::span<double, 0>()), "");
+ static_assert(testConstexprSpan(std::span<A, 0>()), "");
+ static_assert(testConstexprSpan(std::span<std::string, 0>()), "");
+
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 1)), "");
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 2)), "");
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 3)), "");
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 4)), "");
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 5)), "");
+
+ testRuntimeSpan(std::span<int>());
+ testRuntimeSpan(std::span<long>());
+ testRuntimeSpan(std::span<double>());
+ testRuntimeSpan(std::span<A>());
+ testRuntimeSpan(std::span<std::string>());
+
+ testRuntimeSpan(std::span<int, 0>());
+ testRuntimeSpan(std::span<long, 0>());
+ testRuntimeSpan(std::span<double, 0>());
+ testRuntimeSpan(std::span<A, 0>());
+ testRuntimeSpan(std::span<std::string, 0>());
+
+ testRuntimeSpan(std::span<int>(iArr2, 1));
+ testRuntimeSpan(std::span<int>(iArr2, 2));
+ testRuntimeSpan(std::span<int>(iArr2, 3));
+ testRuntimeSpan(std::span<int>(iArr2, 4));
+ testRuntimeSpan(std::span<int>(iArr2, 5));
+
+ std::string s;
+ testRuntimeSpan(std::span<std::string>(&s, (std::size_t)0));
+ testRuntimeSpan(std::span<std::string>(&s, 1));
return 0;
}
diff --git a/libcxx/test/std/containers/views/views.span/span.iterators/end.pass.cpp b/libcxx/test/std/containers/views/views.span/span.iterators/end.pass.cpp
index d6aaf74d1058c36..0daa55bf0542c47 100644
--- a/libcxx/test/std/containers/views/views.span/span.iterators/end.pass.cpp
+++ b/libcxx/test/std/containers/views/views.span/span.iterators/end.pass.cpp
@@ -19,93 +19,81 @@
#include "test_macros.h"
template <class Span>
-constexpr bool testConstexprSpan(Span s)
-{
- bool ret = true;
- typename Span::iterator e = s.end();
- if (s.empty())
- {
- ret = ret && (e == s.begin());
- }
- else
- {
- typename Span::const_pointer last = &*(s.begin() + s.size() - 1);
- ret = ret && (e != s.begin());
- ret = ret && (&*( e-1) == last);
- }
-
- ret = ret && (static_cast<std::size_t>(e - s.begin()) == s.size());
- return ret;
+constexpr bool testConstexprSpan(Span s) {
+ bool ret = true;
+ typename Span::iterator e = s.end();
+ if (s.empty()) {
+ ret = ret && (e == s.begin());
+ } else {
+ typename Span::const_pointer last = &*(s.begin() + s.size() - 1);
+ ret = ret && (e != s.begin());
+ ret = ret && (&*(e - 1) == last);
+ }
+
+ ret = ret && (static_cast<std::size_t>(e - s.begin()) == s.size());
+ return ret;
}
template <class Span>
-void testRuntimeSpan(Span s)
-{
- typename Span::iterator e = s.end();
- if (s.empty())
- {
- assert(e == s.begin());
- }
- else
- {
- typename Span::const_pointer last = &*(s.begin() + s.size() - 1);
- assert(e != s.begin());
- assert(&*( e-1) == last);
- }
-
- assert(static_cast<std::size_t>(e - s.begin()) == s.size());
+void testRuntimeSpan(Span s) {
+ typename Span::iterator e = s.end();
+ if (s.empty()) {
+ assert(e == s.begin());
+ } else {
+ typename Span::const_pointer last = &*(s.begin() + s.size() - 1);
+ assert(e != s.begin());
+ assert(&*(e - 1) == last);
+ }
+
+ assert(static_cast<std::size_t>(e - s.begin()) == s.size());
}
-
-struct A{};
-bool operator==(A, A) {return true;}
-
-constexpr int iArr1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
-
-
-int main(int, char**)
-{
- static_assert(testConstexprSpan(std::span<int>()), "");
- static_assert(testConstexprSpan(std::span<long>()), "");
- static_assert(testConstexprSpan(std::span<double>()), "");
- static_assert(testConstexprSpan(std::span<A>()), "");
- static_assert(testConstexprSpan(std::span<std::string>()), "");
-
- static_assert(testConstexprSpan(std::span<int, 0>()), "");
- static_assert(testConstexprSpan(std::span<long, 0>()), "");
- static_assert(testConstexprSpan(std::span<double, 0>()), "");
- static_assert(testConstexprSpan(std::span<A, 0>()), "");
- static_assert(testConstexprSpan(std::span<std::string, 0>()), "");
-
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 1)), "");
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 2)), "");
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 3)), "");
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 4)), "");
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 5)), "");
-
-
- testRuntimeSpan(std::span<int> ());
- testRuntimeSpan(std::span<long> ());
- testRuntimeSpan(std::span<double> ());
- testRuntimeSpan(std::span<A> ());
- testRuntimeSpan(std::span<std::string>());
-
- testRuntimeSpan(std::span<int, 0> ());
- testRuntimeSpan(std::span<long, 0> ());
- testRuntimeSpan(std::span<double, 0> ());
- testRuntimeSpan(std::span<A, 0> ());
- testRuntimeSpan(std::span<std::string, 0>());
-
- testRuntimeSpan(std::span<int>(iArr2, 1));
- testRuntimeSpan(std::span<int>(iArr2, 2));
- testRuntimeSpan(std::span<int>(iArr2, 3));
- testRuntimeSpan(std::span<int>(iArr2, 4));
- testRuntimeSpan(std::span<int>(iArr2, 5));
-
- std::string s;
- testRuntimeSpan(std::span<std::string>(&s, (std::size_t) 0));
- testRuntimeSpan(std::span<std::string>(&s, 1));
+struct A {};
+bool operator==(A, A) { return true; }
+
+constexpr int iArr1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
+
+int main(int, char**) {
+ static_assert(testConstexprSpan(std::span<int>()), "");
+ static_assert(testConstexprSpan(std::span<long>()), "");
+ static_assert(testConstexprSpan(std::span<double>()), "");
+ static_assert(testConstexprSpan(std::span<A>()), "");
+ static_assert(testConstexprSpan(std::span<std::string>()), "");
+
+ static_assert(testConstexprSpan(std::span<int, 0>()), "");
+ static_assert(testConstexprSpan(std::span<long, 0>()), "");
+ static_assert(testConstexprSpan(std::span<double, 0>()), "");
+ static_assert(testConstexprSpan(std::span<A, 0>()), "");
+ static_assert(testConstexprSpan(std::span<std::string, 0>()), "");
+
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 1)), "");
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 2)), "");
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 3)), "");
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 4)), "");
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 5)), "");
+
+ testRuntimeSpan(std::span<int>());
+ testRuntimeSpan(std::span<long>());
+ testRuntimeSpan(std::span<double>());
+ testRuntimeSpan(std::span<A>());
+ testRuntimeSpan(std::span<std::string>());
+
+ testRuntimeSpan(std::span<int, 0>());
+ testRuntimeSpan(std::span<long, 0>());
+ testRuntimeSpan(std::span<double, 0>());
+ testRuntimeSpan(std::span<A, 0>());
+ testRuntimeSpan(std::span<std::string, 0>());
+
+ testRuntimeSpan(std::span<int>(iArr2, 1));
+ testRuntimeSpan(std::span<int>(iArr2, 2));
+ testRuntimeSpan(std::span<int>(iArr2, 3));
+ testRuntimeSpan(std::span<int>(iArr2, 4));
+ testRuntimeSpan(std::span<int>(iArr2, 5));
+
+ std::string s;
+ testRuntimeSpan(std::span<std::string>(&s, (std::size_t)0));
+ testRuntimeSpan(std::span<std::string>(&s, 1));
return 0;
}
diff --git a/libcxx/test/std/containers/views/views.span/span.iterators/iterator_concept_conformance.compile.pass.cpp b/libcxx/test/std/containers/views/views.span/span.iterators/iterator_concept_conformance.compile.pass.cpp
index 1d9ea600bd2a06b..e07be3efb4a36d0 100644
--- a/libcxx/test/std/containers/views/views.span/span.iterators/iterator_concept_conformance.compile.pass.cpp
+++ b/libcxx/test/std/containers/views/views.span/span.iterators/iterator_concept_conformance.compile.pass.cpp
@@ -15,9 +15,9 @@
#include <iterator>
#include "test_macros.h"
-using iterator = std::span<int>::iterator;
+using iterator = std::span<int>::iterator;
using reverse_iterator = std::span<int>::reverse_iterator;
-using value_type = int;
+using value_type = int;
static_assert(std::contiguous_iterator<iterator>);
LIBCPP_STATIC_ASSERT(std::__has_random_access_iterator_category<iterator>::value);
diff --git a/libcxx/test/std/containers/views/views.span/span.iterators/rbegin.pass.cpp b/libcxx/test/std/containers/views/views.span/span.iterators/rbegin.pass.cpp
index 26e4389840857f4..1030dec7f6e4044 100644
--- a/libcxx/test/std/containers/views/views.span/span.iterators/rbegin.pass.cpp
+++ b/libcxx/test/std/containers/views/views.span/span.iterators/rbegin.pass.cpp
@@ -19,90 +19,77 @@
#include "test_macros.h"
template <class Span>
-constexpr bool testConstexprSpan(Span s)
-{
- bool ret = true;
- typename Span::reverse_iterator b = s.rbegin();
- if (s.empty())
- {
- ret = ret && ( b == s.rend());
- }
- else
- {
- const typename Span::size_type last = s.size() - 1;
- ret = ret && ( *b == s[last]);
- ret = ret && (&*b == &s[last]);
- }
- return ret;
+constexpr bool testConstexprSpan(Span s) {
+ bool ret = true;
+ typename Span::reverse_iterator b = s.rbegin();
+ if (s.empty()) {
+ ret = ret && (b == s.rend());
+ } else {
+ const typename Span::size_type last = s.size() - 1;
+ ret = ret && (*b == s[last]);
+ ret = ret && (&*b == &s[last]);
+ }
+ return ret;
}
-
template <class Span>
-void testRuntimeSpan(Span s)
-{
- typename Span::reverse_iterator b = s.rbegin();
- if (s.empty())
- {
- assert(b == s.rend());
- }
- else
- {
- const typename Span::size_type last = s.size() - 1;
- assert( *b == s[last]);
- assert(&*b == &s[last]);
- }
+void testRuntimeSpan(Span s) {
+ typename Span::reverse_iterator b = s.rbegin();
+ if (s.empty()) {
+ assert(b == s.rend());
+ } else {
+ const typename Span::size_type last = s.size() - 1;
+ assert(*b == s[last]);
+ assert(&*b == &s[last]);
+ }
}
-
-struct A{};
-bool operator==(A, A) {return true;}
-
-constexpr int iArr1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
-
-
-int main(int, char**)
-{
- static_assert(testConstexprSpan(std::span<int>()), "");
- static_assert(testConstexprSpan(std::span<long>()), "");
- static_assert(testConstexprSpan(std::span<double>()), "");
- static_assert(testConstexprSpan(std::span<A>()), "");
- static_assert(testConstexprSpan(std::span<std::string>()), "");
-
- static_assert(testConstexprSpan(std::span<int, 0>()), "");
- static_assert(testConstexprSpan(std::span<long, 0>()), "");
- static_assert(testConstexprSpan(std::span<double, 0>()), "");
- static_assert(testConstexprSpan(std::span<A, 0>()), "");
- static_assert(testConstexprSpan(std::span<std::string, 0>()), "");
-
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 1)), "");
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 2)), "");
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 3)), "");
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 4)), "");
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 5)), "");
-
-
- testRuntimeSpan(std::span<int> ());
- testRuntimeSpan(std::span<long> ());
- testRuntimeSpan(std::span<double> ());
- testRuntimeSpan(std::span<A> ());
- testRuntimeSpan(std::span<std::string>());
-
- testRuntimeSpan(std::span<int, 0> ());
- testRuntimeSpan(std::span<long, 0> ());
- testRuntimeSpan(std::span<double, 0> ());
- testRuntimeSpan(std::span<A, 0> ());
- testRuntimeSpan(std::span<std::string, 0>());
-
- testRuntimeSpan(std::span<int>(iArr2, 1));
- testRuntimeSpan(std::span<int>(iArr2, 2));
- testRuntimeSpan(std::span<int>(iArr2, 3));
- testRuntimeSpan(std::span<int>(iArr2, 4));
- testRuntimeSpan(std::span<int>(iArr2, 5));
-
- std::string s;
- testRuntimeSpan(std::span<std::string>(&s, static_cast<std::size_t>(0)));
- testRuntimeSpan(std::span<std::string>(&s, 1));
+struct A {};
+bool operator==(A, A) { return true; }
+
+constexpr int iArr1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
+
+int main(int, char**) {
+ static_assert(testConstexprSpan(std::span<int>()), "");
+ static_assert(testConstexprSpan(std::span<long>()), "");
+ static_assert(testConstexprSpan(std::span<double>()), "");
+ static_assert(testConstexprSpan(std::span<A>()), "");
+ static_assert(testConstexprSpan(std::span<std::string>()), "");
+
+ static_assert(testConstexprSpan(std::span<int, 0>()), "");
+ static_assert(testConstexprSpan(std::span<long, 0>()), "");
+ static_assert(testConstexprSpan(std::span<double, 0>()), "");
+ static_assert(testConstexprSpan(std::span<A, 0>()), "");
+ static_assert(testConstexprSpan(std::span<std::string, 0>()), "");
+
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 1)), "");
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 2)), "");
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 3)), "");
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 4)), "");
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 5)), "");
+
+ testRuntimeSpan(std::span<int>());
+ testRuntimeSpan(std::span<long>());
+ testRuntimeSpan(std::span<double>());
+ testRuntimeSpan(std::span<A>());
+ testRuntimeSpan(std::span<std::string>());
+
+ testRuntimeSpan(std::span<int, 0>());
+ testRuntimeSpan(std::span<long, 0>());
+ testRuntimeSpan(std::span<double, 0>());
+ testRuntimeSpan(std::span<A, 0>());
+ testRuntimeSpan(std::span<std::string, 0>());
+
+ testRuntimeSpan(std::span<int>(iArr2, 1));
+ testRuntimeSpan(std::span<int>(iArr2, 2));
+ testRuntimeSpan(std::span<int>(iArr2, 3));
+ testRuntimeSpan(std::span<int>(iArr2, 4));
+ testRuntimeSpan(std::span<int>(iArr2, 5));
+
+ std::string s;
+ testRuntimeSpan(std::span<std::string>(&s, static_cast<std::size_t>(0)));
+ testRuntimeSpan(std::span<std::string>(&s, 1));
return 0;
}
diff --git a/libcxx/test/std/containers/views/views.span/span.iterators/rend.pass.cpp b/libcxx/test/std/containers/views/views.span/span.iterators/rend.pass.cpp
index ffec15c6b2492cd..ca2b781aaf61439 100644
--- a/libcxx/test/std/containers/views/views.span/span.iterators/rend.pass.cpp
+++ b/libcxx/test/std/containers/views/views.span/span.iterators/rend.pass.cpp
@@ -19,89 +19,77 @@
#include "test_macros.h"
template <class Span>
-constexpr bool testConstexprSpan(Span s)
-{
- bool ret = true;
- typename Span::reverse_iterator e = s.rend();
- if (s.empty())
- {
- ret = ret && (e == s.rbegin());
- }
- else
- {
- ret = ret && (e != s.rbegin());
- }
-
- ret = ret && (static_cast<std::size_t>(e - s.rbegin()) == s.size());
- return ret;
+constexpr bool testConstexprSpan(Span s) {
+ bool ret = true;
+ typename Span::reverse_iterator e = s.rend();
+ if (s.empty()) {
+ ret = ret && (e == s.rbegin());
+ } else {
+ ret = ret && (e != s.rbegin());
+ }
+
+ ret = ret && (static_cast<std::size_t>(e - s.rbegin()) == s.size());
+ return ret;
}
template <class Span>
-void testRuntimeSpan(Span s)
-{
- typename Span::reverse_iterator e = s.rend();
- if (s.empty())
- {
- assert(e == s.rbegin());
- }
- else
- {
- assert(e != s.rbegin());
- }
-
- assert(static_cast<std::size_t>(e - s.rbegin()) == s.size());
+void testRuntimeSpan(Span s) {
+ typename Span::reverse_iterator e = s.rend();
+ if (s.empty()) {
+ assert(e == s.rbegin());
+ } else {
+ assert(e != s.rbegin());
+ }
+
+ assert(static_cast<std::size_t>(e - s.rbegin()) == s.size());
}
-
-struct A{};
-bool operator==(A, A) {return true;}
-
-constexpr int iArr1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
-
-
-int main(int, char**)
-{
- static_assert(testConstexprSpan(std::span<int>()), "");
- static_assert(testConstexprSpan(std::span<long>()), "");
- static_assert(testConstexprSpan(std::span<double>()), "");
- static_assert(testConstexprSpan(std::span<A>()), "");
- static_assert(testConstexprSpan(std::span<std::string>()), "");
-
- static_assert(testConstexprSpan(std::span<int, 0>()), "");
- static_assert(testConstexprSpan(std::span<long, 0>()), "");
- static_assert(testConstexprSpan(std::span<double, 0>()), "");
- static_assert(testConstexprSpan(std::span<A, 0>()), "");
- static_assert(testConstexprSpan(std::span<std::string, 0>()), "");
-
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 1)), "");
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 2)), "");
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 3)), "");
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 4)), "");
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 5)), "");
-
-
- testRuntimeSpan(std::span<int> ());
- testRuntimeSpan(std::span<long> ());
- testRuntimeSpan(std::span<double> ());
- testRuntimeSpan(std::span<A> ());
- testRuntimeSpan(std::span<std::string>());
-
- testRuntimeSpan(std::span<int, 0> ());
- testRuntimeSpan(std::span<long, 0> ());
- testRuntimeSpan(std::span<double, 0> ());
- testRuntimeSpan(std::span<A, 0> ());
- testRuntimeSpan(std::span<std::string, 0>());
-
- testRuntimeSpan(std::span<int>(iArr2, 1));
- testRuntimeSpan(std::span<int>(iArr2, 2));
- testRuntimeSpan(std::span<int>(iArr2, 3));
- testRuntimeSpan(std::span<int>(iArr2, 4));
- testRuntimeSpan(std::span<int>(iArr2, 5));
-
- std::string s;
- testRuntimeSpan(std::span<std::string>(&s, (std::size_t) 0));
- testRuntimeSpan(std::span<std::string>(&s, 1));
+struct A {};
+bool operator==(A, A) { return true; }
+
+constexpr int iArr1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
+
+int main(int, char**) {
+ static_assert(testConstexprSpan(std::span<int>()), "");
+ static_assert(testConstexprSpan(std::span<long>()), "");
+ static_assert(testConstexprSpan(std::span<double>()), "");
+ static_assert(testConstexprSpan(std::span<A>()), "");
+ static_assert(testConstexprSpan(std::span<std::string>()), "");
+
+ static_assert(testConstexprSpan(std::span<int, 0>()), "");
+ static_assert(testConstexprSpan(std::span<long, 0>()), "");
+ static_assert(testConstexprSpan(std::span<double, 0>()), "");
+ static_assert(testConstexprSpan(std::span<A, 0>()), "");
+ static_assert(testConstexprSpan(std::span<std::string, 0>()), "");
+
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 1)), "");
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 2)), "");
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 3)), "");
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 4)), "");
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 5)), "");
+
+ testRuntimeSpan(std::span<int>());
+ testRuntimeSpan(std::span<long>());
+ testRuntimeSpan(std::span<double>());
+ testRuntimeSpan(std::span<A>());
+ testRuntimeSpan(std::span<std::string>());
+
+ testRuntimeSpan(std::span<int, 0>());
+ testRuntimeSpan(std::span<long, 0>());
+ testRuntimeSpan(std::span<double, 0>());
+ testRuntimeSpan(std::span<A, 0>());
+ testRuntimeSpan(std::span<std::string, 0>());
+
+ testRuntimeSpan(std::span<int>(iArr2, 1));
+ testRuntimeSpan(std::span<int>(iArr2, 2));
+ testRuntimeSpan(std::span<int>(iArr2, 3));
+ testRuntimeSpan(std::span<int>(iArr2, 4));
+ testRuntimeSpan(std::span<int>(iArr2, 5));
+
+ std::string s;
+ testRuntimeSpan(std::span<std::string>(&s, (std::size_t)0));
+ testRuntimeSpan(std::span<std::string>(&s, 1));
return 0;
}
diff --git a/libcxx/test/std/containers/views/views.span/span.objectrep/as_bytes.pass.cpp b/libcxx/test/std/containers/views/views.span/span.objectrep/as_bytes.pass.cpp
index 44b658fb83759b8..1b62fb94e9ab237 100644
--- a/libcxx/test/std/containers/views/views.span/span.objectrep/as_bytes.pass.cpp
+++ b/libcxx/test/std/containers/views/views.span/span.objectrep/as_bytes.pass.cpp
@@ -23,56 +23,54 @@
#include "test_macros.h"
-template<typename Span>
-void testRuntimeSpan(Span sp)
-{
- ASSERT_NOEXCEPT(std::as_bytes(sp));
+template <typename Span>
+void testRuntimeSpan(Span sp) {
+ ASSERT_NOEXCEPT(std::as_bytes(sp));
- auto spBytes = std::as_bytes(sp);
- using SB = decltype(spBytes);
- ASSERT_SAME_TYPE(const std::byte, typename SB::element_type);
+ auto spBytes = std::as_bytes(sp);
+ using SB = decltype(spBytes);
+ ASSERT_SAME_TYPE(const std::byte, typename SB::element_type);
- if constexpr (sp.extent == std::dynamic_extent)
- assert(spBytes.extent == std::dynamic_extent);
- else
- assert(spBytes.extent == sizeof(typename Span::element_type) * sp.extent);
+ if constexpr (sp.extent == std::dynamic_extent)
+ assert(spBytes.extent == std::dynamic_extent);
+ else
+ assert(spBytes.extent == sizeof(typename Span::element_type) * sp.extent);
- assert((void *) spBytes.data() == (void *) sp.data());
- assert(spBytes.size() == sp.size_bytes());
+ assert((void*)spBytes.data() == (void*)sp.data());
+ assert(spBytes.size() == sp.size_bytes());
}
-struct A{};
-int iArr2[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+struct A {};
+int iArr2[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
-int main(int, char**)
-{
- testRuntimeSpan(std::span<int> ());
- testRuntimeSpan(std::span<long> ());
- testRuntimeSpan(std::span<double> ());
- testRuntimeSpan(std::span<A> ());
- testRuntimeSpan(std::span<std::string>());
+int main(int, char**) {
+ testRuntimeSpan(std::span<int>());
+ testRuntimeSpan(std::span<long>());
+ testRuntimeSpan(std::span<double>());
+ testRuntimeSpan(std::span<A>());
+ testRuntimeSpan(std::span<std::string>());
- testRuntimeSpan(std::span<int, 0> ());
- testRuntimeSpan(std::span<long, 0> ());
- testRuntimeSpan(std::span<double, 0> ());
- testRuntimeSpan(std::span<A, 0> ());
- testRuntimeSpan(std::span<std::string, 0>());
+ testRuntimeSpan(std::span<int, 0>());
+ testRuntimeSpan(std::span<long, 0>());
+ testRuntimeSpan(std::span<double, 0>());
+ testRuntimeSpan(std::span<A, 0>());
+ testRuntimeSpan(std::span<std::string, 0>());
- testRuntimeSpan(std::span<int>(iArr2, 1));
- testRuntimeSpan(std::span<int>(iArr2, 2));
- testRuntimeSpan(std::span<int>(iArr2, 3));
- testRuntimeSpan(std::span<int>(iArr2, 4));
- testRuntimeSpan(std::span<int>(iArr2, 5));
+ testRuntimeSpan(std::span<int>(iArr2, 1));
+ testRuntimeSpan(std::span<int>(iArr2, 2));
+ testRuntimeSpan(std::span<int>(iArr2, 3));
+ testRuntimeSpan(std::span<int>(iArr2, 4));
+ testRuntimeSpan(std::span<int>(iArr2, 5));
- testRuntimeSpan(std::span<int, 1>(iArr2 + 5, 1));
- testRuntimeSpan(std::span<int, 2>(iArr2 + 4, 2));
- testRuntimeSpan(std::span<int, 3>(iArr2 + 3, 3));
- testRuntimeSpan(std::span<int, 4>(iArr2 + 2, 4));
- testRuntimeSpan(std::span<int, 5>(iArr2 + 1, 5));
+ testRuntimeSpan(std::span<int, 1>(iArr2 + 5, 1));
+ testRuntimeSpan(std::span<int, 2>(iArr2 + 4, 2));
+ testRuntimeSpan(std::span<int, 3>(iArr2 + 3, 3));
+ testRuntimeSpan(std::span<int, 4>(iArr2 + 2, 4));
+ testRuntimeSpan(std::span<int, 5>(iArr2 + 1, 5));
- std::string s;
- testRuntimeSpan(std::span<std::string>(&s, (std::size_t) 0));
- testRuntimeSpan(std::span<std::string>(&s, 1));
+ std::string s;
+ testRuntimeSpan(std::span<std::string>(&s, (std::size_t)0));
+ testRuntimeSpan(std::span<std::string>(&s, 1));
return 0;
}
diff --git a/libcxx/test/std/containers/views/views.span/span.objectrep/as_writable_bytes.pass.cpp b/libcxx/test/std/containers/views/views.span/span.objectrep/as_writable_bytes.pass.cpp
index d38d69d9fee1d04..40c6a581e9acf83 100644
--- a/libcxx/test/std/containers/views/views.span/span.objectrep/as_writable_bytes.pass.cpp
+++ b/libcxx/test/std/containers/views/views.span/span.objectrep/as_writable_bytes.pass.cpp
@@ -23,56 +23,54 @@
#include "test_macros.h"
-template<typename Span>
-void testRuntimeSpan(Span sp)
-{
- ASSERT_NOEXCEPT(std::as_writable_bytes(sp));
+template <typename Span>
+void testRuntimeSpan(Span sp) {
+ ASSERT_NOEXCEPT(std::as_writable_bytes(sp));
- auto spBytes = std::as_writable_bytes(sp);
- using SB = decltype(spBytes);
- ASSERT_SAME_TYPE(std::byte, typename SB::element_type);
+ auto spBytes = std::as_writable_bytes(sp);
+ using SB = decltype(spBytes);
+ ASSERT_SAME_TYPE(std::byte, typename SB::element_type);
- if constexpr (sp.extent == std::dynamic_extent)
- assert(spBytes.extent == std::dynamic_extent);
- else
- assert(spBytes.extent == sizeof(typename Span::element_type) * sp.extent);
+ if constexpr (sp.extent == std::dynamic_extent)
+ assert(spBytes.extent == std::dynamic_extent);
+ else
+ assert(spBytes.extent == sizeof(typename Span::element_type) * sp.extent);
- assert(static_cast<void*>(spBytes.data()) == static_cast<void*>(sp.data()));
- assert(spBytes.size() == sp.size_bytes());
+ assert(static_cast<void*>(spBytes.data()) == static_cast<void*>(sp.data()));
+ assert(spBytes.size() == sp.size_bytes());
}
-struct A{};
-int iArr2[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+struct A {};
+int iArr2[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
-int main(int, char**)
-{
- testRuntimeSpan(std::span<int> ());
- testRuntimeSpan(std::span<long> ());
- testRuntimeSpan(std::span<double> ());
- testRuntimeSpan(std::span<A> ());
- testRuntimeSpan(std::span<std::string>());
+int main(int, char**) {
+ testRuntimeSpan(std::span<int>());
+ testRuntimeSpan(std::span<long>());
+ testRuntimeSpan(std::span<double>());
+ testRuntimeSpan(std::span<A>());
+ testRuntimeSpan(std::span<std::string>());
- testRuntimeSpan(std::span<int, 0> ());
- testRuntimeSpan(std::span<long, 0> ());
- testRuntimeSpan(std::span<double, 0> ());
- testRuntimeSpan(std::span<A, 0> ());
- testRuntimeSpan(std::span<std::string, 0>());
+ testRuntimeSpan(std::span<int, 0>());
+ testRuntimeSpan(std::span<long, 0>());
+ testRuntimeSpan(std::span<double, 0>());
+ testRuntimeSpan(std::span<A, 0>());
+ testRuntimeSpan(std::span<std::string, 0>());
- testRuntimeSpan(std::span<int>(iArr2, 1));
- testRuntimeSpan(std::span<int>(iArr2, 2));
- testRuntimeSpan(std::span<int>(iArr2, 3));
- testRuntimeSpan(std::span<int>(iArr2, 4));
- testRuntimeSpan(std::span<int>(iArr2, 5));
+ testRuntimeSpan(std::span<int>(iArr2, 1));
+ testRuntimeSpan(std::span<int>(iArr2, 2));
+ testRuntimeSpan(std::span<int>(iArr2, 3));
+ testRuntimeSpan(std::span<int>(iArr2, 4));
+ testRuntimeSpan(std::span<int>(iArr2, 5));
- testRuntimeSpan(std::span<int, 1>(iArr2 + 5, 1));
- testRuntimeSpan(std::span<int, 2>(iArr2 + 4, 2));
- testRuntimeSpan(std::span<int, 3>(iArr2 + 3, 3));
- testRuntimeSpan(std::span<int, 4>(iArr2 + 2, 4));
- testRuntimeSpan(std::span<int, 5>(iArr2 + 1, 5));
+ testRuntimeSpan(std::span<int, 1>(iArr2 + 5, 1));
+ testRuntimeSpan(std::span<int, 2>(iArr2 + 4, 2));
+ testRuntimeSpan(std::span<int, 3>(iArr2 + 3, 3));
+ testRuntimeSpan(std::span<int, 4>(iArr2 + 2, 4));
+ testRuntimeSpan(std::span<int, 5>(iArr2 + 1, 5));
- std::string s;
- testRuntimeSpan(std::span<std::string>(&s, (std::size_t) 0));
- testRuntimeSpan(std::span<std::string>(&s, 1));
+ std::string s;
+ testRuntimeSpan(std::span<std::string>(&s, (std::size_t)0));
+ testRuntimeSpan(std::span<std::string>(&s, 1));
return 0;
}
diff --git a/libcxx/test/std/containers/views/views.span/span.objectrep/as_writable_bytes.verify.cpp b/libcxx/test/std/containers/views/views.span/span.objectrep/as_writable_bytes.verify.cpp
index 45485b339752cdf..9d22641ab268704 100644
--- a/libcxx/test/std/containers/views/views.span/span.objectrep/as_writable_bytes.verify.cpp
+++ b/libcxx/test/std/containers/views/views.span/span.objectrep/as_writable_bytes.verify.cpp
@@ -21,23 +21,35 @@
#include "test_macros.h"
-const int iArr2[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+const int iArr2[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
struct A {};
void f() {
- std::as_writable_bytes(std::span<const int>()); // expected-error {{no matching function for call to 'as_writable_bytes'}}
- std::as_writable_bytes(std::span<const long>()); // expected-error {{no matching function for call to 'as_writable_bytes'}}
- std::as_writable_bytes(std::span<const double>()); // expected-error {{no matching function for call to 'as_writable_bytes'}}
- std::as_writable_bytes(std::span<const A>()); // expected-error {{no matching function for call to 'as_writable_bytes'}}
- std::as_writable_bytes(std::span<const std::string>()); // expected-error {{no matching function for call to 'as_writable_bytes'}}
-
- std::as_writable_bytes(std::span<const int, 0>()); // expected-error {{no matching function for call to 'as_writable_bytes'}}
- std::as_writable_bytes(std::span<const long, 0>()); // expected-error {{no matching function for call to 'as_writable_bytes'}}
- std::as_writable_bytes(std::span<const double, 0>()); // expected-error {{no matching function for call to 'as_writable_bytes'}}
- std::as_writable_bytes(std::span<const A, 0>()); // expected-error {{no matching function for call to 'as_writable_bytes'}}
- std::as_writable_bytes(std::span<const std::string, (std::size_t)0>()); // expected-error {{no matching function for call to 'as_writable_bytes'}}
-
- std::as_writable_bytes(std::span<const int> (iArr2, 1)); // expected-error {{no matching function for call to 'as_writable_bytes'}}
- std::as_writable_bytes(std::span<const int, 1>(iArr2 + 5, 1)); // expected-error {{no matching function for call to 'as_writable_bytes'}}
+ std::as_writable_bytes(std::span<const int>());
+ // expected-error at -1 {{no matching function for call to 'as_writable_bytes'}}
+ std::as_writable_bytes(std::span<const long>());
+ // expected-error at -1 {{no matching function for call to 'as_writable_bytes'}}
+ std::as_writable_bytes(std::span<const double>());
+ // expected-error at -1 {{no matching function for call to 'as_writable_bytes'}}
+ std::as_writable_bytes(std::span<const A>());
+ // expected-error at -1 {{no matching function for call to 'as_writable_bytes'}}
+ std::as_writable_bytes(std::span<const std::string>());
+ // expected-error at -1 {{no matching function for call to 'as_writable_bytes'}}
+
+ std::as_writable_bytes(std::span<const int, 0>());
+ // expected-error at -1 {{no matching function for call to 'as_writable_bytes'}}
+ std::as_writable_bytes(std::span<const long, 0>());
+ // expected-error at -1 {{no matching function for call to 'as_writable_bytes'}}
+ std::as_writable_bytes(std::span<const double, 0>());
+ // expected-error at -1 {{no matching function for call to 'as_writable_bytes'}}
+ std::as_writable_bytes(std::span<const A, 0>());
+ // expected-error at -1 {{no matching function for call to 'as_writable_bytes'}}
+ std::as_writable_bytes(std::span<const std::string, (std::size_t)0>());
+ // expected-error at -1 {{no matching function for call to 'as_writable_bytes'}}
+
+ std::as_writable_bytes(std::span<const int>(iArr2, 1));
+ // expected-error at -1 {{no matching function for call to 'as_writable_bytes'}}
+ std::as_writable_bytes(std::span<const int, 1>(iArr2 + 5, 1));
+ // expected-error at -1 {{no matching function for call to 'as_writable_bytes'}}
}
diff --git a/libcxx/test/std/containers/views/views.span/span.obs/empty.pass.cpp b/libcxx/test/std/containers/views/views.span/span.obs/empty.pass.cpp
index 3aa99b0854f3641..c7b66884abc8c08 100644
--- a/libcxx/test/std/containers/views/views.span/span.obs/empty.pass.cpp
+++ b/libcxx/test/std/containers/views/views.span/span.obs/empty.pass.cpp
@@ -12,62 +12,59 @@
// [[nodiscard]] constexpr bool empty() const noexcept;
//
-
#include <span>
#include <cassert>
#include <string>
#include "test_macros.h"
-struct A{};
-constexpr int iArr1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
-
-int main(int, char**)
-{
- static_assert( noexcept(std::span<int> ().empty()), "");
- static_assert( noexcept(std::span<int, 0>().empty()), "");
-
-
- static_assert( std::span<int>().empty(), "");
- static_assert( std::span<long>().empty(), "");
- static_assert( std::span<double>().empty(), "");
- static_assert( std::span<A>().empty(), "");
- static_assert( std::span<std::string>().empty(), "");
-
- static_assert( std::span<int, 0>().empty(), "");
- static_assert( std::span<long, 0>().empty(), "");
- static_assert( std::span<double, 0>().empty(), "");
- static_assert( std::span<A, 0>().empty(), "");
- static_assert( std::span<std::string, 0>().empty(), "");
-
- static_assert(!std::span<const int>(iArr1, 1).empty(), "");
- static_assert(!std::span<const int>(iArr1, 2).empty(), "");
- static_assert(!std::span<const int>(iArr1, 3).empty(), "");
- static_assert(!std::span<const int>(iArr1, 4).empty(), "");
- static_assert(!std::span<const int>(iArr1, 5).empty(), "");
-
- assert( (std::span<int>().empty() ));
- assert( (std::span<long>().empty() ));
- assert( (std::span<double>().empty() ));
- assert( (std::span<A>().empty() ));
- assert( (std::span<std::string>().empty() ));
-
- assert( (std::span<int, 0>().empty() ));
- assert( (std::span<long, 0>().empty() ));
- assert( (std::span<double, 0>().empty() ));
- assert( (std::span<A, 0>().empty() ));
- assert( (std::span<std::string, 0>().empty()));
-
- assert(!(std::span<int, 1>(iArr2, 1).empty()));
- assert(!(std::span<int, 2>(iArr2, 2).empty()));
- assert(!(std::span<int, 3>(iArr2, 3).empty()));
- assert(!(std::span<int, 4>(iArr2, 4).empty()));
- assert(!(std::span<int, 5>(iArr2, 5).empty()));
-
- std::string s;
- assert( ((std::span<std::string>(&s, (std::size_t) 0)).empty()));
- assert(!((std::span<std::string>(&s, 1).empty())));
+struct A {};
+constexpr int iArr1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
+
+int main(int, char**) {
+ static_assert(noexcept(std::span<int>().empty()), "");
+ static_assert(noexcept(std::span<int, 0>().empty()), "");
+
+ static_assert(std::span<int>().empty(), "");
+ static_assert(std::span<long>().empty(), "");
+ static_assert(std::span<double>().empty(), "");
+ static_assert(std::span<A>().empty(), "");
+ static_assert(std::span<std::string>().empty(), "");
+
+ static_assert(std::span<int, 0>().empty(), "");
+ static_assert(std::span<long, 0>().empty(), "");
+ static_assert(std::span<double, 0>().empty(), "");
+ static_assert(std::span<A, 0>().empty(), "");
+ static_assert(std::span<std::string, 0>().empty(), "");
+
+ static_assert(!std::span<const int>(iArr1, 1).empty(), "");
+ static_assert(!std::span<const int>(iArr1, 2).empty(), "");
+ static_assert(!std::span<const int>(iArr1, 3).empty(), "");
+ static_assert(!std::span<const int>(iArr1, 4).empty(), "");
+ static_assert(!std::span<const int>(iArr1, 5).empty(), "");
+
+ assert((std::span<int>().empty()));
+ assert((std::span<long>().empty()));
+ assert((std::span<double>().empty()));
+ assert((std::span<A>().empty()));
+ assert((std::span<std::string>().empty()));
+
+ assert((std::span<int, 0>().empty()));
+ assert((std::span<long, 0>().empty()));
+ assert((std::span<double, 0>().empty()));
+ assert((std::span<A, 0>().empty()));
+ assert((std::span<std::string, 0>().empty()));
+
+ assert(!(std::span<int, 1>(iArr2, 1).empty()));
+ assert(!(std::span<int, 2>(iArr2, 2).empty()));
+ assert(!(std::span<int, 3>(iArr2, 3).empty()));
+ assert(!(std::span<int, 4>(iArr2, 4).empty()));
+ assert(!(std::span<int, 5>(iArr2, 5).empty()));
+
+ std::string s;
+ assert(((std::span<std::string>(&s, (std::size_t)0)).empty()));
+ assert(!((std::span<std::string>(&s, 1).empty())));
return 0;
}
diff --git a/libcxx/test/std/containers/views/views.span/span.obs/size.pass.cpp b/libcxx/test/std/containers/views/views.span/span.obs/size.pass.cpp
index fa41d7803e97e97..9dde3d4610b24bd 100644
--- a/libcxx/test/std/containers/views/views.span/span.obs/size.pass.cpp
+++ b/libcxx/test/std/containers/views/views.span/span.obs/size.pass.cpp
@@ -12,80 +12,74 @@
// constexpr size_type size() const noexcept;
//
-
#include <span>
#include <cassert>
#include <string>
#include "test_macros.h"
-
template <typename Span>
-constexpr bool testConstexprSpan(Span sp, std::size_t sz)
-{
- ASSERT_NOEXCEPT(sp.size());
- return sp.size() == sz;
+constexpr bool testConstexprSpan(Span sp, std::size_t sz) {
+ ASSERT_NOEXCEPT(sp.size());
+ return sp.size() == sz;
}
-
template <typename Span>
-void testRuntimeSpan(Span sp, std::size_t sz)
-{
- ASSERT_NOEXCEPT(sp.size());
- assert(sp.size() == sz);
+void testRuntimeSpan(Span sp, std::size_t sz) {
+ ASSERT_NOEXCEPT(sp.size());
+ assert(sp.size() == sz);
}
-struct A{};
-constexpr int iArr1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
-
-int main(int, char**)
-{
- static_assert(testConstexprSpan(std::span<int>(), 0), "");
- static_assert(testConstexprSpan(std::span<long>(), 0), "");
- static_assert(testConstexprSpan(std::span<double>(), 0), "");
- static_assert(testConstexprSpan(std::span<A>(), 0), "");
- static_assert(testConstexprSpan(std::span<std::string>(), 0), "");
-
- static_assert(testConstexprSpan(std::span<int, 0>(), 0), "");
- static_assert(testConstexprSpan(std::span<long, 0>(), 0), "");
- static_assert(testConstexprSpan(std::span<double, 0>(), 0), "");
- static_assert(testConstexprSpan(std::span<A, 0>(), 0), "");
- static_assert(testConstexprSpan(std::span<std::string, 0>(), 0), "");
-
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 1), 1), "");
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 2), 2), "");
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 3), 3), "");
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 4), 4), "");
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 5), 5), "");
-
- testRuntimeSpan(std::span<int> (), 0);
- testRuntimeSpan(std::span<long> (), 0);
- testRuntimeSpan(std::span<double> (), 0);
- testRuntimeSpan(std::span<A> (), 0);
- testRuntimeSpan(std::span<std::string>(), 0);
-
- testRuntimeSpan(std::span<int, 0> (), 0);
- testRuntimeSpan(std::span<long, 0> (), 0);
- testRuntimeSpan(std::span<double, 0> (), 0);
- testRuntimeSpan(std::span<A, 0> (), 0);
- testRuntimeSpan(std::span<std::string, 0>(), 0);
-
- testRuntimeSpan(std::span<int>(iArr2, 1), 1);
- testRuntimeSpan(std::span<int>(iArr2, 2), 2);
- testRuntimeSpan(std::span<int>(iArr2, 3), 3);
- testRuntimeSpan(std::span<int>(iArr2, 4), 4);
- testRuntimeSpan(std::span<int>(iArr2, 5), 5);
-
- testRuntimeSpan(std::span<int, 1>(iArr2 + 5, 1), 1);
- testRuntimeSpan(std::span<int, 2>(iArr2 + 4, 2), 2);
- testRuntimeSpan(std::span<int, 3>(iArr2 + 3, 3), 3);
- testRuntimeSpan(std::span<int, 4>(iArr2 + 2, 4), 4);
- testRuntimeSpan(std::span<int, 5>(iArr2 + 1, 5), 5);
-
- std::string s;
- testRuntimeSpan(std::span<std::string>(&s, (std::size_t) 0), 0);
- testRuntimeSpan(std::span<std::string>(&s, 1), 1);
+struct A {};
+constexpr int iArr1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
+
+int main(int, char**) {
+ static_assert(testConstexprSpan(std::span<int>(), 0), "");
+ static_assert(testConstexprSpan(std::span<long>(), 0), "");
+ static_assert(testConstexprSpan(std::span<double>(), 0), "");
+ static_assert(testConstexprSpan(std::span<A>(), 0), "");
+ static_assert(testConstexprSpan(std::span<std::string>(), 0), "");
+
+ static_assert(testConstexprSpan(std::span<int, 0>(), 0), "");
+ static_assert(testConstexprSpan(std::span<long, 0>(), 0), "");
+ static_assert(testConstexprSpan(std::span<double, 0>(), 0), "");
+ static_assert(testConstexprSpan(std::span<A, 0>(), 0), "");
+ static_assert(testConstexprSpan(std::span<std::string, 0>(), 0), "");
+
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 1), 1), "");
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 2), 2), "");
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 3), 3), "");
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 4), 4), "");
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 5), 5), "");
+
+ testRuntimeSpan(std::span<int>(), 0);
+ testRuntimeSpan(std::span<long>(), 0);
+ testRuntimeSpan(std::span<double>(), 0);
+ testRuntimeSpan(std::span<A>(), 0);
+ testRuntimeSpan(std::span<std::string>(), 0);
+
+ testRuntimeSpan(std::span<int, 0>(), 0);
+ testRuntimeSpan(std::span<long, 0>(), 0);
+ testRuntimeSpan(std::span<double, 0>(), 0);
+ testRuntimeSpan(std::span<A, 0>(), 0);
+ testRuntimeSpan(std::span<std::string, 0>(), 0);
+
+ testRuntimeSpan(std::span<int>(iArr2, 1), 1);
+ testRuntimeSpan(std::span<int>(iArr2, 2), 2);
+ testRuntimeSpan(std::span<int>(iArr2, 3), 3);
+ testRuntimeSpan(std::span<int>(iArr2, 4), 4);
+ testRuntimeSpan(std::span<int>(iArr2, 5), 5);
+
+ testRuntimeSpan(std::span<int, 1>(iArr2 + 5, 1), 1);
+ testRuntimeSpan(std::span<int, 2>(iArr2 + 4, 2), 2);
+ testRuntimeSpan(std::span<int, 3>(iArr2 + 3, 3), 3);
+ testRuntimeSpan(std::span<int, 4>(iArr2 + 2, 4), 4);
+ testRuntimeSpan(std::span<int, 5>(iArr2 + 1, 5), 5);
+
+ std::string s;
+ testRuntimeSpan(std::span<std::string>(&s, (std::size_t)0), 0);
+ testRuntimeSpan(std::span<std::string>(&s, 1), 1);
return 0;
}
diff --git a/libcxx/test/std/containers/views/views.span/span.obs/size_bytes.pass.cpp b/libcxx/test/std/containers/views/views.span/span.obs/size_bytes.pass.cpp
index c25eaaa2017bf32..3d6e4209315d705 100644
--- a/libcxx/test/std/containers/views/views.span/span.obs/size_bytes.pass.cpp
+++ b/libcxx/test/std/containers/views/views.span/span.obs/size_bytes.pass.cpp
@@ -13,80 +13,74 @@
//
// Effects: Equivalent to: return size() * sizeof(element_type);
-
#include <span>
#include <cassert>
#include <string>
#include "test_macros.h"
-
template <typename Span>
-constexpr bool testConstexprSpan(Span sp, std::size_t sz)
-{
- ASSERT_NOEXCEPT(sp.size_bytes());
- return (std::size_t) sp.size_bytes() == sz * sizeof(typename Span::element_type);
+constexpr bool testConstexprSpan(Span sp, std::size_t sz) {
+ ASSERT_NOEXCEPT(sp.size_bytes());
+ return (std::size_t)sp.size_bytes() == sz * sizeof(typename Span::element_type);
}
-
template <typename Span>
-void testRuntimeSpan(Span sp, std::size_t sz)
-{
- ASSERT_NOEXCEPT(sp.size_bytes());
- assert((std::size_t) sp.size_bytes() == sz * sizeof(typename Span::element_type));
+void testRuntimeSpan(Span sp, std::size_t sz) {
+ ASSERT_NOEXCEPT(sp.size_bytes());
+ assert((std::size_t)sp.size_bytes() == sz * sizeof(typename Span::element_type));
}
-struct A{};
-constexpr int iArr1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
-
-int main(int, char**)
-{
- static_assert(testConstexprSpan(std::span<int>(), 0), "");
- static_assert(testConstexprSpan(std::span<long>(), 0), "");
- static_assert(testConstexprSpan(std::span<double>(), 0), "");
- static_assert(testConstexprSpan(std::span<A>(), 0), "");
- static_assert(testConstexprSpan(std::span<std::string>(), 0), "");
-
- static_assert(testConstexprSpan(std::span<int, 0>(), 0), "");
- static_assert(testConstexprSpan(std::span<long, 0>(), 0), "");
- static_assert(testConstexprSpan(std::span<double, 0>(), 0), "");
- static_assert(testConstexprSpan(std::span<A, 0>(), 0), "");
- static_assert(testConstexprSpan(std::span<std::string, 0>(), 0), "");
-
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 1), 1), "");
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 2), 2), "");
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 3), 3), "");
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 4), 4), "");
- static_assert(testConstexprSpan(std::span<const int>(iArr1, 5), 5), "");
-
- testRuntimeSpan(std::span<int> (), 0);
- testRuntimeSpan(std::span<long> (), 0);
- testRuntimeSpan(std::span<double> (), 0);
- testRuntimeSpan(std::span<A> (), 0);
- testRuntimeSpan(std::span<std::string>(), 0);
-
- testRuntimeSpan(std::span<int, 0> (), 0);
- testRuntimeSpan(std::span<long, 0> (), 0);
- testRuntimeSpan(std::span<double, 0> (), 0);
- testRuntimeSpan(std::span<A, 0> (), 0);
- testRuntimeSpan(std::span<std::string, 0>(), 0);
-
- testRuntimeSpan(std::span<int>(iArr2, 1), 1);
- testRuntimeSpan(std::span<int>(iArr2, 2), 2);
- testRuntimeSpan(std::span<int>(iArr2, 3), 3);
- testRuntimeSpan(std::span<int>(iArr2, 4), 4);
- testRuntimeSpan(std::span<int>(iArr2, 5), 5);
-
- testRuntimeSpan(std::span<int, 1>(iArr2 + 5, 1), 1);
- testRuntimeSpan(std::span<int, 2>(iArr2 + 4, 2), 2);
- testRuntimeSpan(std::span<int, 3>(iArr2 + 3, 3), 3);
- testRuntimeSpan(std::span<int, 4>(iArr2 + 2, 4), 4);
- testRuntimeSpan(std::span<int, 5>(iArr2 + 1, 5), 5);
-
- std::string s;
- testRuntimeSpan(std::span<std::string>(&s, (std::size_t) 0), 0);
- testRuntimeSpan(std::span<std::string>(&s, 1), 1);
+struct A {};
+constexpr int iArr1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+int iArr2[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
+
+int main(int, char**) {
+ static_assert(testConstexprSpan(std::span<int>(), 0), "");
+ static_assert(testConstexprSpan(std::span<long>(), 0), "");
+ static_assert(testConstexprSpan(std::span<double>(), 0), "");
+ static_assert(testConstexprSpan(std::span<A>(), 0), "");
+ static_assert(testConstexprSpan(std::span<std::string>(), 0), "");
+
+ static_assert(testConstexprSpan(std::span<int, 0>(), 0), "");
+ static_assert(testConstexprSpan(std::span<long, 0>(), 0), "");
+ static_assert(testConstexprSpan(std::span<double, 0>(), 0), "");
+ static_assert(testConstexprSpan(std::span<A, 0>(), 0), "");
+ static_assert(testConstexprSpan(std::span<std::string, 0>(), 0), "");
+
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 1), 1), "");
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 2), 2), "");
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 3), 3), "");
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 4), 4), "");
+ static_assert(testConstexprSpan(std::span<const int>(iArr1, 5), 5), "");
+
+ testRuntimeSpan(std::span<int>(), 0);
+ testRuntimeSpan(std::span<long>(), 0);
+ testRuntimeSpan(std::span<double>(), 0);
+ testRuntimeSpan(std::span<A>(), 0);
+ testRuntimeSpan(std::span<std::string>(), 0);
+
+ testRuntimeSpan(std::span<int, 0>(), 0);
+ testRuntimeSpan(std::span<long, 0>(), 0);
+ testRuntimeSpan(std::span<double, 0>(), 0);
+ testRuntimeSpan(std::span<A, 0>(), 0);
+ testRuntimeSpan(std::span<std::string, 0>(), 0);
+
+ testRuntimeSpan(std::span<int>(iArr2, 1), 1);
+ testRuntimeSpan(std::span<int>(iArr2, 2), 2);
+ testRuntimeSpan(std::span<int>(iArr2, 3), 3);
+ testRuntimeSpan(std::span<int>(iArr2, 4), 4);
+ testRuntimeSpan(std::span<int>(iArr2, 5), 5);
+
+ testRuntimeSpan(std::span<int, 1>(iArr2 + 5, 1), 1);
+ testRuntimeSpan(std::span<int, 2>(iArr2 + 4, 2), 2);
+ testRuntimeSpan(std::span<int, 3>(iArr2 + 3, 3), 3);
+ testRuntimeSpan(std::span<int, 4>(iArr2 + 2, 4), 4);
+ testRuntimeSpan(std::span<int, 5>(iArr2 + 1, 5), 5);
+
+ std::string s;
+ testRuntimeSpan(std::span<std::string>(&s, (std::size_t)0), 0);
+ testRuntimeSpan(std::span<std::string>(&s, 1), 1);
return 0;
}
diff --git a/libcxx/test/std/containers/views/views.span/span.sub/first.pass.cpp b/libcxx/test/std/containers/views/views.span/span.sub/first.pass.cpp
index a354ade2247ae14..a9a697c0c4d2196 100644
--- a/libcxx/test/std/containers/views/views.span/span.sub/first.pass.cpp
+++ b/libcxx/test/std/containers/views/views.span/span.sub/first.pass.cpp
@@ -24,51 +24,43 @@
#include "test_macros.h"
template <typename Span, std::size_t Count>
-constexpr bool testConstexprSpan(Span sp)
-{
- LIBCPP_ASSERT((noexcept(sp.template first<Count>())));
- LIBCPP_ASSERT((noexcept(sp.first(Count))));
- auto s1 = sp.template first<Count>();
- auto s2 = sp.first(Count);
- using S1 = decltype(s1);
- using S2 = decltype(s2);
- ASSERT_SAME_TYPE(typename Span::value_type, typename S1::value_type);
- ASSERT_SAME_TYPE(typename Span::value_type, typename S2::value_type);
- static_assert(S1::extent == Count, "");
- static_assert(S2::extent == std::dynamic_extent, "");
- return
- s1.data() == s2.data()
- && s1.size() == s2.size()
- && std::equal(s1.begin(), s1.end(), sp.begin());
+constexpr bool testConstexprSpan(Span sp) {
+ LIBCPP_ASSERT((noexcept(sp.template first<Count>())));
+ LIBCPP_ASSERT((noexcept(sp.first(Count))));
+ auto s1 = sp.template first<Count>();
+ auto s2 = sp.first(Count);
+ using S1 = decltype(s1);
+ using S2 = decltype(s2);
+ ASSERT_SAME_TYPE(typename Span::value_type, typename S1::value_type);
+ ASSERT_SAME_TYPE(typename Span::value_type, typename S2::value_type);
+ static_assert(S1::extent == Count, "");
+ static_assert(S2::extent == std::dynamic_extent, "");
+ return s1.data() == s2.data() && s1.size() == s2.size() && std::equal(s1.begin(), s1.end(), sp.begin());
}
-
template <typename Span, std::size_t Count>
-void testRuntimeSpan(Span sp)
-{
- LIBCPP_ASSERT((noexcept(sp.template first<Count>())));
- LIBCPP_ASSERT((noexcept(sp.first(Count))));
- auto s1 = sp.template first<Count>();
- auto s2 = sp.first(Count);
- using S1 = decltype(s1);
- using S2 = decltype(s2);
- ASSERT_SAME_TYPE(typename Span::value_type, typename S1::value_type);
- ASSERT_SAME_TYPE(typename Span::value_type, typename S2::value_type);
- static_assert(S1::extent == Count, "");
- static_assert(S2::extent == std::dynamic_extent, "");
- assert(s1.data() == s2.data());
- assert(s1.size() == s2.size());
- assert(std::equal(s1.begin(), s1.end(), sp.begin()));
+void testRuntimeSpan(Span sp) {
+ LIBCPP_ASSERT((noexcept(sp.template first<Count>())));
+ LIBCPP_ASSERT((noexcept(sp.first(Count))));
+ auto s1 = sp.template first<Count>();
+ auto s2 = sp.first(Count);
+ using S1 = decltype(s1);
+ using S2 = decltype(s2);
+ ASSERT_SAME_TYPE(typename Span::value_type, typename S1::value_type);
+ ASSERT_SAME_TYPE(typename Span::value_type, typename S2::value_type);
+ static_assert(S1::extent == Count, "");
+ static_assert(S2::extent == std::dynamic_extent, "");
+ assert(s1.data() == s2.data());
+ assert(s1.size() == s2.size());
+ assert(std::equal(s1.begin(), s1.end(), sp.begin()));
}
+constexpr int carr1[] = {1, 2, 3, 4};
+int arr[] = {5, 6, 7};
+std::string sarr[] = {"ABC", "DEF", "GHI", "JKL", "MNO"};
-constexpr int carr1[] = {1,2,3,4};
- int arr[] = {5,6,7};
-std::string sarr [] = { "ABC", "DEF", "GHI", "JKL", "MNO"};
-
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
using Sp = std::span<const int>;
static_assert(testConstexprSpan<Sp, 0>(Sp{}), "");
@@ -77,9 +69,9 @@ int main(int, char**)
static_assert(testConstexprSpan<Sp, 2>(Sp{carr1}), "");
static_assert(testConstexprSpan<Sp, 3>(Sp{carr1}), "");
static_assert(testConstexprSpan<Sp, 4>(Sp{carr1}), "");
- }
+ }
- {
+ {
using Sp = std::span<const int, 4>;
static_assert(testConstexprSpan<Sp, 0>(Sp{carr1}), "");
@@ -87,9 +79,9 @@ int main(int, char**)
static_assert(testConstexprSpan<Sp, 2>(Sp{carr1}), "");
static_assert(testConstexprSpan<Sp, 3>(Sp{carr1}), "");
static_assert(testConstexprSpan<Sp, 4>(Sp{carr1}), "");
- }
+ }
- {
+ {
using Sp = std::span<int>;
testRuntimeSpan<Sp, 0>(Sp{});
@@ -97,18 +89,18 @@ int main(int, char**)
testRuntimeSpan<Sp, 1>(Sp{arr});
testRuntimeSpan<Sp, 2>(Sp{arr});
testRuntimeSpan<Sp, 3>(Sp{arr});
- }
+ }
- {
+ {
using Sp = std::span<int, 3>;
testRuntimeSpan<Sp, 0>(Sp{arr});
testRuntimeSpan<Sp, 1>(Sp{arr});
testRuntimeSpan<Sp, 2>(Sp{arr});
testRuntimeSpan<Sp, 3>(Sp{arr});
- }
+ }
- {
+ {
using Sp = std::span<std::string>;
testConstexprSpan<Sp, 0>(Sp{});
@@ -118,9 +110,9 @@ int main(int, char**)
testRuntimeSpan<Sp, 3>(Sp{sarr});
testRuntimeSpan<Sp, 4>(Sp{sarr});
testRuntimeSpan<Sp, 5>(Sp{sarr});
- }
+ }
- {
+ {
using Sp = std::span<std::string, 5>;
testRuntimeSpan<Sp, 0>(Sp{sarr});
@@ -129,7 +121,7 @@ int main(int, char**)
testRuntimeSpan<Sp, 3>(Sp{sarr});
testRuntimeSpan<Sp, 4>(Sp{sarr});
testRuntimeSpan<Sp, 5>(Sp{sarr});
- }
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/views/views.span/span.sub/first.verify.cpp b/libcxx/test/std/containers/views/views.span/span.sub/first.verify.cpp
index 39d04b0e1225349..8cf28c25e3b91bd 100644
--- a/libcxx/test/std/containers/views/views.span/span.sub/first.verify.cpp
+++ b/libcxx/test/std/containers/views/views.span/span.sub/first.verify.cpp
@@ -25,5 +25,6 @@ void f() {
[[maybe_unused]] auto s1 = sp.first<5>(); // expected-error at span:* {{span<T, N>::first<Count>(): Count out of range}}
// Count numeric_limits
- [[maybe_unused]] auto s2 = sp.first<std::size_t(-1)>(); // expected-error at span:* {{span<T, N>::first<Count>(): Count out of range}}
+ [[maybe_unused]] auto s2 =
+ sp.first<std::size_t(-1)>(); // expected-error at span:* {{span<T, N>::first<Count>(): Count out of range}}
}
diff --git a/libcxx/test/std/containers/views/views.span/span.sub/last.pass.cpp b/libcxx/test/std/containers/views/views.span/span.sub/last.pass.cpp
index 017c805af3ed517..29b4e94b7c5dfc3 100644
--- a/libcxx/test/std/containers/views/views.span/span.sub/last.pass.cpp
+++ b/libcxx/test/std/containers/views/views.span/span.sub/last.pass.cpp
@@ -24,51 +24,43 @@
#include "test_macros.h"
template <typename Span, std::size_t Count>
-constexpr bool testConstexprSpan(Span sp)
-{
- LIBCPP_ASSERT((noexcept(sp.template last<Count>())));
- LIBCPP_ASSERT((noexcept(sp.last(Count))));
- auto s1 = sp.template last<Count>();
- auto s2 = sp.last(Count);
- using S1 = decltype(s1);
- using S2 = decltype(s2);
- ASSERT_SAME_TYPE(typename Span::value_type, typename S1::value_type);
- ASSERT_SAME_TYPE(typename Span::value_type, typename S2::value_type);
- static_assert(S1::extent == Count, "");
- static_assert(S2::extent == std::dynamic_extent, "");
- return
- s1.data() == s2.data()
- && s1.size() == s2.size()
- && std::equal(s1.begin(), s1.end(), sp.end() - Count);
+constexpr bool testConstexprSpan(Span sp) {
+ LIBCPP_ASSERT((noexcept(sp.template last<Count>())));
+ LIBCPP_ASSERT((noexcept(sp.last(Count))));
+ auto s1 = sp.template last<Count>();
+ auto s2 = sp.last(Count);
+ using S1 = decltype(s1);
+ using S2 = decltype(s2);
+ ASSERT_SAME_TYPE(typename Span::value_type, typename S1::value_type);
+ ASSERT_SAME_TYPE(typename Span::value_type, typename S2::value_type);
+ static_assert(S1::extent == Count, "");
+ static_assert(S2::extent == std::dynamic_extent, "");
+ return s1.data() == s2.data() && s1.size() == s2.size() && std::equal(s1.begin(), s1.end(), sp.end() - Count);
}
-
template <typename Span, std::size_t Count>
-void testRuntimeSpan(Span sp)
-{
- LIBCPP_ASSERT((noexcept(sp.template last<Count>())));
- LIBCPP_ASSERT((noexcept(sp.last(Count))));
- auto s1 = sp.template last<Count>();
- auto s2 = sp.last(Count);
- using S1 = decltype(s1);
- using S2 = decltype(s2);
- ASSERT_SAME_TYPE(typename Span::value_type, typename S1::value_type);
- ASSERT_SAME_TYPE(typename Span::value_type, typename S2::value_type);
- static_assert(S1::extent == Count, "");
- static_assert(S2::extent == std::dynamic_extent, "");
- assert(s1.data() == s2.data());
- assert(s1.size() == s2.size());
- assert(std::equal(s1.begin(), s1.end(), sp.end() - Count));
+void testRuntimeSpan(Span sp) {
+ LIBCPP_ASSERT((noexcept(sp.template last<Count>())));
+ LIBCPP_ASSERT((noexcept(sp.last(Count))));
+ auto s1 = sp.template last<Count>();
+ auto s2 = sp.last(Count);
+ using S1 = decltype(s1);
+ using S2 = decltype(s2);
+ ASSERT_SAME_TYPE(typename Span::value_type, typename S1::value_type);
+ ASSERT_SAME_TYPE(typename Span::value_type, typename S2::value_type);
+ static_assert(S1::extent == Count, "");
+ static_assert(S2::extent == std::dynamic_extent, "");
+ assert(s1.data() == s2.data());
+ assert(s1.size() == s2.size());
+ assert(std::equal(s1.begin(), s1.end(), sp.end() - Count));
}
+constexpr int carr1[] = {1, 2, 3, 4};
+int arr[] = {5, 6, 7};
+std::string sarr[] = {"ABC", "DEF", "GHI", "JKL", "MNO"};
-constexpr int carr1[] = {1,2,3,4};
- int arr[] = {5,6,7};
-std::string sarr [] = { "ABC", "DEF", "GHI", "JKL", "MNO"};
-
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
using Sp = std::span<const int>;
static_assert(testConstexprSpan<Sp, 0>(Sp{}), "");
@@ -77,9 +69,9 @@ int main(int, char**)
static_assert(testConstexprSpan<Sp, 2>(Sp{carr1}), "");
static_assert(testConstexprSpan<Sp, 3>(Sp{carr1}), "");
static_assert(testConstexprSpan<Sp, 4>(Sp{carr1}), "");
- }
+ }
- {
+ {
using Sp = std::span<const int, 4>;
static_assert(testConstexprSpan<Sp, 0>(Sp{carr1}), "");
@@ -87,9 +79,9 @@ int main(int, char**)
static_assert(testConstexprSpan<Sp, 2>(Sp{carr1}), "");
static_assert(testConstexprSpan<Sp, 3>(Sp{carr1}), "");
static_assert(testConstexprSpan<Sp, 4>(Sp{carr1}), "");
- }
+ }
- {
+ {
using Sp = std::span<int>;
testRuntimeSpan<Sp, 0>(Sp{});
@@ -97,18 +89,18 @@ int main(int, char**)
testRuntimeSpan<Sp, 1>(Sp{arr});
testRuntimeSpan<Sp, 2>(Sp{arr});
testRuntimeSpan<Sp, 3>(Sp{arr});
- }
+ }
- {
+ {
using Sp = std::span<int, 3>;
testRuntimeSpan<Sp, 0>(Sp{arr});
testRuntimeSpan<Sp, 1>(Sp{arr});
testRuntimeSpan<Sp, 2>(Sp{arr});
testRuntimeSpan<Sp, 3>(Sp{arr});
- }
+ }
- {
+ {
using Sp = std::span<std::string>;
testConstexprSpan<Sp, 0>(Sp{});
@@ -118,9 +110,9 @@ int main(int, char**)
testRuntimeSpan<Sp, 3>(Sp{sarr});
testRuntimeSpan<Sp, 4>(Sp{sarr});
testRuntimeSpan<Sp, 5>(Sp{sarr});
- }
+ }
- {
+ {
using Sp = std::span<std::string, 5>;
testRuntimeSpan<Sp, 0>(Sp{sarr});
@@ -129,7 +121,7 @@ int main(int, char**)
testRuntimeSpan<Sp, 3>(Sp{sarr});
testRuntimeSpan<Sp, 4>(Sp{sarr});
testRuntimeSpan<Sp, 5>(Sp{sarr});
- }
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/views/views.span/span.sub/last.verify.cpp b/libcxx/test/std/containers/views/views.span/span.sub/last.verify.cpp
index 9fc6deb87a0fad6..d96bfac6d98de65 100644
--- a/libcxx/test/std/containers/views/views.span/span.sub/last.verify.cpp
+++ b/libcxx/test/std/containers/views/views.span/span.sub/last.verify.cpp
@@ -25,5 +25,6 @@ void f() {
[[maybe_unused]] auto s1 = sp.last<5>(); // expected-error at span:* {{span<T, N>::last<Count>(): Count out of range}}
// Count numeric_limits
- [[maybe_unused]] auto s2 = sp.last<std::size_t(-1)>(); // expected-error at span:* {{span<T, N>::last<Count>(): Count out of range}}
+ [[maybe_unused]] auto s2 =
+ sp.last<std::size_t(-1)>(); // expected-error at span:* {{span<T, N>::last<Count>(): Count out of range}}
}
diff --git a/libcxx/test/std/containers/views/views.span/span.sub/subspan.pass.cpp b/libcxx/test/std/containers/views/views.span/span.sub/subspan.pass.cpp
index 401363090e6e556..50e43c5e5582f81 100644
--- a/libcxx/test/std/containers/views/views.span/span.sub/subspan.pass.cpp
+++ b/libcxx/test/std/containers/views/views.span/span.sub/subspan.pass.cpp
@@ -25,88 +25,75 @@
#include "test_macros.h"
template <typename Span, std::size_t Offset, size_t Count>
-constexpr bool testConstexprSpan(Span sp)
-{
- LIBCPP_ASSERT((noexcept(sp.template subspan<Offset, Count>())));
- LIBCPP_ASSERT((noexcept(sp.subspan(Offset, Count))));
- auto s1 = sp.template subspan<Offset, Count>();
- auto s2 = sp.subspan(Offset, Count);
- using S1 = decltype(s1);
- using S2 = decltype(s2);
- ASSERT_SAME_TYPE(typename Span::value_type, typename S1::value_type);
- ASSERT_SAME_TYPE(typename Span::value_type, typename S2::value_type);
- static_assert(S1::extent == Count);
- static_assert(S2::extent == std::dynamic_extent, "");
- return
- s1.data() == s2.data()
- && s1.size() == s2.size()
- && std::equal(s1.begin(), s1.end(), sp.begin() + Offset);
+constexpr bool testConstexprSpan(Span sp) {
+ LIBCPP_ASSERT((noexcept(sp.template subspan<Offset, Count>())));
+ LIBCPP_ASSERT((noexcept(sp.subspan(Offset, Count))));
+ auto s1 = sp.template subspan<Offset, Count>();
+ auto s2 = sp.subspan(Offset, Count);
+ using S1 = decltype(s1);
+ using S2 = decltype(s2);
+ ASSERT_SAME_TYPE(typename Span::value_type, typename S1::value_type);
+ ASSERT_SAME_TYPE(typename Span::value_type, typename S2::value_type);
+ static_assert(S1::extent == Count);
+ static_assert(S2::extent == std::dynamic_extent, "");
+ return s1.data() == s2.data() && s1.size() == s2.size() && std::equal(s1.begin(), s1.end(), sp.begin() + Offset);
}
template <typename Span, std::size_t Offset>
-constexpr bool testConstexprSpan(Span sp)
-{
- LIBCPP_ASSERT((noexcept(sp.template subspan<Offset>())));
- LIBCPP_ASSERT((noexcept(sp.subspan(Offset))));
- auto s1 = sp.template subspan<Offset>();
- auto s2 = sp.subspan(Offset);
- using S1 = decltype(s1);
- using S2 = decltype(s2);
- ASSERT_SAME_TYPE(typename Span::value_type, typename S1::value_type);
- ASSERT_SAME_TYPE(typename Span::value_type, typename S2::value_type);
- static_assert(S1::extent == (Span::extent == std::dynamic_extent ? std::dynamic_extent : Span::extent - Offset), "");
- static_assert(S2::extent == std::dynamic_extent, "");
- return
- s1.data() == s2.data()
- && s1.size() == s2.size()
- && std::equal(s1.begin(), s1.end(), sp.begin() + Offset, sp.end());
+constexpr bool testConstexprSpan(Span sp) {
+ LIBCPP_ASSERT((noexcept(sp.template subspan<Offset>())));
+ LIBCPP_ASSERT((noexcept(sp.subspan(Offset))));
+ auto s1 = sp.template subspan<Offset>();
+ auto s2 = sp.subspan(Offset);
+ using S1 = decltype(s1);
+ using S2 = decltype(s2);
+ ASSERT_SAME_TYPE(typename Span::value_type, typename S1::value_type);
+ ASSERT_SAME_TYPE(typename Span::value_type, typename S2::value_type);
+ static_assert(S1::extent == (Span::extent == std::dynamic_extent ? std::dynamic_extent : Span::extent - Offset), "");
+ static_assert(S2::extent == std::dynamic_extent, "");
+ return s1.data() == s2.data() && s1.size() == s2.size() &&
+ std::equal(s1.begin(), s1.end(), sp.begin() + Offset, sp.end());
}
-
template <typename Span, std::size_t Offset, size_t Count>
-void testRuntimeSpan(Span sp)
-{
- LIBCPP_ASSERT((noexcept(sp.template subspan<Offset, Count>())));
- LIBCPP_ASSERT((noexcept(sp.subspan(Offset, Count))));
- auto s1 = sp.template subspan<Offset, Count>();
- auto s2 = sp.subspan(Offset, Count);
- using S1 = decltype(s1);
- using S2 = decltype(s2);
- ASSERT_SAME_TYPE(typename Span::value_type, typename S1::value_type);
- ASSERT_SAME_TYPE(typename Span::value_type, typename S2::value_type);
- static_assert(S1::extent == Count);
- static_assert(S2::extent == std::dynamic_extent, "");
- assert(s1.data() == s2.data());
- assert(s1.size() == s2.size());
- assert(std::equal(s1.begin(), s1.end(), sp.begin() + Offset));
+void testRuntimeSpan(Span sp) {
+ LIBCPP_ASSERT((noexcept(sp.template subspan<Offset, Count>())));
+ LIBCPP_ASSERT((noexcept(sp.subspan(Offset, Count))));
+ auto s1 = sp.template subspan<Offset, Count>();
+ auto s2 = sp.subspan(Offset, Count);
+ using S1 = decltype(s1);
+ using S2 = decltype(s2);
+ ASSERT_SAME_TYPE(typename Span::value_type, typename S1::value_type);
+ ASSERT_SAME_TYPE(typename Span::value_type, typename S2::value_type);
+ static_assert(S1::extent == Count);
+ static_assert(S2::extent == std::dynamic_extent, "");
+ assert(s1.data() == s2.data());
+ assert(s1.size() == s2.size());
+ assert(std::equal(s1.begin(), s1.end(), sp.begin() + Offset));
}
-
template <typename Span, std::size_t Offset>
-void testRuntimeSpan(Span sp)
-{
- LIBCPP_ASSERT((noexcept(sp.template subspan<Offset>())));
- LIBCPP_ASSERT((noexcept(sp.subspan(Offset))));
- auto s1 = sp.template subspan<Offset>();
- auto s2 = sp.subspan(Offset);
- using S1 = decltype(s1);
- using S2 = decltype(s2);
- ASSERT_SAME_TYPE(typename Span::value_type, typename S1::value_type);
- ASSERT_SAME_TYPE(typename Span::value_type, typename S2::value_type);
- static_assert(S1::extent == (Span::extent == std::dynamic_extent ? std::dynamic_extent : Span::extent - Offset), "");
- static_assert(S2::extent == std::dynamic_extent, "");
- assert(s1.data() == s2.data());
- assert(s1.size() == s2.size());
- assert(std::equal(s1.begin(), s1.end(), sp.begin() + Offset, sp.end()));
+void testRuntimeSpan(Span sp) {
+ LIBCPP_ASSERT((noexcept(sp.template subspan<Offset>())));
+ LIBCPP_ASSERT((noexcept(sp.subspan(Offset))));
+ auto s1 = sp.template subspan<Offset>();
+ auto s2 = sp.subspan(Offset);
+ using S1 = decltype(s1);
+ using S2 = decltype(s2);
+ ASSERT_SAME_TYPE(typename Span::value_type, typename S1::value_type);
+ ASSERT_SAME_TYPE(typename Span::value_type, typename S2::value_type);
+ static_assert(S1::extent == (Span::extent == std::dynamic_extent ? std::dynamic_extent : Span::extent - Offset), "");
+ static_assert(S2::extent == std::dynamic_extent, "");
+ assert(s1.data() == s2.data());
+ assert(s1.size() == s2.size());
+ assert(std::equal(s1.begin(), s1.end(), sp.begin() + Offset, sp.end()));
}
+constexpr int carr1[] = {1, 2, 3, 4};
+int arr1[] = {5, 6, 7};
-constexpr int carr1[] = {1,2,3,4};
- int arr1[] = {5,6,7};
-
-int main(int, char**)
-{
- {
+int main(int, char**) {
+ {
using Sp = std::span<const int>;
static_assert(testConstexprSpan<Sp, 0>(Sp{}), "");
@@ -120,9 +107,9 @@ int main(int, char**)
static_assert(testConstexprSpan<Sp, 2, 2>(Sp{carr1}), "");
static_assert(testConstexprSpan<Sp, 3, 1>(Sp{carr1}), "");
static_assert(testConstexprSpan<Sp, 4, 0>(Sp{carr1}), "");
- }
+ }
- {
+ {
using Sp = std::span<const int, 4>;
static_assert(testConstexprSpan<Sp, 0, 4>(Sp{carr1}), "");
@@ -135,9 +122,9 @@ int main(int, char**)
static_assert(testConstexprSpan<Sp, 2, 2>(Sp{carr1}), "");
static_assert(testConstexprSpan<Sp, 3, 1>(Sp{carr1}), "");
static_assert(testConstexprSpan<Sp, 4, 0>(Sp{carr1}), "");
- }
+ }
- {
+ {
using Sp = std::span<const int>;
static_assert(testConstexprSpan<Sp, 0>(Sp{}), "");
@@ -146,9 +133,9 @@ int main(int, char**)
static_assert(testConstexprSpan<Sp, 2>(Sp{carr1}), "");
static_assert(testConstexprSpan<Sp, 3>(Sp{carr1}), "");
static_assert(testConstexprSpan<Sp, 4>(Sp{carr1}), "");
- }
+ }
- {
+ {
using Sp = std::span<const int, 4>;
static_assert(testConstexprSpan<Sp, 0>(Sp{carr1}), "");
@@ -157,9 +144,9 @@ int main(int, char**)
static_assert(testConstexprSpan<Sp, 2>(Sp{carr1}), "");
static_assert(testConstexprSpan<Sp, 3>(Sp{carr1}), "");
static_assert(testConstexprSpan<Sp, 4>(Sp{carr1}), "");
- }
+ }
- {
+ {
using Sp = std::span<int>;
testRuntimeSpan<Sp, 0>(Sp{});
@@ -171,9 +158,9 @@ int main(int, char**)
testRuntimeSpan<Sp, 1, 2>(Sp{arr1});
testRuntimeSpan<Sp, 2, 1>(Sp{arr1});
testRuntimeSpan<Sp, 3, 0>(Sp{arr1});
- }
+ }
- {
+ {
using Sp = std::span<int, 3>;
testRuntimeSpan<Sp, 0, 3>(Sp{arr1});
@@ -184,9 +171,9 @@ int main(int, char**)
testRuntimeSpan<Sp, 1, 2>(Sp{arr1});
testRuntimeSpan<Sp, 2, 1>(Sp{arr1});
testRuntimeSpan<Sp, 3, 0>(Sp{arr1});
- }
+ }
- {
+ {
using Sp = std::span<int>;
testRuntimeSpan<Sp, 0>(Sp{});
@@ -194,16 +181,16 @@ int main(int, char**)
testRuntimeSpan<Sp, 1>(Sp{arr1});
testRuntimeSpan<Sp, 2>(Sp{arr1});
testRuntimeSpan<Sp, 3>(Sp{arr1});
- }
+ }
- {
+ {
using Sp = std::span<int, 3>;
testRuntimeSpan<Sp, 0>(Sp{arr1});
testRuntimeSpan<Sp, 1>(Sp{arr1});
testRuntimeSpan<Sp, 2>(Sp{arr1});
testRuntimeSpan<Sp, 3>(Sp{arr1});
- }
+ }
return 0;
}
diff --git a/libcxx/test/std/containers/views/views.span/span.sub/subspan.verify.cpp b/libcxx/test/std/containers/views/views.span/span.sub/subspan.verify.cpp
index d6bc21197098a4a..3c8b81a0d473492 100644
--- a/libcxx/test/std/containers/views/views.span/span.sub/subspan.verify.cpp
+++ b/libcxx/test/std/containers/views/views.span/span.sub/subspan.verify.cpp
@@ -26,14 +26,20 @@ void f() {
std::span<const int, 4> sp(array);
// Offset too large templatized
- [[maybe_unused]] auto s1 = sp.subspan<5>(); // expected-error at span:* {{span<T, N>::subspan<Offset, Count>(): Offset out of range}}
+ [[maybe_unused]] auto s1 =
+ sp.subspan<5>(); // expected-error at span:* {{span<T, N>::subspan<Offset, Count>(): Offset out of range}}
// Count too large templatized
- [[maybe_unused]] auto s2 = sp.subspan<0, 5>(); // expected-error at span:* {{span<T, N>::subspan<Offset, Count>(): Offset + Count out of range}}
+ [[maybe_unused]] auto s2 =
+ sp.subspan<0, 5>(); // expected-error at span:* {{span<T, N>::subspan<Offset, Count>(): Offset + Count out of range}}
// Offset + Count too large templatized
- [[maybe_unused]] auto s3 = sp.subspan<2, 3>(); // expected-error at span:* {{span<T, N>::subspan<Offset, Count>(): Offset + Count out of range}}
+ [[maybe_unused]] auto s3 =
+ sp.subspan<2, 3>(); // expected-error at span:* {{span<T, N>::subspan<Offset, Count>(): Offset + Count out of range}}
// Offset + Count overflow templatized
- [[maybe_unused]] auto s4 = sp.subspan<3, std::size_t(-2)>(); // expected-error at span:* {{span<T, N>::subspan<Offset, Count>(): Offset + Count out of range}}, expected-error-re at span:* {{array is too large{{(.* elements)}}}}
+ [[maybe_unused]] auto s4 = sp.subspan<
+ 3,
+ std::size_t(
+ -2)>(); // expected-error at span:* {{span<T, N>::subspan<Offset, Count>(): Offset + Count out of range}}, expected-error-re at span:* {{array is too large{{(.* elements)}}}}
}
diff --git a/libcxx/test/std/containers/views/views.span/types.pass.cpp b/libcxx/test/std/containers/views/views.span/types.pass.cpp
index be17884dae29559..14f5de823f3538a 100644
--- a/libcxx/test/std/containers/views/views.span/types.pass.cpp
+++ b/libcxx/test/std/containers/views/views.span/types.pass.cpp
@@ -37,59 +37,54 @@
#include "test_macros.h"
template <typename S, typename Iter>
-void testIterator()
-{
- typedef std::iterator_traits<Iter> ItT;
+void testIterator() {
+ typedef std::iterator_traits<Iter> ItT;
- ASSERT_SAME_TYPE(typename ItT::iterator_category, std::random_access_iterator_tag);
- ASSERT_SAME_TYPE(typename ItT::value_type, typename S::value_type);
- ASSERT_SAME_TYPE(typename ItT::reference, typename S::reference);
- ASSERT_SAME_TYPE(typename ItT::pointer, typename S::pointer);
- ASSERT_SAME_TYPE(typename ItT::
diff erence_type, typename S::
diff erence_type);
+ ASSERT_SAME_TYPE(typename ItT::iterator_category, std::random_access_iterator_tag);
+ ASSERT_SAME_TYPE(typename ItT::value_type, typename S::value_type);
+ ASSERT_SAME_TYPE(typename ItT::reference, typename S::reference);
+ ASSERT_SAME_TYPE(typename ItT::pointer, typename S::pointer);
+ ASSERT_SAME_TYPE(typename ItT::
diff erence_type, typename S::
diff erence_type);
}
template <typename S, typename ElementType, std::size_t Size>
-void testSpan()
-{
- ASSERT_SAME_TYPE(typename S::element_type, ElementType);
- ASSERT_SAME_TYPE(typename S::value_type, std::remove_cv_t<ElementType>);
- ASSERT_SAME_TYPE(typename S::size_type, std::size_t);
- ASSERT_SAME_TYPE(typename S::
diff erence_type, std::ptr
diff _t);
- ASSERT_SAME_TYPE(typename S::pointer, ElementType *);
- ASSERT_SAME_TYPE(typename S::const_pointer, const ElementType *);
- ASSERT_SAME_TYPE(typename S::reference, ElementType &);
- ASSERT_SAME_TYPE(typename S::const_reference, const ElementType &);
+void testSpan() {
+ ASSERT_SAME_TYPE(typename S::element_type, ElementType);
+ ASSERT_SAME_TYPE(typename S::value_type, std::remove_cv_t<ElementType>);
+ ASSERT_SAME_TYPE(typename S::size_type, std::size_t);
+ ASSERT_SAME_TYPE(typename S::
diff erence_type, std::ptr
diff _t);
+ ASSERT_SAME_TYPE(typename S::pointer, ElementType*);
+ ASSERT_SAME_TYPE(typename S::const_pointer, const ElementType*);
+ ASSERT_SAME_TYPE(typename S::reference, ElementType&);
+ ASSERT_SAME_TYPE(typename S::const_reference, const ElementType&);
- static_assert(S::extent == Size); // check that it exists
+ static_assert(S::extent == Size); // check that it exists
- testIterator<S, typename S::iterator>();
- testIterator<S, typename S::reverse_iterator>();
+ testIterator<S, typename S::iterator>();
+ testIterator<S, typename S::reverse_iterator>();
}
-
template <typename T>
-void test()
-{
- testSpan<std::span< T>, T, std::dynamic_extent>();
- testSpan<std::span<const T>, const T, std::dynamic_extent>();
- testSpan<std::span< volatile T>, volatile T, std::dynamic_extent>();
- testSpan<std::span<const volatile T>, const volatile T, std::dynamic_extent>();
+void test() {
+ testSpan<std::span< T>, T, std::dynamic_extent>();
+ testSpan<std::span<const T>, const T, std::dynamic_extent>();
+ testSpan<std::span< volatile T>, volatile T, std::dynamic_extent>();
+ testSpan<std::span<const volatile T>, const volatile T, std::dynamic_extent>();
- testSpan<std::span< T, 5>, T, 5>();
- testSpan<std::span<const T, 5>, const T, 5>();
- testSpan<std::span< volatile T, 5>, volatile T, 5>();
- testSpan<std::span<const volatile T, 5>, const volatile T, 5>();
+ testSpan<std::span< T, 5>, T, 5>();
+ testSpan<std::span<const T, 5>, const T, 5>();
+ testSpan<std::span< volatile T, 5>, volatile T, 5>();
+ testSpan<std::span<const volatile T, 5>, const volatile T, 5>();
}
-struct A{};
+struct A {};
-int main(int, char**)
-{
- test<int>();
- test<long>();
- test<double>();
- test<std::string>();
- test<A>();
+int main(int, char**) {
+ test<int>();
+ test<long>();
+ test<double>();
+ test<std::string>();
+ test<A>();
return 0;
}
More information about the libcxx-commits
mailing list