[libcxx-commits] [libcxx] [libc++] Make `<map>` `std::multimap` constexpr as part of P3372R3 (PR #161901)
Vinay Deshmukh via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Oct 18 13:04:35 PDT 2025
https://github.com/vinay-deshmukh updated https://github.com/llvm/llvm-project/pull/161901
>From adec1b72b127845afb4a08788ff61e9540e6bd90 Mon Sep 17 00:00:00 2001
From: Vinay Deshmukh <vinay_deshmukh at outlook.com>
Date: Fri, 3 Oct 2025 16:10:04 -0400
Subject: [PATCH 01/11] From PR 134330
Apply initial _LIBCPP_CONSTEXPR_SINCE_CXX26
Add feature test macro
one test to start with
start seeing constexpr failures for at.pass.cpp
member call on object outside its lifetime is not allowed in a constant expression
Move past member call on object past it's lifetime
Add ctor to initialize __value_type and __tree_node_base, and the object of unique_ptr
construction works, at() fails due to throw_out_of_range
can't intentionally throw in constexpr
note: cast from 'void *' is not allowed in a constant expression because the pointed object type 'std::__tree_node<std::__value_type<int, double>, min_pointer<void>>' is not similar to the target type 'std::__tree_node_base<min_pointer<void>>'
note: cast from 'void *' is not allowed in a constant expression because the pointed object type 'std::__tree_node<std::__value_type<int, double>, min_pointer<void>>' is not similar to the target type 'std::__tree_node_base<min_pointer<void>>
ignore min_allocator tests for now
at.pass.cpp works in cpp26 for some reason
empty.verify.cpp passes
index_key_.pass.cpp constexpr fixed, but other failure
index_rv_key.pass.cpp constexpr fixed, but other failure
fix index_tuple.pass.cpp
fix: iterator.pass.cpp
fix max_size.pass.cpp
size.pass.cpp
alloc.pass.cpp
blocked on assign_initializer_list
compare.pass.cpp
Modify all tests to have TEST_CONSTEXPR_CXX26 and without
passing at: copy_assign.addressof.compile.pass.cpp
failing at copy_assign.pass.cpp only in constexpr
pass deduct.pass.cpp
fix map.cons/from_range.pass.cpp
fail at map.cons/move_alloc.pass.cpp
fail at map.cons/move_assign.pass.cpp
fix map.cons/move_noexcept.pass.cpp
pass map.erasure/erase_if.pass.cpp
error: call to deleted constructor at map.modifiers/emplace.pass.cpp
pass map.modifiers/erase_iter.pass.cpp
pass map.modifiers/extract_iterator.pass.cpp
TODO: node-handle tests
pass map.modifiers/extract_key.pass.cpp
pass map.modifiers/insert_and_emplace_allocator_requirements.pass.cpp
pass map.modifiers/insert_cv.pass.cpp
pass map.modifiers/insert_iter_cv.pass.cpp
pass map.modifiers/insert_iter_rv.pass.cpp
pass map.modifiers/insert_node_type.pass
pass map.modifiers/insert_node_type_hint.pass.cpp
pass map.modifiers/insert_or_assign.pass.cpp
pass map.modifiers/insert_rv.pass.cpp
pass map.modifiers/try.emplace.pass.cpp, fix typos
pass map.nonmember/compare.three_way.pass.cpp
pass map.nonmember/op_compare.pass.cpp
pass map.observers/key_comp.pass.cpp
pass map.observers/value_comp.pass.cpp
pass map.ops/contains.pass.cpp
pass map.ops/contains_transparent.pass.cpp
pass map.ops/count.pass.cpp
pass map.ops/count_transparent.pass.cpp
pass map.ops/equal_range_transparent.pass.cpp
pass map.special/member_swap.pass.cpp
pass map.value_compare/invoke.pass.cpp
pass map.value_compare/types.pass.cpp
cleanup
Pass compare.pass.cpp
pass incomplete_type.pass.cpp
error: call to deleted constructor of '__node_value_type' (aka 'std::__value_type<int, int>')
clang-format
Generate macro version correctly
fix unrelated CI failures
pass map.modifiers/emplace.pass.cpp
pass map.modifiers/emplace_hint.pass.cpp
at.pass.cpp passes again
iterator.pass.cpp passes
move_assign.pass.cpp constexpr fixed
move_alloc.pass.cpp constexpr fixed, other remains
copy_assign.pass.cpp constexpr fixed, other remains
erase_iter.pass.cpp
fix typo
map.ops pass
Partially fix assign_initializer_list.pass.cpp
Fix assign_initializer_list.pass.cpp
fix placement new to use std::addressof
fix copy_assign.pass.cpp
move alloc failure location
git-clang-format upstream/main
featuer test generation
<__type_traits/is_constant_evaluated.h>
__node_value_type
Use __libcpp_is_constant_evaluated, still at 7 failures
fix feature gen?
feature macros
? lang support
cf
restore pair to main
back at 7 failures due to min_allocator.h
cf?
insert_range.pass.cpp, empty passes, stuck at next
min_allocator to main
tree
clang format
fix CI?
try CI fix?
readability-identifier-naming
libcpp-hide-from-abi
cf
_Args not Args
map?
generic-cxx03
libcpp-hide-from-abi
cxx03
tmp
WIP???
constexpr test ID*
at.pass.cpp works
empty.pass.cpp
index_key.pass.cpp -> static_assert
error: static assertion failed due to requirement 'std::is_same<std::__tree_node<std::__value_type<CopyInsertable<1>, CopyInsertable<2>>, void *>, std::pair<const CopyInsertable<1>, CopyInsertable<2>>>::value': Only allowed to construct Up
iterator.pass.cpp
size.pass.cpp
map.cons/assign_initializer_list.pass.cpp
map.modifiers/emplace.pass.cpp
map.modifiers/emplace_hint.pass.cpp
map.modifiers/erase_key.pass.cpp
map.ops/count.pass.cpp
map.ops/equal_range.pass.cpp
map.ops/find.pass.cpp
map.ops/upper_bound.pass.cpp
clang-format
fix error
value_comp bad merge
_root cannot be redeclared
remove base and cast
copy_assign.pass.cpp
fails largely because of constexpr limit, because for Container<int, MoveOnly> c, issues happen similar to move_alloc move_assign
use __node_traits::construct over placement new, copy_assing copy_alloc still pass
cf
note for failure
TODO
add constexpr cpp26
mistake
6 failures
something
clean
clean more
fix same_as allocate issues in index_rv_key
failures at move_alloc and move_assign
allocator for copy_assign
index_rv_key at it again
haxxx
Temporary solution for UB & restriction
copy_assign.pass.cpp
Finally only 2 tests fail
insert_key.pass.cpp
Move_alloc.pass.cpp fails
add docs
move_alloc and move_assign, fail in __insert_unique_from_orphaned_node, need to place the SFINAE there, not in __assign_value
kind of fixed it, almost
Fix for move_assign
almost a fix for move_assign.pass.cpp
insert_range_maps_sets.h, needs a lot of constexpr depth
add why sfinae
insert_and_emplace_allocator_requirements.pass.cpp passes
use the typedef
remove concepts, collapse unnecessary sfinae
some docs
breaks correctly
still correct failures with cleanup
more cleans
more clean
PR review comment
include __memory/construct_at
`Assertion `getConstructController()->isInAllocatorConstruct()' failed.`Revert "PR review comment"
This reverts commit 4fbb47245f2e47f1e9b59f656b8d29fc5d332082.
Fails with:
```
# .---command stderr------------
# | t.tmp.exe: /home/runner/_work/llvm-project/llvm-project/libcxx/test/support/container_test_types.h:399: CopyInsertable<1>::CopyInsertable(const CopyInsertable<Dummy> &) [Dummy = 1]: Assertion `getConstructController()->isInAllocatorConstruct()' failed.
# `-----------------------------
# error: command failed with exit status: 250
```
one clean
cleanup for libcxx/test/support/container_test_types.h
clean back
clang-format
adjust constexpr steps arg
clean
Redundant check
Add ReleaseNotes
use allocator as template arg and allocator_traits, tests passed in cpp26
cf
hide from abi
Attempt fix for gcc-15 std=c++26
try
format and arm fix attempt'
cf
fix non-ascii
=default;
noop
abi
constexpr-dtor
WIP: gcc-15 failure investigation
fix the first failure with ptr_ is uninitialized
fix map
revert min_allocator default construction
_ptr is not initialized
use allocator as template arg and allocator_traits, tests passed in cpp26
remove UB using list
cf
doc-fix
Replace __value_ with __get_value() for __tree_node
miss typo
fix ctor for cpp03 buffer
cf
rename in map as well
cf
include
more?
hide from abi
terser
redundant launder
single branch
remove the & from buffer
remove _LIBCPP_STANDALONE_DEBUG
cf
disable test for g++-15
remove debugging attempts
Remove debugging attempt
Fix testing at runtime as well
Description and links
partial fix for }
restore TEST_HAS_NO_EXCEPTIONS
Remove extra include
remove set -x
undo debug attempts
Refactor libcxx/test/std/containers/associative/map/map.modifiers/insert_range.pass.cpp
CWG1514: key() is not constexpr
static can't be constexpr
Refactor libcxx/test/std/containers/associative/map/map.cons/from_range.pass.cpp
Refactor libcxx/test/std/containers/associative/map/map.cons/copy_alloc.pass.cpp
Refactor libcxx/test/std/containers/associative/map/map.cons/copy.pass.cpp
Refactor libcxx/test/std/containers/associative/map/map.access/index_rv_key.pass.cpp
Refactor libcxx/test/std/containers/associative/map/map.access/index_key.pass.cpp
grammar
Pass the generic-hardening-mode-debug
cf and remove non-ascii
Remove hide abi
obsolete comment
Add FIXME
Apply cf
cf
add constexpr
cf
Move ReleaseNotes to Implemented papers
Fix order of annotations
node-handle doc
unrelated defaulting
undo previous
unnecessary destructor for __tree_node_base
Remove constexpr from cpp03 code
Unnecessary annotation on deleted function
simplify type_trait
Allow runtime decision for __insert_unique_from_orphaned_node
Allow runtime decision for __assign_value
local cf
Simplify at.pass.cpp
use TEST_IS_CONSTANT_EVALUATED over libcxx function
Remove extra arm CI hack
missing space
Avoid creating a __tmp
explicit copy
Remove constexpr annotations from multimap
CI fix for clang <=20
Check clang<20 only for clang based compilers
Fix apple-clang macro lookup
Fixme, not todo
Updated FIXME
Remove assert(test());
clang-format?
Synopsis attach: // constexpr since C++26
Revert "Remove assert(test());"
This reverts commit 9f931f59588b2d1a4deaaafc8dcde8420ed23f3b.
Fix the sed script
---
libcxx/docs/FeatureTestMacroTable.rst | 18 +-
libcxx/docs/ReleaseNotes/22.rst | 13 +-
.../include/__iterator/erase_if_container.h | 3 +-
libcxx/include/__node_handle | 46 +-
libcxx/include/__tree | 876 ++++++++++--------
.../lazy_synth_three_way_comparator.h | 33 +-
libcxx/include/map | 714 +++++++-------
libcxx/include/version | 39 +-
libcxx/test/std/containers/Emplaceable.h | 22 +-
.../from_range_associative_containers.h | 18 +-
.../associative/map/compare.pass.cpp | 15 +-
.../associative/map/get_allocator.pass.cpp | 11 +-
.../associative/map/incomplete_type.pass.cpp | 17 +-
.../associative/map/map.access/at.pass.cpp | 66 +-
.../associative/map/map.access/empty.pass.cpp | 11 +-
.../map/map.access/index_key.pass.cpp | 14 +-
.../map/map.access/index_rv_key.pass.cpp | 16 +-
.../map/map.access/index_tuple.pass.cpp | 14 +-
.../map/map.access/iterator.pass.cpp | 33 +-
.../map/map.access/max_size.pass.cpp | 11 +-
.../associative/map/map.access/size.pass.cpp | 11 +-
.../associative/map/map.cons/alloc.pass.cpp | 11 +-
.../map.cons/assign_initializer_list.pass.cpp | 17 +-
.../associative/map/map.cons/compare.pass.cpp | 11 +-
.../map/map.cons/compare_alloc.pass.cpp | 11 +-
.../associative/map/map.cons/copy.pass.cpp | 12 +-
.../map/map.cons/copy_alloc.pass.cpp | 13 +-
.../map/map.cons/copy_assign.pass.cpp | 43 +-
.../associative/map/map.cons/deduct.pass.cpp | 11 +-
.../map/map.cons/deduct_const.pass.cpp | 11 +-
.../associative/map/map.cons/default.pass.cpp | 11 +-
.../map/map.cons/default_noexcept.pass.cpp | 11 +-
.../map/map.cons/dtor_noexcept.pass.cpp | 11 +-
.../map/map.cons/from_range.pass.cpp | 15 +-
.../map/map.cons/initializer_list.pass.cpp | 11 +-
.../initializer_list_compare.pass.cpp | 11 +-
.../initializer_list_compare_alloc.pass.cpp | 11 +-
.../map/map.cons/iter_iter.pass.cpp | 11 +-
.../map/map.cons/iter_iter_comp.pass.cpp | 11 +-
.../map.cons/iter_iter_comp_alloc.pass.cpp | 11 +-
.../associative/map/map.cons/move.pass.cpp | 11 +-
.../map/map.cons/move_alloc.pass.cpp | 12 +-
.../map/map.cons/move_assign.pass.cpp | 13 +-
.../map/map.cons/move_noexcept.pass.cpp | 12 +-
.../map/map.erasure/erase_if.pass.cpp | 29 +-
.../map/map.modifiers/clear.pass.cpp | 11 +-
.../map/map.modifiers/emplace.pass.cpp | 122 +--
.../map/map.modifiers/emplace_hint.pass.cpp | 111 ++-
.../map/map.modifiers/erase_iter.pass.cpp | 13 +-
.../map.modifiers/erase_iter_iter.pass.cpp | 11 +-
.../map/map.modifiers/erase_key.pass.cpp | 11 +-
.../map.modifiers/extract_iterator.pass.cpp | 25 +-
.../map/map.modifiers/extract_key.pass.cpp | 24 +-
.../map/map.modifiers/insert_cv.pass.cpp | 15 +-
.../insert_initializer_list.pass.cpp | 11 +-
.../map/map.modifiers/insert_iter_cv.pass.cpp | 15 +-
.../map.modifiers/insert_iter_iter.pass.cpp | 11 +-
.../map/map.modifiers/insert_iter_rv.pass.cpp | 15 +-
.../map.modifiers/insert_or_assign.pass.cpp | 35 +-
.../map/map.modifiers/insert_range.pass.cpp | 12 +-
.../map/map.modifiers/insert_rv.pass.cpp | 15 +-
.../map/map.modifiers/try.emplace.pass.cpp | 39 +-
.../map.nonmember/compare.three_way.pass.cpp | 7 +-
.../map/map.nonmember/op_compare.pass.cpp | 12 +-
.../map/map.observers/key_comp.pass.cpp | 13 +-
.../map/map.observers/value_comp.pass.cpp | 13 +-
.../associative/map/map.ops/contains.pass.cpp | 20 +-
.../map/map.ops/contains_transparent.pass.cpp | 31 +-
.../associative/map/map.ops/count.pass.cpp | 19 +-
.../associative/map/map.ops/count0.pass.cpp | 11 +-
.../map/map.ops/count_transparent.pass.cpp | 22 +-
.../map/map.ops/equal_range.pass.cpp | 13 +-
.../map/map.ops/equal_range0.pass.cpp | 13 +-
.../map.ops/equal_range_transparent.pass.cpp | 23 +-
.../associative/map/map.ops/find.pass.cpp | 14 +-
.../associative/map/map.ops/find0.pass.cpp | 13 +-
.../map/map.ops/lower_bound.pass.cpp | 13 +-
.../map/map.ops/lower_bound0.pass.cpp | 13 +-
.../map/map.ops/upper_bound.pass.cpp | 13 +-
.../map/map.ops/upper_bound0.pass.cpp | 14 +-
.../map/map.special/member_swap.pass.cpp | 11 +-
.../map/map.special/non_member_swap.pass.cpp | 11 +-
.../map/map.special/swap_noexcept.pass.cpp | 13 +-
.../map/map.value_compare/invoke.pass.cpp | 17 +-
.../containers/associative/map/types.pass.cpp | 9 +-
.../container.node/node_handle.pass.cpp | 52 +-
.../std/containers/insert_range_maps_sets.h | 13 +-
libcxx/test/std/containers/test_compare.h | 18 +-
.../map.version.compile.pass.cpp | 626 +++++++------
.../version.version.compile.pass.cpp | 356 +++----
libcxx/test/support/is_transparent.h | 13 +-
libcxx/test/support/private_constructor.h | 18 +-
.../generate_feature_test_macro_components.py | 66 +-
93 files changed, 2504 insertions(+), 1824 deletions(-)
diff --git a/libcxx/docs/FeatureTestMacroTable.rst b/libcxx/docs/FeatureTestMacroTable.rst
index 8fba6db871f08..1e096bcb325d1 100644
--- a/libcxx/docs/FeatureTestMacroTable.rst
+++ b/libcxx/docs/FeatureTestMacroTable.rst
@@ -198,10 +198,6 @@ Status
---------------------------------------------------------- -----------------
``__cpp_lib_char8_t`` ``201907L``
---------------------------------------------------------- -----------------
- ``__cpp_lib_common_reference`` ``202302L``
- ---------------------------------------------------------- -----------------
- ``__cpp_lib_common_reference_wrapper`` ``202302L``
- ---------------------------------------------------------- -----------------
``__cpp_lib_concepts`` ``202002L``
---------------------------------------------------------- -----------------
``__cpp_lib_constexpr_algorithms`` ``201806L``
@@ -380,7 +376,7 @@ Status
---------------------------------------------------------- -----------------
``__cpp_lib_ranges_iota`` ``202202L``
---------------------------------------------------------- -----------------
- ``__cpp_lib_ranges_join_with`` ``202202L``
+ ``__cpp_lib_ranges_join_with`` *unimplemented*
---------------------------------------------------------- -----------------
``__cpp_lib_ranges_repeat`` ``202207L``
---------------------------------------------------------- -----------------
@@ -418,8 +414,6 @@ Status
---------------------------------------------------------- -----------------
``__cpp_lib_atomic_min_max`` *unimplemented*
---------------------------------------------------------- -----------------
- ``__cpp_lib_atomic_ref`` ``202411L``
- ---------------------------------------------------------- -----------------
``__cpp_lib_bind_front`` ``202306L``
---------------------------------------------------------- -----------------
``__cpp_lib_bitset`` ``202306L``
@@ -430,11 +424,13 @@ Status
---------------------------------------------------------- -----------------
``__cpp_lib_constexpr_list`` ``202502L``
---------------------------------------------------------- -----------------
+ ``__cpp_lib_constexpr_map`` ``202502L``
+ ---------------------------------------------------------- -----------------
``__cpp_lib_constexpr_new`` ``202406L``
---------------------------------------------------------- -----------------
``__cpp_lib_constexpr_queue`` ``202502L``
---------------------------------------------------------- -----------------
- ``__cpp_lib_constrained_equality`` ``202411L``
+ ``__cpp_lib_constrained_equality`` *unimplemented*
---------------------------------------------------------- -----------------
``__cpp_lib_copyable_function`` *unimplemented*
---------------------------------------------------------- -----------------
@@ -482,7 +478,7 @@ Status
---------------------------------------------------------- -----------------
``__cpp_lib_not_fn`` ``202306L``
---------------------------------------------------------- -----------------
- ``__cpp_lib_optional_range_support`` ``202406L``
+ ``__cpp_lib_optional_range_support`` *unimplemented*
---------------------------------------------------------- -----------------
``__cpp_lib_out_ptr`` ``202311L``
---------------------------------------------------------- -----------------
@@ -490,8 +486,6 @@ Status
---------------------------------------------------------- -----------------
``__cpp_lib_ranges_concat`` *unimplemented*
---------------------------------------------------------- -----------------
- ``__cpp_lib_ranges_indices`` ``202506L``
- ---------------------------------------------------------- -----------------
``__cpp_lib_ratio`` ``202306L``
---------------------------------------------------------- -----------------
``__cpp_lib_rcu`` *unimplemented*
@@ -510,8 +504,6 @@ Status
---------------------------------------------------------- -----------------
``__cpp_lib_sstream_from_string_view`` ``202306L``
---------------------------------------------------------- -----------------
- ``__cpp_lib_string_subview`` ``202506L``
- ---------------------------------------------------------- -----------------
``__cpp_lib_string_view`` ``202403L``
---------------------------------------------------------- -----------------
``__cpp_lib_submdspan`` *unimplemented*
diff --git a/libcxx/docs/ReleaseNotes/22.rst b/libcxx/docs/ReleaseNotes/22.rst
index 0fd7e53aed158..c6ee41bccdb30 100644
--- a/libcxx/docs/ReleaseNotes/22.rst
+++ b/libcxx/docs/ReleaseNotes/22.rst
@@ -40,11 +40,8 @@ Implemented Papers
- P2321R2: ``zip`` (`Github <https://llvm.org/PR105169>`__) (The paper is partially implemented. ``zip_transform_view``
is implemented in this release)
-- P3044R2: sub-``string_view`` from ``string`` (`Github <https://llvm.org/PR148140>`__)
-- P3223R2: Making ``std::istream::ignore`` less surprising (`Github <https://llvm.org/PR148178>`__)
-- P3060R3: Add ``std::views::indices(n)`` (`Github <https://llvm.org/PR148175>`__)
-- P2835R7: Expose ``std::atomic_ref``'s object address (`Github <https://llvm.org/PR118377>`__)
- P3168R2: Give ``std::optional`` Range Support (`Github <https://llvm.org/PR105430>`__)
+- P3372R3: ``constexpr map`` (`Github <https://llvm.org/PR134330>`__) (The paper is partially implemented. ``constexpr map`` is implemented in this release)
Improvements and New Features
-----------------------------
@@ -67,14 +64,6 @@ Improvements and New Features
- Multiple internal types have been refactored to use ``[[no_unique_address]]``, resulting in faster compile times and
reduced debug information.
-- The performance of ``std::find`` has been improved by up to 2x for integral types
-- The ``std::distance`` and ``std::ranges::distance`` algorithms have been optimized for segmented iterators (e.g.,
- ``std::join_view`` iterators), reducing the complexity from ``O(n)`` to ``O(n / segment_size)``. Benchmarks show
- performance improvements of over 1600x in favorable cases with large segment sizes (e.g., 1024).
-- The ``std::{fill, fill_n}`` and ``std::ranges::{fill, fill_n}`` algorithms have been optimized for segmented iterators,
- resulting in a performance improvement of at least 10x for ``std::deque<int>`` iterators and
- ``std::join_view<std::vector<std::vector<int>>>`` iterators.
-
Deprecations and Removals
-------------------------
diff --git a/libcxx/include/__iterator/erase_if_container.h b/libcxx/include/__iterator/erase_if_container.h
index 0f87f50cd1c16..8d92d3f1b9dbe 100644
--- a/libcxx/include/__iterator/erase_if_container.h
+++ b/libcxx/include/__iterator/erase_if_container.h
@@ -22,7 +22,8 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Container, class _Predicate>
-_LIBCPP_HIDE_FROM_ABI typename _Container::size_type __libcpp_erase_if_container(_Container& __c, _Predicate& __pred) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 typename _Container::size_type
+__libcpp_erase_if_container(_Container& __c, _Predicate& __pred) {
typename _Container::size_type __old_size = __c.size();
const typename _Container::iterator __last = __c.end();
diff --git a/libcxx/include/__node_handle b/libcxx/include/__node_handle
index b20b0c73a0518..83dfe146a0f61 100644
--- a/libcxx/include/__node_handle
+++ b/libcxx/include/__node_handle
@@ -30,30 +30,30 @@ private:
public:
// [container.node.cons], constructors, copy, and assignment
- constexpr node-handle() noexcept : ptr_(), alloc_() {}
- node-handle(node-handle&&) noexcept;
- node-handle& operator=(node-handle&&);
+ constexpr node-handle() noexcept : ptr_(), alloc_() {} // constexpr since C++26
+ node-handle(node-handle&&) noexcept; // constexpr since C++26
+ node-handle& operator=(node-handle&&); // constexpr since C++26
// [container.node.dtor], destructor
- ~node-handle();
+ ~node-handle(); // constexpr since C++26
// [container.node.observers], observers
value_type& value() const; // not present for map containers
key_type& key() const; // not present for set containers
- mapped_type& mapped() const; // not present for set containers
+ mapped_type& mapped() const; // not present for set containers // constexpr since C++26
- allocator_type get_allocator() const;
- explicit operator bool() const noexcept;
- [[nodiscard]] bool empty() const noexcept; // nodiscard since C++20
+ allocator_type get_allocator() const; // constexpr since C++26
+ explicit operator bool() const noexcept; // constexpr since C++26
+ [[nodiscard]] bool empty() const noexcept; // nodiscard since C++20 // constexpr since C++26
// [container.node.modifiers], modifiers
void swap(node-handle&)
noexcept(ator_traits::propagate_on_container_swap::value ||
- ator_traits::is_always_equal::value);
+ ator_traits::is_always_equal::value); // constexpr since C++26
friend void swap(node-handle& x, node-handle& y) noexcept(noexcept(x.swap(y))) {
x.swap(y);
- }
+ } // constexpr since C++26
};
*/
@@ -99,12 +99,12 @@ private:
__node_pointer_type __ptr_ = nullptr;
optional<allocator_type> __alloc_;
- _LIBCPP_HIDE_FROM_ABI void __release_ptr() {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __release_ptr() {
__ptr_ = nullptr;
__alloc_ = std::nullopt;
}
- _LIBCPP_HIDE_FROM_ABI void __destroy_node_pointer() {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __destroy_node_pointer() {
if (__ptr_ != nullptr) {
typedef typename __allocator_traits_rebind< allocator_type, _NodeType>::type __node_alloc_type;
__node_alloc_type __alloc(*__alloc_);
@@ -113,19 +113,20 @@ private:
}
}
- _LIBCPP_HIDE_FROM_ABI __basic_node_handle(__node_pointer_type __ptr, allocator_type const& __alloc)
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
+ __basic_node_handle(__node_pointer_type __ptr, allocator_type const& __alloc)
: __ptr_(__ptr), __alloc_(__alloc) {}
public:
- _LIBCPP_HIDE_FROM_ABI __basic_node_handle() = default;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __basic_node_handle() = default;
- _LIBCPP_HIDE_FROM_ABI __basic_node_handle(__basic_node_handle&& __other) noexcept
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __basic_node_handle(__basic_node_handle&& __other) noexcept
: __ptr_(__other.__ptr_), __alloc_(std::move(__other.__alloc_)) {
__other.__ptr_ = nullptr;
__other.__alloc_ = std::nullopt;
}
- _LIBCPP_HIDE_FROM_ABI __basic_node_handle& operator=(__basic_node_handle&& __other) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __basic_node_handle& operator=(__basic_node_handle&& __other) {
_LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
__alloc_ == std::nullopt || __alloc_traits::propagate_on_container_move_assignment::value ||
__alloc_ == __other.__alloc_,
@@ -144,13 +145,13 @@ public:
return *this;
}
- _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const { return *__alloc_; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 allocator_type get_allocator() const { return *__alloc_; }
- _LIBCPP_HIDE_FROM_ABI explicit operator bool() const { return __ptr_ != nullptr; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit operator bool() const { return __ptr_ != nullptr; }
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool empty() const { return __ptr_ == nullptr; }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool empty() const { return __ptr_ == nullptr; }
- _LIBCPP_HIDE_FROM_ABI void swap(__basic_node_handle& __other) noexcept(
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void swap(__basic_node_handle& __other) noexcept(
__alloc_traits::propagate_on_container_swap::value || __alloc_traits::is_always_equal::value) {
using std::swap;
swap(__ptr_, __other.__ptr_);
@@ -159,12 +160,12 @@ public:
swap(__alloc_, __other.__alloc_);
}
- _LIBCPP_HIDE_FROM_ABI friend void
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 friend void
swap(__basic_node_handle& __a, __basic_node_handle& __b) noexcept(noexcept(__a.swap(__b))) {
__a.swap(__b);
}
- _LIBCPP_HIDE_FROM_ABI ~__basic_node_handle() { __destroy_node_pointer(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 ~__basic_node_handle() { __destroy_node_pointer(); }
};
template <class _NodeType, class _Derived>
@@ -179,6 +180,7 @@ struct __map_node_handle_specifics {
using key_type = __remove_const_t<typename _NodeType::__node_value_type::first_type>;
using mapped_type = typename _NodeType::__node_value_type::second_type;
+ // This method is not constexpr as per the standard.
_LIBCPP_HIDE_FROM_ABI key_type& key() const {
return const_cast<key_type&>(static_cast<_Derived const*>(this)->__ptr_->__get_value().first);
}
diff --git a/libcxx/include/__tree b/libcxx/include/__tree
index 0738c8c6a5e2b..ecaa72f591622 100644
--- a/libcxx/include/__tree
+++ b/libcxx/include/__tree
@@ -28,13 +28,14 @@
#include <__type_traits/copy_cvref.h>
#include <__type_traits/enable_if.h>
#include <__type_traits/invoke.h>
+#include <__type_traits/is_const.h>
+#include <__type_traits/is_constant_evaluated.h>
#include <__type_traits/is_constructible.h>
#include <__type_traits/is_nothrow_assignable.h>
#include <__type_traits/is_nothrow_constructible.h>
#include <__type_traits/is_same.h>
#include <__type_traits/is_specialization.h>
#include <__type_traits/is_swappable.h>
-#include <__type_traits/make_transparent.h>
#include <__type_traits/remove_const.h>
#include <__utility/forward.h>
#include <__utility/lazy_synth_three_way_comparator.h>
@@ -111,7 +112,7 @@ __root, have a non-null __parent_ field.
// Returns: true if __x is a left child of its parent, else false
// Precondition: __x != nullptr.
template <class _NodePtr>
-inline _LIBCPP_HIDE_FROM_ABI bool __tree_is_left_child(_NodePtr __x) _NOEXCEPT {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool __tree_is_left_child(_NodePtr __x) _NOEXCEPT {
return __x == __x->__parent_->__left_;
}
@@ -119,7 +120,7 @@ inline _LIBCPP_HIDE_FROM_ABI bool __tree_is_left_child(_NodePtr __x) _NOEXCEPT {
// __x is a proper subtree, returns the black height (null counts as 1). If
// __x is an improper subtree, returns 0.
template <class _NodePtr>
-unsigned __tree_sub_invariant(_NodePtr __x) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 unsigned __tree_sub_invariant(_NodePtr __x) {
if (__x == nullptr)
return 1;
// parent consistency checked by caller
@@ -151,7 +152,7 @@ unsigned __tree_sub_invariant(_NodePtr __x) {
// __root == nullptr is a proper tree. Returns true if __root is a proper
// red black tree, else returns false.
template <class _NodePtr>
-_LIBCPP_HIDE_FROM_ABI bool __tree_invariant(_NodePtr __root) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool __tree_invariant(_NodePtr __root) {
if (__root == nullptr)
return true;
// check __x->__parent_ consistency
@@ -168,7 +169,7 @@ _LIBCPP_HIDE_FROM_ABI bool __tree_invariant(_NodePtr __root) {
// Returns: pointer to the left-most node under __x.
template <class _NodePtr>
-inline _LIBCPP_HIDE_FROM_ABI _NodePtr __tree_min(_NodePtr __x) _NOEXCEPT {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _NodePtr __tree_min(_NodePtr __x) _NOEXCEPT {
_LIBCPP_ASSERT_INTERNAL(__x != nullptr, "Root node shouldn't be null");
while (__x->__left_ != nullptr)
__x = __x->__left_;
@@ -177,7 +178,7 @@ inline _LIBCPP_HIDE_FROM_ABI _NodePtr __tree_min(_NodePtr __x) _NOEXCEPT {
// Returns: pointer to the right-most node under __x.
template <class _NodePtr>
-inline _LIBCPP_HIDE_FROM_ABI _NodePtr __tree_max(_NodePtr __x) _NOEXCEPT {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _NodePtr __tree_max(_NodePtr __x) _NOEXCEPT {
_LIBCPP_ASSERT_INTERNAL(__x != nullptr, "Root node shouldn't be null");
while (__x->__right_ != nullptr)
__x = __x->__right_;
@@ -186,7 +187,7 @@ inline _LIBCPP_HIDE_FROM_ABI _NodePtr __tree_max(_NodePtr __x) _NOEXCEPT {
// Returns: pointer to the next in-order node after __x.
template <class _NodePtr>
-_LIBCPP_HIDE_FROM_ABI _NodePtr __tree_next(_NodePtr __x) _NOEXCEPT {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _NodePtr __tree_next(_NodePtr __x) _NOEXCEPT {
_LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null");
if (__x->__right_ != nullptr)
return std::__tree_min(__x->__right_);
@@ -201,10 +202,10 @@ _LIBCPP_HIDE_FROM_ABI _NodePtr __tree_next(_NodePtr __x) _NOEXCEPT {
// to the actual root of the tree through a __left_ pointer. Incrementing the end() pointer is UB, so we can assume that
// never happens.
template <class _EndNodePtr, class _NodePtr>
-inline _LIBCPP_HIDE_FROM_ABI _EndNodePtr __tree_next_iter(_NodePtr __x) _NOEXCEPT {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _EndNodePtr __tree_next_iter(_NodePtr __x) _NOEXCEPT {
_LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null");
if (__x->__right_ != nullptr)
- return static_cast<_EndNodePtr>(std::__tree_min(__x->__right_));
+ return std::__static_fancy_pointer_cast<_EndNodePtr>(std::__tree_min(__x->__right_));
while (!std::__tree_is_left_child(__x))
__x = __x->__parent_unsafe();
return static_cast<_EndNodePtr>(__x->__parent_);
@@ -213,11 +214,11 @@ inline _LIBCPP_HIDE_FROM_ABI _EndNodePtr __tree_next_iter(_NodePtr __x) _NOEXCEP
// Returns: pointer to the previous in-order node before __x.
// Note: __x may be the end node.
template <class _NodePtr, class _EndNodePtr>
-inline _LIBCPP_HIDE_FROM_ABI _NodePtr __tree_prev_iter(_EndNodePtr __x) _NOEXCEPT {
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _NodePtr __tree_prev_iter(_EndNodePtr __x) _NOEXCEPT {
_LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null");
if (__x->__left_ != nullptr)
return std::__tree_max(__x->__left_);
- _NodePtr __xx = static_cast<_NodePtr>(__x);
+ _NodePtr __xx = std::__static_fancy_pointer_cast<_NodePtr>(__x);
while (std::__tree_is_left_child(__xx))
__xx = __xx->__parent_unsafe();
return __xx->__parent_unsafe();
@@ -225,7 +226,7 @@ inline _LIBCPP_HIDE_FROM_ABI _NodePtr __tree_prev_iter(_EndNodePtr __x) _NOEXCEP
// Returns: pointer to a node which has no children
template <class _NodePtr>
-_LIBCPP_HIDE_FROM_ABI _NodePtr __tree_leaf(_NodePtr __x) _NOEXCEPT {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _NodePtr __tree_leaf(_NodePtr __x) _NOEXCEPT {
_LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null");
while (true) {
if (__x->__left_ != nullptr) {
@@ -244,7 +245,7 @@ _LIBCPP_HIDE_FROM_ABI _NodePtr __tree_leaf(_NodePtr __x) _NOEXCEPT {
// Effects: Makes __x->__right_ the subtree root with __x as its left child
// while preserving in-order order.
template <class _NodePtr>
-_LIBCPP_HIDE_FROM_ABI void __tree_left_rotate(_NodePtr __x) _NOEXCEPT {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __tree_left_rotate(_NodePtr __x) _NOEXCEPT {
_LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null");
_LIBCPP_ASSERT_INTERNAL(__x->__right_ != nullptr, "node should have a right child");
_NodePtr __y = __x->__right_;
@@ -263,7 +264,7 @@ _LIBCPP_HIDE_FROM_ABI void __tree_left_rotate(_NodePtr __x) _NOEXCEPT {
// Effects: Makes __x->__left_ the subtree root with __x as its right child
// while preserving in-order order.
template <class _NodePtr>
-_LIBCPP_HIDE_FROM_ABI void __tree_right_rotate(_NodePtr __x) _NOEXCEPT {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __tree_right_rotate(_NodePtr __x) _NOEXCEPT {
_LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null");
_LIBCPP_ASSERT_INTERNAL(__x->__left_ != nullptr, "node should have a left child");
_NodePtr __y = __x->__left_;
@@ -287,7 +288,8 @@ _LIBCPP_HIDE_FROM_ABI void __tree_right_rotate(_NodePtr __x) _NOEXCEPT {
// Postcondition: __tree_invariant(end_node->__left_) == true. end_node->__left_
// may be different than the value passed in as __root.
template <class _NodePtr>
-_LIBCPP_HIDE_FROM_ABI void __tree_balance_after_insert(_NodePtr __root, _NodePtr __x) _NOEXCEPT {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
+__tree_balance_after_insert(_NodePtr __root, _NodePtr __x) _NOEXCEPT {
_LIBCPP_ASSERT_INTERNAL(__root != nullptr, "Root of the tree shouldn't be null");
_LIBCPP_ASSERT_INTERNAL(__x != nullptr, "Can't attach null node to a leaf");
__x->__is_black_ = __x == __root;
@@ -343,7 +345,7 @@ _LIBCPP_HIDE_FROM_ABI void __tree_balance_after_insert(_NodePtr __root, _NodePtr
// nor any of its children refer to __z. end_node->__left_
// may be different than the value passed in as __root.
template <class _NodePtr>
-_LIBCPP_HIDE_FROM_ABI void __tree_remove(_NodePtr __root, _NodePtr __z) _NOEXCEPT {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __tree_remove(_NodePtr __root, _NodePtr __z) _NOEXCEPT {
_LIBCPP_ASSERT_INTERNAL(__root != nullptr, "Root node should not be null");
_LIBCPP_ASSERT_INTERNAL(__z != nullptr, "The node to remove should not be null");
_LIBCPP_ASSERT_INTERNAL(std::__tree_invariant(__root), "The tree invariants should hold");
@@ -558,7 +560,7 @@ public:
using pointer = _Pointer;
pointer __left_;
- _LIBCPP_HIDE_FROM_ABI __tree_end_node() _NOEXCEPT : __left_() {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_end_node() _NOEXCEPT : __left_(nullptr) {}
};
template <class _VoidPtr>
@@ -571,11 +573,15 @@ public:
__end_node_pointer __parent_;
bool __is_black_;
- _LIBCPP_HIDE_FROM_ABI pointer __parent_unsafe() const { return static_cast<pointer>(__parent_); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pointer __parent_unsafe() const {
+ return std::__static_fancy_pointer_cast<pointer>(__parent_);
+ }
- _LIBCPP_HIDE_FROM_ABI void __set_parent(pointer __p) { __parent_ = static_cast<__end_node_pointer>(__p); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __set_parent(pointer __p) {
+ __parent_ = std::__static_fancy_pointer_cast<__end_node_pointer>(__p);
+ }
- _LIBCPP_HIDE_FROM_ABI __tree_node_base() = default;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_node_base() = default;
__tree_node_base(__tree_node_base const&) = delete;
__tree_node_base& operator=(__tree_node_base const&) = delete;
};
@@ -596,7 +602,7 @@ private:
};
public:
- _LIBCPP_HIDE_FROM_ABI __node_value_type& __get_value() { return __value_; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_value_type& __get_value() { return __value_; }
#else
private:
@@ -607,10 +613,27 @@ public:
#endif
template <class _Alloc, class... _Args>
- _LIBCPP_HIDE_FROM_ABI explicit __tree_node(_Alloc& __na, _Args&&... __args) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit __tree_node(_Alloc& __na, _Args&&... __args) {
allocator_traits<_Alloc>::construct(__na, std::addressof(__get_value()), std::forward<_Args>(__args)...);
}
+
+// This line fails with:
+// libcxx/test-suite-install/include/c++/v1/__memory/construct_at.h:38:49: note: non-literal type
+// 'std::__tree_node<std::__value_type<Key, int>, void *>' cannot be used in a constant expression
+//
+// during constant evaluation as part of P3372
+// on:
+// 1. Arm CI which is on clang 19.x (will be fixed in: https://github.com/llvm/llvm-project/issues/161159 )
+// 2. AppleClang is not yet using clang >= 20.x, which has "fixed" this issue
+// 3. A few others like FreeBSD/amd64, AArch64, AIX
+// FIXME: when AppleClang is based off of clang >= 20.x
+// FIXME: when Clang-based CI is using clang >= 20.x
+#if (defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER < 2000) || \
+ (defined(_LIBCPP_APPLE_CLANG_VER) && _LIBCPP_APPLE_CLANG_VER < 2000)
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 ~__tree_node() {}
+#else
~__tree_node() = delete;
+#endif
__tree_node(__tree_node const&) = delete;
__tree_node& operator=(__tree_node const&) = delete;
};
@@ -629,14 +652,15 @@ private:
public:
bool __value_constructed;
- _LIBCPP_HIDE_FROM_ABI __tree_node_destructor(const __tree_node_destructor&) = default;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_node_destructor(const __tree_node_destructor&) = default;
__tree_node_destructor& operator=(const __tree_node_destructor&) = delete;
- _LIBCPP_HIDE_FROM_ABI explicit __tree_node_destructor(allocator_type& __na, bool __val = false) _NOEXCEPT
+ _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit __tree_node_destructor(allocator_type& __na, bool __val = false) _NOEXCEPT
: __na_(__na),
__value_constructed(__val) {}
- _LIBCPP_HIDE_FROM_ABI void operator()(pointer __p) _NOEXCEPT {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void operator()(pointer __p) _NOEXCEPT {
if (__value_constructed)
__alloc_traits::destroy(__na_, std::addressof(__p->__get_value()));
if (__p)
@@ -673,44 +697,50 @@ public:
using reference = value_type&;
using pointer = __rebind_pointer_t<_NodePtr, value_type>;
- _LIBCPP_HIDE_FROM_ABI __tree_iterator() _NOEXCEPT : __ptr_(nullptr) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_iterator() _NOEXCEPT : __ptr_(nullptr) {}
- _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __get_np()->__get_value(); }
- _LIBCPP_HIDE_FROM_ABI pointer operator->() const {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reference operator*() const { return __get_np()->__get_value(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pointer operator->() const {
return pointer_traits<pointer>::pointer_to(__get_np()->__get_value());
}
- _LIBCPP_HIDE_FROM_ABI __tree_iterator& operator++() {
- __ptr_ = std::__tree_next_iter<__end_node_pointer>(static_cast<__node_base_pointer>(__ptr_));
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_iterator& operator++() {
+ __ptr_ = std::__tree_next_iter<__end_node_pointer>(std::__static_fancy_pointer_cast<__node_base_pointer>(__ptr_));
return *this;
}
- _LIBCPP_HIDE_FROM_ABI __tree_iterator operator++(int) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_iterator operator++(int) {
__tree_iterator __t(*this);
++(*this);
return __t;
}
- _LIBCPP_HIDE_FROM_ABI __tree_iterator& operator--() {
- __ptr_ = static_cast<__end_node_pointer>(std::__tree_prev_iter<__node_base_pointer>(__ptr_));
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_iterator& operator--() {
+ __ptr_ = std::__static_fancy_pointer_cast<__end_node_pointer>(std::__tree_prev_iter<__node_base_pointer>(__ptr_));
return *this;
}
- _LIBCPP_HIDE_FROM_ABI __tree_iterator operator--(int) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_iterator operator--(int) {
__tree_iterator __t(*this);
--(*this);
return __t;
}
- friend _LIBCPP_HIDE_FROM_ABI bool operator==(const __tree_iterator& __x, const __tree_iterator& __y) {
+ friend _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
+ operator==(const __tree_iterator& __x, const __tree_iterator& __y) {
return __x.__ptr_ == __y.__ptr_;
}
- friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const __tree_iterator& __x, const __tree_iterator& __y) {
+ friend _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
+ operator!=(const __tree_iterator& __x, const __tree_iterator& __y) {
return !(__x == __y);
}
private:
- _LIBCPP_HIDE_FROM_ABI explicit __tree_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
- _LIBCPP_HIDE_FROM_ABI explicit __tree_iterator(__end_node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
- _LIBCPP_HIDE_FROM_ABI __node_pointer __get_np() const { return static_cast<__node_pointer>(__ptr_); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit __tree_iterator(__node_pointer __p) _NOEXCEPT
+ : __ptr_(std::__static_fancy_pointer_cast<__end_node_pointer>(__p)) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit __tree_iterator(__end_node_pointer __p) _NOEXCEPT
+ : __ptr_(__p) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_pointer __get_np() const {
+ return std::__static_fancy_pointer_cast<__node_pointer>(__ptr_);
+ }
template <class, class, class>
friend class __tree;
template <class, class, class>
@@ -735,48 +765,55 @@ public:
using pointer = __rebind_pointer_t<_NodePtr, const value_type>;
using __non_const_iterator _LIBCPP_NODEBUG = __tree_iterator<_Tp, __node_pointer, difference_type>;
- _LIBCPP_HIDE_FROM_ABI __tree_const_iterator() _NOEXCEPT : __ptr_(nullptr) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_const_iterator() _NOEXCEPT : __ptr_(nullptr) {}
- _LIBCPP_HIDE_FROM_ABI __tree_const_iterator(__non_const_iterator __p) _NOEXCEPT : __ptr_(__p.__ptr_) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_const_iterator(__non_const_iterator __p) _NOEXCEPT
+ : __ptr_(__p.__ptr_) {}
- _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __get_np()->__get_value(); }
- _LIBCPP_HIDE_FROM_ABI pointer operator->() const {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reference operator*() const { return __get_np()->__get_value(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pointer operator->() const {
return pointer_traits<pointer>::pointer_to(__get_np()->__get_value());
}
- _LIBCPP_HIDE_FROM_ABI __tree_const_iterator& operator++() {
- __ptr_ = std::__tree_next_iter<__end_node_pointer>(static_cast<__node_base_pointer>(__ptr_));
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_const_iterator& operator++() {
+ __ptr_ = std::__tree_next_iter<__end_node_pointer>(std::__static_fancy_pointer_cast<__node_base_pointer>(__ptr_));
return *this;
}
- _LIBCPP_HIDE_FROM_ABI __tree_const_iterator operator++(int) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_const_iterator operator++(int) {
__tree_const_iterator __t(*this);
++(*this);
return __t;
}
- _LIBCPP_HIDE_FROM_ABI __tree_const_iterator& operator--() {
- __ptr_ = static_cast<__end_node_pointer>(std::__tree_prev_iter<__node_base_pointer>(__ptr_));
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_const_iterator& operator--() {
+ __ptr_ = std::__static_fancy_pointer_cast<__end_node_pointer>(std::__tree_prev_iter<__node_base_pointer>(__ptr_));
return *this;
}
- _LIBCPP_HIDE_FROM_ABI __tree_const_iterator operator--(int) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_const_iterator operator--(int) {
__tree_const_iterator __t(*this);
--(*this);
return __t;
}
- friend _LIBCPP_HIDE_FROM_ABI bool operator==(const __tree_const_iterator& __x, const __tree_const_iterator& __y) {
+ friend _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
+ operator==(const __tree_const_iterator& __x, const __tree_const_iterator& __y) {
return __x.__ptr_ == __y.__ptr_;
}
- friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const __tree_const_iterator& __x, const __tree_const_iterator& __y) {
+ friend _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
+ operator!=(const __tree_const_iterator& __x, const __tree_const_iterator& __y) {
return !(__x == __y);
}
private:
- _LIBCPP_HIDE_FROM_ABI explicit __tree_const_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
- _LIBCPP_HIDE_FROM_ABI explicit __tree_const_iterator(__end_node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
- _LIBCPP_HIDE_FROM_ABI __node_pointer __get_np() const { return static_cast<__node_pointer>(__ptr_); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit __tree_const_iterator(__node_pointer __p) _NOEXCEPT
+ : __ptr_(std::__static_fancy_pointer_cast<__end_node_pointer>(__p)) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit __tree_const_iterator(__end_node_pointer __p) _NOEXCEPT
+ : __ptr_(std::__static_fancy_pointer_cast<__end_node_pointer>(__p)) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_pointer __get_np() const {
+ return std::__static_fancy_pointer_cast<__node_pointer>(__ptr_);
+ }
template <class, class, class>
friend class __tree;
@@ -852,63 +889,73 @@ private:
_LIBCPP_COMPRESSED_PAIR(size_type, __size_, value_compare, __value_comp_);
public:
- _LIBCPP_HIDE_FROM_ABI __end_node_pointer __end_node() _NOEXCEPT {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __end_node_pointer __end_node() _NOEXCEPT {
return pointer_traits<__end_node_pointer>::pointer_to(__end_node_);
}
- _LIBCPP_HIDE_FROM_ABI __end_node_pointer __end_node() const _NOEXCEPT {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __end_node_pointer __end_node() const _NOEXCEPT {
return pointer_traits<__end_node_pointer>::pointer_to(const_cast<__end_node_t&>(__end_node_));
}
- _LIBCPP_HIDE_FROM_ABI __node_allocator& __node_alloc() _NOEXCEPT { return __node_alloc_; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_allocator& __node_alloc() _NOEXCEPT {
+ return __node_alloc_;
+ }
private:
- _LIBCPP_HIDE_FROM_ABI const __node_allocator& __node_alloc() const _NOEXCEPT { return __node_alloc_; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const __node_allocator& __node_alloc() const _NOEXCEPT {
+ return __node_alloc_;
+ }
public:
- _LIBCPP_HIDE_FROM_ABI allocator_type __alloc() const _NOEXCEPT { return allocator_type(__node_alloc()); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 allocator_type __alloc() const _NOEXCEPT {
+ return allocator_type(__node_alloc());
+ }
- _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __size_; }
- _LIBCPP_HIDE_FROM_ABI value_compare& value_comp() _NOEXCEPT { return __value_comp_; }
- _LIBCPP_HIDE_FROM_ABI const value_compare& value_comp() const _NOEXCEPT { return __value_comp_; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type size() const _NOEXCEPT { return __size_; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 value_compare& value_comp() _NOEXCEPT { return __value_comp_; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const value_compare& value_comp() const _NOEXCEPT {
+ return __value_comp_;
+ }
public:
- _LIBCPP_HIDE_FROM_ABI __node_pointer __root() const _NOEXCEPT {
- return static_cast<__node_pointer>(__end_node()->__left_);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_pointer __root() const _NOEXCEPT {
+ return std::__static_fancy_pointer_cast<__node_pointer>(__end_node()->__left_);
}
- _LIBCPP_HIDE_FROM_ABI __node_base_pointer* __root_ptr() const _NOEXCEPT {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_base_pointer* __root_ptr() const _NOEXCEPT {
return std::addressof(__end_node()->__left_);
}
using iterator = __tree_iterator<_Tp, __node_pointer, difference_type>;
using const_iterator = __tree_const_iterator<_Tp, __node_pointer, difference_type>;
- _LIBCPP_HIDE_FROM_ABI explicit __tree(const value_compare& __comp) _NOEXCEPT_(
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit __tree(const value_compare& __comp) _NOEXCEPT_(
is_nothrow_default_constructible<__node_allocator>::value&& is_nothrow_copy_constructible<value_compare>::value)
: __size_(0), __value_comp_(__comp) {
__begin_node_ = __end_node();
}
- _LIBCPP_HIDE_FROM_ABI explicit __tree(const allocator_type& __a)
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit __tree(const allocator_type& __a)
: __begin_node_(), __node_alloc_(__node_allocator(__a)), __size_(0) {
__begin_node_ = __end_node();
}
- _LIBCPP_HIDE_FROM_ABI __tree(const value_compare& __comp, const allocator_type& __a)
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree(const value_compare& __comp, const allocator_type& __a)
: __begin_node_(), __node_alloc_(__node_allocator(__a)), __size_(0), __value_comp_(__comp) {
__begin_node_ = __end_node();
}
- _LIBCPP_HIDE_FROM_ABI __tree(const __tree& __t);
- _LIBCPP_HIDE_FROM_ABI __tree& operator=(const __tree& __t);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree(const __tree& __t);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree& operator=(const __tree& __t);
template <class _ForwardIterator>
- _LIBCPP_HIDE_FROM_ABI void __assign_unique(_ForwardIterator __first, _ForwardIterator __last);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
+ __assign_unique(_ForwardIterator __first, _ForwardIterator __last);
template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI void __assign_multi(_InputIterator __first, _InputIterator __last);
- _LIBCPP_HIDE_FROM_ABI __tree(__tree&& __t) _NOEXCEPT_(
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
+ __assign_multi(_InputIterator __first, _InputIterator __last);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree(__tree&& __t) _NOEXCEPT_(
is_nothrow_move_constructible<__node_allocator>::value&& is_nothrow_move_constructible<value_compare>::value);
- _LIBCPP_HIDE_FROM_ABI __tree(__tree&& __t, const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree(__tree&& __t, const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI __tree& operator=(__tree&& __t)
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree& operator=(__tree&& __t)
_NOEXCEPT_(is_nothrow_move_assignable<value_compare>::value &&
((__node_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<__node_allocator>::value) ||
@@ -917,23 +964,27 @@ public:
return *this;
}
- _LIBCPP_HIDE_FROM_ABI ~__tree() {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 ~__tree() {
static_assert(is_copy_constructible<value_compare>::value, "Comparator must be copy-constructible.");
destroy(__root());
}
- _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return iterator(__begin_node_); }
- _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return const_iterator(__begin_node_); }
- _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return iterator(__end_node()); }
- _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return const_iterator(__end_node()); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator begin() _NOEXCEPT { return iterator(__begin_node_); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator begin() const _NOEXCEPT {
+ return const_iterator(__begin_node_);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator end() _NOEXCEPT { return iterator(__end_node()); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator end() const _NOEXCEPT {
+ return const_iterator(__end_node());
+ }
- _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type max_size() const _NOEXCEPT {
return std::min<size_type>(__node_traits::max_size(__node_alloc()), numeric_limits<difference_type >::max());
}
- _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void clear() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI void swap(__tree& __t)
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void swap(__tree& __t)
#if _LIBCPP_STD_VER <= 11
_NOEXCEPT_(__is_nothrow_swappable_v<value_compare> &&
(!__node_traits::propagate_on_container_swap::value || __is_nothrow_swappable_v<__node_allocator>));
@@ -942,21 +993,22 @@ public:
#endif
template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI iterator __emplace_multi(_Args&&... __args);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator __emplace_multi(_Args&&... __args);
template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI iterator __emplace_hint_multi(const_iterator __p, _Args&&... __args);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator
+ __emplace_hint_multi(const_iterator __p, _Args&&... __args);
template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique(_Args&&... __args) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, bool> __emplace_unique(_Args&&... __args) {
return std::__try_key_extraction<key_type>(
[this](const key_type& __key, _Args&&... __args2) {
auto [__parent, __child] = __find_equal(__key);
- __node_pointer __r = static_cast<__node_pointer>(__child);
+ __node_pointer __r = std::__static_fancy_pointer_cast<__node_pointer>(__child);
bool __inserted = false;
if (__child == nullptr) {
__node_holder __h = __construct_node(std::forward<_Args>(__args2)...);
- __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
+ __insert_node_at(__parent, __child, std::__static_fancy_pointer_cast<__node_base_pointer>(__h.get()));
__r = __h.release();
__inserted = true;
}
@@ -965,10 +1017,10 @@ public:
[this](_Args&&... __args2) {
__node_holder __h = __construct_node(std::forward<_Args>(__args2)...);
auto [__parent, __child] = __find_equal(__h->__get_value());
- __node_pointer __r = static_cast<__node_pointer>(__child);
+ __node_pointer __r = std::__static_fancy_pointer_cast<__node_pointer>(__child);
bool __inserted = false;
if (__child == nullptr) {
- __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
+ __insert_node_at(__parent, __child, std::__static_fancy_pointer_cast<__node_base_pointer>(__h.get()));
__r = __h.release();
__inserted = true;
}
@@ -978,16 +1030,17 @@ public:
}
template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_hint_unique(const_iterator __p, _Args&&... __args) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, bool>
+ __emplace_hint_unique(const_iterator __p, _Args&&... __args) {
return std::__try_key_extraction<key_type>(
[this, __p](const key_type& __key, _Args&&... __args2) {
__node_base_pointer __dummy;
auto [__parent, __child] = __find_equal(__p, __dummy, __key);
- __node_pointer __r = static_cast<__node_pointer>(__child);
+ __node_pointer __r = std::__static_fancy_pointer_cast<__node_pointer>(__child);
bool __inserted = false;
if (__child == nullptr) {
__node_holder __h = __construct_node(std::forward<_Args>(__args2)...);
- __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
+ __insert_node_at(__parent, __child, std::__static_fancy_pointer_cast<__node_base_pointer>(__h.get()));
__r = __h.release();
__inserted = true;
}
@@ -997,9 +1050,9 @@ public:
__node_holder __h = __construct_node(std::forward<_Args>(__args2)...);
__node_base_pointer __dummy;
auto [__parent, __child] = __find_equal(__p, __dummy, __h->__get_value());
- __node_pointer __r = static_cast<__node_pointer>(__child);
+ __node_pointer __r = std::__static_fancy_pointer_cast<__node_pointer>(__child);
if (__child == nullptr) {
- __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
+ __insert_node_at(__parent, __child, std::__static_fancy_pointer_cast<__node_base_pointer>(__h.get()));
__r = __h.release();
}
return pair<iterator, bool>(iterator(__r), __child == nullptr);
@@ -1007,29 +1060,62 @@ public:
std::forward<_Args>(__args)...);
}
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, bool>
+ __emplace_hint_unique__sfinae(true_type, const_iterator __p, _Args&&... __args) {
+ return __emplace_hint_unique(__p, __args...);
+ }
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, bool>
+ __emplace_hint_unique__sfinae(false_type, const_iterator, _Args&&...) {
+ // This method body should never be run. It only exists to allow for compilation. See note in
+ // __insert_unique_from_orphaned_node for more information.
+ return pair<iterator, bool>(iterator(__node_pointer()), false);
+ }
+
template <class _ValueT = _Tp, __enable_if_t<__is_tree_value_type_v<_ValueT>, int> = 0>
- _LIBCPP_HIDE_FROM_ABI void
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
__insert_unique_from_orphaned_node(const_iterator __p, __get_node_value_type_t<_Tp>&& __value) {
- __emplace_hint_unique(__p, const_cast<key_type&&>(__value.first), std::move(__value.second));
+#if _LIBCPP_STD_VER >= 26
+ if (std::is_constant_evaluated() && std::is_copy_constructible_v<decltype(__value.first)>) {
+ // We create a sfinae wrapper method here, because if the __emplace_hint_unique method gets template instantiated
+ // within __insert_unique_from_orphaned_node, the code will fail to compile where the value is not
+ // copy_constructible for runtime execution as well; unless we use `if constexpr`. Given the copy-constructible
+ // code path will be a performance regression, we want to restrict it to only execute during constant evaluation
+ //, we need to delay the template instantiation
+ __emplace_hint_unique__sfinae(
+ integral_constant< bool, std::is_copy_constructible_v<decltype(__value.first)> >(),
+ __p,
+ __value.first,
+ std::move(__value.second));
+ } else
+#endif
+ {
+ __emplace_hint_unique(__p, const_cast<key_type&&>(__value.first), std::move(__value.second));
+ }
}
template <class _ValueT = _Tp, __enable_if_t<!__is_tree_value_type_v<_ValueT>, int> = 0>
- _LIBCPP_HIDE_FROM_ABI void __insert_unique_from_orphaned_node(const_iterator __p, _Tp&& __value) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
+ __insert_unique_from_orphaned_node(const_iterator __p, _Tp&& __value) {
__emplace_hint_unique(__p, std::move(__value));
}
template <class _ValueT = _Tp, __enable_if_t<__is_tree_value_type_v<_ValueT>, int> = 0>
- _LIBCPP_HIDE_FROM_ABI void __insert_multi_from_orphaned_node(const_iterator __p, value_type&& __value) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
+ __insert_multi_from_orphaned_node(const_iterator __p, value_type&& __value) {
__emplace_hint_multi(__p, const_cast<key_type&&>(__value.first), std::move(__value.second));
}
template <class _ValueT = _Tp, __enable_if_t<!__is_tree_value_type_v<_ValueT>, int> = 0>
- _LIBCPP_HIDE_FROM_ABI void __insert_multi_from_orphaned_node(const_iterator __p, _Tp&& __value) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
+ __insert_multi_from_orphaned_node(const_iterator __p, _Tp&& __value) {
__emplace_hint_multi(__p, std::move(__value));
}
template <class _InIter, class _Sent>
- _LIBCPP_HIDE_FROM_ABI void __insert_range_multi(_InIter __first, _Sent __last) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __insert_range_multi(_InIter __first, _Sent __last) {
if (__first == __last)
return;
@@ -1057,23 +1143,27 @@ public:
}
}
- _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __node_assign_unique(const value_type& __v, __node_pointer __dest);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, bool>
+ __node_assign_unique(const value_type& __v, __node_pointer __dest);
- _LIBCPP_HIDE_FROM_ABI iterator __node_insert_multi(__node_pointer __nd);
- _LIBCPP_HIDE_FROM_ABI iterator __node_insert_multi(const_iterator __p, __node_pointer __nd);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator __node_insert_multi(__node_pointer __nd);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator
+ __node_insert_multi(const_iterator __p, __node_pointer __nd);
template <class _InIter, class _Sent>
- _LIBCPP_HIDE_FROM_ABI void __insert_range_unique(_InIter __first, _Sent __last) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __insert_range_unique(_InIter __first, _Sent __last) {
if (__first == __last)
return;
if (__root() == nullptr) {
- __insert_node_at(
- __end_node(), __end_node()->__left_, static_cast<__node_base_pointer>(__construct_node(*__first).release()));
+ __insert_node_at(__end_node(),
+ __end_node()->__left_,
+ std::__static_fancy_pointer_cast<__node_base_pointer>(__construct_node(*__first).release()));
++__first;
}
- auto __max_node = static_cast<__node_pointer>(std::__tree_max(static_cast<__node_base_pointer>(__root())));
+ auto __max_node = std::__static_fancy_pointer_cast<__node_pointer>(
+ std::__tree_max(std::__static_fancy_pointer_cast<__node_base_pointer>(__root())));
using __reference = decltype(*__first);
@@ -1082,29 +1172,31 @@ public:
[this, &__max_node](const key_type& __key, __reference&& __val) {
if (value_comp()(__max_node->__get_value(), __key)) { // __key > __max_node
__node_holder __nd = __construct_node(std::forward<__reference>(__val));
- __insert_node_at(static_cast<__end_node_pointer>(__max_node),
+ __insert_node_at(std::__static_fancy_pointer_cast<__end_node_pointer>(__max_node),
__max_node->__right_,
- static_cast<__node_base_pointer>(__nd.get()));
+ std::__static_fancy_pointer_cast<__node_base_pointer>(__nd.get()));
__max_node = __nd.release();
} else {
auto [__parent, __child] = __find_equal(__key);
if (__child == nullptr) {
__node_holder __nd = __construct_node(std::forward<__reference>(__val));
- __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd.release()));
+ __insert_node_at(
+ __parent, __child, std::__static_fancy_pointer_cast<__node_base_pointer>(__nd.release()));
}
}
},
[this, &__max_node](__reference&& __val) {
__node_holder __nd = __construct_node(std::forward<__reference>(__val));
if (value_comp()(__max_node->__get_value(), __nd->__get_value())) { // __node > __max_node
- __insert_node_at(static_cast<__end_node_pointer>(__max_node),
+ __insert_node_at(std::__static_fancy_pointer_cast<__end_node_pointer>(__max_node),
__max_node->__right_,
- static_cast<__node_base_pointer>(__nd.get()));
+ std::__static_fancy_pointer_cast<__node_base_pointer>(__nd.get()));
__max_node = __nd.release();
} else {
auto [__parent, __child] = __find_equal(__nd->__get_value());
if (__child == nullptr) {
- __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd.release()));
+ __insert_node_at(
+ __parent, __child, std::__static_fancy_pointer_cast<__node_base_pointer>(__nd.release()));
}
}
},
@@ -1112,219 +1204,220 @@ public:
}
}
- _LIBCPP_HIDE_FROM_ABI iterator __remove_node_pointer(__node_pointer) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator __remove_node_pointer(__node_pointer) _NOEXCEPT;
#if _LIBCPP_STD_VER >= 17
template <class _NodeHandle, class _InsertReturnType>
- _LIBCPP_HIDE_FROM_ABI _InsertReturnType __node_handle_insert_unique(_NodeHandle&&);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _InsertReturnType __node_handle_insert_unique(_NodeHandle&&);
template <class _NodeHandle>
- _LIBCPP_HIDE_FROM_ABI iterator __node_handle_insert_unique(const_iterator, _NodeHandle&&);
- template <class _Comp2>
- _LIBCPP_HIDE_FROM_ABI void __node_handle_merge_unique(__tree<_Tp, _Comp2, _Allocator>& __source);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator
+ __node_handle_insert_unique(const_iterator, _NodeHandle&&);
+ template <class _Tree>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __node_handle_merge_unique(_Tree& __source);
template <class _NodeHandle>
- _LIBCPP_HIDE_FROM_ABI iterator __node_handle_insert_multi(_NodeHandle&&);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator __node_handle_insert_multi(_NodeHandle&&);
template <class _NodeHandle>
- _LIBCPP_HIDE_FROM_ABI iterator __node_handle_insert_multi(const_iterator, _NodeHandle&&);
- template <class _Comp2>
- _LIBCPP_HIDE_FROM_ABI void __node_handle_merge_multi(__tree<_Tp, _Comp2, _Allocator>& __source);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator
+ __node_handle_insert_multi(const_iterator, _NodeHandle&&);
+ template <class _Tree>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __node_handle_merge_multi(_Tree& __source);
template <class _NodeHandle>
- _LIBCPP_HIDE_FROM_ABI _NodeHandle __node_handle_extract(key_type const&);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _NodeHandle __node_handle_extract(key_type const&);
template <class _NodeHandle>
- _LIBCPP_HIDE_FROM_ABI _NodeHandle __node_handle_extract(const_iterator);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _NodeHandle __node_handle_extract(const_iterator);
#endif
- _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p);
- _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __f, const_iterator __l);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator erase(const_iterator __p);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator erase(const_iterator __f, const_iterator __l);
template <class _Key>
- _LIBCPP_HIDE_FROM_ABI size_type __erase_unique(const _Key& __k);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type __erase_unique(const _Key& __k);
template <class _Key>
- _LIBCPP_HIDE_FROM_ABI size_type __erase_multi(const _Key& __k);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type __erase_multi(const _Key& __k);
- _LIBCPP_HIDE_FROM_ABI void
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
__insert_node_at(__end_node_pointer __parent, __node_base_pointer& __child, __node_base_pointer __new_node) _NOEXCEPT;
template <class _Key>
- _LIBCPP_HIDE_FROM_ABI iterator find(const _Key& __key) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator find(const _Key& __key) {
auto [__, __match] = __find_equal(__key);
if (__match == nullptr)
return end();
- return iterator(static_cast<__node_pointer>(__match));
+ return iterator(std::__static_fancy_pointer_cast<__node_pointer>(__match));
}
template <class _Key>
- _LIBCPP_HIDE_FROM_ABI const_iterator find(const _Key& __key) const {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator find(const _Key& __key) const {
auto [__, __match] = __find_equal(__key);
if (__match == nullptr)
return end();
- return const_iterator(static_cast<__node_pointer>(__match));
+ return const_iterator(std::__static_fancy_pointer_cast<__node_pointer>(__match));
}
template <class _Key>
- _LIBCPP_HIDE_FROM_ABI size_type __count_unique(const _Key& __k) const;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type __count_unique(const _Key& __k) const;
template <class _Key>
- _LIBCPP_HIDE_FROM_ABI size_type __count_multi(const _Key& __k) const;
-
- template <bool _LowerBound, class _Key>
- _LIBCPP_HIDE_FROM_ABI __end_node_pointer __lower_upper_bound_unique_impl(const _Key& __v) const {
- auto __rt = __root();
- auto __result = __end_node();
- auto __comp = __lazy_synth_three_way_comparator<_Compare, _Key, value_type>(value_comp());
- while (__rt != nullptr) {
- auto __comp_res = __comp(__v, __rt->__get_value());
-
- if (__comp_res.__less()) {
- __result = static_cast<__end_node_pointer>(__rt);
- __rt = static_cast<__node_pointer>(__rt->__left_);
- } else if (__comp_res.__greater()) {
- __rt = static_cast<__node_pointer>(__rt->__right_);
- } else if _LIBCPP_CONSTEXPR (_LowerBound) {
- return static_cast<__end_node_pointer>(__rt);
- } else {
- return __rt->__right_ ? static_cast<__end_node_pointer>(std::__tree_min(__rt->__right_)) : __result;
- }
- }
- return __result;
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type __count_multi(const _Key& __k) const;
template <class _Key>
- _LIBCPP_HIDE_FROM_ABI iterator __lower_bound_unique(const _Key& __v) {
- return iterator(__lower_upper_bound_unique_impl<true>(__v));
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator lower_bound(const _Key& __v) {
+ return __lower_bound(__v, __root(), __end_node());
}
-
template <class _Key>
- _LIBCPP_HIDE_FROM_ABI const_iterator __lower_bound_unique(const _Key& __v) const {
- return const_iterator(__lower_upper_bound_unique_impl<true>(__v));
- }
-
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI iterator __upper_bound_unique(const _Key& __v) {
- return iterator(__lower_upper_bound_unique_impl<false>(__v));
- }
-
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator
+ __lower_bound(const _Key& __v, __node_pointer __root, __end_node_pointer __result);
template <class _Key>
- _LIBCPP_HIDE_FROM_ABI const_iterator __upper_bound_unique(const _Key& __v) const {
- return iterator(__lower_upper_bound_unique_impl<false>(__v));
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator lower_bound(const _Key& __v) const {
+ return __lower_bound(__v, __root(), __end_node());
}
-
-private:
template <class _Key>
- _LIBCPP_HIDE_FROM_ABI iterator
- __lower_bound_multi(const _Key& __v, __node_pointer __root, __end_node_pointer __result);
-
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator
+ __lower_bound(const _Key& __v, __node_pointer __root, __end_node_pointer __result) const;
template <class _Key>
- _LIBCPP_HIDE_FROM_ABI const_iterator
- __lower_bound_multi(const _Key& __v, __node_pointer __root, __end_node_pointer __result) const;
-
-public:
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI iterator __lower_bound_multi(const _Key& __v) {
- return __lower_bound_multi(__v, __root(), __end_node());
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator upper_bound(const _Key& __v) {
+ return __upper_bound(__v, __root(), __end_node());
}
template <class _Key>
- _LIBCPP_HIDE_FROM_ABI const_iterator __lower_bound_multi(const _Key& __v) const {
- return __lower_bound_multi(__v, __root(), __end_node());
- }
-
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator
+ __upper_bound(const _Key& __v, __node_pointer __root, __end_node_pointer __result);
template <class _Key>
- _LIBCPP_HIDE_FROM_ABI iterator __upper_bound_multi(const _Key& __v) {
- return __upper_bound_multi(__v, __root(), __end_node());
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator upper_bound(const _Key& __v) const {
+ return __upper_bound(__v, __root(), __end_node());
}
-
template <class _Key>
- _LIBCPP_HIDE_FROM_ABI const_iterator __upper_bound_multi(const _Key& __v) const {
- return __upper_bound_multi(__v, __root(), __end_node());
- }
-
-private:
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator
+ __upper_bound(const _Key& __v, __node_pointer __root, __end_node_pointer __result) const;
template <class _Key>
- _LIBCPP_HIDE_FROM_ABI iterator
- __upper_bound_multi(const _Key& __v, __node_pointer __root, __end_node_pointer __result);
-
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator> __equal_range_unique(const _Key& __k);
template <class _Key>
- _LIBCPP_HIDE_FROM_ABI const_iterator
- __upper_bound_multi(const _Key& __v, __node_pointer __root, __end_node_pointer __result) const;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator>
+ __equal_range_unique(const _Key& __k) const;
-public:
template <class _Key>
- _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> __equal_range_unique(const _Key& __k);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator> __equal_range_multi(const _Key& __k);
template <class _Key>
- _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> __equal_range_unique(const _Key& __k) const;
-
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> __equal_range_multi(const _Key& __k);
- template <class _Key>
- _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> __equal_range_multi(const _Key& __k) const;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator>
+ __equal_range_multi(const _Key& __k) const;
using _Dp _LIBCPP_NODEBUG = __tree_node_destructor<__node_allocator>;
using __node_holder _LIBCPP_NODEBUG = unique_ptr<__node, _Dp>;
- _LIBCPP_HIDE_FROM_ABI __node_holder remove(const_iterator __p) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_holder remove(const_iterator __p) _NOEXCEPT;
// FIXME: Make this function const qualified. Unfortunately doing so
// breaks existing code which uses non-const callable comparators.
template <class _Key>
- _LIBCPP_HIDE_FROM_ABI pair<__end_node_pointer, __node_base_pointer&> __find_equal(const _Key& __v);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<__end_node_pointer, __node_base_pointer&>
+ __find_equal(const _Key& __v);
template <class _Key>
- _LIBCPP_HIDE_FROM_ABI pair<__end_node_pointer, __node_base_pointer&> __find_equal(const _Key& __v) const {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<__end_node_pointer, __node_base_pointer&>
+ __find_equal(const _Key& __v) const {
return const_cast<__tree*>(this)->__find_equal(__v);
}
template <class _Key>
- _LIBCPP_HIDE_FROM_ABI pair<__end_node_pointer, __node_base_pointer&>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<__end_node_pointer, __node_base_pointer&>
__find_equal(const_iterator __hint, __node_base_pointer& __dummy, const _Key& __v);
- _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const __tree& __t) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __copy_assign_alloc(const __tree& __t) {
__copy_assign_alloc(__t, integral_constant<bool, __node_traits::propagate_on_container_copy_assignment::value>());
}
- _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const __tree& __t, true_type) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __copy_assign_alloc(const __tree& __t, true_type) {
if (__node_alloc() != __t.__node_alloc())
clear();
__node_alloc() = __t.__node_alloc();
}
- _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const __tree&, false_type) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __copy_assign_alloc(const __tree&, false_type) {}
private:
- _LIBCPP_HIDE_FROM_ABI __node_base_pointer& __find_leaf_low(__end_node_pointer& __parent, const value_type& __v);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_base_pointer&
+ __find_leaf_low(__end_node_pointer& __parent, const value_type& __v);
- _LIBCPP_HIDE_FROM_ABI __node_base_pointer& __find_leaf_high(__end_node_pointer& __parent, const value_type& __v);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_base_pointer&
+ __find_leaf_high(__end_node_pointer& __parent, const value_type& __v);
- _LIBCPP_HIDE_FROM_ABI __node_base_pointer&
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_base_pointer&
__find_leaf(const_iterator __hint, __end_node_pointer& __parent, const value_type& __v);
template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI __node_holder __construct_node(_Args&&... __args);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_holder __construct_node(_Args&&... __args);
// TODO: Make this _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_HIDDEN void destroy(__node_pointer __nd) _NOEXCEPT { (__tree_deleter(__node_alloc_))(__nd); }
+ _LIBCPP_HIDDEN _LIBCPP_CONSTEXPR_SINCE_CXX26 void destroy(__node_pointer __nd) _NOEXCEPT {
+ (__tree_deleter(__node_alloc_))(__nd);
+ }
- _LIBCPP_HIDE_FROM_ABI void __move_assign(__tree& __t, false_type);
- _LIBCPP_HIDE_FROM_ABI void __move_assign(__tree& __t, true_type) _NOEXCEPT_(
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __move_assign(__tree& __t, false_type);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __move_assign(__tree& __t, true_type) _NOEXCEPT_(
is_nothrow_move_assignable<value_compare>::value&& is_nothrow_move_assignable<__node_allocator>::value);
- _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(__tree& __t)
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __move_assign_alloc(__tree& __t)
_NOEXCEPT_(!__node_traits::propagate_on_container_move_assignment::value ||
is_nothrow_move_assignable<__node_allocator>::value) {
__move_assign_alloc(__t, integral_constant<bool, __node_traits::propagate_on_container_move_assignment::value>());
}
- _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(__tree& __t, true_type)
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __move_assign_alloc(__tree& __t, true_type)
_NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value) {
__node_alloc() = std::move(__t.__node_alloc());
}
- _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(__tree&, false_type) _NOEXCEPT {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __move_assign_alloc(__tree&, false_type) _NOEXCEPT {}
+
+ template <class _From, class _ValueT = _Tp, __enable_if_t<__is_tree_value_type_v<_ValueT>, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
+ __assign_value__sfinae(true_type, __get_node_value_type_t<value_type>& __lhs, _From&& __rhs) {
+ __node_allocator& __na = __node_alloc();
+ __node_traits::destroy(__na, std::addressof(__lhs));
+ __node_traits::construct(__na, std::addressof(__lhs), __rhs.first, __rhs.second);
+ }
template <class _From, class _ValueT = _Tp, __enable_if_t<__is_tree_value_type_v<_ValueT>, int> = 0>
- _LIBCPP_HIDE_FROM_ABI static void __assign_value(__get_node_value_type_t<value_type>& __lhs, _From&& __rhs) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
+ __assign_value__sfinae(false_type, __get_node_value_type_t<value_type>&, _From&&) {
+ // This method body should never be run. It only exists to allow for compilation. See note in __assign_value for
+ // more information
+ }
+
+ template <class _From, class _ValueT = _Tp, __enable_if_t<__is_tree_value_type_v<_ValueT>, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
+ __assign_value(__get_node_value_type_t<value_type>& __lhs, _From&& __rhs) {
using __key_type = __remove_const_t<typename value_type::first_type>;
- // This is technically UB, since the object was constructed as `const`.
- // Clang doesn't optimize on this currently though.
- const_cast<__key_type&>(__lhs.first) = const_cast<__copy_cvref_t<_From, __key_type>&&>(__rhs.first);
- __lhs.second = std::forward<_From>(__rhs).second;
+#if _LIBCPP_STD_VER >= 26
+
+ if (std::is_constant_evaluated() && std::is_copy_constructible_v<decltype(__rhs.first)>) {
+ // we use copy, and not "move" as the constraint
+ // because we can NOT move from `const key_type`, which is how `value_type` is defined
+ // atleast for map
+ // typedef pair<const key_type, mapped_type> value_type;
+ // so we must copy it
+
+ // const_cast is not allowed at constexpr time.
+ // we get around this by deleting __lhs and creating a new node in-place
+ // to avoid const_cast __lhs.first
+
+ // We create a sfinae wrapper method here, because if the body of the true_type overload for
+ // __assign_value__sfinae() gets template instantiated within __assign_value, the code will fail to compile where
+ // the value is not copy_constructible for runtime execution as well; unless we use `if constexpr`. Given the
+ // copy-constructible code path will be a performance regression, we want to restrict it to only execute during
+ // constant evaluation
+ //, we need to delay the template instantiation
+
+ __assign_value__sfinae(std::integral_constant<bool, std::is_copy_constructible_v<decltype(__rhs.first)>>(),
+ std::forward<decltype(__lhs)>(__lhs),
+ std::forward<decltype(__rhs)>(__rhs));
+
+ } else
+#endif
+ {
+ // This is technically UB, since the object was constructed as `const`.
+ // Clang doesn't optimize on this currently though.
+ const_cast<__key_type&>(__lhs.first) = const_cast<__copy_cvref_t<_From, __key_type>&&>(__rhs.first);
+ __lhs.second = std::forward<_From>(__rhs).second;
+ }
}
template <class _To, class _From, class _ValueT = _Tp, __enable_if_t<!__is_tree_value_type_v<_ValueT>, int> = 0>
@@ -1333,22 +1426,22 @@ private:
}
struct _DetachedTreeCache {
- _LIBCPP_HIDE_FROM_ABI explicit _DetachedTreeCache(__tree* __t) _NOEXCEPT
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit _DetachedTreeCache(__tree* __t) _NOEXCEPT
: __t_(__t),
__cache_root_(__detach_from_tree(__t)) {
__advance();
}
- _LIBCPP_HIDE_FROM_ABI __node_pointer __get() const _NOEXCEPT { return __cache_elem_; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_pointer __get() const _NOEXCEPT { return __cache_elem_; }
- _LIBCPP_HIDE_FROM_ABI void __advance() _NOEXCEPT {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __advance() _NOEXCEPT {
__cache_elem_ = __cache_root_;
if (__cache_root_) {
__cache_root_ = __detach_next(__cache_root_);
}
}
- _LIBCPP_HIDE_FROM_ABI ~_DetachedTreeCache() {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 ~_DetachedTreeCache() {
__t_->destroy(__cache_elem_);
if (__cache_root_) {
while (__cache_root_->__parent_ != nullptr)
@@ -1361,8 +1454,8 @@ private:
_DetachedTreeCache& operator=(_DetachedTreeCache const&) = delete;
private:
- _LIBCPP_HIDE_FROM_ABI static __node_pointer __detach_from_tree(__tree* __t) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI static __node_pointer __detach_next(__node_pointer) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 static __node_pointer __detach_from_tree(__tree* __t) _NOEXCEPT;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 static __node_pointer __detach_next(__node_pointer) _NOEXCEPT;
__tree* __t_;
__node_pointer __cache_root_;
@@ -1375,24 +1468,23 @@ private:
public:
using pointer = __node_pointer;
- _LIBCPP_HIDE_FROM_ABI __tree_deleter(__node_allocator& __alloc) : __alloc_(__alloc) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_deleter(__node_allocator& __alloc) : __alloc_(__alloc) {}
#ifdef _LIBCPP_COMPILER_CLANG_BASED // FIXME: GCC complains about not being able to always_inline a recursive function
_LIBCPP_HIDE_FROM_ABI
#endif
- void
- operator()(__node_pointer __ptr) {
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 void operator()(__node_pointer __ptr) {
if (!__ptr)
return;
- (*this)(static_cast<__node_pointer>(__ptr->__left_));
+ (*this)(std::__static_fancy_pointer_cast<__node_pointer>(__ptr->__left_));
auto __right = __ptr->__right_;
__node_traits::destroy(__alloc_, std::addressof(__ptr->__get_value()));
__node_traits::deallocate(__alloc_, __ptr, 1);
- (*this)(static_cast<__node_pointer>(__right));
+ (*this)(std::__static_fancy_pointer_cast<__node_pointer>(__right));
}
};
@@ -1403,26 +1495,25 @@ private:
#ifdef _LIBCPP_COMPILER_CLANG_BASED // FIXME: GCC complains about not being able to always_inline a recursive function
_LIBCPP_HIDE_FROM_ABI
#endif
- __node_pointer
- __copy_construct_tree(__node_pointer __src) {
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_pointer __copy_construct_tree(__node_pointer __src) {
if (!__src)
return nullptr;
__node_holder __new_node = __construct_node(__src->__get_value());
unique_ptr<__node, __tree_deleter> __left(
- __copy_construct_tree(static_cast<__node_pointer>(__src->__left_)), __node_alloc_);
- __node_pointer __right = __copy_construct_tree(static_cast<__node_pointer>(__src->__right_));
+ __copy_construct_tree(std::__static_fancy_pointer_cast<__node_pointer>(__src->__left_)), __node_alloc_);
+ __node_pointer __right = __copy_construct_tree(std::__static_fancy_pointer_cast<__node_pointer>(__src->__right_));
__node_pointer __new_node_ptr = __new_node.release();
__new_node_ptr->__is_black_ = __src->__is_black_;
- __new_node_ptr->__left_ = static_cast<__node_base_pointer>(__left.release());
- __new_node_ptr->__right_ = static_cast<__node_base_pointer>(__right);
+ __new_node_ptr->__left_ = std::__static_fancy_pointer_cast<__node_base_pointer>(__left.release());
+ __new_node_ptr->__right_ = std::__static_fancy_pointer_cast<__node_base_pointer>(__right);
if (__new_node_ptr->__left_)
- __new_node_ptr->__left_->__parent_ = static_cast<__end_node_pointer>(__new_node_ptr);
+ __new_node_ptr->__left_->__parent_ = std::__static_fancy_pointer_cast<__end_node_pointer>(__new_node_ptr);
if (__new_node_ptr->__right_)
- __new_node_ptr->__right_->__parent_ = static_cast<__end_node_pointer>(__new_node_ptr);
+ __new_node_ptr->__right_->__parent_ = std::__static_fancy_pointer_cast<__end_node_pointer>(__new_node_ptr);
return __new_node_ptr;
}
@@ -1432,8 +1523,7 @@ private:
#ifdef _LIBCPP_COMPILER_CLANG_BASED // FIXME: GCC complains about not being able to always_inline a recursive function
_LIBCPP_HIDE_FROM_ABI
#endif
- __node_pointer
- __copy_assign_tree(__node_pointer __dest, __node_pointer __src) {
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_pointer __copy_assign_tree(__node_pointer __dest, __node_pointer __src) {
if (!__src) {
destroy(__dest);
return nullptr;
@@ -1444,24 +1534,26 @@ private:
// If we already have a left node in the destination tree, reuse it and copy-assign recursively
if (__dest->__left_) {
- __dest->__left_ = static_cast<__node_base_pointer>(__copy_assign_tree(
- static_cast<__node_pointer>(__dest->__left_), static_cast<__node_pointer>(__src->__left_)));
+ __dest->__left_ = std::__static_fancy_pointer_cast<__node_base_pointer>(__copy_assign_tree(
+ std::__static_fancy_pointer_cast<__node_pointer>(__dest->__left_),
+ std::__static_fancy_pointer_cast<__node_pointer>(__src->__left_)));
// Otherwise, we must create new nodes; copy-construct from here on
} else if (__src->__left_) {
- auto __new_left = __copy_construct_tree(static_cast<__node_pointer>(__src->__left_));
- __dest->__left_ = static_cast<__node_base_pointer>(__new_left);
- __new_left->__parent_ = static_cast<__end_node_pointer>(__dest);
+ auto __new_left = __copy_construct_tree(std::__static_fancy_pointer_cast<__node_pointer>(__src->__left_));
+ __dest->__left_ = std::__static_fancy_pointer_cast<__node_base_pointer>(__new_left);
+ __new_left->__parent_ = std::__static_fancy_pointer_cast<__end_node_pointer>(__dest);
}
// Identical to the left case above, just for the right nodes
if (__dest->__right_) {
- __dest->__right_ = static_cast<__node_base_pointer>(__copy_assign_tree(
- static_cast<__node_pointer>(__dest->__right_), static_cast<__node_pointer>(__src->__right_)));
+ __dest->__right_ = std::__static_fancy_pointer_cast<__node_base_pointer>(__copy_assign_tree(
+ std::__static_fancy_pointer_cast<__node_pointer>(__dest->__right_),
+ std::__static_fancy_pointer_cast<__node_pointer>(__src->__right_)));
} else if (__src->__right_) {
- auto __new_right = __copy_construct_tree(static_cast<__node_pointer>(__src->__right_));
- __dest->__right_ = static_cast<__node_base_pointer>(__new_right);
- __new_right->__parent_ = static_cast<__end_node_pointer>(__dest);
+ auto __new_right = __copy_construct_tree(std::__static_fancy_pointer_cast<__node_pointer>(__src->__right_));
+ __dest->__right_ = std::__static_fancy_pointer_cast<__node_base_pointer>(__new_right);
+ __new_right->__parent_ = std::__static_fancy_pointer_cast<__end_node_pointer>(__dest);
}
return __dest;
@@ -1470,16 +1562,16 @@ private:
// Precondition: __size_ != 0
template <class _Tp, class _Compare, class _Allocator>
-typename __tree<_Tp, _Compare, _Allocator>::__node_pointer
+_LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::__node_pointer
__tree<_Tp, _Compare, _Allocator>::_DetachedTreeCache::__detach_from_tree(__tree* __t) _NOEXCEPT {
- __node_pointer __cache = static_cast<__node_pointer>(__t->__begin_node_);
+ __node_pointer __cache = std::__static_fancy_pointer_cast<__node_pointer>(__t->__begin_node_);
__t->__begin_node_ = __t->__end_node();
__t->__end_node()->__left_->__parent_ = nullptr;
__t->__end_node()->__left_ = nullptr;
__t->__size_ = 0;
// __cache->__left_ == nullptr
if (__cache->__right_ != nullptr)
- __cache = static_cast<__node_pointer>(__cache->__right_);
+ __cache = std::__static_fancy_pointer_cast<__node_pointer>(__cache->__right_);
// __cache->__left_ == nullptr
// __cache->__right_ == nullptr
return __cache;
@@ -1490,27 +1582,28 @@ __tree<_Tp, _Compare, _Allocator>::_DetachedTreeCache::__detach_from_tree(__tree
// __cache->right_ == nullptr
// This is no longer a red-black tree
template <class _Tp, class _Compare, class _Allocator>
-typename __tree<_Tp, _Compare, _Allocator>::__node_pointer
+_LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::__node_pointer
__tree<_Tp, _Compare, _Allocator>::_DetachedTreeCache::__detach_next(__node_pointer __cache) _NOEXCEPT {
if (__cache->__parent_ == nullptr)
return nullptr;
- if (std::__tree_is_left_child(static_cast<__node_base_pointer>(__cache))) {
+ if (std::__tree_is_left_child(std::__static_fancy_pointer_cast<__node_base_pointer>(__cache))) {
__cache->__parent_->__left_ = nullptr;
- __cache = static_cast<__node_pointer>(__cache->__parent_);
+ __cache = std::__static_fancy_pointer_cast<__node_pointer>(__cache->__parent_);
if (__cache->__right_ == nullptr)
return __cache;
return static_cast<__node_pointer>(std::__tree_leaf(__cache->__right_));
}
// __cache is right child
__cache->__parent_unsafe()->__right_ = nullptr;
- __cache = static_cast<__node_pointer>(__cache->__parent_);
+ __cache = std::__static_fancy_pointer_cast<__node_pointer>(__cache->__parent_);
if (__cache->__left_ == nullptr)
return __cache;
return static_cast<__node_pointer>(std::__tree_leaf(__cache->__left_));
}
template <class _Tp, class _Compare, class _Allocator>
-__tree<_Tp, _Compare, _Allocator>& __tree<_Tp, _Compare, _Allocator>::operator=(const __tree& __t) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 __tree<_Tp, _Compare, _Allocator>&
+__tree<_Tp, _Compare, _Allocator>::operator=(const __tree& __t) {
if (this == std::addressof(__t))
return *this;
@@ -1518,14 +1611,15 @@ __tree<_Tp, _Compare, _Allocator>& __tree<_Tp, _Compare, _Allocator>::operator=(
__copy_assign_alloc(__t);
if (__size_ != 0) {
- *__root_ptr() = static_cast<__node_base_pointer>(__copy_assign_tree(__root(), __t.__root()));
+ *__root_ptr() = std::__static_fancy_pointer_cast<__node_base_pointer>(__copy_assign_tree(__root(), __t.__root()));
} else {
- *__root_ptr() = static_cast<__node_base_pointer>(__copy_construct_tree(__t.__root()));
+ *__root_ptr() = std::__static_fancy_pointer_cast<__node_base_pointer>(__copy_construct_tree(__t.__root()));
if (__root())
__root()->__parent_ = __end_node();
}
- __begin_node_ =
- __end_node()->__left_ ? static_cast<__end_node_pointer>(std::__tree_min(__end_node()->__left_)) : __end_node();
+ __begin_node_ = __end_node()->__left_
+ ? std::__static_fancy_pointer_cast<__end_node_pointer>(std::__tree_min(__end_node()->__left_))
+ : __end_node();
__size_ = __t.size();
return *this;
@@ -1533,7 +1627,8 @@ __tree<_Tp, _Compare, _Allocator>& __tree<_Tp, _Compare, _Allocator>::operator=(
template <class _Tp, class _Compare, class _Allocator>
template <class _ForwardIterator>
-void __tree<_Tp, _Compare, _Allocator>::__assign_unique(_ForwardIterator __first, _ForwardIterator __last) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 void
+__tree<_Tp, _Compare, _Allocator>::__assign_unique(_ForwardIterator __first, _ForwardIterator __last) {
using _ITraits = iterator_traits<_ForwardIterator>;
using _ItValueType = typename _ITraits::value_type;
static_assert(
@@ -1553,7 +1648,8 @@ void __tree<_Tp, _Compare, _Allocator>::__assign_unique(_ForwardIterator __first
template <class _Tp, class _Compare, class _Allocator>
template <class _InputIterator>
-void __tree<_Tp, _Compare, _Allocator>::__assign_multi(_InputIterator __first, _InputIterator __last) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 void
+__tree<_Tp, _Compare, _Allocator>::__assign_multi(_InputIterator __first, _InputIterator __last) {
using _ITraits = iterator_traits<_InputIterator>;
using _ItValueType = typename _ITraits::value_type;
static_assert(
@@ -1572,7 +1668,7 @@ void __tree<_Tp, _Compare, _Allocator>::__assign_multi(_InputIterator __first, _
}
template <class _Tp, class _Compare, class _Allocator>
-__tree<_Tp, _Compare, _Allocator>::__tree(const __tree& __t)
+_LIBCPP_CONSTEXPR_SINCE_CXX26 __tree<_Tp, _Compare, _Allocator>::__tree(const __tree& __t)
: __begin_node_(__end_node()),
__node_alloc_(__node_traits::select_on_container_copy_construction(__t.__node_alloc())),
__size_(0),
@@ -1580,14 +1676,14 @@ __tree<_Tp, _Compare, _Allocator>::__tree(const __tree& __t)
if (__t.size() == 0)
return;
- *__root_ptr() = static_cast<__node_base_pointer>(__copy_construct_tree(__t.__root()));
+ *__root_ptr() = std::__static_fancy_pointer_cast<__node_base_pointer>(__copy_construct_tree(__t.__root()));
__root()->__parent_ = __end_node();
- __begin_node_ = static_cast<__end_node_pointer>(std::__tree_min(__end_node()->__left_));
+ __begin_node_ = std::__static_fancy_pointer_cast<__end_node_pointer>(std::__tree_min(__end_node()->__left_));
__size_ = __t.size();
}
template <class _Tp, class _Compare, class _Allocator>
-__tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t) _NOEXCEPT_(
+_LIBCPP_CONSTEXPR_SINCE_CXX26 __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t) _NOEXCEPT_(
is_nothrow_move_constructible<__node_allocator>::value&& is_nothrow_move_constructible<value_compare>::value)
: __begin_node_(std::move(__t.__begin_node_)),
__end_node_(std::move(__t.__end_node_)),
@@ -1605,7 +1701,7 @@ __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t) _NOEXCEPT_(
}
template <class _Tp, class _Compare, class _Allocator>
-__tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t, const allocator_type& __a)
+_LIBCPP_CONSTEXPR_SINCE_CXX26 __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t, const allocator_type& __a)
: __node_alloc_(__node_allocator(__a)), __size_(0), __value_comp_(std::move(__t.value_comp())) {
if (__a == __t.__alloc()) {
if (__t.__size_ == 0)
@@ -1625,7 +1721,7 @@ __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t, const allocator_type& __
}
template <class _Tp, class _Compare, class _Allocator>
-void __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, true_type)
+_LIBCPP_CONSTEXPR_SINCE_CXX26 void __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, true_type)
_NOEXCEPT_(is_nothrow_move_assignable<value_compare>::value&& is_nothrow_move_assignable<__node_allocator>::value) {
destroy(static_cast<__node_pointer>(__end_node()->__left_));
__begin_node_ = __t.__begin_node_;
@@ -1644,7 +1740,7 @@ void __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, true_type)
}
template <class _Tp, class _Compare, class _Allocator>
-void __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, false_type) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 void __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, false_type) {
if (__node_alloc() == __t.__node_alloc())
__move_assign(__t, true_type());
else {
@@ -1665,7 +1761,7 @@ void __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, false_type) {
}
template <class _Tp, class _Compare, class _Allocator>
-void __tree<_Tp, _Compare, _Allocator>::swap(__tree& __t)
+_LIBCPP_CONSTEXPR_SINCE_CXX26 void __tree<_Tp, _Compare, _Allocator>::swap(__tree& __t)
#if _LIBCPP_STD_VER <= 11
_NOEXCEPT_(__is_nothrow_swappable_v<value_compare> &&
(!__node_traits::propagate_on_container_swap::value || __is_nothrow_swappable_v<__node_allocator>))
@@ -1690,7 +1786,7 @@ void __tree<_Tp, _Compare, _Allocator>::swap(__tree& __t)
}
template <class _Tp, class _Compare, class _Allocator>
-void __tree<_Tp, _Compare, _Allocator>::clear() _NOEXCEPT {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 void __tree<_Tp, _Compare, _Allocator>::clear() _NOEXCEPT {
destroy(__root());
__size_ = 0;
__begin_node_ = __end_node();
@@ -1701,7 +1797,7 @@ void __tree<_Tp, _Compare, _Allocator>::clear() _NOEXCEPT {
// Set __parent to parent of null leaf
// Return reference to null leaf
template <class _Tp, class _Compare, class _Allocator>
-typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer&
+_LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer&
__tree<_Tp, _Compare, _Allocator>::__find_leaf_low(__end_node_pointer& __parent, const value_type& __v) {
__node_pointer __nd = __root();
if (__nd != nullptr) {
@@ -1731,7 +1827,7 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf_low(__end_node_pointer& __parent,
// Set __parent to parent of null leaf
// Return reference to null leaf
template <class _Tp, class _Compare, class _Allocator>
-typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer&
+_LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer&
__tree<_Tp, _Compare, _Allocator>::__find_leaf_high(__end_node_pointer& __parent, const value_type& __v) {
__node_pointer __nd = __root();
if (__nd != nullptr) {
@@ -1747,7 +1843,7 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf_high(__end_node_pointer& __parent
if (__nd->__right_ != nullptr)
__nd = static_cast<__node_pointer>(__nd->__right_);
else {
- __parent = static_cast<__end_node_pointer>(__nd);
+ __parent = std::__static_fancy_pointer_cast<__end_node_pointer>(__nd);
return __nd->__right_;
}
}
@@ -1764,7 +1860,8 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf_high(__end_node_pointer& __parent
// Set __parent to parent of null leaf
// Return reference to null leaf
template <class _Tp, class _Compare, class _Allocator>
-typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer& __tree<_Tp, _Compare, _Allocator>::__find_leaf(
+_LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer&
+__tree<_Tp, _Compare, _Allocator>::__find_leaf(
const_iterator __hint, __end_node_pointer& __parent, const value_type& __v) {
if (__hint == end() || !value_comp()(*__hint, __v)) // check before
{
@@ -1777,7 +1874,7 @@ typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer& __tree<_Tp, _Co
return __parent->__left_;
} else {
__parent = static_cast<__end_node_pointer>(__prior.__ptr_);
- return static_cast<__node_base_pointer>(__prior.__ptr_)->__right_;
+ return std::__static_fancy_pointer_cast<__node_base_pointer>(__prior.__ptr_)->__right_;
}
}
// __v < *prev(__hint)
@@ -1792,8 +1889,9 @@ typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer& __tree<_Tp, _Co
// If __v doesn't exist, return the parent of the null leaf and a reference to the pointer to the null leaf.
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
-_LIBCPP_HIDE_FROM_ABI pair<typename __tree<_Tp, _Compare, _Allocator>::__end_node_pointer,
- typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer&>
+_LIBCPP_HIDE_FROM_ABI
+_LIBCPP_CONSTEXPR_SINCE_CXX26 pair<typename __tree<_Tp, _Compare, _Allocator>::__end_node_pointer,
+ typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer&>
__tree<_Tp, _Compare, _Allocator>::__find_equal(const _Key& __v) {
using _Pair = pair<__end_node_pointer, __node_base_pointer&>;
@@ -1805,26 +1903,25 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(const _Key& __v) {
}
__node_base_pointer* __node_ptr = __root_ptr();
- auto&& __transparent = std::__as_transparent(value_comp());
- auto __comp = __lazy_synth_three_way_comparator<__make_transparent_t<_Compare>, _Key, value_type>(__transparent);
+ auto __comp = __lazy_synth_three_way_comparator<_Compare, _Key, value_type>(value_comp());
while (true) {
auto __comp_res = __comp(__v, __nd->__get_value());
if (__comp_res.__less()) {
if (__nd->__left_ == nullptr)
- return _Pair(static_cast<__end_node_pointer>(__nd), __nd->__left_);
+ return _Pair(std::__static_fancy_pointer_cast<__end_node_pointer>(__nd), __nd->__left_);
__node_ptr = std::addressof(__nd->__left_);
- __nd = static_cast<__node_pointer>(__nd->__left_);
+ __nd = std::__static_fancy_pointer_cast<__node_pointer>(__nd->__left_);
} else if (__comp_res.__greater()) {
if (__nd->__right_ == nullptr)
- return _Pair(static_cast<__end_node_pointer>(__nd), __nd->__right_);
+ return _Pair(std::__static_fancy_pointer_cast<__end_node_pointer>(__nd), __nd->__right_);
__node_ptr = std::addressof(__nd->__right_);
- __nd = static_cast<__node_pointer>(__nd->__right_);
+ __nd = std::__static_fancy_pointer_cast<__node_pointer>(__nd->__right_);
} else {
- return _Pair(static_cast<__end_node_pointer>(__nd), *__node_ptr);
+ return _Pair(std::__static_fancy_pointer_cast<__end_node_pointer>(__nd), *__node_ptr);
}
}
}
@@ -1837,8 +1934,9 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(const _Key& __v) {
// If __v doesn't exist, return the parent of the null leaf and a reference to the pointer to the null leaf.
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
-_LIBCPP_HIDE_FROM_ABI pair<typename __tree<_Tp, _Compare, _Allocator>::__end_node_pointer,
- typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer&>
+_LIBCPP_HIDE_FROM_ABI
+_LIBCPP_CONSTEXPR_SINCE_CXX26 pair<typename __tree<_Tp, _Compare, _Allocator>::__end_node_pointer,
+ typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer&>
__tree<_Tp, _Compare, _Allocator>::__find_equal(const_iterator __hint, __node_base_pointer& __dummy, const _Key& __v) {
using _Pair = pair<__end_node_pointer, __node_base_pointer&>;
@@ -1849,7 +1947,7 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(const_iterator __hint, __node_ba
// *prev(__hint) < __v < *__hint
if (__hint.__ptr_->__left_ == nullptr)
return _Pair(__hint.__ptr_, __hint.__ptr_->__left_);
- return _Pair(__prior.__ptr_, static_cast<__node_pointer>(__prior.__ptr_)->__right_);
+ return _Pair(__prior.__ptr_, std::__static_fancy_pointer_cast<__node_pointer>(__prior.__ptr_)->__right_);
}
// __v <= *prev(__hint)
return __find_equal(__v);
@@ -1874,7 +1972,7 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(const_iterator __hint, __node_ba
}
template <class _Tp, class _Compare, class _Allocator>
-void __tree<_Tp, _Compare, _Allocator>::__insert_node_at(
+_LIBCPP_CONSTEXPR_SINCE_CXX26 void __tree<_Tp, _Compare, _Allocator>::__insert_node_at(
__end_node_pointer __parent, __node_base_pointer& __child, __node_base_pointer __new_node) _NOEXCEPT {
__new_node->__left_ = nullptr;
__new_node->__right_ = nullptr;
@@ -1882,14 +1980,14 @@ void __tree<_Tp, _Compare, _Allocator>::__insert_node_at(
// __new_node->__is_black_ is initialized in __tree_balance_after_insert
__child = __new_node;
if (__begin_node_->__left_ != nullptr)
- __begin_node_ = static_cast<__end_node_pointer>(__begin_node_->__left_);
+ __begin_node_ = std::__static_fancy_pointer_cast<__end_node_pointer>(__begin_node_->__left_);
std::__tree_balance_after_insert(__end_node()->__left_, __child);
++__size_;
}
template <class _Tp, class _Compare, class _Allocator>
template <class... _Args>
-typename __tree<_Tp, _Compare, _Allocator>::__node_holder
+_LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::__node_holder
__tree<_Tp, _Compare, _Allocator>::__construct_node(_Args&&... __args) {
__node_allocator& __na = __node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
@@ -1900,7 +1998,7 @@ __tree<_Tp, _Compare, _Allocator>::__construct_node(_Args&&... __args) {
template <class _Tp, class _Compare, class _Allocator>
template <class... _Args>
-typename __tree<_Tp, _Compare, _Allocator>::iterator
+typename __tree<_Tp, _Compare, _Allocator>::iterator _LIBCPP_CONSTEXPR_SINCE_CXX26
__tree<_Tp, _Compare, _Allocator>::__emplace_multi(_Args&&... __args) {
__node_holder __h = __construct_node(std::forward<_Args>(__args)...);
__end_node_pointer __parent;
@@ -1911,24 +2009,24 @@ __tree<_Tp, _Compare, _Allocator>::__emplace_multi(_Args&&... __args) {
template <class _Tp, class _Compare, class _Allocator>
template <class... _Args>
-typename __tree<_Tp, _Compare, _Allocator>::iterator
+typename __tree<_Tp, _Compare, _Allocator>::iterator _LIBCPP_CONSTEXPR_SINCE_CXX26
__tree<_Tp, _Compare, _Allocator>::__emplace_hint_multi(const_iterator __p, _Args&&... __args) {
__node_holder __h = __construct_node(std::forward<_Args>(__args)...);
__end_node_pointer __parent;
__node_base_pointer& __child = __find_leaf(__p, __parent, __h->__get_value());
- __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
+ __insert_node_at(__parent, __child, std::__static_fancy_pointer_cast<__node_base_pointer>(__h.get()));
return iterator(static_cast<__node_pointer>(__h.release()));
}
template <class _Tp, class _Compare, class _Allocator>
-pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
+pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool> _LIBCPP_CONSTEXPR_SINCE_CXX26
__tree<_Tp, _Compare, _Allocator>::__node_assign_unique(const value_type& __v, __node_pointer __nd) {
auto [__parent, __child] = __find_equal(__v);
__node_pointer __r = static_cast<__node_pointer>(__child);
bool __inserted = false;
if (__child == nullptr) {
__assign_value(__nd->__get_value(), __v);
- __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd));
+ __insert_node_at(__parent, __child, std::__static_fancy_pointer_cast<__node_base_pointer>(__nd));
__r = __nd;
__inserted = true;
}
@@ -1936,16 +2034,16 @@ __tree<_Tp, _Compare, _Allocator>::__node_assign_unique(const value_type& __v, _
}
template <class _Tp, class _Compare, class _Allocator>
-typename __tree<_Tp, _Compare, _Allocator>::iterator
+_LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::iterator
__tree<_Tp, _Compare, _Allocator>::__node_insert_multi(__node_pointer __nd) {
__end_node_pointer __parent;
__node_base_pointer& __child = __find_leaf_high(__parent, __nd->__get_value());
- __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd));
+ __insert_node_at(__parent, __child, std::__static_fancy_pointer_cast<__node_base_pointer>(__nd));
return iterator(__nd);
}
template <class _Tp, class _Compare, class _Allocator>
-typename __tree<_Tp, _Compare, _Allocator>::iterator
+_LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::iterator
__tree<_Tp, _Compare, _Allocator>::__node_insert_multi(const_iterator __p, __node_pointer __nd) {
__end_node_pointer __parent;
__node_base_pointer& __child = __find_leaf(__p, __parent, __nd->__get_value());
@@ -1954,21 +2052,21 @@ __tree<_Tp, _Compare, _Allocator>::__node_insert_multi(const_iterator __p, __nod
}
template <class _Tp, class _Compare, class _Allocator>
-typename __tree<_Tp, _Compare, _Allocator>::iterator
+_LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::iterator
__tree<_Tp, _Compare, _Allocator>::__remove_node_pointer(__node_pointer __ptr) _NOEXCEPT {
iterator __r(__ptr);
++__r;
if (__begin_node_ == __ptr)
__begin_node_ = __r.__ptr_;
--__size_;
- std::__tree_remove(__end_node()->__left_, static_cast<__node_base_pointer>(__ptr));
+ std::__tree_remove(__end_node()->__left_, std::__static_fancy_pointer_cast<__node_base_pointer>(__ptr));
return __r;
}
#if _LIBCPP_STD_VER >= 17
template <class _Tp, class _Compare, class _Allocator>
template <class _NodeHandle, class _InsertReturnType>
-_LIBCPP_HIDE_FROM_ABI _InsertReturnType
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _InsertReturnType
__tree<_Tp, _Compare, _Allocator>::__node_handle_insert_unique(_NodeHandle&& __nh) {
if (__nh.empty())
return _InsertReturnType{end(), false, _NodeHandle()};
@@ -1985,7 +2083,7 @@ __tree<_Tp, _Compare, _Allocator>::__node_handle_insert_unique(_NodeHandle&& __n
template <class _Tp, class _Compare, class _Allocator>
template <class _NodeHandle>
-_LIBCPP_HIDE_FROM_ABI typename __tree<_Tp, _Compare, _Allocator>::iterator
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::iterator
__tree<_Tp, _Compare, _Allocator>::__node_handle_insert_unique(const_iterator __hint, _NodeHandle&& __nh) {
if (__nh.empty())
return end();
@@ -2004,7 +2102,8 @@ __tree<_Tp, _Compare, _Allocator>::__node_handle_insert_unique(const_iterator __
template <class _Tp, class _Compare, class _Allocator>
template <class _NodeHandle>
-_LIBCPP_HIDE_FROM_ABI _NodeHandle __tree<_Tp, _Compare, _Allocator>::__node_handle_extract(key_type const& __key) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _NodeHandle
+__tree<_Tp, _Compare, _Allocator>::__node_handle_extract(key_type const& __key) {
iterator __it = find(__key);
if (__it == end())
return _NodeHandle();
@@ -2013,17 +2112,20 @@ _LIBCPP_HIDE_FROM_ABI _NodeHandle __tree<_Tp, _Compare, _Allocator>::__node_hand
template <class _Tp, class _Compare, class _Allocator>
template <class _NodeHandle>
-_LIBCPP_HIDE_FROM_ABI _NodeHandle __tree<_Tp, _Compare, _Allocator>::__node_handle_extract(const_iterator __p) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _NodeHandle
+__tree<_Tp, _Compare, _Allocator>::__node_handle_extract(const_iterator __p) {
__node_pointer __np = __p.__get_np();
__remove_node_pointer(__np);
return _NodeHandle(__np, __alloc());
}
template <class _Tp, class _Compare, class _Allocator>
-template <class _Comp2>
-_LIBCPP_HIDE_FROM_ABI void
-__tree<_Tp, _Compare, _Allocator>::__node_handle_merge_unique(__tree<_Tp, _Comp2, _Allocator>& __source) {
- for (iterator __i = __source.begin(); __i != __source.end();) {
+template <class _Tree>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
+__tree<_Tp, _Compare, _Allocator>::__node_handle_merge_unique(_Tree& __source) {
+ static_assert(is_same<typename _Tree::__node_pointer, __node_pointer>::value, "");
+
+ for (typename _Tree::iterator __i = __source.begin(); __i != __source.end();) {
__node_pointer __src_ptr = __i.__get_np();
auto [__parent, __child] = __find_equal(__src_ptr->__get_value());
++__i;
@@ -2036,7 +2138,7 @@ __tree<_Tp, _Compare, _Allocator>::__node_handle_merge_unique(__tree<_Tp, _Comp2
template <class _Tp, class _Compare, class _Allocator>
template <class _NodeHandle>
-_LIBCPP_HIDE_FROM_ABI typename __tree<_Tp, _Compare, _Allocator>::iterator
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::iterator
__tree<_Tp, _Compare, _Allocator>::__node_handle_insert_multi(_NodeHandle&& __nh) {
if (__nh.empty())
return end();
@@ -2050,7 +2152,7 @@ __tree<_Tp, _Compare, _Allocator>::__node_handle_insert_multi(_NodeHandle&& __nh
template <class _Tp, class _Compare, class _Allocator>
template <class _NodeHandle>
-_LIBCPP_HIDE_FROM_ABI typename __tree<_Tp, _Compare, _Allocator>::iterator
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::iterator
__tree<_Tp, _Compare, _Allocator>::__node_handle_insert_multi(const_iterator __hint, _NodeHandle&& __nh) {
if (__nh.empty())
return end();
@@ -2064,10 +2166,12 @@ __tree<_Tp, _Compare, _Allocator>::__node_handle_insert_multi(const_iterator __h
}
template <class _Tp, class _Compare, class _Allocator>
-template <class _Comp2>
-_LIBCPP_HIDE_FROM_ABI void
-__tree<_Tp, _Compare, _Allocator>::__node_handle_merge_multi(__tree<_Tp, _Comp2, _Allocator>& __source) {
- for (iterator __i = __source.begin(); __i != __source.end();) {
+template <class _Tree>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
+__tree<_Tp, _Compare, _Allocator>::__node_handle_merge_multi(_Tree& __source) {
+ static_assert(is_same<typename _Tree::__node_pointer, __node_pointer>::value, "");
+
+ for (typename _Tree::iterator __i = __source.begin(); __i != __source.end();) {
__node_pointer __src_ptr = __i.__get_np();
__end_node_pointer __parent;
__node_base_pointer& __child = __find_leaf_high(__parent, __src_ptr->__get_value());
@@ -2080,7 +2184,8 @@ __tree<_Tp, _Compare, _Allocator>::__node_handle_merge_multi(__tree<_Tp, _Comp2,
#endif // _LIBCPP_STD_VER >= 17
template <class _Tp, class _Compare, class _Allocator>
-typename __tree<_Tp, _Compare, _Allocator>::iterator __tree<_Tp, _Compare, _Allocator>::erase(const_iterator __p) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26
+ typename __tree<_Tp, _Compare, _Allocator>::iterator __tree<_Tp, _Compare, _Allocator>::erase(const_iterator __p) {
__node_pointer __np = __p.__get_np();
iterator __r = __remove_node_pointer(__np);
__node_allocator& __na = __node_alloc();
@@ -2090,7 +2195,7 @@ typename __tree<_Tp, _Compare, _Allocator>::iterator __tree<_Tp, _Compare, _Allo
}
template <class _Tp, class _Compare, class _Allocator>
-typename __tree<_Tp, _Compare, _Allocator>::iterator
+_LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::iterator
__tree<_Tp, _Compare, _Allocator>::erase(const_iterator __f, const_iterator __l) {
while (__f != __l)
__f = erase(__f);
@@ -2099,7 +2204,7 @@ __tree<_Tp, _Compare, _Allocator>::erase(const_iterator __f, const_iterator __l)
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
-typename __tree<_Tp, _Compare, _Allocator>::size_type
+_LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::size_type
__tree<_Tp, _Compare, _Allocator>::__erase_unique(const _Key& __k) {
iterator __i = find(__k);
if (__i == end())
@@ -2110,7 +2215,7 @@ __tree<_Tp, _Compare, _Allocator>::__erase_unique(const _Key& __k) {
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
-typename __tree<_Tp, _Compare, _Allocator>::size_type
+_LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::size_type
__tree<_Tp, _Compare, _Allocator>::__erase_multi(const _Key& __k) {
pair<iterator, iterator> __p = __equal_range_multi(__k);
size_type __r = 0;
@@ -2121,16 +2226,16 @@ __tree<_Tp, _Compare, _Allocator>::__erase_multi(const _Key& __k) {
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
-typename __tree<_Tp, _Compare, _Allocator>::size_type
+_LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::size_type
__tree<_Tp, _Compare, _Allocator>::__count_unique(const _Key& __k) const {
__node_pointer __rt = __root();
auto __comp = __lazy_synth_three_way_comparator<value_compare, _Key, value_type>(value_comp());
while (__rt != nullptr) {
auto __comp_res = __comp(__k, __rt->__get_value());
if (__comp_res.__less()) {
- __rt = static_cast<__node_pointer>(__rt->__left_);
+ __rt = std::__static_fancy_pointer_cast<__node_pointer>(__rt->__left_);
} else if (__comp_res.__greater())
- __rt = static_cast<__node_pointer>(__rt->__right_);
+ __rt = std::__static_fancy_pointer_cast<__node_pointer>(__rt->__right_);
else
return 1;
}
@@ -2139,7 +2244,7 @@ __tree<_Tp, _Compare, _Allocator>::__count_unique(const _Key& __k) const {
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
-typename __tree<_Tp, _Compare, _Allocator>::size_type
+_LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::size_type
__tree<_Tp, _Compare, _Allocator>::__count_multi(const _Key& __k) const {
__end_node_pointer __result = __end_node();
__node_pointer __rt = __root();
@@ -2153,72 +2258,75 @@ __tree<_Tp, _Compare, _Allocator>::__count_multi(const _Key& __k) const {
__rt = static_cast<__node_pointer>(__rt->__right_);
else
return std::distance(
- __lower_bound_multi(__k, static_cast<__node_pointer>(__rt->__left_), static_cast<__end_node_pointer>(__rt)),
- __upper_bound_multi(__k, static_cast<__node_pointer>(__rt->__right_), __result));
+ __lower_bound(__k, static_cast<__node_pointer>(__rt->__left_), static_cast<__end_node_pointer>(__rt)),
+ __upper_bound(__k, static_cast<__node_pointer>(__rt->__right_), __result));
}
return 0;
}
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
-typename __tree<_Tp, _Compare, _Allocator>::iterator __tree<_Tp, _Compare, _Allocator>::__lower_bound_multi(
- const _Key& __v, __node_pointer __root, __end_node_pointer __result) {
+typename __tree<_Tp, _Compare, _Allocator>::iterator _LIBCPP_CONSTEXPR_SINCE_CXX26
+__tree<_Tp, _Compare, _Allocator>::__lower_bound(const _Key& __v, __node_pointer __root, __end_node_pointer __result) {
while (__root != nullptr) {
if (!value_comp()(__root->__get_value(), __v)) {
- __result = static_cast<__end_node_pointer>(__root);
- __root = static_cast<__node_pointer>(__root->__left_);
+ __result = std::__static_fancy_pointer_cast<__end_node_pointer>(__root);
+ __root = std::__static_fancy_pointer_cast<__node_pointer>(__root->__left_);
} else
- __root = static_cast<__node_pointer>(__root->__right_);
+ __root = std::__static_fancy_pointer_cast<__node_pointer>(__root->__right_);
}
return iterator(__result);
}
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
-typename __tree<_Tp, _Compare, _Allocator>::const_iterator __tree<_Tp, _Compare, _Allocator>::__lower_bound_multi(
+_LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::const_iterator
+__tree<_Tp, _Compare, _Allocator>::__lower_bound(
const _Key& __v, __node_pointer __root, __end_node_pointer __result) const {
while (__root != nullptr) {
if (!value_comp()(__root->__get_value(), __v)) {
- __result = static_cast<__end_node_pointer>(__root);
- __root = static_cast<__node_pointer>(__root->__left_);
+ __result = std::__static_fancy_pointer_cast<__end_node_pointer>(__root);
+ __root = std::__static_fancy_pointer_cast<__node_pointer>(__root->__left_);
} else
- __root = static_cast<__node_pointer>(__root->__right_);
+ __root = std::__static_fancy_pointer_cast<__node_pointer>(__root->__right_);
}
return const_iterator(__result);
}
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
-typename __tree<_Tp, _Compare, _Allocator>::iterator __tree<_Tp, _Compare, _Allocator>::__upper_bound_multi(
- const _Key& __v, __node_pointer __root, __end_node_pointer __result) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::iterator
+__tree<_Tp, _Compare, _Allocator>::__upper_bound(const _Key& __v, __node_pointer __root, __end_node_pointer __result) {
while (__root != nullptr) {
if (value_comp()(__v, __root->__get_value())) {
- __result = static_cast<__end_node_pointer>(__root);
- __root = static_cast<__node_pointer>(__root->__left_);
+ __result = std::__static_fancy_pointer_cast<__end_node_pointer>(__root);
+ __root = std::__static_fancy_pointer_cast<__node_pointer>(__root->__left_);
} else
- __root = static_cast<__node_pointer>(__root->__right_);
+ __root = std::__static_fancy_pointer_cast<__node_pointer>(__root->__right_);
}
return iterator(__result);
}
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
-typename __tree<_Tp, _Compare, _Allocator>::const_iterator __tree<_Tp, _Compare, _Allocator>::__upper_bound_multi(
+_LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::const_iterator
+__tree<_Tp, _Compare, _Allocator>::__upper_bound(
const _Key& __v, __node_pointer __root, __end_node_pointer __result) const {
while (__root != nullptr) {
if (value_comp()(__v, __root->__get_value())) {
- __result = static_cast<__end_node_pointer>(__root);
- __root = static_cast<__node_pointer>(__root->__left_);
+ __result = std::__static_fancy_pointer_cast<__end_node_pointer>(__root);
+ __root = std::__static_fancy_pointer_cast<__node_pointer>(__root->__left_);
} else
- __root = static_cast<__node_pointer>(__root->__right_);
+ __root = std::__static_fancy_pointer_cast<__node_pointer>(__root->__right_);
}
return const_iterator(__result);
}
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
-pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, typename __tree<_Tp, _Compare, _Allocator>::iterator>
-__tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26
+ pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, typename __tree<_Tp, _Compare, _Allocator>::iterator>
+ __tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) {
using _Pp = pair<iterator, iterator>;
__end_node_pointer __result = __end_node();
__node_pointer __rt = __root();
@@ -2226,22 +2334,23 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) {
while (__rt != nullptr) {
auto __comp_res = __comp(__k, __rt->__get_value());
if (__comp_res.__less()) {
- __result = static_cast<__end_node_pointer>(__rt);
- __rt = static_cast<__node_pointer>(__rt->__left_);
+ __result = std::__static_fancy_pointer_cast<__end_node_pointer>(__rt);
+ __rt = std::__static_fancy_pointer_cast<__node_pointer>(__rt->__left_);
} else if (__comp_res.__greater())
- __rt = static_cast<__node_pointer>(__rt->__right_);
+ __rt = std::__static_fancy_pointer_cast<__node_pointer>(__rt->__right_);
else
return _Pp(iterator(__rt),
- iterator(__rt->__right_ != nullptr ? static_cast<__end_node_pointer>(std::__tree_min(__rt->__right_))
- : __result));
+ iterator(__rt->__right_ != nullptr
+ ? std::__static_fancy_pointer_cast<__end_node_pointer>(std::__tree_min(__rt->__right_))
+ : __result));
}
return _Pp(iterator(__result), iterator(__result));
}
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
-pair<typename __tree<_Tp, _Compare, _Allocator>::const_iterator,
- typename __tree<_Tp, _Compare, _Allocator>::const_iterator>
+_LIBCPP_CONSTEXPR_SINCE_CXX26 pair<typename __tree<_Tp, _Compare, _Allocator>::const_iterator,
+ typename __tree<_Tp, _Compare, _Allocator>::const_iterator>
__tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) const {
using _Pp = pair<const_iterator, const_iterator>;
__end_node_pointer __result = __end_node();
@@ -2250,23 +2359,25 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) const {
while (__rt != nullptr) {
auto __comp_res = __comp(__k, __rt->__get_value());
if (__comp_res.__less()) {
- __result = static_cast<__end_node_pointer>(__rt);
- __rt = static_cast<__node_pointer>(__rt->__left_);
+ __result = std::__static_fancy_pointer_cast<__end_node_pointer>(__rt);
+ __rt = std::__static_fancy_pointer_cast<__node_pointer>(__rt->__left_);
} else if (__comp_res.__greater())
- __rt = static_cast<__node_pointer>(__rt->__right_);
+ __rt = std::__static_fancy_pointer_cast<__node_pointer>(__rt->__right_);
else
return _Pp(
const_iterator(__rt),
- const_iterator(
- __rt->__right_ != nullptr ? static_cast<__end_node_pointer>(std::__tree_min(__rt->__right_)) : __result));
+ const_iterator(__rt->__right_ != nullptr
+ ? std::__static_fancy_pointer_cast<__end_node_pointer>(std::__tree_min(__rt->__right_))
+ : __result));
}
return _Pp(const_iterator(__result), const_iterator(__result));
}
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
-pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, typename __tree<_Tp, _Compare, _Allocator>::iterator>
-__tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26
+ pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, typename __tree<_Tp, _Compare, _Allocator>::iterator>
+ __tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) {
using _Pp = pair<iterator, iterator>;
__end_node_pointer __result = __end_node();
__node_pointer __rt = __root();
@@ -2279,17 +2390,16 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) {
} else if (__comp_res.__greater())
__rt = static_cast<__node_pointer>(__rt->__right_);
else
- return _Pp(
- __lower_bound_multi(__k, static_cast<__node_pointer>(__rt->__left_), static_cast<__end_node_pointer>(__rt)),
- __upper_bound_multi(__k, static_cast<__node_pointer>(__rt->__right_), __result));
+ return _Pp(__lower_bound(__k, static_cast<__node_pointer>(__rt->__left_), static_cast<__end_node_pointer>(__rt)),
+ __upper_bound(__k, static_cast<__node_pointer>(__rt->__right_), __result));
}
return _Pp(iterator(__result), iterator(__result));
}
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
-pair<typename __tree<_Tp, _Compare, _Allocator>::const_iterator,
- typename __tree<_Tp, _Compare, _Allocator>::const_iterator>
+_LIBCPP_CONSTEXPR_SINCE_CXX26 pair<typename __tree<_Tp, _Compare, _Allocator>::const_iterator,
+ typename __tree<_Tp, _Compare, _Allocator>::const_iterator>
__tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) const {
using _Pp = pair<const_iterator, const_iterator>;
__end_node_pointer __result = __end_node();
@@ -2303,15 +2413,14 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) const {
} else if (__comp_res.__greater())
__rt = static_cast<__node_pointer>(__rt->__right_);
else
- return _Pp(
- __lower_bound_multi(__k, static_cast<__node_pointer>(__rt->__left_), static_cast<__end_node_pointer>(__rt)),
- __upper_bound_multi(__k, static_cast<__node_pointer>(__rt->__right_), __result));
+ return _Pp(__lower_bound(__k, static_cast<__node_pointer>(__rt->__left_), static_cast<__end_node_pointer>(__rt)),
+ __upper_bound(__k, static_cast<__node_pointer>(__rt->__right_), __result));
}
return _Pp(const_iterator(__result), const_iterator(__result));
}
template <class _Tp, class _Compare, class _Allocator>
-typename __tree<_Tp, _Compare, _Allocator>::__node_holder
+_LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::__node_holder
__tree<_Tp, _Compare, _Allocator>::remove(const_iterator __p) _NOEXCEPT {
__node_pointer __np = __p.__get_np();
if (__begin_node_ == __p.__ptr_) {
@@ -2326,7 +2435,8 @@ __tree<_Tp, _Compare, _Allocator>::remove(const_iterator __p) _NOEXCEPT {
}
template <class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI void swap(__tree<_Tp, _Compare, _Allocator>& __x, __tree<_Tp, _Compare, _Allocator>& __y)
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
+swap(__tree<_Tp, _Compare, _Allocator>& __x, __tree<_Tp, _Compare, _Allocator>& __y)
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
__x.swap(__y);
}
diff --git a/libcxx/include/__utility/lazy_synth_three_way_comparator.h b/libcxx/include/__utility/lazy_synth_three_way_comparator.h
index 8c78742ccb4e3..3b2c7aa4de83f 100644
--- a/libcxx/include/__utility/lazy_synth_three_way_comparator.h
+++ b/libcxx/include/__utility/lazy_synth_three_way_comparator.h
@@ -34,14 +34,14 @@ struct __lazy_compare_result {
const _LHS& __lhs_;
const _RHS& __rhs_;
- _LIBCPP_HIDE_FROM_ABI
- __lazy_compare_result(_LIBCPP_CTOR_LIFETIMEBOUND const _Comparator& __comp,
- _LIBCPP_CTOR_LIFETIMEBOUND const _LHS& __lhs,
- _LIBCPP_CTOR_LIFETIMEBOUND const _RHS& __rhs)
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __lazy_compare_result(
+ _LIBCPP_CTOR_LIFETIMEBOUND const _Comparator& __comp,
+ _LIBCPP_CTOR_LIFETIMEBOUND const _LHS& __lhs,
+ _LIBCPP_CTOR_LIFETIMEBOUND const _RHS& __rhs)
: __comp_(__comp), __lhs_(__lhs), __rhs_(__rhs) {}
- _LIBCPP_HIDE_FROM_ABI bool __less() const { return __comp_(__lhs_, __rhs_); }
- _LIBCPP_HIDE_FROM_ABI bool __greater() const { return __comp_(__rhs_, __lhs_); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool __less() const { return __comp_(__lhs_, __rhs_); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool __greater() const { return __comp_(__rhs_, __lhs_); }
};
// This class provides three way comparison between _LHS and _RHS as efficiently as possible. This can be specialized if
@@ -51,10 +51,11 @@ template <class _Comparator, class _LHS, class _RHS, class = void>
struct __lazy_synth_three_way_comparator {
const _Comparator& __comp_;
- _LIBCPP_HIDE_FROM_ABI __lazy_synth_three_way_comparator(_LIBCPP_CTOR_LIFETIMEBOUND const _Comparator& __comp)
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
+ __lazy_synth_three_way_comparator(_LIBCPP_CTOR_LIFETIMEBOUND const _Comparator& __comp)
: __comp_(__comp) {}
- _LIBCPP_HIDE_FROM_ABI __lazy_compare_result<_Comparator, _LHS, _RHS>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __lazy_compare_result<_Comparator, _LHS, _RHS>
operator()(_LIBCPP_LIFETIMEBOUND const _LHS& __lhs, _LIBCPP_LIFETIMEBOUND const _RHS& __rhs) const {
return __lazy_compare_result<_Comparator, _LHS, _RHS>(__comp_, __lhs, __rhs);
}
@@ -63,10 +64,10 @@ struct __lazy_synth_three_way_comparator {
struct __eager_compare_result {
int __res_;
- _LIBCPP_HIDE_FROM_ABI explicit __eager_compare_result(int __res) : __res_(__res) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit __eager_compare_result(int __res) : __res_(__res) {}
- _LIBCPP_HIDE_FROM_ABI bool __less() const { return __res_ < 0; }
- _LIBCPP_HIDE_FROM_ABI bool __greater() const { return __res_ > 0; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool __less() const { return __res_ < 0; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool __greater() const { return __res_ > 0; }
};
template <class _Comparator, class _LHS, class _RHS>
@@ -77,10 +78,11 @@ struct __lazy_synth_three_way_comparator<_Comparator,
__has_default_three_way_comparator<_LHS, _RHS> >::value> > {
// This lifetimebound annotation is technically incorrect, but other specializations actually capture the lifetime of
// the comparator.
- _LIBCPP_HIDE_FROM_ABI __lazy_synth_three_way_comparator(_LIBCPP_CTOR_LIFETIMEBOUND const _Comparator&) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
+ __lazy_synth_three_way_comparator(_LIBCPP_CTOR_LIFETIMEBOUND const _Comparator&) {}
// Same comment as above.
- _LIBCPP_HIDE_FROM_ABI static __eager_compare_result
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 static __eager_compare_result
operator()(_LIBCPP_LIFETIMEBOUND const _LHS& __lhs, _LIBCPP_LIFETIMEBOUND const _RHS& __rhs) {
return __eager_compare_result(__default_three_way_comparator<_LHS, _RHS>()(__lhs, __rhs));
}
@@ -94,10 +96,11 @@ struct __lazy_synth_three_way_comparator<_Comparator,
__has_default_three_way_comparator<_LHS, _RHS> >::value> > {
// This lifetimebound annotation is technically incorrect, but other specializations actually capture the lifetime of
// the comparator.
- _LIBCPP_HIDE_FROM_ABI __lazy_synth_three_way_comparator(_LIBCPP_CTOR_LIFETIMEBOUND const _Comparator&) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
+ __lazy_synth_three_way_comparator(_LIBCPP_CTOR_LIFETIMEBOUND const _Comparator&) {}
// Same comment as above.
- _LIBCPP_HIDE_FROM_ABI static __eager_compare_result
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 static __eager_compare_result
operator()(_LIBCPP_LIFETIMEBOUND const _LHS& __lhs, _LIBCPP_LIFETIMEBOUND const _RHS& __rhs) {
return __eager_compare_result(-__default_three_way_comparator<_LHS, _RHS>()(__lhs, __rhs));
}
diff --git a/libcxx/include/map b/libcxx/include/map
index 3ff849afcde09..b2c71d265c218 100644
--- a/libcxx/include/map
+++ b/libcxx/include/map
@@ -61,173 +61,175 @@ public:
noexcept(
is_nothrow_default_constructible<allocator_type>::value &&
is_nothrow_default_constructible<key_compare>::value &&
- is_nothrow_copy_constructible<key_compare>::value);
- explicit map(const key_compare& comp);
- map(const key_compare& comp, const allocator_type& a);
+ is_nothrow_copy_constructible<key_compare>::value); // constexpr since C++26
+ explicit map(const key_compare& comp); // constexpr since C++26
+ map(const key_compare& comp, const allocator_type& a); // constexpr since C++26
template <class InputIterator>
map(InputIterator first, InputIterator last,
- const key_compare& comp = key_compare());
+ const key_compare& comp = key_compare()); // constexpr since C++26
template <class InputIterator>
map(InputIterator first, InputIterator last,
- const key_compare& comp, const allocator_type& a);
+ const key_compare& comp, const allocator_type& a); // constexpr since C++26
template<container-compatible-range<value_type> R>
- map(from_range_t, R&& rg, const Compare& comp = Compare(), const Allocator& = Allocator()); // C++23
- map(const map& m);
+ map(from_range_t, R&& rg, const Compare& comp = Compare(), const Allocator& = Allocator()); // C++23 // constexpr
+since C++26
+
+ map(const map& m); // constexpr since C++26
map(map&& m)
noexcept(
is_nothrow_move_constructible<allocator_type>::value &&
- is_nothrow_move_constructible<key_compare>::value);
- explicit map(const allocator_type& a);
- map(const map& m, const allocator_type& a);
- map(map&& m, const allocator_type& a);
- map(initializer_list<value_type> il, const key_compare& comp = key_compare());
- map(initializer_list<value_type> il, const key_compare& comp, const allocator_type& a);
+ is_nothrow_move_constructible<key_compare>::value); // constexpr since C++26
+ explicit map(const allocator_type& a); // constexpr since C++26
+ map(const map& m, const allocator_type& a); // constexpr since C++26
+ map(map&& m, const allocator_type& a); // constexpr since C++26
+ map(initializer_list<value_type> il, const key_compare& comp = key_compare()); // constexpr since C++26
+ map(initializer_list<value_type> il, const key_compare& comp, const allocator_type& a); // constexpr since C++26
template <class InputIterator>
map(InputIterator first, InputIterator last, const allocator_type& a)
- : map(first, last, Compare(), a) {} // C++14
+ : map(first, last, Compare(), a) {} // C++14 // constexpr since C++26
template<container-compatible-range<value_type> R>
map(from_range_t, R&& rg, const Allocator& a))
- : map(from_range, std::forward<R>(rg), Compare(), a) { } // C++23
+ : map(from_range, std::forward<R>(rg), Compare(), a) { } // C++23 // constexpr since C++26
map(initializer_list<value_type> il, const allocator_type& a)
- : map(il, Compare(), a) {} // C++14
- ~map();
+ : map(il, Compare(), a) {} // C++14 // constexpr since C++26
+ ~map(); // constexpr since C++26
- map& operator=(const map& m);
+ map& operator=(const map& m); // constexpr since C++26
map& operator=(map&& m)
noexcept(
allocator_type::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value &&
- is_nothrow_move_assignable<key_compare>::value);
- map& operator=(initializer_list<value_type> il);
+ is_nothrow_move_assignable<key_compare>::value); // constexpr since C++26
+ map& operator=(initializer_list<value_type> il); // constexpr since C++26
// iterators:
- iterator begin() noexcept;
- const_iterator begin() const noexcept;
- iterator end() noexcept;
- const_iterator end() const noexcept;
+ iterator begin() noexcept; // constexpr since C++26
+ const_iterator begin() const noexcept; // constexpr since C++26
+ iterator end() noexcept; // constexpr since C++26
+ const_iterator end() const noexcept; // constexpr since C++26
- reverse_iterator rbegin() noexcept;
- const_reverse_iterator rbegin() const noexcept;
- reverse_iterator rend() noexcept;
- const_reverse_iterator rend() const noexcept;
+ reverse_iterator rbegin() noexcept; // constexpr since C++26
+ const_reverse_iterator rbegin() const noexcept; // constexpr since C++26
+ reverse_iterator rend() noexcept; // constexpr since C++26
+ const_reverse_iterator rend() const noexcept; // constexpr since C++26
- const_iterator cbegin() const noexcept;
- const_iterator cend() const noexcept;
- const_reverse_iterator crbegin() const noexcept;
- const_reverse_iterator crend() const noexcept;
+ const_iterator cbegin() const noexcept; // constexpr since C++26
+ const_iterator cend() const noexcept; // constexpr since C++26
+ const_reverse_iterator crbegin() const noexcept; // constexpr since C++26
+ const_reverse_iterator crend() const noexcept; // constexpr since C++26
// capacity:
- bool empty() const noexcept;
- size_type size() const noexcept;
- size_type max_size() const noexcept;
+ bool empty() const noexcept; // constexpr since C++26
+ size_type size() const noexcept; // constexpr since C++26
+ size_type max_size() const noexcept; // constexpr since C++26
// element access:
- mapped_type& operator[](const key_type& k);
- mapped_type& operator[](key_type&& k);
+ mapped_type& operator[](const key_type& k); // constexpr since C++26
+ mapped_type& operator[](key_type&& k); // constexpr since C++26
- mapped_type& at(const key_type& k);
- const mapped_type& at(const key_type& k) const;
+ mapped_type& at(const key_type& k); // constexpr since C++26
+ const mapped_type& at(const key_type& k) const; // constexpr since C++26
// modifiers:
template <class... Args>
- pair<iterator, bool> emplace(Args&&... args);
+ pair<iterator, bool> emplace(Args&&... args); // constexpr since C++26
template <class... Args>
- iterator emplace_hint(const_iterator position, Args&&... args);
- pair<iterator, bool> insert(const value_type& v);
- pair<iterator, bool> insert( value_type&& v); // C++17
+ iterator emplace_hint(const_iterator position, Args&&... args); // constexpr since C++26
+ pair<iterator, bool> insert(const value_type& v); // constexpr since C++26
+ pair<iterator, bool> insert( value_type&& v); // C++17 // constexpr since C++26
template <class P>
- pair<iterator, bool> insert(P&& p);
- iterator insert(const_iterator position, const value_type& v);
- iterator insert(const_iterator position, value_type&& v); // C++17
+ pair<iterator, bool> insert(P&& p); // constexpr since C++26
+ iterator insert(const_iterator position, const value_type& v); // constexpr since C++26
+ iterator insert(const_iterator position, value_type&& v); // C++17 // constexpr since C++26
template <class P>
- iterator insert(const_iterator position, P&& p);
+ iterator insert(const_iterator position, P&& p); // constexpr since C++26
template <class InputIterator>
- void insert(InputIterator first, InputIterator last);
+ void insert(InputIterator first, InputIterator last); // constexpr since C++26
template<container-compatible-range<value_type> R>
- void insert_range(R&& rg); // C++23
- void insert(initializer_list<value_type> il);
+ void insert_range(R&& rg); // C++23 // constexpr since C++26
+ void insert(initializer_list<value_type> il); // constexpr since C++26
- node_type extract(const_iterator position); // C++17
- node_type extract(const key_type& x); // C++17
- insert_return_type insert(node_type&& nh); // C++17
- iterator insert(const_iterator hint, node_type&& nh); // C++17
+ node_type extract(const_iterator position); // C++17 // constexpr since C++26
+ node_type extract(const key_type& x); // C++17 // constexpr since C++26
+ insert_return_type insert(node_type&& nh); // C++17 // constexpr since C++26
+ iterator insert(const_iterator hint, node_type&& nh); // C++17 // constexpr since C++26
template <class... Args>
- pair<iterator, bool> try_emplace(const key_type& k, Args&&... args); // C++17
+ pair<iterator, bool> try_emplace(const key_type& k, Args&&... args); // C++17 // constexpr since C++26
template <class... Args>
- pair<iterator, bool> try_emplace(key_type&& k, Args&&... args); // C++17
+ pair<iterator, bool> try_emplace(key_type&& k, Args&&... args); // C++17 // constexpr since C++26
template <class... Args>
- iterator try_emplace(const_iterator hint, const key_type& k, Args&&... args); // C++17
+ iterator try_emplace(const_iterator hint, const key_type& k, Args&&... args); // C++17 // constexpr since C++26
template <class... Args>
- iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args); // C++17
+ iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args); // C++17 // constexpr since C++26
template <class M>
- pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj); // C++17
+ pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj); // C++17 // constexpr since C++26
template <class M>
- pair<iterator, bool> insert_or_assign(key_type&& k, M&& obj); // C++17
+ pair<iterator, bool> insert_or_assign(key_type&& k, M&& obj); // C++17 // constexpr since C++26
template <class M>
- iterator insert_or_assign(const_iterator hint, const key_type& k, M&& obj); // C++17
+ iterator insert_or_assign(const_iterator hint, const key_type& k, M&& obj); // C++17 // constexpr since C++26
template <class M>
- iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj); // C++17
+ iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj); // C++17 // constexpr since C++26
- iterator erase(const_iterator position);
- iterator erase(iterator position); // C++14
- size_type erase(const key_type& k);
- iterator erase(const_iterator first, const_iterator last);
- void clear() noexcept;
+ iterator erase(const_iterator position); // constexpr since C++26
+ iterator erase(iterator position); // C++14 // constexpr since C++26
+ size_type erase(const key_type& k); // constexpr since C++26
+ iterator erase(const_iterator first, const_iterator last); // constexpr since C++26
+ void clear() noexcept; // constexpr since C++26
template<class C2>
- void merge(map<Key, T, C2, Allocator>& source); // C++17
+ void merge(map<Key, T, C2, Allocator>& source); // C++17 // constexpr since C++26
template<class C2>
- void merge(map<Key, T, C2, Allocator>&& source); // C++17
+ void merge(map<Key, T, C2, Allocator>&& source); // C++17 // constexpr since C++26
template<class C2>
- void merge(multimap<Key, T, C2, Allocator>& source); // C++17
+ void merge(multimap<Key, T, C2, Allocator>& source); // C++17 // constexpr since C++26
template<class C2>
- void merge(multimap<Key, T, C2, Allocator>&& source); // C++17
+ void merge(multimap<Key, T, C2, Allocator>&& source); // C++17 // constexpr since C++26
void swap(map& m)
noexcept(allocator_traits<allocator_type>::is_always_equal::value &&
- is_nothrow_swappable<key_compare>::value); // C++17
+ is_nothrow_swappable<key_compare>::value); // C++17 // constexpr since C++26
// observers:
- allocator_type get_allocator() const noexcept;
- key_compare key_comp() const;
- value_compare value_comp() const;
+ allocator_type get_allocator() const noexcept; // constexpr since C++26
+ key_compare key_comp() const; // constexpr since C++26
+ value_compare value_comp() const; // constexpr since C++26
// map operations:
- iterator find(const key_type& k);
- const_iterator find(const key_type& k) const;
+ iterator find(const key_type& k); // constexpr since C++26
+ const_iterator find(const key_type& k) const; // constexpr since C++26
template<typename K>
- iterator find(const K& x); // C++14
+ iterator find(const K& x); // C++14 // constexpr since C++26
template<typename K>
- const_iterator find(const K& x) const; // C++14
+ const_iterator find(const K& x) const; // C++14 // constexpr since C++26
template<typename K>
- size_type count(const K& x) const; // C++14
- size_type count(const key_type& k) const;
+ size_type count(const K& x) const; // C++14 // constexpr since C++26
+ size_type count(const key_type& k) const; // constexpr since C++26
- bool contains(const key_type& x) const; // C++20
- template<class K> bool contains(const K& x) const; // C++20
+ bool contains(const key_type& x) const; // C++20 // constexpr since C++26
+ template<class K> bool contains(const K& x) const; // C++20 // constexpr since C++26
- iterator lower_bound(const key_type& k);
- const_iterator lower_bound(const key_type& k) const;
+ iterator lower_bound(const key_type& k); // constexpr since C++26
+ const_iterator lower_bound(const key_type& k) const; // constexpr since C++26
template<typename K>
- iterator lower_bound(const K& x); // C++14
+ iterator lower_bound(const K& x); // C++14 // constexpr since C++26
template<typename K>
- const_iterator lower_bound(const K& x) const; // C++14
+ const_iterator lower_bound(const K& x) const; // C++14 // constexpr since C++26
- iterator upper_bound(const key_type& k);
- const_iterator upper_bound(const key_type& k) const;
+ iterator upper_bound(const key_type& k); // constexpr since C++26
+ const_iterator upper_bound(const key_type& k) const; // constexpr since C++26
template<typename K>
- iterator upper_bound(const K& x); // C++14
+ iterator upper_bound(const K& x); // C++14 // constexpr since C++26
template<typename K>
- const_iterator upper_bound(const K& x) const; // C++14
+ const_iterator upper_bound(const K& x) const; // C++14 // constexpr since C++26
- pair<iterator,iterator> equal_range(const key_type& k);
- pair<const_iterator,const_iterator> equal_range(const key_type& k) const;
+ pair<iterator,iterator> equal_range(const key_type& k); // constexpr since C++26
+ pair<const_iterator,const_iterator> equal_range(const key_type& k) const; // constexpr since C++26
template<typename K>
- pair<iterator,iterator> equal_range(const K& x); // C++14
+ pair<iterator,iterator> equal_range(const K& x); // C++14 // constexpr since C++26
template<typename K>
- pair<const_iterator,const_iterator> equal_range(const K& x) const; // C++14
+ pair<const_iterator,const_iterator> equal_range(const K& x) const; // C++14 // constexpr since C++26
};
template <class InputIterator,
@@ -261,7 +263,7 @@ map(initializer_list<pair<const Key, T>>, Allocator) -> map<Key, T, less<Key>, A
template <class Key, class T, class Compare, class Allocator>
bool
operator==(const map<Key, T, Compare, Allocator>& x,
- const map<Key, T, Compare, Allocator>& y);
+ const map<Key, T, Compare, Allocator>& y); // constexpr since C++26
template <class Key, class T, class Compare, class Allocator>
bool
@@ -297,11 +299,11 @@ template<class Key, class T, class Compare, class Allocator>
template <class Key, class T, class Compare, class Allocator>
void
swap(map<Key, T, Compare, Allocator>& x, map<Key, T, Compare, Allocator>& y)
- noexcept(noexcept(x.swap(y)));
+ noexcept(noexcept(x.swap(y))); // constexpr since C++26
template <class Key, class T, class Compare, class Allocator, class Predicate>
typename map<Key, T, Compare, Allocator>::size_type
-erase_if(map<Key, T, Compare, Allocator>& c, Predicate pred); // C++20
+erase_if(map<Key, T, Compare, Allocator>& c, Predicate pred); // C++20 // constexpr since C++26
template <class Key, class T, class Compare = less<Key>,
@@ -600,10 +602,7 @@ erase_if(multimap<Key, T, Compare, Allocator>& c, Predicate pred); // C++20
# include <__ranges/from_range.h>
# include <__tree>
# include <__type_traits/container_traits.h>
-# include <__type_traits/desugars_to.h>
# include <__type_traits/is_allocator.h>
-# include <__type_traits/is_convertible.h>
-# include <__type_traits/make_transparent.h>
# include <__type_traits/remove_const.h>
# include <__type_traits/type_identity.h>
# include <__utility/forward.h>
@@ -642,48 +641,52 @@ class __map_value_compare {
_LIBCPP_COMPRESSED_ELEMENT(_Compare, __comp_);
public:
- _LIBCPP_HIDE_FROM_ABI __map_value_compare() _NOEXCEPT_(is_nothrow_default_constructible<_Compare>::value)
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __map_value_compare()
+ _NOEXCEPT_(is_nothrow_default_constructible<_Compare>::value)
: __comp_() {}
- _LIBCPP_HIDE_FROM_ABI __map_value_compare(_Compare __c) _NOEXCEPT_(is_nothrow_copy_constructible<_Compare>::value)
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __map_value_compare(_Compare __c)
+ _NOEXCEPT_(is_nothrow_copy_constructible<_Compare>::value)
: __comp_(__c) {}
- _LIBCPP_HIDE_FROM_ABI const _Compare& key_comp() const _NOEXCEPT { return __comp_; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const _Compare& key_comp() const _NOEXCEPT { return __comp_; }
- _LIBCPP_HIDE_FROM_ABI bool operator()(const _CP& __x, const _CP& __y) const { return __comp_(__x.first, __y.first); }
- _LIBCPP_HIDE_FROM_ABI bool operator()(const _CP& __x, const _Key& __y) const { return __comp_(__x.first, __y); }
- _LIBCPP_HIDE_FROM_ABI bool operator()(const _Key& __x, const _CP& __y) const { return __comp_(__x, __y.first); }
- _LIBCPP_HIDE_FROM_ABI void swap(__map_value_compare& __y) _NOEXCEPT_(__is_nothrow_swappable_v<_Compare>) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool operator()(const _CP& __x, const _CP& __y) const {
+ return __comp_(__x.first, __y.first);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool operator()(const _CP& __x, const _Key& __y) const {
+ return __comp_(__x.first, __y);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool operator()(const _Key& __x, const _CP& __y) const {
+ return __comp_(__x, __y.first);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void swap(__map_value_compare& __y)
+ _NOEXCEPT_(__is_nothrow_swappable_v<_Compare>) {
using std::swap;
swap(__comp_, __y.__comp_);
}
# if _LIBCPP_STD_VER >= 14
template <typename _K2>
- _LIBCPP_HIDE_FROM_ABI bool operator()(const _K2& __x, const _CP& __y) const {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool operator()(const _K2& __x, const _CP& __y) const {
return __comp_(__x, __y.first);
}
template <typename _K2>
- _LIBCPP_HIDE_FROM_ABI bool operator()(const _CP& __x, const _K2& __y) const {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool operator()(const _CP& __x, const _K2& __y) const {
return __comp_(__x.first, __y);
}
# endif
};
-template <class _Key, class _MapValueT, class _Compare>
-struct __make_transparent<__map_value_compare<_Key, _MapValueT, _Compare> > {
- using type _LIBCPP_NODEBUG = __map_value_compare<_Key, _MapValueT, __make_transparent_t<_Compare> >;
-};
-
# if _LIBCPP_STD_VER >= 14
template <class _MapValueT, class _Key, class _Compare>
struct __lazy_synth_three_way_comparator<__map_value_compare<_Key, _MapValueT, _Compare>, _MapValueT, _MapValueT> {
__lazy_synth_three_way_comparator<_Compare, _Key, _Key> __comp_;
- __lazy_synth_three_way_comparator(
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 __lazy_synth_three_way_comparator(
_LIBCPP_CTOR_LIFETIMEBOUND const __map_value_compare<_Key, _MapValueT, _Compare>& __comp)
: __comp_(__comp.key_comp()) {}
- _LIBCPP_HIDE_FROM_ABI auto
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 auto
operator()(_LIBCPP_LIFETIMEBOUND const _MapValueT& __lhs, _LIBCPP_LIFETIMEBOUND const _MapValueT& __rhs) const {
return __comp_(__lhs.first, __rhs.first);
}
@@ -693,11 +696,11 @@ template <class _MapValueT, class _Key, class _TransparentKey, class _Compare>
struct __lazy_synth_three_way_comparator<__map_value_compare<_Key, _MapValueT, _Compare>, _TransparentKey, _MapValueT> {
__lazy_synth_three_way_comparator<_Compare, _TransparentKey, _Key> __comp_;
- __lazy_synth_three_way_comparator(
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 __lazy_synth_three_way_comparator(
_LIBCPP_CTOR_LIFETIMEBOUND const __map_value_compare<_Key, _MapValueT, _Compare>& __comp)
: __comp_(__comp.key_comp()) {}
- _LIBCPP_HIDE_FROM_ABI auto
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 auto
operator()(_LIBCPP_LIFETIMEBOUND const _TransparentKey& __lhs, _LIBCPP_LIFETIMEBOUND const _MapValueT& __rhs) const {
return __comp_(__lhs, __rhs.first);
}
@@ -719,7 +722,7 @@ struct __lazy_synth_three_way_comparator<__map_value_compare<_Key, _MapValueT, _
# endif // _LIBCPP_STD_VER >= 14
template <class _Key, class _CP, class _Compare>
-inline _LIBCPP_HIDE_FROM_ABI void
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
swap(__map_value_compare<_Key, _CP, _Compare>& __x, __map_value_compare<_Key, _CP, _Compare>& __y)
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
__x.swap(__y);
@@ -780,37 +783,41 @@ public:
using reference = value_type&;
using pointer = typename _TreeIterator::pointer;
- _LIBCPP_HIDE_FROM_ABI __map_iterator() _NOEXCEPT {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __map_iterator() _NOEXCEPT {}
- _LIBCPP_HIDE_FROM_ABI __map_iterator(_TreeIterator __i) _NOEXCEPT : __i_(__i) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __map_iterator(_TreeIterator __i) _NOEXCEPT : __i_(__i) {}
- _LIBCPP_HIDE_FROM_ABI reference operator*() const { return *__i_; }
- _LIBCPP_HIDE_FROM_ABI pointer operator->() const { return pointer_traits<pointer>::pointer_to(*__i_); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reference operator*() const { return *__i_; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pointer operator->() const {
+ return pointer_traits<pointer>::pointer_to(*__i_);
+ }
- _LIBCPP_HIDE_FROM_ABI __map_iterator& operator++() {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __map_iterator& operator++() {
++__i_;
return *this;
}
- _LIBCPP_HIDE_FROM_ABI __map_iterator operator++(int) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __map_iterator operator++(int) {
__map_iterator __t(*this);
++(*this);
return __t;
}
- _LIBCPP_HIDE_FROM_ABI __map_iterator& operator--() {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __map_iterator& operator--() {
--__i_;
return *this;
}
- _LIBCPP_HIDE_FROM_ABI __map_iterator operator--(int) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __map_iterator operator--(int) {
__map_iterator __t(*this);
--(*this);
return __t;
}
- friend _LIBCPP_HIDE_FROM_ABI bool operator==(const __map_iterator& __x, const __map_iterator& __y) {
+ friend _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
+ operator==(const __map_iterator& __x, const __map_iterator& __y) {
return __x.__i_ == __y.__i_;
}
- friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const __map_iterator& __x, const __map_iterator& __y) {
+ friend _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
+ operator!=(const __map_iterator& __x, const __map_iterator& __y) {
return __x.__i_ != __y.__i_;
}
@@ -833,39 +840,43 @@ public:
using reference = const value_type&;
using pointer = typename _TreeIterator::pointer;
- _LIBCPP_HIDE_FROM_ABI __map_const_iterator() _NOEXCEPT {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __map_const_iterator() _NOEXCEPT {}
- _LIBCPP_HIDE_FROM_ABI __map_const_iterator(_TreeIterator __i) _NOEXCEPT : __i_(__i) {}
- _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __map_const_iterator(_TreeIterator __i) _NOEXCEPT : __i_(__i) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
__map_const_iterator(__map_iterator< typename _TreeIterator::__non_const_iterator> __i) _NOEXCEPT : __i_(__i.__i_) {}
- _LIBCPP_HIDE_FROM_ABI reference operator*() const { return *__i_; }
- _LIBCPP_HIDE_FROM_ABI pointer operator->() const { return pointer_traits<pointer>::pointer_to(*__i_); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reference operator*() const { return *__i_; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pointer operator->() const {
+ return pointer_traits<pointer>::pointer_to(*__i_);
+ }
- _LIBCPP_HIDE_FROM_ABI __map_const_iterator& operator++() {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __map_const_iterator& operator++() {
++__i_;
return *this;
}
- _LIBCPP_HIDE_FROM_ABI __map_const_iterator operator++(int) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __map_const_iterator operator++(int) {
__map_const_iterator __t(*this);
++(*this);
return __t;
}
- _LIBCPP_HIDE_FROM_ABI __map_const_iterator& operator--() {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __map_const_iterator& operator--() {
--__i_;
return *this;
}
- _LIBCPP_HIDE_FROM_ABI __map_const_iterator operator--(int) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __map_const_iterator operator--(int) {
__map_const_iterator __t(*this);
--(*this);
return __t;
}
- friend _LIBCPP_HIDE_FROM_ABI bool operator==(const __map_const_iterator& __x, const __map_const_iterator& __y) {
+ friend _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
+ operator==(const __map_const_iterator& __x, const __map_const_iterator& __y) {
return __x.__i_ == __y.__i_;
}
- friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const __map_const_iterator& __x, const __map_const_iterator& __y) {
+ friend _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
+ operator!=(const __map_const_iterator& __x, const __map_const_iterator& __y) {
return __x.__i_ != __y.__i_;
}
@@ -901,10 +912,11 @@ public:
protected:
key_compare comp;
- _LIBCPP_HIDE_FROM_ABI value_compare(key_compare __c) : comp(__c) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 value_compare(key_compare __c) : comp(__c) {}
public:
- _LIBCPP_HIDE_FROM_ABI bool operator()(const value_type& __x, const value_type& __y) const {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
+ operator()(const value_type& __x, const value_type& __y) const {
return comp(__x.first, __y.first);
}
};
@@ -940,26 +952,27 @@ public:
template <class _Key2, class _Value2, class _Comp2, class _Alloc2>
friend class multimap;
- _LIBCPP_HIDE_FROM_ABI map() _NOEXCEPT_(
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 map() _NOEXCEPT_(
is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_default_constructible<key_compare>::value&&
is_nothrow_copy_constructible<key_compare>::value)
: __tree_(__vc(key_compare())) {}
- _LIBCPP_HIDE_FROM_ABI explicit map(const key_compare& __comp) _NOEXCEPT_(
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit map(const key_compare& __comp) _NOEXCEPT_(
is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_copy_constructible<key_compare>::value)
: __tree_(__vc(__comp)) {}
- _LIBCPP_HIDE_FROM_ABI explicit map(const key_compare& __comp, const allocator_type& __a)
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit map(const key_compare& __comp, const allocator_type& __a)
: __tree_(__vc(__comp), typename __base::allocator_type(__a)) {}
template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI map(_InputIterator __f, _InputIterator __l, const key_compare& __comp = key_compare())
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
+ map(_InputIterator __f, _InputIterator __l, const key_compare& __comp = key_compare())
: __tree_(__vc(__comp)) {
insert(__f, __l);
}
template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
map(_InputIterator __f, _InputIterator __l, const key_compare& __comp, const allocator_type& __a)
: __tree_(__vc(__comp), typename __base::allocator_type(__a)) {
insert(__f, __l);
@@ -967,7 +980,7 @@ public:
# if _LIBCPP_STD_VER >= 23
template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
map(from_range_t,
_Range&& __range,
const key_compare& __comp = key_compare(),
@@ -979,157 +992,169 @@ public:
# if _LIBCPP_STD_VER >= 14
template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI map(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
+ _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 map(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
: map(__f, __l, key_compare(), __a) {}
# endif
# if _LIBCPP_STD_VER >= 23
template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI map(from_range_t, _Range&& __range, const allocator_type& __a)
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 map(from_range_t, _Range&& __range, const allocator_type& __a)
: map(from_range, std::forward<_Range>(__range), key_compare(), __a) {}
# endif
- _LIBCPP_HIDE_FROM_ABI map(const map& __m) = default;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 map(const map& __m) = default;
- _LIBCPP_HIDE_FROM_ABI map& operator=(const map& __m) = default;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 map& operator=(const map& __m) = default;
# ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI map(map&& __m) = default;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 map(map&& __m) = default;
- _LIBCPP_HIDE_FROM_ABI map(map&& __m, const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 map(map&& __m, const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI map& operator=(map&& __m) = default;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 map& operator=(map&& __m) = default;
- _LIBCPP_HIDE_FROM_ABI map(initializer_list<value_type> __il, const key_compare& __comp = key_compare())
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
+ map(initializer_list<value_type> __il, const key_compare& __comp = key_compare())
: __tree_(__vc(__comp)) {
insert(__il.begin(), __il.end());
}
- _LIBCPP_HIDE_FROM_ABI map(initializer_list<value_type> __il, const key_compare& __comp, const allocator_type& __a)
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
+ map(initializer_list<value_type> __il, const key_compare& __comp, const allocator_type& __a)
: __tree_(__vc(__comp), typename __base::allocator_type(__a)) {
insert(__il.begin(), __il.end());
}
# if _LIBCPP_STD_VER >= 14
- _LIBCPP_HIDE_FROM_ABI map(initializer_list<value_type> __il, const allocator_type& __a)
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 map(initializer_list<value_type> __il, const allocator_type& __a)
: map(__il, key_compare(), __a) {}
# endif
- _LIBCPP_HIDE_FROM_ABI map& operator=(initializer_list<value_type> __il) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 map& operator=(initializer_list<value_type> __il) {
__tree_.__assign_unique(__il.begin(), __il.end());
return *this;
}
# endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI explicit map(const allocator_type& __a) : __tree_(typename __base::allocator_type(__a)) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit map(const allocator_type& __a)
+ : __tree_(typename __base::allocator_type(__a)) {}
- _LIBCPP_HIDE_FROM_ABI map(const map& __m, const allocator_type& __a)
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 map(const map& __m, const allocator_type& __a)
: __tree_(__m.__tree_.value_comp(), typename __base::allocator_type(__a)) {
insert(__m.begin(), __m.end());
}
- _LIBCPP_HIDE_FROM_ABI ~map() { static_assert(sizeof(std::__diagnose_non_const_comparator<_Key, _Compare>()), ""); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 ~map() {
+ static_assert(sizeof(std::__diagnose_non_const_comparator<_Key, _Compare>()), "");
+ }
- _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __tree_.begin(); }
- _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __tree_.begin(); }
- _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __tree_.end(); }
- _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __tree_.end(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator begin() _NOEXCEPT { return __tree_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator begin() const _NOEXCEPT { return __tree_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator end() _NOEXCEPT { return __tree_.end(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator end() const _NOEXCEPT { return __tree_.end(); }
- _LIBCPP_HIDE_FROM_ABI reverse_iterator rbegin() _NOEXCEPT { return reverse_iterator(end()); }
- _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rbegin() const _NOEXCEPT { return const_reverse_iterator(end()); }
- _LIBCPP_HIDE_FROM_ABI reverse_iterator rend() _NOEXCEPT { return reverse_iterator(begin()); }
- _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend() const _NOEXCEPT { return const_reverse_iterator(begin()); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reverse_iterator rbegin() _NOEXCEPT {
+ return reverse_iterator(end());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator rbegin() const _NOEXCEPT {
+ return const_reverse_iterator(end());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reverse_iterator rend() _NOEXCEPT {
+ return reverse_iterator(begin());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator rend() const _NOEXCEPT {
+ return const_reverse_iterator(begin());
+ }
- _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return begin(); }
- _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return end(); }
- _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crbegin() const _NOEXCEPT { return rbegin(); }
- _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT { return rend(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator cbegin() const _NOEXCEPT { return begin(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator cend() const _NOEXCEPT { return end(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator crbegin() const _NOEXCEPT {
+ return rbegin();
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator crend() const _NOEXCEPT { return rend(); }
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __tree_.size() == 0; }
- _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __tree_.size(); }
- _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __tree_.max_size(); }
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool empty() const _NOEXCEPT {
+ return __tree_.size() == 0;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type size() const _NOEXCEPT { return __tree_.size(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type max_size() const _NOEXCEPT {
+ return __tree_.max_size();
+ }
- _LIBCPP_HIDE_FROM_ABI mapped_type& operator[](const key_type& __k);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 mapped_type& operator[](const key_type& __k);
# ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI mapped_type& operator[](key_type&& __k);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 mapped_type& operator[](key_type&& __k);
# endif
- template <class _Arg,
- __enable_if_t<__is_transparently_comparable_v<_Compare, key_type, __remove_cvref_t<_Arg> >, int> = 0>
- _LIBCPP_HIDE_FROM_ABI mapped_type& at(_Arg&& __arg) {
- auto [_, __child] = __tree_.__find_equal(__arg);
- if (__child == nullptr)
- std::__throw_out_of_range("map::at: key not found");
- return static_cast<__node_pointer>(__child)->__get_value().second;
- }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 mapped_type& at(const key_type& __k);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const mapped_type& at(const key_type& __k) const;
- template <class _Arg,
- __enable_if_t<__is_transparently_comparable_v<_Compare, key_type, __remove_cvref_t<_Arg> >, int> = 0>
- _LIBCPP_HIDE_FROM_ABI const mapped_type& at(_Arg&& __arg) const {
- auto [_, __child] = __tree_.__find_equal(__arg);
- if (__child == nullptr)
- std::__throw_out_of_range("map::at: key not found");
- return static_cast<__node_pointer>(__child)->__get_value().second;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 allocator_type get_allocator() const _NOEXCEPT {
+ return allocator_type(__tree_.__alloc());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 key_compare key_comp() const {
+ return __tree_.value_comp().key_comp();
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 value_compare value_comp() const {
+ return value_compare(__tree_.value_comp().key_comp());
}
-
- _LIBCPP_HIDE_FROM_ABI mapped_type& at(const key_type& __k);
- _LIBCPP_HIDE_FROM_ABI const mapped_type& at(const key_type& __k) const;
-
- _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT { return allocator_type(__tree_.__alloc()); }
- _LIBCPP_HIDE_FROM_ABI key_compare key_comp() const { return __tree_.value_comp().key_comp(); }
- _LIBCPP_HIDE_FROM_ABI value_compare value_comp() const { return value_compare(__tree_.value_comp().key_comp()); }
# ifndef _LIBCPP_CXX03_LANG
template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> emplace(_Args&&... __args) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, bool> emplace(_Args&&... __args) {
return __tree_.__emplace_unique(std::forward<_Args>(__args)...);
}
template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI iterator emplace_hint(const_iterator __p, _Args&&... __args) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator emplace_hint(const_iterator __p, _Args&&... __args) {
return __tree_.__emplace_hint_unique(__p.__i_, std::forward<_Args>(__args)...).first;
}
template <class _Pp, __enable_if_t<is_constructible<value_type, _Pp>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert(_Pp&& __p) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, bool> insert(_Pp&& __p) {
return __tree_.__emplace_unique(std::forward<_Pp>(__p));
}
template <class _Pp, __enable_if_t<is_constructible<value_type, _Pp>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __pos, _Pp&& __p) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __pos, _Pp&& __p) {
return __tree_.__emplace_hint_unique(__pos.__i_, std::forward<_Pp>(__p)).first;
}
# endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert(const value_type& __v) { return __tree_.__emplace_unique(__v); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, bool> insert(const value_type& __v) {
+ return __tree_.__emplace_unique(__v);
+ }
- _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, const value_type& __v) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __p, const value_type& __v) {
return __tree_.__emplace_hint_unique(__p.__i_, __v).first;
}
# ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert(value_type&& __v) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, bool> insert(value_type&& __v) {
return __tree_.__emplace_unique(std::move(__v));
}
- _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, value_type&& __v) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __p, value_type&& __v) {
return __tree_.__emplace_hint_unique(__p.__i_, std::move(__v)).first;
}
- _LIBCPP_HIDE_FROM_ABI void insert(initializer_list<value_type> __il) { insert(__il.begin(), __il.end()); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert(initializer_list<value_type> __il) {
+ insert(__il.begin(), __il.end());
+ }
# endif
template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __first, _InputIterator __last) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert(_InputIterator __first, _InputIterator __last) {
__tree_.__insert_range_unique(__first, __last);
}
# if _LIBCPP_STD_VER >= 23
template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI void insert_range(_Range&& __range) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert_range(_Range&& __range) {
__tree_.__insert_range_unique(ranges::begin(__range), ranges::end(__range));
}
# endif
@@ -1137,13 +1162,15 @@ public:
# if _LIBCPP_STD_VER >= 17
template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> try_emplace(const key_type& __k, _Args&&... __args) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, bool>
+ try_emplace(const key_type& __k, _Args&&... __args) {
return __tree_.__emplace_unique(
std::piecewise_construct, std::forward_as_tuple(__k), std::forward_as_tuple(std::forward<_Args>(__args)...));
}
template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> try_emplace(key_type&& __k, _Args&&... __args) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, bool>
+ try_emplace(key_type&& __k, _Args&&... __args) {
return __tree_.__emplace_unique(
std::piecewise_construct,
std::forward_as_tuple(std::move(__k)),
@@ -1151,7 +1178,8 @@ public:
}
template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI iterator try_emplace(const_iterator __h, const key_type& __k, _Args&&... __args) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator
+ try_emplace(const_iterator __h, const key_type& __k, _Args&&... __args) {
return __tree_
.__emplace_hint_unique(
__h.__i_,
@@ -1162,7 +1190,8 @@ public:
}
template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI iterator try_emplace(const_iterator __h, key_type&& __k, _Args&&... __args) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator
+ try_emplace(const_iterator __h, key_type&& __k, _Args&&... __args) {
return __tree_
.__emplace_hint_unique(
__h.__i_,
@@ -1173,7 +1202,8 @@ public:
}
template <class _Vp>
- _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert_or_assign(const key_type& __k, _Vp&& __v) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, bool>
+ insert_or_assign(const key_type& __k, _Vp&& __v) {
auto __result = __tree_.__emplace_unique(__k, std::forward<_Vp>(__v));
auto& [__iter, __inserted] = __result;
if (!__inserted)
@@ -1182,7 +1212,7 @@ public:
}
template <class _Vp>
- _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert_or_assign(key_type&& __k, _Vp&& __v) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, bool> insert_or_assign(key_type&& __k, _Vp&& __v) {
auto __result = __tree_.__emplace_unique(std::move(__k), std::forward<_Vp>(__v));
auto& [__iter, __inserted] = __result;
if (!__inserted)
@@ -1191,7 +1221,8 @@ public:
}
template <class _Vp>
- _LIBCPP_HIDE_FROM_ABI iterator insert_or_assign(const_iterator __h, const key_type& __k, _Vp&& __v) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator
+ insert_or_assign(const_iterator __h, const key_type& __k, _Vp&& __v) {
auto [__r, __inserted] = __tree_.__emplace_hint_unique(__h.__i_, __k, std::forward<_Vp>(__v));
if (!__inserted)
@@ -1201,7 +1232,8 @@ public:
}
template <class _Vp>
- _LIBCPP_HIDE_FROM_ABI iterator insert_or_assign(const_iterator __h, key_type&& __k, _Vp&& __v) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator
+ insert_or_assign(const_iterator __h, key_type&& __k, _Vp&& __v) {
auto [__r, __inserted] = __tree_.__emplace_hint_unique(__h.__i_, std::move(__k), std::forward<_Vp>(__v));
if (!__inserted)
@@ -1212,39 +1244,45 @@ public:
# endif // _LIBCPP_STD_VER >= 17
- _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p) { return __tree_.erase(__p.__i_); }
- _LIBCPP_HIDE_FROM_ABI iterator erase(iterator __p) { return __tree_.erase(__p.__i_); }
- _LIBCPP_HIDE_FROM_ABI size_type erase(const key_type& __k) { return __tree_.__erase_unique(__k); }
- _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __f, const_iterator __l) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator erase(const_iterator __p) {
+ return __tree_.erase(__p.__i_);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator erase(iterator __p) { return __tree_.erase(__p.__i_); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type erase(const key_type& __k) {
+ return __tree_.__erase_unique(__k);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator erase(const_iterator __f, const_iterator __l) {
return __tree_.erase(__f.__i_, __l.__i_);
}
- _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT { __tree_.clear(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void clear() _NOEXCEPT { __tree_.clear(); }
# if _LIBCPP_STD_VER >= 17
- _LIBCPP_HIDE_FROM_ABI insert_return_type insert(node_type&& __nh) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 insert_return_type insert(node_type&& __nh) {
_LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
"node_type with incompatible allocator passed to map::insert()");
return __tree_.template __node_handle_insert_unique< node_type, insert_return_type>(std::move(__nh));
}
- _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __hint, node_type&& __nh) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __hint, node_type&& __nh) {
_LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
"node_type with incompatible allocator passed to map::insert()");
return __tree_.template __node_handle_insert_unique<node_type>(__hint.__i_, std::move(__nh));
}
- _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 node_type extract(key_type const& __key) {
return __tree_.template __node_handle_extract<node_type>(__key);
}
- _LIBCPP_HIDE_FROM_ABI node_type extract(const_iterator __it) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 node_type extract(const_iterator __it) {
return __tree_.template __node_handle_extract<node_type>(__it.__i_);
}
template <class _Compare2>
- _LIBCPP_HIDE_FROM_ABI void merge(map<key_type, mapped_type, _Compare2, allocator_type>& __source) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
+ merge(map<key_type, mapped_type, _Compare2, allocator_type>& __source) {
_LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
__source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
__tree_.__node_handle_merge_unique(__source.__tree_);
}
template <class _Compare2>
- _LIBCPP_HIDE_FROM_ABI void merge(map<key_type, mapped_type, _Compare2, allocator_type>&& __source) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
+ merge(map<key_type, mapped_type, _Compare2, allocator_type>&& __source) {
_LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
__source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
__tree_.__node_handle_merge_unique(__source.__tree_);
@@ -1263,101 +1301,95 @@ public:
}
# endif
- _LIBCPP_HIDE_FROM_ABI void swap(map& __m) _NOEXCEPT_(__is_nothrow_swappable_v<__base>) { __tree_.swap(__m.__tree_); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void swap(map& __m) _NOEXCEPT_(__is_nothrow_swappable_v<__base>) {
+ __tree_.swap(__m.__tree_);
+ }
- _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __tree_.find(__k); }
- _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __tree_.find(__k); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator find(const key_type& __k) { return __tree_.find(__k); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator find(const key_type& __k) const {
+ return __tree_.find(__k);
+ }
# if _LIBCPP_STD_VER >= 14
- template <typename _K2,
- enable_if_t<__is_transparent_v<_Compare, _K2> || __is_transparently_comparable_v<_Compare, key_type, _K2>,
- int> = 0>
- _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) {
+ template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator find(const _K2& __k) {
return __tree_.find(__k);
}
- template <typename _K2,
- enable_if_t<__is_transparent_v<_Compare, _K2> || __is_transparently_comparable_v<_Compare, key_type, _K2>,
- int> = 0>
- _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const {
+ template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator find(const _K2& __k) const {
return __tree_.find(__k);
}
# endif
- _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const { return __tree_.__count_unique(__k); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type count(const key_type& __k) const {
+ return __tree_.__count_unique(__k);
+ }
# if _LIBCPP_STD_VER >= 14
template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
- _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type count(const _K2& __k) const {
return __tree_.__count_multi(__k);
}
# endif
# if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); }
- template <typename _K2,
- enable_if_t<__is_transparent_v<_Compare, _K2> || __is_transparently_comparable_v<_Compare, key_type, _K2>,
- int> = 0>
- _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool contains(const key_type& __k) const {
+ return find(__k) != end();
+ }
+ template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool contains(const _K2& __k) const {
return find(__k) != end();
}
# endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const key_type& __k) { return __tree_.__lower_bound_unique(__k); }
-
- _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const key_type& __k) const {
- return __tree_.__lower_bound_unique(__k);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator lower_bound(const key_type& __k) {
+ return __tree_.lower_bound(__k);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator lower_bound(const key_type& __k) const {
+ return __tree_.lower_bound(__k);
}
-
- // The transparent versions of the lookup functions use the _multi version, since a non-element key is allowed to
- // match multiple elements.
# if _LIBCPP_STD_VER >= 14
- template <typename _K2,
- enable_if_t<__is_transparent_v<_Compare, _K2> || __is_transparently_comparable_v<_Compare, key_type, _K2>,
- int> = 0>
- _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const _K2& __k) {
- return __tree_.__lower_bound_multi(__k);
+ template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator lower_bound(const _K2& __k) {
+ return __tree_.lower_bound(__k);
}
- template <typename _K2,
- enable_if_t<__is_transparent_v<_Compare, _K2> || __is_transparently_comparable_v<_Compare, key_type, _K2>,
- int> = 0>
- _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const _K2& __k) const {
- return __tree_.__lower_bound_multi(__k);
+ template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator lower_bound(const _K2& __k) const {
+ return __tree_.lower_bound(__k);
}
# endif
- _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const key_type& __k) { return __tree_.__upper_bound_unique(__k); }
-
- _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const key_type& __k) const {
- return __tree_.__upper_bound_unique(__k);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator upper_bound(const key_type& __k) {
+ return __tree_.upper_bound(__k);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator upper_bound(const key_type& __k) const {
+ return __tree_.upper_bound(__k);
}
-
# if _LIBCPP_STD_VER >= 14
- template <typename _K2,
- enable_if_t<__is_transparent_v<_Compare, _K2> || __is_transparently_comparable_v<_Compare, key_type, _K2>,
- int> = 0>
- _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const _K2& __k) {
- return __tree_.__upper_bound_multi(__k);
+ template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator upper_bound(const _K2& __k) {
+ return __tree_.upper_bound(__k);
}
- template <typename _K2,
- enable_if_t<__is_transparent_v<_Compare, _K2> || __is_transparently_comparable_v<_Compare, key_type, _K2>,
- int> = 0>
- _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const _K2& __k) const {
- return __tree_.__upper_bound_multi(__k);
+ template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator upper_bound(const _K2& __k) const {
+ return __tree_.upper_bound(__k);
}
# endif
- _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator> equal_range(const key_type& __k) {
return __tree_.__equal_range_unique(__k);
}
- _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator>
+ equal_range(const key_type& __k) const {
return __tree_.__equal_range_unique(__k);
}
# if _LIBCPP_STD_VER >= 14
template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
- _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator> equal_range(const _K2& __k) {
return __tree_.__equal_range_multi(__k);
}
template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
- _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator>
+ equal_range(const _K2& __k) const {
return __tree_.__equal_range_multi(__k);
}
# endif
@@ -1382,8 +1414,8 @@ template <class _InputIterator,
class _Compare = less<__iter_key_type<_InputIterator>>,
class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>,
class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
- class = enable_if_t<!__is_allocator_v<_Compare>>,
- class = enable_if_t<__is_allocator_v<_Allocator>>>
+ class = enable_if_t<!__is_allocator<_Compare>::value, void>,
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>>
map(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator())
-> map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Compare, _Allocator>;
@@ -1391,8 +1423,8 @@ map(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocat
template <ranges::input_range _Range,
class _Compare = less<__range_key_type<_Range>>,
class _Allocator = allocator<__range_to_alloc_type<_Range>>,
- class = enable_if_t<!__is_allocator_v<_Compare>>,
- class = enable_if_t<__is_allocator_v<_Allocator>>>
+ class = enable_if_t<!__is_allocator<_Compare>::value, void>,
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>>
map(from_range_t, _Range&&, _Compare = _Compare(), _Allocator = _Allocator())
-> map<__range_key_type<_Range>, __range_mapped_type<_Range>, _Compare, _Allocator>;
# endif
@@ -1401,15 +1433,16 @@ template <class _Key,
class _Tp,
class _Compare = less<remove_const_t<_Key>>,
class _Allocator = allocator<pair<const _Key, _Tp>>,
- class = enable_if_t<!__is_allocator_v<_Compare>>,
- class = enable_if_t<__is_allocator_v<_Allocator>>>
-map(initializer_list<pair<_Key, _Tp>>, _Compare = _Compare(), _Allocator = _Allocator())
- -> map<remove_const_t<_Key>, _Tp, _Compare, _Allocator>;
+ class = enable_if_t<!__is_allocator<_Compare>::value, void>,
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+map(initializer_list<pair<_Key, _Tp>>,
+ _Compare = _Compare(),
+ _Allocator = _Allocator()) -> map<remove_const_t<_Key>, _Tp, _Compare, _Allocator>;
template <class _InputIterator,
class _Allocator,
class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
- class = enable_if_t<__is_allocator_v<_Allocator>>>
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>>
map(_InputIterator, _InputIterator, _Allocator)
-> map<__iter_key_type<_InputIterator>,
__iter_mapped_type<_InputIterator>,
@@ -1417,19 +1450,19 @@ map(_InputIterator, _InputIterator, _Allocator)
_Allocator>;
# if _LIBCPP_STD_VER >= 23
-template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator_v<_Allocator>>>
+template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value, void>>
map(from_range_t, _Range&&, _Allocator)
-> map<__range_key_type<_Range>, __range_mapped_type<_Range>, less<__range_key_type<_Range>>, _Allocator>;
# endif
-template <class _Key, class _Tp, class _Allocator, class = enable_if_t<__is_allocator_v<_Allocator>>>
-map(initializer_list<pair<_Key, _Tp>>, _Allocator)
- -> map<remove_const_t<_Key>, _Tp, less<remove_const_t<_Key>>, _Allocator>;
+template <class _Key, class _Tp, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+map(initializer_list<pair<_Key, _Tp>>,
+ _Allocator) -> map<remove_const_t<_Key>, _Tp, less<remove_const_t<_Key>>, _Allocator>;
# endif
# ifndef _LIBCPP_CXX03_LANG
template <class _Key, class _Tp, class _Compare, class _Allocator>
-map<_Key, _Tp, _Compare, _Allocator>::map(map&& __m, const allocator_type& __a)
+_LIBCPP_CONSTEXPR_SINCE_CXX26 map<_Key, _Tp, _Compare, _Allocator>::map(map&& __m, const allocator_type& __a)
: __tree_(std::move(__m.__tree_), typename __base::allocator_type(__a)) {
if (__a != __m.get_allocator()) {
const_iterator __e = cend();
@@ -1441,13 +1474,13 @@ map<_Key, _Tp, _Compare, _Allocator>::map(map&& __m, const allocator_type& __a)
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
-_Tp& map<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 _Tp& map<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k) {
return __tree_.__emplace_unique(std::piecewise_construct, std::forward_as_tuple(__k), std::forward_as_tuple())
.first->second;
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
-_Tp& map<_Key, _Tp, _Compare, _Allocator>::operator[](key_type&& __k) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 _Tp& map<_Key, _Tp, _Compare, _Allocator>::operator[](key_type&& __k) {
return __tree_
.__emplace_unique(std::piecewise_construct, std::forward_as_tuple(std::move(__k)), std::forward_as_tuple())
.first->second;
@@ -1482,23 +1515,23 @@ _Tp& map<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k) {
# endif // _LIBCPP_CXX03_LANG
template <class _Key, class _Tp, class _Compare, class _Allocator>
-_Tp& map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 _Tp& map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k) {
auto [_, __child] = __tree_.__find_equal(__k);
if (__child == nullptr)
std::__throw_out_of_range("map::at: key not found");
- return static_cast<__node_pointer>(__child)->__get_value().second;
+ return std::__static_fancy_pointer_cast<__node_pointer>(__child)->__get_value().second;
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
-const _Tp& map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k) const {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 const _Tp& map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k) const {
auto [_, __child] = __tree_.__find_equal(__k);
if (__child == nullptr)
std::__throw_out_of_range("map::at: key not found");
- return static_cast<__node_pointer>(__child)->__get_value().second;
+ return std::__static_fancy_pointer_cast<__node_pointer>(__child)->__get_value().second;
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI bool
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
operator==(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) {
return __x.size() == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin());
}
@@ -1506,31 +1539,31 @@ operator==(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp,
# if _LIBCPP_STD_VER <= 17
template <class _Key, class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI bool
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
operator<(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) {
return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI bool
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
operator!=(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) {
return !(__x == __y);
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI bool
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
operator>(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) {
return __y < __x;
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI bool
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
operator>=(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) {
return !(__x < __y);
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI bool
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
operator<=(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) {
return !(__y < __x);
}
@@ -1538,7 +1571,7 @@ operator<=(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp,
# else // #if _LIBCPP_STD_VER <= 17
template <class _Key, class _Tp, class _Compare, class _Allocator>
-_LIBCPP_HIDE_FROM_ABI __synth_three_way_result<pair<const _Key, _Tp>>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __synth_three_way_result<pair<const _Key, _Tp>>
operator<=>(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) {
return std::lexicographical_compare_three_way(__x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way);
}
@@ -1546,7 +1579,7 @@ operator<=>(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp
# endif // #if _LIBCPP_STD_VER <= 17
template <class _Key, class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI void
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
swap(map<_Key, _Tp, _Compare, _Allocator>& __x, map<_Key, _Tp, _Compare, _Allocator>& __y)
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
__x.swap(__y);
@@ -1554,7 +1587,7 @@ swap(map<_Key, _Tp, _Compare, _Allocator>& __x, map<_Key, _Tp, _Compare, _Alloca
# if _LIBCPP_STD_VER >= 20
template <class _Key, class _Tp, class _Compare, class _Allocator, class _Predicate>
-inline _LIBCPP_HIDE_FROM_ABI typename map<_Key, _Tp, _Compare, _Allocator>::size_type
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 typename map<_Key, _Tp, _Compare, _Allocator>::size_type
erase_if(map<_Key, _Tp, _Compare, _Allocator>& __c, _Predicate __pred) {
return std::__libcpp_erase_if_container(__c, __pred);
}
@@ -1881,38 +1914,30 @@ public:
}
# endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const key_type& __k) { return __tree_.__lower_bound_multi(__k); }
-
- _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const key_type& __k) const {
- return __tree_.__lower_bound_multi(__k);
- }
-
+ _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const key_type& __k) { return __tree_.lower_bound(__k); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const key_type& __k) const { return __tree_.lower_bound(__k); }
# if _LIBCPP_STD_VER >= 14
template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
_LIBCPP_HIDE_FROM_ABI iterator lower_bound(const _K2& __k) {
- return __tree_.__lower_bound_multi(__k);
+ return __tree_.lower_bound(__k);
}
template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
_LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const _K2& __k) const {
- return __tree_.__lower_bound_multi(__k);
+ return __tree_.lower_bound(__k);
}
# endif
- _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const key_type& __k) { return __tree_.__upper_bound_multi(__k); }
-
- _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const key_type& __k) const {
- return __tree_.__upper_bound_multi(__k);
- }
-
+ _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const key_type& __k) { return __tree_.upper_bound(__k); }
+ _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const key_type& __k) const { return __tree_.upper_bound(__k); }
# if _LIBCPP_STD_VER >= 14
template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
_LIBCPP_HIDE_FROM_ABI iterator upper_bound(const _K2& __k) {
- return __tree_.__upper_bound_multi(__k);
+ return __tree_.upper_bound(__k);
}
template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
_LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const _K2& __k) const {
- return __tree_.__upper_bound_multi(__k);
+ return __tree_.upper_bound(__k);
}
# endif
@@ -1947,8 +1972,8 @@ template <class _InputIterator,
class _Compare = less<__iter_key_type<_InputIterator>>,
class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>,
class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
- class = enable_if_t<!__is_allocator_v<_Compare>>,
- class = enable_if_t<__is_allocator_v<_Allocator>>>
+ class = enable_if_t<!__is_allocator<_Compare>::value, void>,
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>>
multimap(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator())
-> multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Compare, _Allocator>;
@@ -1956,8 +1981,8 @@ multimap(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Al
template <ranges::input_range _Range,
class _Compare = less<__range_key_type<_Range>>,
class _Allocator = allocator<__range_to_alloc_type<_Range>>,
- class = enable_if_t<!__is_allocator_v<_Compare>>,
- class = enable_if_t<__is_allocator_v<_Allocator>>>
+ class = enable_if_t<!__is_allocator<_Compare>::value, void>,
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>>
multimap(from_range_t, _Range&&, _Compare = _Compare(), _Allocator = _Allocator())
-> multimap<__range_key_type<_Range>, __range_mapped_type<_Range>, _Compare, _Allocator>;
# endif
@@ -1966,15 +1991,16 @@ template <class _Key,
class _Tp,
class _Compare = less<remove_const_t<_Key>>,
class _Allocator = allocator<pair<const _Key, _Tp>>,
- class = enable_if_t<!__is_allocator_v<_Compare>>,
- class = enable_if_t<__is_allocator_v<_Allocator>>>
-multimap(initializer_list<pair<_Key, _Tp>>, _Compare = _Compare(), _Allocator = _Allocator())
- -> multimap<remove_const_t<_Key>, _Tp, _Compare, _Allocator>;
+ class = enable_if_t<!__is_allocator<_Compare>::value, void>,
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+multimap(initializer_list<pair<_Key, _Tp>>,
+ _Compare = _Compare(),
+ _Allocator = _Allocator()) -> multimap<remove_const_t<_Key>, _Tp, _Compare, _Allocator>;
template <class _InputIterator,
class _Allocator,
class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
- class = enable_if_t<__is_allocator_v<_Allocator>>>
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>>
multimap(_InputIterator, _InputIterator, _Allocator)
-> multimap<__iter_key_type<_InputIterator>,
__iter_mapped_type<_InputIterator>,
@@ -1982,14 +2008,14 @@ multimap(_InputIterator, _InputIterator, _Allocator)
_Allocator>;
# if _LIBCPP_STD_VER >= 23
-template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator_v<_Allocator>>>
+template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value, void>>
multimap(from_range_t, _Range&&, _Allocator)
-> multimap<__range_key_type<_Range>, __range_mapped_type<_Range>, less<__range_key_type<_Range>>, _Allocator>;
# endif
-template <class _Key, class _Tp, class _Allocator, class = enable_if_t<__is_allocator_v<_Allocator>>>
-multimap(initializer_list<pair<_Key, _Tp>>, _Allocator)
- -> multimap<remove_const_t<_Key>, _Tp, less<remove_const_t<_Key>>, _Allocator>;
+template <class _Key, class _Tp, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+multimap(initializer_list<pair<_Key, _Tp>>,
+ _Allocator) -> multimap<remove_const_t<_Key>, _Tp, less<remove_const_t<_Key>>, _Allocator>;
# endif
# ifndef _LIBCPP_CXX03_LANG
diff --git a/libcxx/include/version b/libcxx/include/version
index 0fef1bb87cf60..03d14bb146741 100644
--- a/libcxx/include/version
+++ b/libcxx/include/version
@@ -37,8 +37,7 @@ __cpp_lib_atomic_float 201711L <atomic>
__cpp_lib_atomic_is_always_lock_free 201603L <atomic>
__cpp_lib_atomic_lock_free_type_aliases 201907L <atomic>
__cpp_lib_atomic_min_max 202403L <atomic>
-__cpp_lib_atomic_ref 202411L <atomic>
- 201806L // C++20
+__cpp_lib_atomic_ref 201806L <atomic>
__cpp_lib_atomic_shared_ptr 201711L <atomic>
__cpp_lib_atomic_value_initialization 201911L <atomic> <memory>
__cpp_lib_atomic_wait 201907L <atomic>
@@ -60,8 +59,6 @@ __cpp_lib_char8_t 201907L <atomic> <filesy
__cpp_lib_chrono 201611L <chrono>
__cpp_lib_chrono_udls 201304L <chrono>
__cpp_lib_clamp 201603L <algorithm>
-__cpp_lib_common_reference 202302L <type_traits>
-__cpp_lib_common_reference_wrapper 202302L <functional>
__cpp_lib_complex_udls 201309L <complex>
__cpp_lib_concepts 202002L <concepts>
__cpp_lib_constexpr_algorithms 202306L <algorithm> <utility>
@@ -75,6 +72,7 @@ __cpp_lib_constexpr_forward_list 202502L <forward_list>
__cpp_lib_constexpr_functional 201907L <functional>
__cpp_lib_constexpr_iterator 201811L <iterator>
__cpp_lib_constexpr_list 202502L <list>
+__cpp_lib_constexpr_map 202502L <map>
__cpp_lib_constexpr_memory 202202L <memory>
201811L // C++20
__cpp_lib_constexpr_new 202406L <new>
@@ -86,8 +84,8 @@ __cpp_lib_constexpr_tuple 201811L <tuple>
__cpp_lib_constexpr_typeinfo 202106L <typeinfo>
__cpp_lib_constexpr_utility 201811L <utility>
__cpp_lib_constexpr_vector 201907L <vector>
-__cpp_lib_constrained_equality 202411L <expected> <optional> <tuple>
- <utility> <variant>
+__cpp_lib_constrained_equality 202403L <optional> <tuple> <utility>
+ <variant>
__cpp_lib_containers_ranges 202202L <deque> <forward_list> <list>
<map> <queue> <set>
<stack> <string> <unordered_map>
@@ -206,7 +204,6 @@ __cpp_lib_ranges_chunk_by 202202L <ranges>
__cpp_lib_ranges_concat 202403L <ranges>
__cpp_lib_ranges_contains 202207L <algorithm>
__cpp_lib_ranges_find_last 202207L <algorithm>
-__cpp_lib_ranges_indices 202506L <ranges>
__cpp_lib_ranges_iota 202202L <numeric>
__cpp_lib_ranges_join_with 202202L <ranges>
__cpp_lib_ranges_repeat 202207L <ranges>
@@ -247,7 +244,6 @@ __cpp_lib_starts_ends_with 201711L <string> <string
__cpp_lib_stdatomic_h 202011L <stdatomic.h>
__cpp_lib_string_contains 202011L <string> <string_view>
__cpp_lib_string_resize_and_overwrite 202110L <string>
-__cpp_lib_string_subview 202506L <string> <string_view>
__cpp_lib_string_udls 201304L <string>
__cpp_lib_string_view 202403L <string> <string_view>
201803L // C++20
@@ -336,7 +332,7 @@ __cpp_lib_void_t 201411L <type_traits>
# define __cpp_lib_clamp 201603L
# define __cpp_lib_enable_shared_from_this 201603L
// # define __cpp_lib_execution 201603L
-# if _LIBCPP_HAS_FILESYSTEM
+# if _LIBCPP_HAS_FILESYSTEM && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY
# define __cpp_lib_filesystem 201703L
# endif
# define __cpp_lib_gcd_lcm 201606L
@@ -394,8 +390,10 @@ __cpp_lib_void_t 201411L <type_traits>
# define __cpp_lib_atomic_ref 201806L
// # define __cpp_lib_atomic_shared_ptr 201711L
# define __cpp_lib_atomic_value_initialization 201911L
-# define __cpp_lib_atomic_wait 201907L
-# if _LIBCPP_HAS_THREADS
+# if _LIBCPP_AVAILABILITY_HAS_SYNC
+# define __cpp_lib_atomic_wait 201907L
+# endif
+# if _LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC
# define __cpp_lib_barrier 201907L
# endif
# define __cpp_lib_bind_front 201907L
@@ -405,8 +403,6 @@ __cpp_lib_void_t 201411L <type_traits>
# if _LIBCPP_HAS_CHAR8_T
# define __cpp_lib_char8_t 201907L
# endif
-# define __cpp_lib_common_reference 202302L
-# define __cpp_lib_common_reference_wrapper 202302L
# define __cpp_lib_concepts 202002L
# define __cpp_lib_constexpr_algorithms 201806L
# define __cpp_lib_constexpr_complex 201711L
@@ -440,10 +436,10 @@ __cpp_lib_void_t 201411L <type_traits>
// # define __cpp_lib_is_layout_compatible 201907L
# define __cpp_lib_is_nothrow_convertible 201806L
// # define __cpp_lib_is_pointer_interconvertible 201907L
-# if _LIBCPP_HAS_THREADS
+# if _LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC
# define __cpp_lib_jthread 201911L
# endif
-# if _LIBCPP_HAS_THREADS
+# if _LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC
# define __cpp_lib_latch 201907L
# endif
# define __cpp_lib_list_remove_return_type 201806L
@@ -456,7 +452,7 @@ __cpp_lib_void_t 201411L <type_traits>
# endif
# define __cpp_lib_ranges 202110L
# define __cpp_lib_remove_cvref 201711L
-# if _LIBCPP_HAS_THREADS
+# if _LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC
# define __cpp_lib_semaphore 201907L
# endif
# undef __cpp_lib_shared_ptr_arrays
@@ -524,7 +520,7 @@ __cpp_lib_void_t 201411L <type_traits>
# define __cpp_lib_ranges_contains 202207L
# define __cpp_lib_ranges_find_last 202207L
# define __cpp_lib_ranges_iota 202202L
-# define __cpp_lib_ranges_join_with 202202L
+// # define __cpp_lib_ranges_join_with 202202L
# define __cpp_lib_ranges_repeat 202207L
// # define __cpp_lib_ranges_slide 202202L
# define __cpp_lib_ranges_starts_ends_with 202106L
@@ -545,8 +541,6 @@ __cpp_lib_void_t 201411L <type_traits>
# define __cpp_lib_aligned_accessor 202411L
// # define __cpp_lib_associative_heterogeneous_insertion 202306L
// # define __cpp_lib_atomic_min_max 202403L
-# undef __cpp_lib_atomic_ref
-# define __cpp_lib_atomic_ref 202411L
# undef __cpp_lib_bind_front
# define __cpp_lib_bind_front 202306L
# define __cpp_lib_bitset 202306L
@@ -554,11 +548,12 @@ __cpp_lib_void_t 201411L <type_traits>
# define __cpp_lib_constexpr_algorithms 202306L
# define __cpp_lib_constexpr_forward_list 202502L
# define __cpp_lib_constexpr_list 202502L
+# define __cpp_lib_constexpr_map 202502L
# if !defined(_LIBCPP_ABI_VCRUNTIME)
# define __cpp_lib_constexpr_new 202406L
# endif
# define __cpp_lib_constexpr_queue 202502L
-# define __cpp_lib_constrained_equality 202411L
+// # define __cpp_lib_constrained_equality 202403L
// # define __cpp_lib_copyable_function 202306L
// # define __cpp_lib_debugging 202311L
// # define __cpp_lib_default_template_type_for_algorithm_values 202403L
@@ -588,12 +583,11 @@ __cpp_lib_void_t 201411L <type_traits>
# define __cpp_lib_mdspan 202406L
# undef __cpp_lib_not_fn
# define __cpp_lib_not_fn 202306L
-# define __cpp_lib_optional_range_support 202406L
+// # define __cpp_lib_optional_range_support 202406L
# undef __cpp_lib_out_ptr
# define __cpp_lib_out_ptr 202311L
// # define __cpp_lib_philox_engine 202406L
// # define __cpp_lib_ranges_concat 202403L
-# define __cpp_lib_ranges_indices 202506L
# define __cpp_lib_ratio 202306L
// # define __cpp_lib_rcu 202306L
# define __cpp_lib_reference_wrapper 202403L
@@ -603,7 +597,6 @@ __cpp_lib_void_t 201411L <type_traits>
# define __cpp_lib_span_at 202311L
# define __cpp_lib_span_initializer_list 202311L
# define __cpp_lib_sstream_from_string_view 202306L
-# define __cpp_lib_string_subview 202506L
# undef __cpp_lib_string_view
# define __cpp_lib_string_view 202403L
// # define __cpp_lib_submdspan 202306L
diff --git a/libcxx/test/std/containers/Emplaceable.h b/libcxx/test/std/containers/Emplaceable.h
index d8d3407791731..d9d0965fa64cb 100644
--- a/libcxx/test/std/containers/Emplaceable.h
+++ b/libcxx/test/std/containers/Emplaceable.h
@@ -15,20 +15,20 @@
#if TEST_STD_VER >= 11
class Emplaceable {
- TEST_CONSTEXPR Emplaceable(const Emplaceable&);
- TEST_CONSTEXPR_CXX14 Emplaceable& operator=(const Emplaceable&);
+ Emplaceable(const Emplaceable&);
+ Emplaceable& operator=(const Emplaceable&);
int int_;
double double_;
public:
- TEST_CONSTEXPR_CXX20 Emplaceable() : int_(0), double_(0) {}
- TEST_CONSTEXPR_CXX20 Emplaceable(int i, double d) : int_(i), double_(d) {}
- TEST_CONSTEXPR_CXX20 Emplaceable(Emplaceable&& x) : int_(x.int_), double_(x.double_) {
+ TEST_CONSTEXPR_CXX26 Emplaceable() : int_(0), double_(0) {}
+ TEST_CONSTEXPR_CXX26 Emplaceable(int i, double d) : int_(i), double_(d) {}
+ TEST_CONSTEXPR_CXX26 Emplaceable(Emplaceable&& x) : int_(x.int_), double_(x.double_) {
x.int_ = 0;
x.double_ = 0;
}
- TEST_CONSTEXPR_CXX20 Emplaceable& operator=(Emplaceable&& x) {
+ TEST_CONSTEXPR_CXX26 Emplaceable& operator=(Emplaceable&& x) {
int_ = x.int_;
x.int_ = 0;
double_ = x.double_;
@@ -36,12 +36,10 @@ class Emplaceable {
return *this;
}
- TEST_CONSTEXPR_CXX20 bool operator==(const Emplaceable& x) const { return int_ == x.int_ && double_ == x.double_; }
- TEST_CONSTEXPR_CXX20 bool operator<(const Emplaceable& x) const {
- return int_ < x.int_ || (int_ == x.int_ && double_ < x.double_);
- }
+ TEST_CONSTEXPR_CXX26 bool operator==(const Emplaceable& x) const { return int_ == x.int_ && double_ == x.double_; }
+ TEST_CONSTEXPR_CXX26 bool operator<(const Emplaceable& x) const { return int_ < x.int_ || (int_ == x.int_ && double_ < x.double_); }
- TEST_CONSTEXPR_CXX20 int get() const { return int_; }
+ TEST_CONSTEXPR_CXX26 int get() const { return int_; }
};
template <>
@@ -49,7 +47,7 @@ struct std::hash<Emplaceable> {
typedef Emplaceable argument_type;
typedef std::size_t result_type;
- TEST_CONSTEXPR_CXX20 std::size_t operator()(const Emplaceable& x) const { return static_cast<std::size_t>(x.get()); }
+ std::size_t operator()(const Emplaceable& x) const { return static_cast<std::size_t>(x.get()); }
};
#endif // TEST_STD_VER >= 11
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 cb3646d738968..943b79f5211fc 100644
--- a/libcxx/test/std/containers/associative/from_range_associative_containers.h
+++ b/libcxx/test/std/containers/associative/from_range_associative_containers.h
@@ -60,7 +60,7 @@ template <template <class...> class Container,
class Comp,
class Alloc,
class ValueType = std::pair<const K, V>>
-void test_associative_map_with_input(std::vector<ValueType>&& input) {
+TEST_CONSTEXPR_CXX26 void test_associative_map_with_input(std::vector<ValueType>&& input) {
{ // (range)
auto in = wrap_input<Iter, Sent>(input);
Container<K, V> c(std::from_range, in);
@@ -103,7 +103,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>
-void test_associative_map() {
+TEST_CONSTEXPR_CXX26 void test_associative_map() {
auto test_with_input = &test_associative_map_with_input<Container, K, V, Iter, Sent, Comp, Alloc>;
// Normal input.
@@ -115,7 +115,7 @@ void test_associative_map() {
}
template <template <class...> class Container>
-void test_associative_map_move_only() {
+TEST_CONSTEXPR_CXX26 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});
@@ -123,8 +123,8 @@ void test_associative_map_move_only() {
}
template <template <class...> class Container>
-void test_map_exception_safety_throwing_copy() {
-#if !defined(TEST_HAS_NO_EXCEPTIONS)
+TEST_CONSTEXPR_CXX26 void test_map_exception_safety_throwing_copy() {
+#if !defined(TEST_HAS_NO_EXCEPTIONS) && !defined(TEST_IS_CONSTANT_EVALUATED)
using K = int;
using V = ThrowingCopy<3>;
@@ -145,8 +145,8 @@ void test_map_exception_safety_throwing_copy() {
}
template <template <class...> class Container, class K, class V>
-void test_map_exception_safety_throwing_allocator() {
-#if !defined(TEST_HAS_NO_EXCEPTIONS)
+TEST_CONSTEXPR_CXX26 void test_map_exception_safety_throwing_allocator() {
+#if !defined(TEST_HAS_NO_EXCEPTIONS) && !defined(TEST_IS_CONSTANT_EVALUATED)
using ValueType = std::pair<const K, V>;
ValueType in[] = {ValueType{K{1}, V{1}}};
@@ -189,7 +189,7 @@ constexpr bool test_set_constraints() {
}
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) {
+TEST_CONSTEXPR_CXX26 void test_associative_set_with_input(std::vector<T>&& input) {
{ // (range)
std::ranges::subrange in(Iter(input.data()), Sent(Iter(input.data() + input.size())));
Container<T> c(std::from_range, in);
@@ -232,7 +232,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>
-void test_associative_set() {
+TEST_CONSTEXPR_CXX26 void test_associative_set() {
auto test_with_input = &test_associative_set_with_input<Container, T, Iter, Sent, Comp, Alloc>;
// Normal input.
diff --git a/libcxx/test/std/containers/associative/map/compare.pass.cpp b/libcxx/test/std/containers/associative/map/compare.pass.cpp
index cb7a64b0409fc..464446e4d9058 100644
--- a/libcxx/test/std/containers/associative/map/compare.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/compare.pass.cpp
@@ -10,7 +10,7 @@
// template <class Key, class T, class Compare = less<Key>,
// class Allocator = allocator<pair<const Key, T>>>
-// class map
+// class map // constexpr since C++26
// https://llvm.org/PR16538
// https://llvm.org/PR16549
@@ -23,11 +23,11 @@
struct Key {
template <typename T>
- Key(const T&) {}
- bool operator<(const Key&) const { return false; }
+ TEST_CONSTEXPR_CXX26 Key(const T&) {}
+ TEST_CONSTEXPR_CXX26 bool operator<(const Key&) const { return false; }
};
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
typedef std::map<Key, int> MapT;
typedef MapT::iterator Iter;
typedef std::pair<Iter, bool> IterBool;
@@ -50,6 +50,13 @@ int main(int, char**) {
assert(!result2.second);
assert(map[Key(0)] == 42);
}
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
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 2dbd662d3b7ac..d52ce6a775c73 100644
--- a/libcxx/test/std/containers/associative/map/get_allocator.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/get_allocator.pass.cpp
@@ -10,7 +10,7 @@
// class map
-// allocator_type get_allocator() const
+// allocator_type get_allocator() const // constexpr since C++26
#include <map>
#include <cassert>
@@ -19,7 +19,7 @@
#include "test_allocator.h"
#include "test_macros.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
typedef std::pair<const int, std::string> ValueType;
{
std::allocator<ValueType> alloc;
@@ -31,6 +31,13 @@ int main(int, char**) {
const std::map<int, std::string, std::less<int>, other_allocator<ValueType> > m(alloc);
assert(m.get_allocator() == alloc);
}
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
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 6f9e38cf35f5c..27d25230d9248 100644
--- a/libcxx/test/std/containers/associative/map/incomplete_type.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/incomplete_type.pass.cpp
@@ -6,14 +6,15 @@
//
//===----------------------------------------------------------------------===//
-// <map>
+// <map> // constexpr since C++26
// Check that std::map and its iterators can be instantiated with an incomplete
// type.
#include <map>
-#include "min_allocator.h"
+#include <cassert>
+
#include "test_macros.h"
struct A {
@@ -26,11 +27,15 @@ struct A {
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; }
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
A a;
+ return true;
+}
- // Make sure that the allocator isn't rebound to and incomplete type
- std::map<int, int, std::less<int>, complete_type_allocator<std::pair<const int, int> > > m;
-
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
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 cabc9f7eb1066..61f3d24c41189 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
@@ -10,8 +10,8 @@
// class map
-// mapped_type& at(const key_type& k);
-// const mapped_type& at(const key_type& k) const;
+// mapped_type& at(const key_type& k); // constexpr since C++26
+// const mapped_type& at(const key_type& k) const; // constexpr since C++26
#include <cassert>
#include <map>
@@ -20,7 +20,7 @@
#include "min_allocator.h"
#include "test_macros.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef std::pair<const int, double> V;
V ar[] = {
@@ -42,11 +42,15 @@ int main(int, char**) {
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&) {
- }
+
+ // throwing is not allowed during constant evaluation
+ if (!TEST_IS_CONSTANT_EVALUATED)
+ 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);
@@ -71,12 +75,15 @@ int main(int, char**) {
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&) {
- }
+ // throwing is not allowed during constant evaluation
+ if (!TEST_IS_CONSTANT_EVALUATED)
+ 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);
@@ -103,11 +110,14 @@ int main(int, char**) {
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&) {
- }
+
+ // throwing is not allowed during constant evaluation
+ if (!TEST_IS_CONSTANT_EVALUATED)
+ 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);
@@ -132,17 +142,27 @@ int main(int, char**) {
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&) {
- }
+ // throwing is not allowed during constant evaluation
+ if (!TEST_IS_CONSTANT_EVALUATED)
+ 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 true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#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 21118eca69693..a0ed694f97f3d 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
@@ -10,7 +10,7 @@
// class map
-// bool empty() const;
+// bool empty() const;// constexpr since C++26
#include <map>
#include <cassert>
@@ -18,7 +18,7 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef std::map<int, double> M;
M m;
@@ -39,6 +39,13 @@ int main(int, char**) {
assert(m.empty());
}
#endif
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
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 58610c69ed3dc..586bbefc04019 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
@@ -10,7 +10,7 @@
// class map
-// mapped_type& operator[](const key_type& k);
+// mapped_type& operator[](const key_type& k);// constexpr since C++26
#include <map>
#include <cassert>
@@ -23,7 +23,7 @@
# include "container_test_types.h"
#endif
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef std::pair<const int, double> V;
V ar[] = {
@@ -74,6 +74,8 @@ int main(int, char**) {
assert(m[6] == 6.5);
assert(m.size() == 8);
}
+# ifndef TEST_IS_CONSTANT_EVALUATED
+ // static can't be constexpr
{
// Use "container_test_types.h" to check what arguments get passed
// to the allocator for operator[]
@@ -107,6 +109,7 @@ int main(int, char**) {
}
}
}
+# endif
#endif
#if TEST_STD_VER > 11
{
@@ -135,6 +138,13 @@ int main(int, char**) {
assert(m.size() == 8);
}
#endif
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#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 d5d01b96a6988..485e6fc01851d 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
@@ -12,7 +12,7 @@
// class map
-// mapped_type& operator[](key_type&& k);
+// mapped_type& operator[](key_type&& k);// constexpr since C++26
#include <map>
#include <cassert>
@@ -23,7 +23,7 @@
#include "min_allocator.h"
#include "container_test_types.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
std::map<MoveOnly, double> m;
assert(m.size() == 0);
@@ -53,6 +53,8 @@ int main(int, char**) {
assert(m[6] == 6.5);
assert(m.size() == 2);
}
+#ifndef TEST_IS_CONSTANT_EVALUATED
+ // static can't be constexpr
{
// Use "container_test_types.h" to check what arguments get passed
// to the allocator for operator[]
@@ -76,5 +78,15 @@ int main(int, char**) {
}
}
+#endif
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
+
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 3f33cfd699151..35e41aa27ae7c 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
@@ -12,16 +12,26 @@
// class map
-// mapped_type& operator[](const key_type& k);
+// mapped_type& operator[](const key_type& k);// constexpr since C++26
// https://llvm.org/PR16542
#include <map>
#include <tuple>
-int main(int, char**) {
+#include <cassert>
+#include "test_macros.h"
+
+TEST_CONSTEXPR_CXX26 bool test() {
std::map<std::tuple<int, int>, std::size_t> m;
m[std::make_tuple(2, 3)] = 7;
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
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 bbad44c8edb30..de0dfb2e76a30 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
@@ -10,20 +10,20 @@
// class map
-// iterator begin();
-// const_iterator begin() const;
-// iterator end();
-// const_iterator end() const;
+// iterator begin();// constexpr since C++26
+// const_iterator begin() const;// constexpr since C++26
+// iterator end();// constexpr since C++26
+// const_iterator end() const;// constexpr since C++26
//
-// reverse_iterator rbegin();
-// const_reverse_iterator rbegin() const;
-// reverse_iterator rend();
-// const_reverse_iterator rend() const;
+// reverse_iterator rbegin();// constexpr since C++26
+// const_reverse_iterator rbegin() const;// constexpr since C++26
+// reverse_iterator rend();// constexpr since C++26
+// const_reverse_iterator rend() const;// constexpr since C++26
//
-// const_iterator cbegin() const;
-// const_iterator cend() const;
-// const_reverse_iterator crbegin() const;
-// const_reverse_iterator crend() const;
+// const_iterator cbegin() const;// constexpr since C++26
+// const_iterator cend() const;// constexpr since C++26
+// const_reverse_iterator crbegin() const;// constexpr since C++26
+// const_reverse_iterator crend() const;// constexpr since C++26
#include <map>
#include <cassert>
@@ -32,7 +32,7 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
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),
@@ -156,6 +156,13 @@ int main(int, char**) {
assert(!(cii != ii1));
}
#endif
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#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 1a5d35c2579d8..b0a0877f8a7a2 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
@@ -10,7 +10,7 @@
// class map
-// size_type max_size() const;
+// size_type max_size() const;// constexpr since C++26
#include <cassert>
#include <limits>
@@ -20,7 +20,7 @@
#include "test_allocator.h"
#include "test_macros.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
typedef std::pair<const int, int> KV;
{
typedef limited_allocator<KV, 10> A;
@@ -44,6 +44,13 @@ int main(int, char**) {
assert(c.max_size() <= max_dist);
assert(c.max_size() <= alloc_max_size(c.get_allocator()));
}
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
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 23914f6b8ed16..fdc9a8c5ac608 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
@@ -10,7 +10,7 @@
// class map
-// size_type size() const;
+// size_type size() const;// constexpr since C++26
#include <map>
#include <cassert>
@@ -18,7 +18,7 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef std::map<int, double> M;
M m;
@@ -55,6 +55,13 @@ int main(int, char**) {
assert(m.size() == 0);
}
#endif
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#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 52199204d7914..9b854659c38f9 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
@@ -10,7 +10,7 @@
// class map
-// explicit map(const allocator_type& a);
+// explicit map(const allocator_type& a); // constexpr since C++26
#include <map>
#include <cassert>
@@ -19,7 +19,7 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef std::less<int> C;
typedef test_allocator<std::pair<const int, double> > A;
@@ -46,6 +46,13 @@ int main(int, char**) {
assert(m.get_allocator() == A());
}
#endif
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#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 f237c9b56deee..c970815030517 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
@@ -12,7 +12,7 @@
// class map
-// map& operator=(initializer_list<value_type> il);
+// map& operator=(initializer_list<value_type> il);// constexpr since C++26
#include <map>
#include <cassert>
@@ -21,7 +21,7 @@
#include "min_allocator.h"
#include "test_allocator.h"
-void test_basic() {
+TEST_CONSTEXPR_CXX26 bool test_basic() {
{
typedef std::pair<const int, double> V;
std::map<int, double> m = {
@@ -46,9 +46,10 @@ void test_basic() {
assert(*std::next(m.begin()) == V(2, 1));
assert(*std::next(m.begin(), 2) == V(3, 1));
}
+ return true;
}
-void duplicate_keys_test() {
+TEST_CONSTEXPR_CXX26 bool duplicate_keys_test() {
test_allocator_statistics alloc_stats;
typedef std::map<int, int, std::less<int>, test_allocator<std::pair<const int, int> > > Map;
{
@@ -61,11 +62,19 @@ void duplicate_keys_test() {
assert(s.begin()->first == 4);
}
LIBCPP_ASSERT(alloc_stats.alloc_count == 0);
+ return true;
}
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
test_basic();
duplicate_keys_test();
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
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 bd27a2f4ddeb9..f89c18b10e36c 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
@@ -10,7 +10,7 @@
// class map
-// explicit map(const key_compare& comp);
+// explicit map(const key_compare& comp);// constexpr since C++26
#include <map>
#include <cassert>
@@ -19,7 +19,7 @@
#include "../../../test_compare.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef test_less<int> C;
const std::map<int, double, C> m(C(3));
@@ -36,6 +36,13 @@ int main(int, char**) {
assert(m.key_comp() == C(3));
}
#endif
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#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 20f6a08db6a36..c4e46528cc2ba 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
@@ -10,7 +10,7 @@
// class map
-// map(const key_compare& comp, const allocator_type& a);
+// map(const key_compare& comp, const allocator_type& a);// constexpr since C++26
#include <map>
#include <cassert>
@@ -20,7 +20,7 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef test_less<int> C;
typedef test_allocator<std::pair<const int, double> > A;
@@ -50,6 +50,13 @@ int main(int, char**) {
assert(m.get_allocator() == A{});
}
#endif
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
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 f1696b003c131..3a5db9d6ec96e 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
@@ -10,7 +10,7 @@
// class map
-// map(const map& m);
+// map(const map& m); // constexpr since C++26
#include <cassert>
#include <map>
@@ -20,7 +20,7 @@
#include "test_allocator.h"
template <template <class> class Alloc>
-void test_alloc() {
+TEST_CONSTEXPR_CXX26 bool test_alloc() {
{ // Simple check
using V = std::pair<const int, int>;
using Map = std::map<int, int, std::less<int>, Alloc<V> >;
@@ -80,9 +80,10 @@ void test_alloc() {
assert(*std::next(orig.begin(), 4) == V(5, 0));
assert(std::next(orig.begin(), 5) == orig.end());
}
+ return true;
}
-void test() {
+TEST_CONSTEXPR_CXX26 bool test() {
test_alloc<std::allocator>();
test_alloc<min_allocator>(); // Make sure that fancy pointers work
@@ -131,10 +132,13 @@ void test() {
assert(orig.size() == 3);
assert(orig.get_allocator() == other_allocator<V>(10));
}
+ return true;
}
int main(int, char**) {
test();
-
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#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 caa3490d44faf..4fa69e6f91a2c 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
@@ -10,7 +10,7 @@
// class map
-// map(const map& m, const allocator_type& a);
+// map(const map& m, const allocator_type& a);// constexpr since C++26
#include <cassert>
#include <map>
@@ -21,7 +21,7 @@
#include "min_allocator.h"
template <class Alloc>
-void test_alloc(const Alloc& new_alloc) {
+TEST_CONSTEXPR_CXX26 bool test_alloc(const Alloc& new_alloc) {
{ // Simple check
using V = std::pair<const int, int>;
using Map = std::map<int, int, std::less<int>, Alloc>;
@@ -81,9 +81,10 @@ void test_alloc(const Alloc& new_alloc) {
assert(*std::next(orig.begin(), 4) == V(5, 0));
assert(std::next(orig.begin(), 5) == orig.end());
}
+ return true;
}
-void test() {
+TEST_CONSTEXPR_CXX26 bool test() {
test_alloc(std::allocator<std::pair<const int, int> >());
test_alloc(test_allocator<std::pair<const int, int> >(25)); // Make sure that the new allocator is actually used
test_alloc(min_allocator<std::pair<const int, int> >()); // Make sure that fancy pointers work
@@ -102,10 +103,14 @@ void test() {
assert(orig.size() == 3);
assert(orig.key_comp() == test_less<int>(3));
}
+
+ return true;
}
int main(int, char**) {
test();
-
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#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 56c6cdd7e1e99..6613f8546e806 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
@@ -10,7 +10,7 @@
// class map
-// map& operator=(const map& m);
+// map& operator=(const map& m); // constexpr since C++26
#include <algorithm>
#include <cassert>
@@ -35,42 +35,43 @@ class tracking_allocator {
using value_type = T;
using propagate_on_container_copy_assignment = std::true_type;
- tracking_allocator(std::vector<void*>& allocs) : allocs_(&allocs) {}
+ TEST_CONSTEXPR_CXX26 tracking_allocator(std::vector<void*>& allocs) : allocs_(&allocs) {}
template <class U>
- tracking_allocator(const tracking_allocator<U>& other) : allocs_(other.allocs_) {}
+ TEST_CONSTEXPR_CXX26 tracking_allocator(const tracking_allocator<U>& other) : allocs_(other.allocs_) {}
- T* allocate(std::size_t n) {
+ TEST_CONSTEXPR_CXX26 T* allocate(std::size_t n) {
T* allocation = std::allocator<T>().allocate(n);
allocs_->push_back(allocation);
return allocation;
}
- void deallocate(T* ptr, std::size_t n) TEST_NOEXCEPT {
+ TEST_CONSTEXPR_CXX26 void deallocate(T* ptr, std::size_t n) TEST_NOEXCEPT {
auto res = std::remove(allocs_->begin(), allocs_->end(), ptr);
assert(res != allocs_->end() && "Trying to deallocate memory from different allocator?");
allocs_->erase(res);
std::allocator<T>().deallocate(ptr, n);
}
- friend bool operator==(const tracking_allocator& lhs, const tracking_allocator& rhs) {
+ TEST_CONSTEXPR_CXX26 friend bool operator==(const tracking_allocator& lhs, const tracking_allocator& rhs) {
return lhs.allocs_ == rhs.allocs_;
}
- friend bool operator!=(const tracking_allocator& lhs, const tracking_allocator& rhs) {
+ TEST_CONSTEXPR_CXX26 friend bool operator!=(const tracking_allocator& lhs, const tracking_allocator& rhs) {
return lhs.allocs_ != rhs.allocs_;
}
};
struct NoOp {
- void operator()() {}
+ TEST_CONSTEXPR_CXX26 void operator()() {}
};
template <class Alloc, class AllocatorInvariant = NoOp>
-void test_alloc(const Alloc& lhs_alloc = Alloc(),
- const Alloc& rhs_alloc = Alloc(),
- AllocatorInvariant check_alloc_invariant = NoOp()) {
- { // Test empty/non-empty map combinations
+TEST_CONSTEXPR_CXX26 bool
+test_alloc(const Alloc& lhs_alloc = Alloc(),
+ const Alloc& rhs_alloc = Alloc(),
+ AllocatorInvariant check_alloc_invariant = NoOp()) {
+ { // Test empty/non-empy map combinations
{ // assign from a non-empty container into an empty one
using V = std::pair<const int, int>;
using Map = std::map<int, int, std::less<int>, Alloc>;
@@ -225,7 +226,7 @@ void test_alloc(const Alloc& lhs_alloc = Alloc(),
}
check_alloc_invariant();
}
- { // Make a somewhat larger set to exercise the algorithm a bit
+ { // Make a somewhat larget set to exercise the algorithm a bit
using V = std::pair<const int, int>;
using Map = std::map<int, int, std::less<int>, Alloc>;
@@ -242,10 +243,15 @@ void test_alloc(const Alloc& lhs_alloc = Alloc(),
}
}
check_alloc_invariant();
+ return true;
}
-void test() {
+TEST_CONSTEXPR_CXX26 bool test() {
test_alloc<std::allocator<std::pair<const int, int> > >();
+#if TEST_STD_VER >= 26
+ static_assert(test_alloc<std::allocator<std::pair<const int, int> > >());
+#endif
+
#if TEST_STD_VER >= 11
test_alloc<min_allocator<std::pair<const int, int> > >();
@@ -256,10 +262,10 @@ void test() {
std::vector<void*>* rhs_allocs_;
public:
- AssertEmpty(std::vector<void*>& lhs_allocs, std::vector<void*>& rhs_allocs)
+ TEST_CONSTEXPR_CXX26 AssertEmpty(std::vector<void*>& lhs_allocs, std::vector<void*>& rhs_allocs)
: lhs_allocs_(&lhs_allocs), rhs_allocs_(&rhs_allocs) {}
- void operator()() {
+ TEST_CONSTEXPR_CXX26 void operator()() {
assert(lhs_allocs_->empty());
assert(rhs_allocs_->empty());
}
@@ -300,10 +306,13 @@ void test() {
out = in;
out.erase(std::next(out.begin(), 17), out.end());
}
+ return true;
}
int main(int, char**) {
test();
-
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#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 5cefb6f361a53..83aa3e93074cb 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
@@ -33,7 +33,7 @@
// template<ranges::input_range R, class Allocator>
// map(from_range_t, R&&, Allocator)
// -> map<range-key-type<R>, range-mapped-type<R>, less<range-key-type<R>>, Allocator>; // C++23
-
+// constexpr since C++26
#include <algorithm> // std::equal
#include <array>
#include <cassert>
@@ -51,7 +51,7 @@
using P = std::pair<int, long>;
using PC = std::pair<const int, long>;
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
const P arr[] = {{1, 1L}, {2, 2L}, {1, 1L}, {INT_MAX, 1L}, {3, 1L}};
std::map m(std::begin(arr), std::end(arr));
@@ -212,6 +212,13 @@ int main(int, char**) {
#endif
AssociativeContainerDeductionGuidesSfinaeAway<std::map, std::map<int, long>>();
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
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 dcc2d4510bcb6..709b63a2f4089 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
@@ -24,7 +24,7 @@
// template<class Key, class Allocator>
// map(initializer_list<Key>, Allocator)
// -> map<Key, less<Key>, Allocator>;
-
+// constexpr since C++26
#include <algorithm> // std::equal
#include <cassert>
#include <climits> // INT_MAX
@@ -39,7 +39,7 @@ 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**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
const PCC arr[] = {{1, 1L}, {2, 2L}, {1, 1L}, {INT_MAX, 1L}, {3, 1L}};
std::map m(std::begin(arr), std::end(arr));
@@ -102,6 +102,13 @@ int main(int, char**) {
assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
assert(m.get_allocator().get_id() == 45);
}
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
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 1b48370387a8f..1d8d2e35c749d 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
@@ -10,7 +10,7 @@
// class map
-// map();
+// map(); // constexpr since C++26
#include <map>
#include <cassert>
@@ -18,7 +18,7 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
std::map<int, double> m;
assert(m.empty());
@@ -50,6 +50,13 @@ int main(int, char**) {
assert(m.begin() == m.end());
}
#endif
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#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 1e43a893d66c1..e5fe293a45bc2 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
@@ -12,7 +12,7 @@
// noexcept(
// is_nothrow_default_constructible<allocator_type>::value &&
// is_nothrow_default_constructible<key_compare>::value &&
-// is_nothrow_copy_constructible<key_compare>::value);
+// is_nothrow_copy_constructible<key_compare>::value); // constexpr since C++26
// This tests a conforming extension
@@ -32,7 +32,7 @@ struct some_comp {
bool operator()(const T&, const T&) const { return false; }
};
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
typedef std::pair<const MoveOnly, MoveOnly> V;
#if defined(_LIBCPP_VERSION)
{
@@ -52,6 +52,13 @@ int main(int, char**) {
typedef std::map<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_default_constructible<C>::value, "");
}
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
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 8497b942ad8eb..b17c465a18e24 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
@@ -8,7 +8,7 @@
// <map>
-// ~map() // implied noexcept;
+// ~map() // implied noexcept; // constexpr since C++26
// UNSUPPORTED: c++03
@@ -26,7 +26,7 @@ struct some_comp {
bool operator()(const T&, const T&) const noexcept { return false; }
};
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
typedef std::pair<const MoveOnly, MoveOnly> V;
{
typedef std::map<MoveOnly, MoveOnly> C;
@@ -46,6 +46,13 @@ int main(int, char**) {
static_assert(!std::is_nothrow_destructible<C>::value, "");
}
#endif // _LIBCPP_VERSION
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
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 dc06266064a8d..d74ce4b72d1ba 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
@@ -9,11 +9,11 @@
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
// template<container-compatible-range<value_type> R>
-// map(from_range_t, R&& rg, const Compare& comp = Compare(), const Allocator& = Allocator()); // C++23
+// map(from_range_t, R&& rg, const Compare& comp = Compare(), const Allocator& = Allocator()); // C++23 // constexpr since C++26
//
// template<container-compatible-range<value_type> R>
// map(from_range_t, R&& rg, const Allocator& a))
-// : map(from_range, std::forward<R>(rg), Compare(), a) { } // C++23
+// : map(from_range, std::forward<R>(rg), Compare(), a) { } // C++23 // constexpr since C++26
#include <array>
#include <map>
@@ -21,7 +21,7 @@
#include "../../from_range_associative_containers.h"
#include "test_macros.h"
-void test_duplicates() {
+TEST_CONSTEXPR_CXX26 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'}};
@@ -30,7 +30,7 @@ void test_duplicates() {
assert(std::ranges::is_permutation(expected, c));
}
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
using T = std::pair<const int, int>;
for_all_iterators_and_allocators<T>([]<class Iter, class Sent, class Alloc>() {
test_associative_map<std::map, int, int, Iter, Sent, test_less<int>, Alloc>();
@@ -42,6 +42,13 @@ int main(int, char**) {
test_map_exception_safety_throwing_copy<std::map>();
test_map_exception_safety_throwing_allocator<std::map, int, int>();
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
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 b18dc5cf754a0..a8b426d324c4e 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
@@ -12,7 +12,7 @@
// class map
-// map(initializer_list<value_type> il);
+// map(initializer_list<value_type> il); // constexpr since C++26
#include <map>
#include <cassert>
@@ -20,7 +20,7 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
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}};
@@ -40,6 +40,13 @@ int main(int, char**) {
assert(*std::next(m.begin()) == V(2, 1));
assert(*std::next(m.begin(), 2) == V(3, 1));
}
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
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 301384362bfe7..74380e5754b23 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
@@ -12,7 +12,7 @@
// class map
-// map(initializer_list<value_type> il, const key_compare& comp);
+// map(initializer_list<value_type> il, const key_compare& comp); // constexpr since C++26
#include <map>
#include <cassert>
@@ -20,7 +20,7 @@
#include "../../../test_compare.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef std::pair<const int, double> V;
typedef test_less<int> C;
@@ -44,6 +44,13 @@ int main(int, char**) {
assert(*std::next(m.begin(), 2) == V(3, 1));
assert(m.key_comp() == C(3));
}
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
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 da138ebd9ae61..f3f1b6909994a 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
@@ -12,7 +12,7 @@
// class map
-// map(initializer_list<value_type> il, const key_compare& comp, const allocator_type& a);
+// map(initializer_list<value_type> il, const key_compare& comp, const allocator_type& a); // constexpr since C++26
#include <map>
#include <cassert>
@@ -21,7 +21,7 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef std::pair<const int, double> V;
typedef test_less<int> C;
@@ -80,6 +80,13 @@ int main(int, char**) {
assert(m.key_comp() == C(3));
assert(m.get_allocator() == a);
}
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
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 c8ed1413c3084..1fe40d583d846 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
@@ -11,7 +11,7 @@
// class map
// template <class InputIterator>
-// map(InputIterator first, InputIterator last);
+// map(InputIterator first, InputIterator last); // constexpr since C++26
#include <map>
#include <cassert>
@@ -19,7 +19,7 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef std::pair<const int, double> V;
V ar[] = {
@@ -63,6 +63,13 @@ int main(int, char**) {
assert(*std::next(m.begin(), 2) == V(3, 1));
}
#endif
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#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 f8ecee04a528a..356eb0abf457a 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
@@ -11,7 +11,7 @@
// class map
// template <class InputIterator>
-// map(InputIterator first, InputIterator last, const key_compare& comp);
+// map(InputIterator first, InputIterator last, const key_compare& comp); // constexpr since C++26
#include <map>
#include <cassert>
@@ -20,7 +20,7 @@
#include "../../../test_compare.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef std::pair<const int, double> V;
V ar[] = {
@@ -67,6 +67,13 @@ int main(int, char**) {
assert(*std::next(m.begin(), 2) == V(3, 1));
}
#endif
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#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 862b07bb11731..33e8f2f515435 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
@@ -12,7 +12,7 @@
// template <class InputIterator>
// map(InputIterator first, InputIterator last,
-// const key_compare& comp, const allocator_type& a);
+// const key_compare& comp, const allocator_type& a); // constexpr since C++26
#include <map>
#include <cassert>
@@ -22,7 +22,7 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef std::pair<const int, double> V;
V ar[] = {
@@ -115,6 +115,13 @@ int main(int, char**) {
}
# endif
#endif
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#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 d33ef527c91de..ebf94b65897bc 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
@@ -12,7 +12,7 @@
// class map
-// map(map&& m);
+// map(map&& m); // constexpr since C++26
#include <map>
#include <cassert>
@@ -22,7 +22,7 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
typedef std::pair<const int, double> V;
{
typedef test_less<int> C;
@@ -114,6 +114,13 @@ int main(int, char**) {
assert(mo.size() == 0);
assert(std::distance(mo.begin(), mo.end()) == 0);
}
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
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 886a4fa714d89..4a6638d7f6128 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
@@ -12,7 +12,7 @@
// class map
-// map(map&& m, const allocator_type& a);
+// map(map&& m, const allocator_type& a); // constexpr since C++26
#include <map>
#include <cassert>
@@ -25,7 +25,7 @@
#include "min_allocator.h"
#include "Counter.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef std::pair<MoveOnly, MoveOnly> V;
typedef std::pair<const MoveOnly, MoveOnly> VC;
@@ -150,6 +150,14 @@ int main(int, char**) {
assert(m3.key_comp() == C(5));
LIBCPP_ASSERT(m1.empty());
}
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+// FIXME: Within __tree, it is not allowed to move from a `const MoveOnly` which prevents this from executing during constant evaluation
+// static_assert(test());
+#endif
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 94f991976d6ad..1f9a0530effb9 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
@@ -12,7 +12,7 @@
// class map
-// map& operator=(map&& m);
+// map& operator=(map&& m); // constexpr since C++26
#include <map>
#include <cassert>
@@ -23,7 +23,8 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef std::pair<MoveOnly, MoveOnly> V;
typedef std::pair<const MoveOnly, MoveOnly> VC;
@@ -96,6 +97,14 @@ int main(int, char**) {
assert(m3.key_comp() == C(5));
assert(m1.empty());
}
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+// FIXME: Within __tree, it is not allowed to move from a `const MoveOnly` which prevents this from executing during constant evaluation
+// static_assert(test());
+#endif
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 06316ccf0901a..ed58c0a9f849e 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
@@ -10,7 +10,7 @@
// map(map&&)
// noexcept(is_nothrow_move_constructible<allocator_type>::value &&
-// is_nothrow_move_constructible<key_compare>::value);
+// is_nothrow_move_constructible<key_compare>::value); // constexpr since C++26
// This tests a conforming extension
@@ -30,7 +30,7 @@ struct some_comp {
bool operator()(const T&, const T&) const { return false; }
};
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
#if defined(_LIBCPP_VERSION)
typedef std::pair<const MoveOnly, MoveOnly> V;
{
@@ -50,6 +50,12 @@ int main(int, char**) {
typedef std::map<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_move_constructible<C>::value, "");
}
-
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
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 ccfd800cafde0..751ebf2e7b8f6 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
@@ -11,7 +11,7 @@
// template <class Key, class T, class Compare, class Allocator, class Predicate>
// typename map<Key, T, Compare, Allocator>::size_type
-// erase_if(map<Key, T, Compare, Allocator>& c, Predicate pred);
+// erase_if(map<Key, T, Compare, Allocator>& c, Predicate pred); // constexpr since C++26
#include <map>
@@ -21,7 +21,7 @@
using Init = std::initializer_list<int>;
template <typename M>
-M make(Init vals) {
+TEST_CONSTEXPR_CXX26 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);
@@ -29,7 +29,7 @@ M make(Init vals) {
}
template <typename M, typename Pred>
-void test0(Init vals, Pred p, Init expected, std::size_t expected_erased_count) {
+TEST_CONSTEXPR_CXX26 void test0(Init vals, Pred p, Init expected, std::size_t expected_erased_count) {
M s = make<M>(vals);
ASSERT_SAME_TYPE(typename M::size_type, decltype(std::erase_if(s, p)));
assert(expected_erased_count == std::erase_if(s, p));
@@ -37,7 +37,7 @@ void test0(Init vals, Pred p, Init expected, std::size_t expected_erased_count)
}
template <typename S>
-void test() {
+TEST_CONSTEXPR_CXX26 bool 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; };
@@ -61,9 +61,12 @@ void test() {
test0<S>({1, 2, 3}, True, {}, 3);
test0<S>({1, 2, 3}, False, {1, 2, 3}, 0);
+
+ return true;
}
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test_upper() {
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>>>>();
@@ -71,5 +74,21 @@ int main(int, char**) {
test<std::map<long, short>>();
test<std::map<short, double>>();
+ return true;
+}
+
+int main(int, char**) {
+ assert(test_upper());
+
+#if TEST_STD_VER >= 26
+# ifndef TEST_COMPILER_GCC
+ // FIXME: Fails with g++-15 with:
+ // clang-format off
+ // __tree:116:23: error: ''result_decl' not supported by dump_expr<expression error>' is not a constant expression
+ // clang-format on
+ static_assert(test_upper());
+# endif
+#endif
+
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 938f22eb880a6..4ca10b15564f5 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
@@ -10,7 +10,7 @@
// class map
-// void clear() noexcept;
+// void clear() noexcept; // constexpr since C++26
#include <map>
#include <cassert>
@@ -18,7 +18,7 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef std::map<int, double> M;
typedef std::pair<int, double> P;
@@ -59,6 +59,13 @@ int main(int, char**) {
assert(m.size() == 0);
}
#endif
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#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 36b073c2b551e..c129722a09813 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
@@ -13,7 +13,7 @@
// class map
// template <class... Args>
-// pair<iterator, bool> emplace(Args&&... args);
+// pair<iterator, bool> emplace(Args&&... args); // constexpr since C++26
#include <map>
#include <cassert>
@@ -24,35 +24,38 @@
#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;
+TEST_CONSTEXPR_CXX26 bool test() {
+ // DefaultOnly::count is static
+ if (!TEST_IS_CONSTANT_EVALUATED) {
+ {
+ 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);
+ }
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);
}
- assert(DefaultOnly::count == 0);
{
typedef std::map<int, Emplaceable> M;
typedef std::pair<M::iterator, bool> R;
@@ -87,34 +90,38 @@ int main(int, char**) {
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;
+
+ if (!TEST_IS_CONSTANT_EVALUATED) {
+ {
+ 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);
+ }
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);
}
- 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;
@@ -149,6 +156,13 @@ int main(int, char**) {
assert(m.begin()->first == 2);
assert(m.begin()->second == 3.5);
}
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
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 56d1c5c2b90ac..15b24d0c160bf 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
@@ -13,7 +13,7 @@
// class map
// template <class... Args>
-// iterator emplace_hint(const_iterator position, Args&&... args);
+// iterator emplace_hint(const_iterator position, Args&&... args); // constexpr since C++26
#include <map>
#include <cassert>
@@ -23,32 +23,36 @@
#include "DefaultOnly.h"
#include "min_allocator.h"
-int main(int, char**) {
- {
- typedef std::map<int, DefaultOnly> M;
- typedef M::iterator R;
- M m;
+TEST_CONSTEXPR_CXX26 bool test() {
+ // DefaultOnly::count is static
+ if (!TEST_IS_CONSTANT_EVALUATED) {
+ {
+ 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);
+ }
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);
}
- assert(DefaultOnly::count == 0);
+
{
typedef std::map<int, Emplaceable> M;
typedef M::iterator R;
@@ -79,31 +83,35 @@ int main(int, char**) {
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;
+
+ if (!TEST_IS_CONSTANT_EVALUATED) {
+ {
+ 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);
+ }
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);
}
- assert(DefaultOnly::count == 0);
+
{
typedef std::map<int, Emplaceable, std::less<int>, min_allocator<std::pair<const int, Emplaceable>>> M;
typedef M::iterator R;
@@ -134,6 +142,13 @@ int main(int, char**) {
assert(m.begin()->first == 2);
assert(m.begin()->second == 3.5);
}
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
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 9a0cf9bd21cee..341ff2b48cfa2 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
@@ -10,7 +10,7 @@
// class map
-// iterator erase(const_iterator position);
+// iterator erase(const_iterator position); // constexpr since C++26
#include <map>
#include <cassert>
@@ -20,12 +20,12 @@
struct TemplateConstructor {
template <typename T>
- TemplateConstructor(const T&) {}
+ TEST_CONSTEXPR_CXX26 TemplateConstructor(const T&) {}
};
bool operator<(const TemplateConstructor&, const TemplateConstructor&) { return false; }
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef std::map<int, double> M;
typedef std::pair<int, double> P;
@@ -252,6 +252,13 @@ int main(int, char**) {
c.erase(it);
}
#endif
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#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 671f114951fc4..f85b1649f704e 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
@@ -10,7 +10,7 @@
// class map
-// iterator erase(const_iterator first, const_iterator last);
+// iterator erase(const_iterator first, const_iterator last); // constexpr since C++26
#include <map>
#include <cassert>
@@ -18,7 +18,7 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef std::map<int, double> M;
typedef std::pair<int, double> P;
@@ -151,6 +151,13 @@ int main(int, char**) {
assert(i == m.end());
}
#endif
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#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 f276467d97029..5f2cbb4d5b18e 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
@@ -10,7 +10,7 @@
// class map
-// size_type erase(const key_type& k);
+// size_type erase(const key_type& k); // constexpr since C++26
#include <map>
#include <cassert>
@@ -18,7 +18,7 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef std::map<int, double> M;
typedef std::pair<int, double> P;
@@ -269,6 +269,13 @@ int main(int, char**) {
assert(s == 1);
}
#endif
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#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 db360cb8fe701..2442cd36368b4 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
@@ -12,7 +12,7 @@
// class map
-// node_type extract(const_iterator);
+// node_type extract(const_iterator); // constexpr since C++26
#include <map>
#include "test_macros.h"
@@ -20,7 +20,7 @@
#include "Counter.h"
template <class Container>
-void test(Container& c) {
+TEST_CONSTEXPR_CXX26 bool test(Container& c) {
std::size_t sz = c.size();
auto some_key = c.cbegin()->first;
@@ -29,24 +29,28 @@ void test(Container& c) {
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);
+ if (!TEST_IS_CONSTANT_EVALUATED) {
+ // FIXME: CWG1514: key() is not `constexpr`
+ 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);
+ return true;
}
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
using map_type = std::map<int, int>;
map_type m = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}};
test(m);
}
- {
+ if (!TEST_IS_CONSTANT_EVALUATED) {
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);
@@ -58,6 +62,13 @@ int main(int, char**) {
min_alloc_map m = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}};
test(m);
}
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
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 7ad9558c90c07..0e28fd5f59d43 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
@@ -12,7 +12,7 @@
// class map
-// node_type extract(key_type const&);
+// node_type extract(key_type const&); // constexpr since C++26
#include <map>
#include "test_macros.h"
@@ -20,7 +20,7 @@
#include "Counter.h"
template <class Container, class KeyTypeIter>
-void test(Container& c, KeyTypeIter first, KeyTypeIter last) {
+TEST_CONSTEXPR_CXX26 void test(Container& c, KeyTypeIter first, KeyTypeIter last) {
std::size_t sz = c.size();
assert((std::size_t)std::distance(first, last) == sz);
@@ -28,9 +28,12 @@ void test(Container& c, KeyTypeIter first, KeyTypeIter last) {
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);
+ if (!TEST_IS_CONSTANT_EVALUATED) {
+ // CWG1514: key() is not `constexpr`
+ 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());
}
@@ -43,14 +46,14 @@ void test(Container& c, KeyTypeIter first, KeyTypeIter last) {
}
}
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
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));
}
- {
+ if (!TEST_IS_CONSTANT_EVALUATED) {
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};
@@ -66,6 +69,13 @@ int main(int, char**) {
int keys[] = {1, 2, 3, 4, 5, 6};
test(m, std::begin(keys), std::end(keys));
}
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
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 e845461cfbf31..8705b0a5c1c7e 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
@@ -10,7 +10,7 @@
// class map
-// pair<iterator, bool> insert(const value_type& v);
+// pair<iterator, bool> insert(const value_type& v); // constexpr since C++26
#include <map>
#include <cassert>
@@ -19,7 +19,7 @@
#include "min_allocator.h"
template <class Container>
-void do_insert_cv_test() {
+TEST_CONSTEXPR_CXX26 bool do_insert_cv_test() {
typedef Container M;
typedef std::pair<typename M::iterator, bool> R;
typedef typename M::value_type VT;
@@ -56,9 +56,11 @@ void do_insert_cv_test() {
assert(m.size() == 3);
assert(r.first->first == 3);
assert(r.first->second == 3.5);
+
+ return true;
}
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
do_insert_cv_test<std::map<int, double> >();
#if TEST_STD_VER >= 11
{
@@ -66,6 +68,13 @@ int main(int, char**) {
do_insert_cv_test<M>();
}
#endif
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#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 1f6e5c6371a11..0f5eb4e8b1766 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
@@ -12,7 +12,7 @@
// class map
-// void insert(initializer_list<value_type> il);
+// void insert(initializer_list<value_type> il); // constexpr since C++26
#include <map>
#include <cassert>
@@ -20,7 +20,7 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
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}};
@@ -49,6 +49,13 @@ int main(int, char**) {
assert(*std::next(m.begin()) == V(2, 1));
assert(*std::next(m.begin(), 2) == V(3, 1));
}
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
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 5256ca2c8d451..c76f2277a2643 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
@@ -10,7 +10,7 @@
// class map
-// iterator insert(const_iterator position, const value_type& v);
+// iterator insert(const_iterator position, const value_type& v); // constexpr since C++26
#include <map>
#include <cassert>
@@ -19,7 +19,7 @@
#include "min_allocator.h"
template <class Container>
-void do_insert_iter_cv_test() {
+TEST_CONSTEXPR_CXX26 bool do_insert_iter_cv_test() {
typedef Container M;
typedef typename M::iterator R;
typedef typename M::value_type VT;
@@ -52,9 +52,11 @@ void do_insert_iter_cv_test() {
assert(m.size() == 3);
assert(r->first == 3);
assert(r->second == 3.5);
+
+ return true;
}
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
do_insert_iter_cv_test<std::map<int, double> >();
#if TEST_STD_VER >= 11
{
@@ -62,6 +64,13 @@ int main(int, char**) {
do_insert_iter_cv_test<M>();
}
#endif
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#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 dfbeb33698e6c..7367ea512cc95 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
@@ -11,7 +11,7 @@
// class map
// template <class InputIterator>
-// void insert(InputIterator first, InputIterator last);
+// void insert(InputIterator first, InputIterator last); // constexpr since C++26
#include <array>
#include <cassert>
@@ -21,7 +21,7 @@
#include "min_allocator.h"
template <class Iter, class Alloc>
-void test_alloc() {
+TEST_CONSTEXPR_CXX26 void test_alloc() {
{ // Check that an empty range works correctly
{ // Without elements in the container
using Map = std::map<int, int, std::less<int>, Alloc>;
@@ -188,13 +188,16 @@ void test_alloc() {
}
}
-void test() {
+TEST_CONSTEXPR_CXX26 bool test() {
test_alloc<cpp17_input_iterator<std::pair<const int, int>*>, std::allocator<std::pair<const int, int> > >();
test_alloc<cpp17_input_iterator<std::pair<const int, int>*>, min_allocator<std::pair<const int, int> > >();
+ return true;
}
int main(int, char**) {
test();
-
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#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 5d72bae39bad1..41f7541d3e5e7 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
@@ -13,7 +13,7 @@
// class map
// template <class P>
-// iterator insert(const_iterator position, P&& p);
+// iterator insert(const_iterator position, P&& p); // constexpr since C++26
#include <map>
#include <cassert>
@@ -23,7 +23,7 @@
#include "test_macros.h"
template <class Container, class Pair>
-void do_insert_iter_rv_test() {
+TEST_CONSTEXPR_CXX26 bool do_insert_iter_rv_test() {
typedef Container M;
typedef Pair P;
typedef typename M::iterator R;
@@ -51,8 +51,10 @@ void do_insert_iter_rv_test() {
assert(m.size() == 3);
assert(r->first == 3);
assert(r->second == 3);
+
+ return true;
}
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
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>>();
@@ -91,6 +93,13 @@ int main(int, char**) {
assert(r->first == 3);
assert(r->second == 3);
}
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
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 22d4a19a0eb44..825fbe795da20 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
@@ -13,13 +13,13 @@
// class map
// template <class M>
-// pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj); // C++17
+// pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj); // C++17 // constexpr since C++26
// template <class M>
-// pair<iterator, bool> insert_or_assign(key_type&& k, M&& obj); // C++17
+// pair<iterator, bool> insert_or_assign(key_type&& k, M&& obj); // C++17 // constexpr since C++26
// template <class M>
-// iterator insert_or_assign(const_iterator hint, const key_type& k, M&& obj); // C++17
+// iterator insert_or_assign(const_iterator hint, const key_type& k, M&& obj); // C++17 // constexpr since C++26
// template <class M>
-// iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj); // C++17
+// iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj); // C++17 // constexpr since C++26
#include <map>
#include <cassert>
@@ -36,13 +36,13 @@ class Moveable {
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_) {
+ TEST_CONSTEXPR_CXX26 Moveable() : int_(0), double_(0) {}
+ TEST_CONSTEXPR_CXX26 Moveable(int i, double d) : int_(i), double_(d) {}
+ TEST_CONSTEXPR_CXX26 Moveable(Moveable&& x) : int_(x.int_), double_(x.double_) {
x.int_ = -1;
x.double_ = -1;
}
- Moveable& operator=(Moveable&& x) {
+ TEST_CONSTEXPR_CXX26 Moveable& operator=(Moveable&& x) {
int_ = x.int_;
x.int_ = -1;
double_ = x.double_;
@@ -50,14 +50,16 @@ class Moveable {
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_); }
+ TEST_CONSTEXPR_CXX26 bool operator==(const Moveable& x) const { return int_ == x.int_ && double_ == x.double_; }
+ TEST_CONSTEXPR_CXX26 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; }
+ TEST_CONSTEXPR_CXX26 int get() const { return int_; }
+ TEST_CONSTEXPR_CXX26 bool moved() const { return int_ == -1; }
};
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{ // 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;
@@ -290,6 +292,13 @@ int main(int, char**) {
assert(r->first.get() == 11); // key
assert(r->second.get() == 13); // value
}
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
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 95d8897cea282..3f3e66783518d 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
@@ -9,18 +9,19 @@
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
// Some fields in the test case variables are deliberately not explicitly initialized, this silences a warning on GCC.
// ADDITIONAL_COMPILE_FLAGS(gcc-style-warnings): -Wno-missing-field-initializers
+// ADDITIONAL_COMPILE_FLAGS(has-fconstexpr-steps): -fconstexpr-steps=2147483647
// <map>
// template<container-compatible-range<value_type> R>
-// void insert_range(R&& rg); // C++23
+// void insert_range(R&& rg); // C++23 // constexpr since C++26
#include <map>
#include "../../../insert_range_maps_sets.h"
#include "test_macros.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
// 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>;
@@ -35,6 +36,13 @@ int main(int, char**) {
test_map_insert_range_exception_safety_throwing_copy<std::map>();
test_assoc_map_insert_range_exception_safety_throwing_allocator<std::map, int, int>();
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
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 345bfde531cf9..ea97db1ac99ba 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
@@ -14,7 +14,7 @@
// pair<iterator, bool> insert( value_type&& v); // C++17 and later
// template <class P>
-// pair<iterator, bool> insert(P&& p);
+// pair<iterator, bool> insert(P&& p); // constexpr since C++26
#include <map>
#include <cassert>
@@ -24,7 +24,7 @@
#include "test_macros.h"
template <class Container, class Pair>
-void do_insert_rv_test() {
+TEST_CONSTEXPR_CXX26 bool do_insert_rv_test() {
typedef Container M;
typedef Pair P;
typedef std::pair<typename M::iterator, bool> R;
@@ -56,9 +56,11 @@ void do_insert_rv_test() {
assert(m.size() == 3);
assert(r.first->first == 3);
assert(r.first->second == 3);
+
+ return true;
}
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
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>>();
@@ -101,6 +103,13 @@ int main(int, char**) {
assert(r.first->first == 3);
assert(r.first->second == 3);
}
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
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 a087704fb4daf..51b8c63fe0924 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
@@ -13,13 +13,13 @@
// class map
// template <class... Args>
-// pair<iterator, bool> try_emplace(const key_type& k, Args&&... args); // C++17
+// pair<iterator, bool> try_emplace(const key_type& k, Args&&... args); // C++17 // constexpr since C++26
// template <class... Args>
-// pair<iterator, bool> try_emplace(key_type&& k, Args&&... args); // C++17
+// pair<iterator, bool> try_emplace(key_type&& k, Args&&... args); // C++17 // constexpr since C++26
// template <class... Args>
-// iterator try_emplace(const_iterator hint, const key_type& k, Args&&... args); // C++17
+// iterator try_emplace(const_iterator hint, const key_type& k, Args&&... args); // C++17 // constexpr since C++26
// template <class... Args>
-// iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args); // C++17
+// iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args); // C++17 // constexpr since C++26
#include <map>
#include <cassert>
@@ -36,13 +36,13 @@ class Moveable {
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_) {
+ TEST_CONSTEXPR_CXX26 Moveable() : int_(0), double_(0) {}
+ TEST_CONSTEXPR_CXX26 Moveable(int i, double d) : int_(i), double_(d) {}
+ TEST_CONSTEXPR_CXX26 Moveable(Moveable&& x) : int_(x.int_), double_(x.double_) {
x.int_ = -1;
x.double_ = -1;
}
- Moveable& operator=(Moveable&& x) {
+ TEST_CONSTEXPR_CXX26 Moveable& operator=(Moveable&& x) {
int_ = x.int_;
x.int_ = -1;
double_ = x.double_;
@@ -50,14 +50,16 @@ class Moveable {
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_); }
+ TEST_CONSTEXPR_CXX26 bool operator==(const Moveable& x) const { return int_ == x.int_ && double_ == x.double_; }
+ TEST_CONSTEXPR_CXX26 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; }
+ TEST_CONSTEXPR_CXX26 int get() const { return int_; }
+ TEST_CONSTEXPR_CXX26 bool moved() const { return int_ == -1; }
};
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{ // pair<iterator, bool> try_emplace(const key_type& k, Args&&... args);
typedef std::map<int, Moveable> M;
typedef std::pair<M::iterator, bool> R;
@@ -92,10 +94,10 @@ int main(int, char**) {
assert(r.first->second.get() == 5); // value
Moveable mv3(-1, 3.0);
- r = m.try_emplace(117, std::move(mv2));
+ r = m.try_emplace(117, std::move(mv3));
assert(m.size() == 13);
assert(r.second); // was inserted
- assert(mv2.moved()); // was moved from
+ assert(mv3.moved()); // was moved from
assert(r.first->first == 117); // key
assert(r.first->second.get() == -1); // value
}
@@ -178,6 +180,13 @@ int main(int, char**) {
assert(r->first.get() == 3); // key
assert(r->second.get() == 4); // value
}
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/map/map.nonmember/compare.three_way.pass.cpp b/libcxx/test/std/containers/associative/map/map.nonmember/compare.three_way.pass.cpp
index 0e1c57f123e58..72c21bf7a62bf 100644
--- a/libcxx/test/std/containers/associative/map/map.nonmember/compare.three_way.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.nonmember/compare.three_way.pass.cpp
@@ -23,6 +23,11 @@
int main(int, char**) {
assert(test_ordered_map_container_spaceship<std::map>());
- // `std::map` is not constexpr, so no `static_assert` test here.
+ // `std::map` is not constexpr before C++26
+
+#if TEST_STD_VER >= 26
+ static_assert(test_ordered_map_container_spaceship<std::map>());
+#endif
+
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 9e376f6a1862b..b4f1c4aff16a4 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
@@ -38,7 +38,7 @@
#include "test_comparisons.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
typedef std::map<int, std::string> map_type;
typedef map_type::value_type value_type;
{
@@ -77,5 +77,15 @@ int main(int, char**) {
const map_type &cm1 = m1, cm2 = m2;
assert(testComparisons(cm1, cm2, false, true));
}
+
+ return true;
+}
+
+int main(int, char**) {
+ test();
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
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 f0757ab47ee48..dcd7af29d5f18 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
@@ -8,13 +8,15 @@
// <map>
-// key_compare key_comp() const;
+// key_compare key_comp() const; // constexpr since C++26
#include <map>
#include <cassert>
#include <string>
-int main(int, char**) {
+#include "test_macros.h"
+
+TEST_CONSTEXPR_CXX26 bool test() {
typedef std::map<int, std::string> map_type;
map_type m;
@@ -25,6 +27,13 @@ int main(int, char**) {
assert(cm.key_comp()(p1.first->first, p2.first->first));
assert(!cm.key_comp()(p2.first->first, p1.first->first));
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
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 edd1cd3c5c271..32a10acafbd61 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
@@ -8,13 +8,15 @@
// <map>
-// value_compare value_comp() const;
+// value_compare value_comp() const; // constexpr since C++26
#include <map>
#include <cassert>
#include <string>
-int main(int, char**) {
+#include "test_macros.h"
+
+TEST_CONSTEXPR_CXX26 bool test() {
typedef std::map<int, std::string> map_type;
map_type m;
@@ -25,6 +27,13 @@ int main(int, char**) {
assert(cm.value_comp()(*p1.first, *p2.first));
assert(!cm.value_comp()(*p2.first, *p1.first));
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
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 7191d4c5e835d..64ccb401e134c 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
@@ -13,10 +13,12 @@
// <map>
-// bool contains(const key_type& x) const;
+// bool contains(const key_type& x) const; // constexpr since C++26
+
+#include "test_macros.h"
template <typename T, typename P, typename B, typename... Pairs>
-void test(B bad, Pairs... args) {
+TEST_CONSTEXPR_CXX26 bool test(B bad, Pairs... args) {
T map;
P pairs[] = {args...};
@@ -26,6 +28,8 @@ void test(B bad, Pairs... args) {
assert(map.contains(p.first));
assert(!map.contains(bad));
+
+ return true;
}
struct E {
@@ -34,7 +38,7 @@ struct E {
char c = 1;
};
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
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));
@@ -45,7 +49,8 @@ int main(int, char**) {
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{}));
}
- {
+ // FIXME: remove when multimap is made constexpr
+ if (!TEST_IS_CONSTANT_EVALUATED) {
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));
@@ -55,6 +60,13 @@ int main(int, char**) {
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 true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
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 f80f1a2714bfd..a0ef0dea30e8a 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
@@ -13,29 +13,46 @@
// <map>
-// template<class K> bool contains(const K& x) const; // C++20
+// template<class K> bool contains(const K& x) const; // C++20 // constexpr since C++26
+
+#include "test_macros.h"
struct Comp {
using is_transparent = void;
- bool operator()(const std::pair<int, int>& lhs, const std::pair<int, int>& rhs) const { return lhs < rhs; }
+ TEST_CONSTEXPR_CXX26 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; }
+ TEST_CONSTEXPR_CXX26 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; }
+ TEST_CONSTEXPR_CXX26 bool operator()(int lhs, const std::pair<int, int>& rhs) const { return lhs < rhs.first; }
};
template <typename Container>
-void test() {
+TEST_CONSTEXPR_CXX26 bool test() {
Container s{{{2, 1}, 1}, {{1, 2}, 2}, {{1, 3}, 3}, {{1, 4}, 4}, {{2, 2}, 5}};
assert(s.contains(1));
assert(!s.contains(-1));
+
+ return true;
}
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
test<std::map<std::pair<int, int>, int, Comp> >();
- test<std::multimap<std::pair<int, int>, int, Comp> >();
+ // FIXME: remove when multimap is made constexpr
+ if (!TEST_IS_CONSTANT_EVALUATED) {
+ test<std::multimap<std::pair<int, int>, int, Comp> >();
+ }
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/map/map.ops/count.pass.cpp b/libcxx/test/std/containers/associative/map/map.ops/count.pass.cpp
index 9fa53ca05026c..7f7ef18a879d7 100644
--- a/libcxx/test/std/containers/associative/map/map.ops/count.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.ops/count.pass.cpp
@@ -10,7 +10,7 @@
// class map
-// size_type count(const key_type& k) const;
+// size_type count(const key_type& k) const; // constexpr since C++26
#include <map>
#include <cassert>
@@ -23,12 +23,12 @@
#if TEST_STD_VER >= 11
template <class T>
struct FinalCompare final {
- bool operator()(const T& x, const T& y) const { return x < y; }
+ TEST_CONSTEXPR_CXX26 bool operator()(const T& x, const T& y) const { return x < y; }
};
#endif
template <class Map, class ArgType = typename Map::key_type>
-void test() {
+TEST_CONSTEXPR_CXX26 bool test() {
typedef typename Map::value_type V;
typedef typename Map::size_type R;
@@ -45,9 +45,11 @@ void test() {
R r = m.count(ArgType(i));
assert(r == 1);
}
+
+ return true;
}
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
test<std::map<int, double> >();
#if TEST_STD_VER >= 11
typedef std::pair<const int, double> V;
@@ -85,5 +87,14 @@ int main(int, char**) {
}
}
#endif // TEST_STD_VER >= 14
+
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
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 62491e2bc4438..856f91fc18fee 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
@@ -12,7 +12,7 @@
// class map
-// size_type count(const key_type& k) const;
+// size_type count(const key_type& k) const; // constexpr since C++26
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
@@ -24,7 +24,7 @@
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef std::map<int, double, transparent_less> M;
assert(M().count(C2Int{5}) == 0);
@@ -37,6 +37,13 @@ int main(int, char**) {
using M = std::map<int, double, transparent_less_nonempty>;
assert(M().count(C2Int{5}) == 0);
}
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
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 fc097c1dc672c..609ef457b95cf 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
@@ -13,27 +13,39 @@
// class map
// template<typename K>
-// size_type count(const K& x) const; // C++14
+// size_type count(const K& x) const; // C++14 // constexpr since C++26
#include <cassert>
#include <map>
#include <utility>
+#include "test_macros.h"
+
struct Comp {
using is_transparent = void;
- bool operator()(const std::pair<int, int>& lhs, const std::pair<int, int>& rhs) const { return lhs < rhs; }
+ TEST_CONSTEXPR_CXX26 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; }
+ TEST_CONSTEXPR_CXX26 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; }
+ TEST_CONSTEXPR_CXX26 bool operator()(int lhs, const std::pair<int, int>& rhs) const { return lhs < rhs.first; }
};
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
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);
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
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 883cd379802e6..ad4877630e65f 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
@@ -10,8 +10,8 @@
// class map
-// pair<iterator,iterator> equal_range(const key_type& k);
-// pair<const_iterator,const_iterator> equal_range(const key_type& k) const;
+// pair<iterator,iterator> equal_range(const key_type& k); // constexpr since C++26
+// pair<const_iterator,const_iterator> equal_range(const key_type& k) const; // constexpr since C++26
#include <map>
#include <cassert>
@@ -21,7 +21,7 @@
#include "private_constructor.h"
#include "is_transparent.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef std::pair<const int, double> V;
typedef std::map<int, double> M;
@@ -436,6 +436,13 @@ int main(int, char**) {
assert(r.second == std::next(m.begin(), 8));
}
#endif
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#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 57ce9339f6323..62f473fc8616f 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
@@ -12,8 +12,8 @@
// class map
-// pair<iterator,iterator> equal_range(const key_type& k);
-// pair<const_iterator,const_iterator> equal_range(const key_type& k) const;
+// pair<iterator,iterator> equal_range(const key_type& k); // constexpr since C++26
+// pair<const_iterator,const_iterator> equal_range(const key_type& k) const; // constexpr since C++26
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
@@ -25,7 +25,7 @@
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef std::map<int, double, transparent_less> M;
typedef std::pair<typename M::iterator, typename M::iterator> P;
@@ -47,6 +47,13 @@ int main(int, char**) {
P result = example.equal_range(C2Int{5});
assert(result.first == result.second);
}
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
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 2b651468887ea..8c72d5139aaf2 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
@@ -13,26 +13,30 @@
// class map
// template<typename K>
-// pair<iterator,iterator> equal_range(const K& x); // C++14
+// pair<iterator,iterator> equal_range(const K& x); // C++14 // constexpr since C++26
// template<typename K>
// pair<const_iterator,const_iterator> equal_range(const K& x) const;
-// // C++14
+// // C++14 // constexpr since C++26
#include <cassert>
#include <map>
#include <utility>
+#include "test_macros.h"
+
struct Comp {
using is_transparent = void;
- bool operator()(const std::pair<int, int>& lhs, const std::pair<int, int>& rhs) const { return lhs < rhs; }
+ TEST_CONSTEXPR_CXX26 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; }
+ TEST_CONSTEXPR_CXX26 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; }
+ TEST_CONSTEXPR_CXX26 bool operator()(int lhs, const std::pair<int, int>& rhs) const { return lhs < rhs.first; }
};
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
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);
@@ -44,6 +48,13 @@ int main(int, char**) {
}
assert(nels == 3);
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
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 63dbcda512803..7a63fb670af61 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
@@ -10,8 +10,8 @@
// class map
-// iterator find(const key_type& k);
-// const_iterator find(const key_type& k) const;
+// iterator find(const key_type& k); // constexpr since C++26
+// const_iterator find(const key_type& k) const; // constexpr since C++26
#include <map>
#include <cassert>
@@ -21,7 +21,7 @@
#include "private_constructor.h"
#include "is_transparent.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef std::pair<const int, double> V;
typedef std::map<int, double> M;
@@ -95,6 +95,7 @@ int main(int, char**) {
{
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)};
+ (void)ar[0].second;
M m(ar, ar + sizeof(ar) / sizeof(ar[0]));
R r = m.find(5);
assert(r == m.begin());
@@ -222,6 +223,13 @@ int main(int, char**) {
assert(r == std::next(m.begin(), 8));
}
#endif
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#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 3f09d5608772d..3ff7876631af8 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
@@ -12,8 +12,8 @@
// class map
-// iterator find(const key_type& k);
-// const_iterator find(const key_type& k) const;
+// iterator find(const key_type& k); // constexpr since C++26
+// const_iterator find(const key_type& k) const; // constexpr since C++26
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
@@ -25,7 +25,7 @@
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef std::map<int, double, transparent_less> M;
M example;
@@ -41,6 +41,13 @@ int main(int, char**) {
M example;
assert(example.find(C2Int{5}) == example.end());
}
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
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 755ad36a3ba4d..99202b728354d 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
@@ -10,8 +10,8 @@
// class map
-// iterator lower_bound(const key_type& k);
-// const_iterator lower_bound(const key_type& k) const;
+// iterator lower_bound(const key_type& k); // constexpr since C++26
+// const_iterator lower_bound(const key_type& k) const; // constexpr since C++26
#include <map>
#include <cassert>
@@ -21,7 +21,7 @@
#include "private_constructor.h"
#include "is_transparent.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef std::pair<const int, double> V;
typedef std::map<int, double> M;
@@ -318,6 +318,13 @@ int main(int, char**) {
assert(r == std::next(m.begin(), 8));
}
#endif
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#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 308a2ed1e3af0..ce3ebde91eb5f 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
@@ -12,8 +12,8 @@
// class map
-// iterator lower_bound(const key_type& k);
-// const_iterator lower_bound(const key_type& k) const;
+// iterator lower_bound(const key_type& k); // constexpr since C++26
+// const_iterator lower_bound(const key_type& k) const; // constexpr since C++26
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
@@ -25,7 +25,7 @@
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef std::map<int, double, transparent_less> M;
M example;
@@ -41,6 +41,13 @@ int main(int, char**) {
M example;
assert(example.lower_bound(C2Int{5}) == example.end());
}
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
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 bd967e3dfb742..a7c4070691233 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
@@ -10,8 +10,8 @@
// class map
-// iterator upper_bound(const key_type& k);
-// const_iterator upper_bound(const key_type& k) const;
+// iterator upper_bound(const key_type& k); // constexpr since C++26
+// const_iterator upper_bound(const key_type& k) const; // constexpr since C++26
#include <map>
#include <cassert>
@@ -20,7 +20,7 @@
#include "min_allocator.h"
#include "private_constructor.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef std::pair<const int, double> V;
typedef std::map<int, double> M;
@@ -281,6 +281,13 @@ int main(int, char**) {
assert(r == std::next(m.begin(), 8));
}
#endif
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#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 332b71a84e9fb..75d9fe082239c 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
@@ -12,8 +12,8 @@
// class map
-// iterator upper_bound(const key_type& k);
-// const_iterator upper_bound(const key_type& k) const;
+// iterator upper_bound(const key_type& k); // constexpr since C++26
+// const_iterator upper_bound(const key_type& k) const; // constexpr since C++26
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
@@ -25,7 +25,7 @@
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef std::map<int, double, transparent_less> M;
M example;
@@ -41,6 +41,12 @@ int main(int, char**) {
M example;
assert(example.upper_bound(C2Int{5}) == example.end());
}
-
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
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 ffb74f62b8877..442a58cbe3a37 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
@@ -10,7 +10,7 @@
// class map
-// void swap(map& m);
+// void swap(map& m); // constexpr since C++26
#include <map>
#include <cassert>
@@ -18,7 +18,7 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
typedef std::pair<const int, double> V;
{
typedef std::map<int, double> M;
@@ -108,6 +108,13 @@ int main(int, char**) {
}
}
#endif
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#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 ba390acd128f5..cfb5a8f007b6e 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
@@ -12,7 +12,7 @@
// template <class Key, class T, class Compare, class Allocator>
// void
-// swap(map<Key, T, Compare, Allocator>& x, map<Key, T, Compare, Allocator>& y);
+// swap(map<Key, T, Compare, Allocator>& x, map<Key, T, Compare, Allocator>& y); // constexpr since C++26
#include <map>
#include <cassert>
@@ -21,7 +21,7 @@
#include "../../../test_compare.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
typedef std::pair<const int, double> V;
{
typedef std::map<int, double> M;
@@ -165,6 +165,13 @@ int main(int, char**) {
assert(m2.get_allocator() == A());
}
#endif
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#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 118158fd45ec3..8ede02a4f772d 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
@@ -12,11 +12,11 @@
// void swap(map& c)
// noexcept(!allocator_type::propagate_on_container_swap::value ||
-// __is_nothrow_swappable<allocator_type>::value);
+// __is_nothrow_swappable<allocator_type>::value); // constexpr since C++26
//
// In C++17, the standard says that swap shall have:
// noexcept(allocator_traits<Allocator>::is_always_equal::value &&
-// noexcept(swap(declval<Compare&>(), declval<Compare&>())));
+// noexcept(swap(declval<Compare&>(), declval<Compare&>()))); // constexpr since C++26
// This tests a conforming extension
@@ -86,7 +86,7 @@ struct some_alloc3 {
typedef std::false_type is_always_equal;
};
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
typedef std::pair<const MoveOnly, MoveOnly> V;
{
typedef std::map<MoveOnly, MoveOnly> C;
@@ -131,6 +131,13 @@ int main(int, char**) {
}
# endif // _LIBCPP_VERSION
#endif
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#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 70fa972812cec..b5fa819bb2ca6 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
@@ -10,24 +10,26 @@
// class value_compare
-// bool operator()( const value_type& lhs, const value_type& rhs ) const;
+// bool operator()( const value_type& lhs, const value_type& rhs ) const; // constexpr since C++26
#include <map>
#include <cassert>
#include <string>
#include <utility>
+#include "test_macros.h"
+
template <typename Map>
struct CallCompMember : Map::value_compare {
- CallCompMember(const typename Map::value_compare& vc) : Map::value_compare(vc) {}
+ TEST_CONSTEXPR_CXX26 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 {
+ TEST_CONSTEXPR_CXX26 bool operator()(const value_type& value1, const value_type& value2) const {
return this->comp(value1.first, value2.first);
}
};
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
typedef std::map<int, std::string> map_type;
map_type m;
@@ -42,6 +44,13 @@ int main(int, char**) {
assert(!vc(*p2.first, *p1.first));
assert(!call_comp(*p2.first, *p1.first));
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/map/types.pass.cpp b/libcxx/test/std/containers/associative/map/types.pass.cpp
index 7832ff3efd3a4..e69eb59081043 100644
--- a/libcxx/test/std/containers/associative/map/types.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/types.pass.cpp
@@ -34,7 +34,7 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef std::map<int, double> C;
static_assert((std::is_same<C::key_type, int>::value), "");
@@ -66,6 +66,13 @@ int main(int, char**) {
static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
}
#endif
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
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 3b1552cdaa5d4..e25ef0f2d5514 100644
--- a/libcxx/test/std/containers/container.node/node_handle.pass.cpp
+++ b/libcxx/test/std/containers/container.node/node_handle.pass.cpp
@@ -107,7 +107,7 @@ static_assert(
"");
template <class Container>
-void test_node_handle_operations() {
+TEST_CONSTEXPR_CXX26 bool test_node_handle_operations() {
Container c;
typename Container::node_type nt1, nt2 = c.extract(c.emplace().first);
@@ -117,10 +117,12 @@ void test_node_handle_operations() {
std::swap(nt1, nt2);
assert(nt1.get_allocator() == c.get_allocator());
assert(nt2.empty());
+
+ return true;
}
template <class Container>
-void test_node_handle_operations_multi() {
+TEST_CONSTEXPR_CXX26 bool test_node_handle_operations_multi() {
Container c;
typename Container::node_type nt1, nt2 = c.extract(c.emplace());
@@ -130,30 +132,50 @@ void test_node_handle_operations_multi() {
std::swap(nt1, nt2);
assert(nt1.get_allocator() == c.get_allocator());
assert(nt2.empty());
+
+ return true;
}
template <class>
-void test_typedef() {}
+TEST_CONSTEXPR_CXX26 bool test_typedef() {
+ return true;
+}
template <class Container>
-void test_insert_return_type() {
+TEST_CONSTEXPR_CXX26 bool test_insert_return_type() {
test_typedef<typename Container::insert_return_type>();
+ return true;
}
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
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>>();
+
+ // FIXME: update when other containers are made constexpr
+ if (!TEST_IS_CONSTANT_EVALUATED) {
+ 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>>();
+ // FIXME: update when other containers are made constexpr
+ if (!TEST_IS_CONSTANT_EVALUATED) {
+ 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 true;
+}
+
+int main(int, char**) {
+ assert(test());
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/insert_range_maps_sets.h b/libcxx/test/std/containers/insert_range_maps_sets.h
index 6e344d8ad3b0f..9b14a70a68236 100644
--- a/libcxx/test/std/containers/insert_range_maps_sets.h
+++ b/libcxx/test/std/containers/insert_range_maps_sets.h
@@ -200,7 +200,7 @@ TestCaseMapSet<std::pair<K, V>> constexpr NElementsContainer_RangeWithDuplicates
{16, 'D'}}};
template <class Container, class T, class Iter, class Sent>
-void test_map_set_insert_range(bool allow_duplicates = false) {
+TEST_CONSTEXPR_CXX26 void test_map_set_insert_range(bool allow_duplicates = false) {
auto test = [&](const TestCaseMapSet<T>& test_case, bool check_multi = false) {
Container c(test_case.initial.begin(), test_case.initial.end());
auto in = wrap_input<Iter, Sent>(test_case.input);
@@ -259,13 +259,14 @@ void test_set_insert_range_move_only() {
}
template <template <class...> class Container>
-void test_map_insert_range_move_only() {
+TEST_CONSTEXPR_CXX26 bool test_map_insert_range_move_only() {
using Value = std::pair<const int, MoveOnly>;
Value input[5];
std::ranges::subrange in(std::move_iterator{input}, std::move_iterator{input + 5});
Container<int, MoveOnly> c;
c.insert_range(in);
+ return true;
}
// Exception safety.
@@ -290,8 +291,8 @@ void test_set_insert_range_exception_safety_throwing_copy() {
}
template <template <class...> class Container>
-void test_map_insert_range_exception_safety_throwing_copy() {
-#if !defined(TEST_HAS_NO_EXCEPTIONS)
+TEST_CONSTEXPR_CXX26 void test_map_insert_range_exception_safety_throwing_copy() {
+#if !defined(TEST_HAS_NO_EXCEPTIONS) && !defined(TEST_IS_CONSTANT_EVALUATED)
using K = int;
using V = ThrowingCopy<3>;
@@ -351,8 +352,8 @@ void test_unord_set_insert_range_exception_safety_throwing_allocator() {
}
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)
+TEST_CONSTEXPR_CXX26 void test_assoc_map_insert_range_exception_safety_throwing_allocator() {
+#if !defined(TEST_HAS_NO_EXCEPTIONS) && !defined(TEST_IS_CONSTANT_EVALUATED)
using ValueType = std::pair<const K, V>;
ValueType in[] = {ValueType{K{1}, V{1}}};
diff --git a/libcxx/test/std/containers/test_compare.h b/libcxx/test/std/containers/test_compare.h
index 070f15869a4a3..3afb1a981387c 100644
--- a/libcxx/test/std/containers/test_compare.h
+++ b/libcxx/test/std/containers/test_compare.h
@@ -14,19 +14,21 @@
template <class T>
struct test_equal_to {
int data_;
- TEST_CONSTEXPR explicit test_equal_to() : data_(0) {}
- TEST_CONSTEXPR explicit test_equal_to(int data) : data_(data) {}
- TEST_CONSTEXPR bool operator()(const T& a, const T& b) const { return a == b; }
- TEST_CONSTEXPR friend bool operator==(const test_equal_to& a, const test_equal_to& b) { return a.data_ == b.data_; }
+ TEST_CONSTEXPR_CXX26 explicit test_equal_to() : data_(0) {}
+ TEST_CONSTEXPR_CXX26 explicit test_equal_to(int data) : data_(data) {}
+ TEST_CONSTEXPR_CXX26 bool operator()(const T& a, const T& b) const { return a == b; }
+ TEST_CONSTEXPR_CXX26 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_;
- TEST_CONSTEXPR explicit test_less() : data_(0) {}
- TEST_CONSTEXPR explicit test_less(int data) : data_(data) {}
- TEST_CONSTEXPR bool operator()(const T& a, const T& b) const { return a < b; }
- TEST_CONSTEXPR friend bool operator==(const test_less& a, const test_less& b) { return a.data_ == b.data_; }
+ TEST_CONSTEXPR_CXX26 explicit test_less() : data_(0) {}
+ TEST_CONSTEXPR_CXX26 explicit test_less(int data) : data_(data) {}
+ TEST_CONSTEXPR_CXX26 bool operator()(const T& a, const T& b) const { return a < b; }
+ TEST_CONSTEXPR_CXX26 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/language.support/support.limits/support.limits.general/map.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/map.version.compile.pass.cpp
index 3db3861c72b5c..ebb8d7aa27da7 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/map.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/map.version.compile.pass.cpp
@@ -5,9 +5,11 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
-
+//
// WARNING: This test was generated by generate_feature_test_macro_components.py
// and should not be edited manually.
+//
+// clang-format off
// <map>
@@ -20,232 +22,252 @@
#if TEST_STD_VER < 14
-# ifdef __cpp_lib_allocator_traits_is_always_equal
-# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
-# endif
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
+# endif
-# ifdef __cpp_lib_associative_heterogeneous_erasure
-# error "__cpp_lib_associative_heterogeneous_erasure should not be defined before c++23"
-# endif
+# ifdef __cpp_lib_associative_heterogeneous_erasure
+# error "__cpp_lib_associative_heterogeneous_erasure should not be defined before c++23"
+# endif
+
+# ifdef __cpp_lib_associative_heterogeneous_insertion
+# error "__cpp_lib_associative_heterogeneous_insertion should not be defined before c++26"
+# endif
-# ifdef __cpp_lib_associative_heterogeneous_insertion
-# error "__cpp_lib_associative_heterogeneous_insertion should not be defined before c++26"
+# ifdef __cpp_lib_constexpr_map
+# error "__cpp_lib_constexpr_map should not be defined before c++26"
# endif
# ifdef __cpp_lib_containers_ranges
# error "__cpp_lib_containers_ranges should not be defined before c++23"
# endif
-# ifdef __cpp_lib_erase_if
-# error "__cpp_lib_erase_if should not be defined before c++20"
-# endif
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++20"
+# endif
-# ifdef __cpp_lib_generic_associative_lookup
-# error "__cpp_lib_generic_associative_lookup should not be defined before c++14"
-# endif
+# ifdef __cpp_lib_generic_associative_lookup
+# error "__cpp_lib_generic_associative_lookup should not be defined before c++14"
+# endif
-# ifdef __cpp_lib_map_try_emplace
-# error "__cpp_lib_map_try_emplace should not be defined before c++17"
-# endif
+# ifdef __cpp_lib_map_try_emplace
+# error "__cpp_lib_map_try_emplace should not be defined before c++17"
+# endif
-# ifdef __cpp_lib_node_extract
-# error "__cpp_lib_node_extract should not be defined before c++17"
-# endif
+# ifdef __cpp_lib_node_extract
+# error "__cpp_lib_node_extract should not be defined before c++17"
+# endif
-# ifdef __cpp_lib_nonmember_container_access
-# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
-# endif
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
-# ifdef __cpp_lib_tuple_like
-# error "__cpp_lib_tuple_like should not be defined before c++23"
-# endif
+# ifdef __cpp_lib_tuple_like
+# error "__cpp_lib_tuple_like should not be defined before c++23"
+# endif
#elif TEST_STD_VER == 14
-# ifdef __cpp_lib_allocator_traits_is_always_equal
-# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
-# endif
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
+# endif
-# ifdef __cpp_lib_associative_heterogeneous_erasure
-# error "__cpp_lib_associative_heterogeneous_erasure should not be defined before c++23"
-# endif
+# ifdef __cpp_lib_associative_heterogeneous_erasure
+# error "__cpp_lib_associative_heterogeneous_erasure should not be defined before c++23"
+# endif
-# ifdef __cpp_lib_associative_heterogeneous_insertion
-# error "__cpp_lib_associative_heterogeneous_insertion should not be defined before c++26"
+# ifdef __cpp_lib_associative_heterogeneous_insertion
+# error "__cpp_lib_associative_heterogeneous_insertion should not be defined before c++26"
+# endif
+
+# ifdef __cpp_lib_constexpr_map
+# error "__cpp_lib_constexpr_map should not be defined before c++26"
# endif
# ifdef __cpp_lib_containers_ranges
# error "__cpp_lib_containers_ranges should not be defined before c++23"
# endif
-# ifdef __cpp_lib_erase_if
-# error "__cpp_lib_erase_if should not be defined before c++20"
-# endif
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++20"
+# endif
-# ifndef __cpp_lib_generic_associative_lookup
-# error "__cpp_lib_generic_associative_lookup should be defined in c++14"
-# endif
-# if __cpp_lib_generic_associative_lookup != 201304L
-# error "__cpp_lib_generic_associative_lookup should have the value 201304L in c++14"
-# endif
+# ifndef __cpp_lib_generic_associative_lookup
+# error "__cpp_lib_generic_associative_lookup should be defined in c++14"
+# endif
+# if __cpp_lib_generic_associative_lookup != 201304L
+# error "__cpp_lib_generic_associative_lookup should have the value 201304L in c++14"
+# endif
-# ifdef __cpp_lib_map_try_emplace
-# error "__cpp_lib_map_try_emplace should not be defined before c++17"
-# endif
+# ifdef __cpp_lib_map_try_emplace
+# error "__cpp_lib_map_try_emplace should not be defined before c++17"
+# endif
-# ifdef __cpp_lib_node_extract
-# error "__cpp_lib_node_extract should not be defined before c++17"
-# endif
+# ifdef __cpp_lib_node_extract
+# error "__cpp_lib_node_extract should not be defined before c++17"
+# endif
-# ifdef __cpp_lib_nonmember_container_access
-# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
-# endif
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
-# ifdef __cpp_lib_tuple_like
-# error "__cpp_lib_tuple_like should not be defined before c++23"
-# endif
+# ifdef __cpp_lib_tuple_like
+# error "__cpp_lib_tuple_like should not be defined before c++23"
+# endif
#elif TEST_STD_VER == 17
-# ifndef __cpp_lib_allocator_traits_is_always_equal
-# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++17"
-# endif
-# if __cpp_lib_allocator_traits_is_always_equal != 201411L
-# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++17"
-# endif
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++17"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++17"
+# endif
-# ifdef __cpp_lib_associative_heterogeneous_erasure
-# error "__cpp_lib_associative_heterogeneous_erasure should not be defined before c++23"
-# endif
+# ifdef __cpp_lib_associative_heterogeneous_erasure
+# error "__cpp_lib_associative_heterogeneous_erasure should not be defined before c++23"
+# endif
-# ifdef __cpp_lib_associative_heterogeneous_insertion
-# error "__cpp_lib_associative_heterogeneous_insertion should not be defined before c++26"
+# ifdef __cpp_lib_associative_heterogeneous_insertion
+# error "__cpp_lib_associative_heterogeneous_insertion should not be defined before c++26"
+# endif
+
+# ifdef __cpp_lib_constexpr_map
+# error "__cpp_lib_constexpr_map should not be defined before c++26"
# endif
# ifdef __cpp_lib_containers_ranges
# error "__cpp_lib_containers_ranges should not be defined before c++23"
# endif
-# ifdef __cpp_lib_erase_if
-# error "__cpp_lib_erase_if should not be defined before c++20"
-# endif
-
-# ifndef __cpp_lib_generic_associative_lookup
-# error "__cpp_lib_generic_associative_lookup should be defined in c++17"
-# endif
-# if __cpp_lib_generic_associative_lookup != 201304L
-# error "__cpp_lib_generic_associative_lookup should have the value 201304L in c++17"
-# endif
-
-# ifndef __cpp_lib_map_try_emplace
-# error "__cpp_lib_map_try_emplace should be defined in c++17"
-# endif
-# if __cpp_lib_map_try_emplace != 201411L
-# error "__cpp_lib_map_try_emplace should have the value 201411L in c++17"
-# endif
-
-# ifndef __cpp_lib_node_extract
-# error "__cpp_lib_node_extract should be defined in c++17"
-# endif
-# if __cpp_lib_node_extract != 201606L
-# error "__cpp_lib_node_extract should have the value 201606L in c++17"
-# endif
-
-# ifndef __cpp_lib_nonmember_container_access
-# error "__cpp_lib_nonmember_container_access should be defined in c++17"
-# endif
-# if __cpp_lib_nonmember_container_access != 201411L
-# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++17"
-# endif
-
-# ifdef __cpp_lib_tuple_like
-# error "__cpp_lib_tuple_like should not be defined before c++23"
-# endif
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++20"
+# endif
+
+# ifndef __cpp_lib_generic_associative_lookup
+# error "__cpp_lib_generic_associative_lookup should be defined in c++17"
+# endif
+# if __cpp_lib_generic_associative_lookup != 201304L
+# error "__cpp_lib_generic_associative_lookup should have the value 201304L in c++17"
+# endif
+
+# ifndef __cpp_lib_map_try_emplace
+# error "__cpp_lib_map_try_emplace should be defined in c++17"
+# endif
+# if __cpp_lib_map_try_emplace != 201411L
+# error "__cpp_lib_map_try_emplace should have the value 201411L in c++17"
+# endif
+
+# ifndef __cpp_lib_node_extract
+# error "__cpp_lib_node_extract should be defined in c++17"
+# endif
+# if __cpp_lib_node_extract != 201606L
+# error "__cpp_lib_node_extract should have the value 201606L in c++17"
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++17"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++17"
+# endif
+
+# ifdef __cpp_lib_tuple_like
+# error "__cpp_lib_tuple_like should not be defined before c++23"
+# endif
#elif TEST_STD_VER == 20
-# ifndef __cpp_lib_allocator_traits_is_always_equal
-# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++20"
-# endif
-# if __cpp_lib_allocator_traits_is_always_equal != 201411L
-# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++20"
-# endif
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++20"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++20"
+# endif
-# ifdef __cpp_lib_associative_heterogeneous_erasure
-# error "__cpp_lib_associative_heterogeneous_erasure should not be defined before c++23"
-# endif
+# ifdef __cpp_lib_associative_heterogeneous_erasure
+# error "__cpp_lib_associative_heterogeneous_erasure should not be defined before c++23"
+# endif
+
+# ifdef __cpp_lib_associative_heterogeneous_insertion
+# error "__cpp_lib_associative_heterogeneous_insertion should not be defined before c++26"
+# endif
-# ifdef __cpp_lib_associative_heterogeneous_insertion
-# error "__cpp_lib_associative_heterogeneous_insertion should not be defined before c++26"
+# ifdef __cpp_lib_constexpr_map
+# error "__cpp_lib_constexpr_map should not be defined before c++26"
# endif
# ifdef __cpp_lib_containers_ranges
# error "__cpp_lib_containers_ranges should not be defined before c++23"
# endif
-# ifndef __cpp_lib_erase_if
-# error "__cpp_lib_erase_if should be defined in c++20"
-# endif
-# if __cpp_lib_erase_if != 202002L
-# error "__cpp_lib_erase_if should have the value 202002L in c++20"
-# endif
-
-# ifndef __cpp_lib_generic_associative_lookup
-# error "__cpp_lib_generic_associative_lookup should be defined in c++20"
-# endif
-# if __cpp_lib_generic_associative_lookup != 201304L
-# error "__cpp_lib_generic_associative_lookup should have the value 201304L in c++20"
-# endif
-
-# ifndef __cpp_lib_map_try_emplace
-# error "__cpp_lib_map_try_emplace should be defined in c++20"
-# endif
-# if __cpp_lib_map_try_emplace != 201411L
-# error "__cpp_lib_map_try_emplace should have the value 201411L in c++20"
-# endif
-
-# ifndef __cpp_lib_node_extract
-# error "__cpp_lib_node_extract should be defined in c++20"
-# endif
-# if __cpp_lib_node_extract != 201606L
-# error "__cpp_lib_node_extract should have the value 201606L in c++20"
-# endif
-
-# ifndef __cpp_lib_nonmember_container_access
-# error "__cpp_lib_nonmember_container_access should be defined in c++20"
-# endif
-# if __cpp_lib_nonmember_container_access != 201411L
-# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++20"
-# endif
-
-# ifdef __cpp_lib_tuple_like
-# error "__cpp_lib_tuple_like should not be defined before c++23"
-# endif
+# ifndef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should be defined in c++20"
+# endif
+# if __cpp_lib_erase_if != 202002L
+# error "__cpp_lib_erase_if should have the value 202002L in c++20"
+# endif
+
+# ifndef __cpp_lib_generic_associative_lookup
+# error "__cpp_lib_generic_associative_lookup should be defined in c++20"
+# endif
+# if __cpp_lib_generic_associative_lookup != 201304L
+# error "__cpp_lib_generic_associative_lookup should have the value 201304L in c++20"
+# endif
+
+# ifndef __cpp_lib_map_try_emplace
+# error "__cpp_lib_map_try_emplace should be defined in c++20"
+# endif
+# if __cpp_lib_map_try_emplace != 201411L
+# error "__cpp_lib_map_try_emplace should have the value 201411L in c++20"
+# endif
+
+# ifndef __cpp_lib_node_extract
+# error "__cpp_lib_node_extract should be defined in c++20"
+# endif
+# if __cpp_lib_node_extract != 201606L
+# error "__cpp_lib_node_extract should have the value 201606L in c++20"
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++20"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++20"
+# endif
+
+# ifdef __cpp_lib_tuple_like
+# error "__cpp_lib_tuple_like should not be defined before c++23"
+# endif
#elif TEST_STD_VER == 23
-# ifndef __cpp_lib_allocator_traits_is_always_equal
-# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++23"
-# endif
-# if __cpp_lib_allocator_traits_is_always_equal != 201411L
-# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++23"
-# endif
-
-# if !defined(_LIBCPP_VERSION)
-# ifndef __cpp_lib_associative_heterogeneous_erasure
-# error "__cpp_lib_associative_heterogeneous_erasure should be defined in c++23"
-# endif
-# if __cpp_lib_associative_heterogeneous_erasure != 202110L
-# error "__cpp_lib_associative_heterogeneous_erasure should have the value 202110L in c++23"
-# endif
-# else
-# ifdef __cpp_lib_associative_heterogeneous_erasure
-# error "__cpp_lib_associative_heterogeneous_erasure should not be defined because it is unimplemented in libc++!"
-# endif
-# endif
-
-# ifdef __cpp_lib_associative_heterogeneous_insertion
-# error "__cpp_lib_associative_heterogeneous_insertion should not be defined before c++26"
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++23"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++23"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_associative_heterogeneous_erasure
+# error "__cpp_lib_associative_heterogeneous_erasure should be defined in c++23"
+# endif
+# if __cpp_lib_associative_heterogeneous_erasure != 202110L
+# error "__cpp_lib_associative_heterogeneous_erasure should have the value 202110L in c++23"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_associative_heterogeneous_erasure
+# error "__cpp_lib_associative_heterogeneous_erasure should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifdef __cpp_lib_associative_heterogeneous_insertion
+# error "__cpp_lib_associative_heterogeneous_insertion should not be defined before c++26"
+# endif
+
+# ifdef __cpp_lib_constexpr_map
+# error "__cpp_lib_constexpr_map should not be defined before c++26"
# endif
# ifndef __cpp_lib_containers_ranges
@@ -255,87 +277,94 @@
# error "__cpp_lib_containers_ranges should have the value 202202L in c++23"
# endif
-# ifndef __cpp_lib_erase_if
-# error "__cpp_lib_erase_if should be defined in c++23"
-# endif
-# if __cpp_lib_erase_if != 202002L
-# error "__cpp_lib_erase_if should have the value 202002L in c++23"
-# endif
-
-# ifndef __cpp_lib_generic_associative_lookup
-# error "__cpp_lib_generic_associative_lookup should be defined in c++23"
-# endif
-# if __cpp_lib_generic_associative_lookup != 201304L
-# error "__cpp_lib_generic_associative_lookup should have the value 201304L in c++23"
-# endif
-
-# ifndef __cpp_lib_map_try_emplace
-# error "__cpp_lib_map_try_emplace should be defined in c++23"
-# endif
-# if __cpp_lib_map_try_emplace != 201411L
-# error "__cpp_lib_map_try_emplace should have the value 201411L in c++23"
-# endif
-
-# ifndef __cpp_lib_node_extract
-# error "__cpp_lib_node_extract should be defined in c++23"
-# endif
-# if __cpp_lib_node_extract != 201606L
-# error "__cpp_lib_node_extract should have the value 201606L in c++23"
-# endif
-
-# ifndef __cpp_lib_nonmember_container_access
-# error "__cpp_lib_nonmember_container_access should be defined in c++23"
-# endif
-# if __cpp_lib_nonmember_container_access != 201411L
-# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++23"
-# endif
-
-# if !defined(_LIBCPP_VERSION)
-# ifndef __cpp_lib_tuple_like
-# error "__cpp_lib_tuple_like should be defined in c++23"
-# endif
-# if __cpp_lib_tuple_like != 202207L
-# error "__cpp_lib_tuple_like should have the value 202207L in c++23"
-# endif
-# else
-# ifdef __cpp_lib_tuple_like
-# error "__cpp_lib_tuple_like should not be defined because it is unimplemented in libc++!"
-# endif
-# endif
+# ifndef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should be defined in c++23"
+# endif
+# if __cpp_lib_erase_if != 202002L
+# error "__cpp_lib_erase_if should have the value 202002L in c++23"
+# endif
+
+# ifndef __cpp_lib_generic_associative_lookup
+# error "__cpp_lib_generic_associative_lookup should be defined in c++23"
+# endif
+# if __cpp_lib_generic_associative_lookup != 201304L
+# error "__cpp_lib_generic_associative_lookup should have the value 201304L in c++23"
+# endif
+
+# ifndef __cpp_lib_map_try_emplace
+# error "__cpp_lib_map_try_emplace should be defined in c++23"
+# endif
+# if __cpp_lib_map_try_emplace != 201411L
+# error "__cpp_lib_map_try_emplace should have the value 201411L in c++23"
+# endif
+
+# ifndef __cpp_lib_node_extract
+# error "__cpp_lib_node_extract should be defined in c++23"
+# endif
+# if __cpp_lib_node_extract != 201606L
+# error "__cpp_lib_node_extract should have the value 201606L in c++23"
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++23"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++23"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_tuple_like
+# error "__cpp_lib_tuple_like should be defined in c++23"
+# endif
+# if __cpp_lib_tuple_like != 202207L
+# error "__cpp_lib_tuple_like should have the value 202207L in c++23"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_tuple_like
+# error "__cpp_lib_tuple_like should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
#elif TEST_STD_VER > 23
-# ifndef __cpp_lib_allocator_traits_is_always_equal
-# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++26"
-# endif
-# if __cpp_lib_allocator_traits_is_always_equal != 201411L
-# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++26"
-# endif
-
-# if !defined(_LIBCPP_VERSION)
-# ifndef __cpp_lib_associative_heterogeneous_erasure
-# error "__cpp_lib_associative_heterogeneous_erasure should be defined in c++26"
-# endif
-# if __cpp_lib_associative_heterogeneous_erasure != 202110L
-# error "__cpp_lib_associative_heterogeneous_erasure should have the value 202110L in c++26"
-# endif
-# else
-# ifdef __cpp_lib_associative_heterogeneous_erasure
-# error "__cpp_lib_associative_heterogeneous_erasure should not be defined because it is unimplemented in libc++!"
-# endif
-# endif
-
-# if !defined(_LIBCPP_VERSION)
-# ifndef __cpp_lib_associative_heterogeneous_insertion
-# error "__cpp_lib_associative_heterogeneous_insertion should be defined in c++26"
-# endif
-# if __cpp_lib_associative_heterogeneous_insertion != 202306L
-# error "__cpp_lib_associative_heterogeneous_insertion should have the value 202306L in c++26"
-# endif
-# else
-# ifdef __cpp_lib_associative_heterogeneous_insertion
-# error "__cpp_lib_associative_heterogeneous_insertion should not be defined because it is unimplemented in libc++!"
-# endif
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++26"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++26"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_associative_heterogeneous_erasure
+# error "__cpp_lib_associative_heterogeneous_erasure should be defined in c++26"
+# endif
+# if __cpp_lib_associative_heterogeneous_erasure != 202110L
+# error "__cpp_lib_associative_heterogeneous_erasure should have the value 202110L in c++26"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_associative_heterogeneous_erasure
+# error "__cpp_lib_associative_heterogeneous_erasure should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_associative_heterogeneous_insertion
+# error "__cpp_lib_associative_heterogeneous_insertion should be defined in c++26"
+# endif
+# if __cpp_lib_associative_heterogeneous_insertion != 202306L
+# error "__cpp_lib_associative_heterogeneous_insertion should have the value 202306L in c++26"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_associative_heterogeneous_insertion
+# error "__cpp_lib_associative_heterogeneous_insertion should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_constexpr_map
+# error "__cpp_lib_constexpr_map should be defined in c++26"
+# endif
+# if __cpp_lib_constexpr_map != 202502L
+# error "__cpp_lib_constexpr_map should have the value 202502L in c++26"
# endif
# ifndef __cpp_lib_containers_ranges
@@ -345,54 +374,53 @@
# error "__cpp_lib_containers_ranges should have the value 202202L in c++26"
# endif
-# ifndef __cpp_lib_erase_if
-# error "__cpp_lib_erase_if should be defined in c++26"
-# endif
-# if __cpp_lib_erase_if != 202002L
-# error "__cpp_lib_erase_if should have the value 202002L in c++26"
-# endif
-
-# ifndef __cpp_lib_generic_associative_lookup
-# error "__cpp_lib_generic_associative_lookup should be defined in c++26"
-# endif
-# if __cpp_lib_generic_associative_lookup != 201304L
-# error "__cpp_lib_generic_associative_lookup should have the value 201304L in c++26"
-# endif
-
-# ifndef __cpp_lib_map_try_emplace
-# error "__cpp_lib_map_try_emplace should be defined in c++26"
-# endif
-# if __cpp_lib_map_try_emplace != 201411L
-# error "__cpp_lib_map_try_emplace should have the value 201411L in c++26"
-# endif
-
-# ifndef __cpp_lib_node_extract
-# error "__cpp_lib_node_extract should be defined in c++26"
-# endif
-# if __cpp_lib_node_extract != 201606L
-# error "__cpp_lib_node_extract should have the value 201606L in c++26"
-# endif
-
-# ifndef __cpp_lib_nonmember_container_access
-# error "__cpp_lib_nonmember_container_access should be defined in c++26"
-# endif
-# if __cpp_lib_nonmember_container_access != 201411L
-# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++26"
-# endif
-
-# if !defined(_LIBCPP_VERSION)
-# ifndef __cpp_lib_tuple_like
-# error "__cpp_lib_tuple_like should be defined in c++26"
-# endif
-# if __cpp_lib_tuple_like != 202311L
-# error "__cpp_lib_tuple_like should have the value 202311L in c++26"
-# endif
-# else
-# ifdef __cpp_lib_tuple_like
-# error "__cpp_lib_tuple_like should not be defined because it is unimplemented in libc++!"
-# endif
-# endif
+# ifndef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should be defined in c++26"
+# endif
+# if __cpp_lib_erase_if != 202002L
+# error "__cpp_lib_erase_if should have the value 202002L in c++26"
+# endif
+
+# ifndef __cpp_lib_generic_associative_lookup
+# error "__cpp_lib_generic_associative_lookup should be defined in c++26"
+# endif
+# if __cpp_lib_generic_associative_lookup != 201304L
+# error "__cpp_lib_generic_associative_lookup should have the value 201304L in c++26"
+# endif
+
+# ifndef __cpp_lib_map_try_emplace
+# error "__cpp_lib_map_try_emplace should be defined in c++26"
+# endif
+# if __cpp_lib_map_try_emplace != 201411L
+# error "__cpp_lib_map_try_emplace should have the value 201411L in c++26"
+# endif
+
+# ifndef __cpp_lib_node_extract
+# error "__cpp_lib_node_extract should be defined in c++26"
+# endif
+# if __cpp_lib_node_extract != 201606L
+# error "__cpp_lib_node_extract should have the value 201606L in c++26"
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++26"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++26"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_tuple_like
+# error "__cpp_lib_tuple_like should be defined in c++26"
+# endif
+# if __cpp_lib_tuple_like != 202311L
+# error "__cpp_lib_tuple_like should have the value 202311L in c++26"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_tuple_like
+# error "__cpp_lib_tuple_like should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
#endif // TEST_STD_VER > 23
-// clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
index 05af1fb0cf14b..51abe491d7cb7 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
@@ -164,14 +164,6 @@
# error "__cpp_lib_clamp should not be defined before c++17"
# endif
-# ifdef __cpp_lib_common_reference
-# error "__cpp_lib_common_reference should not be defined before c++20"
-# endif
-
-# ifdef __cpp_lib_common_reference_wrapper
-# error "__cpp_lib_common_reference_wrapper should not be defined before c++20"
-# endif
-
# ifdef __cpp_lib_complex_udls
# error "__cpp_lib_complex_udls should not be defined before c++14"
# endif
@@ -204,10 +196,6 @@
# error "__cpp_lib_constexpr_dynamic_alloc should not be defined before c++20"
# endif
-# ifdef __cpp_lib_constexpr_forward_list
-# error "__cpp_lib_constexpr_forward_list should not be defined before c++26"
-# endif
-
# ifdef __cpp_lib_constexpr_functional
# error "__cpp_lib_constexpr_functional should not be defined before c++20"
# endif
@@ -216,8 +204,8 @@
# error "__cpp_lib_constexpr_iterator should not be defined before c++20"
# endif
-# ifdef __cpp_lib_constexpr_list
-# error "__cpp_lib_constexpr_list should not be defined before c++26"
+# ifdef __cpp_lib_constexpr_map
+# error "__cpp_lib_constexpr_map should not be defined before c++26"
# endif
# ifdef __cpp_lib_constexpr_memory
@@ -664,10 +652,6 @@
# error "__cpp_lib_ranges_find_last should not be defined before c++23"
# endif
-# ifdef __cpp_lib_ranges_indices
-# error "__cpp_lib_ranges_indices should not be defined before c++26"
-# endif
-
# ifdef __cpp_lib_ranges_iota
# error "__cpp_lib_ranges_iota should not be defined before c++23"
# endif
@@ -824,10 +808,6 @@
# error "__cpp_lib_string_resize_and_overwrite should not be defined before c++23"
# endif
-# ifdef __cpp_lib_string_subview
-# error "__cpp_lib_string_subview should not be defined before c++26"
-# endif
-
# ifdef __cpp_lib_string_udls
# error "__cpp_lib_string_udls should not be defined before c++14"
# endif
@@ -1073,14 +1053,6 @@
# error "__cpp_lib_clamp should not be defined before c++17"
# endif
-# ifdef __cpp_lib_common_reference
-# error "__cpp_lib_common_reference should not be defined before c++20"
-# endif
-
-# ifdef __cpp_lib_common_reference_wrapper
-# error "__cpp_lib_common_reference_wrapper should not be defined before c++20"
-# endif
-
# ifndef __cpp_lib_complex_udls
# error "__cpp_lib_complex_udls should be defined in c++14"
# endif
@@ -1116,10 +1088,6 @@
# error "__cpp_lib_constexpr_dynamic_alloc should not be defined before c++20"
# endif
-# ifdef __cpp_lib_constexpr_forward_list
-# error "__cpp_lib_constexpr_forward_list should not be defined before c++26"
-# endif
-
# ifdef __cpp_lib_constexpr_functional
# error "__cpp_lib_constexpr_functional should not be defined before c++20"
# endif
@@ -1128,8 +1096,8 @@
# error "__cpp_lib_constexpr_iterator should not be defined before c++20"
# endif
-# ifdef __cpp_lib_constexpr_list
-# error "__cpp_lib_constexpr_list should not be defined before c++26"
+# ifdef __cpp_lib_constexpr_map
+# error "__cpp_lib_constexpr_map should not be defined before c++26"
# endif
# ifdef __cpp_lib_constexpr_memory
@@ -1612,10 +1580,6 @@
# error "__cpp_lib_ranges_find_last should not be defined before c++23"
# endif
-# ifdef __cpp_lib_ranges_indices
-# error "__cpp_lib_ranges_indices should not be defined before c++26"
-# endif
-
# ifdef __cpp_lib_ranges_iota
# error "__cpp_lib_ranges_iota should not be defined before c++23"
# endif
@@ -1787,10 +1751,6 @@
# error "__cpp_lib_string_resize_and_overwrite should not be defined before c++23"
# endif
-# ifdef __cpp_lib_string_subview
-# error "__cpp_lib_string_subview should not be defined before c++26"
-# endif
-
# ifndef __cpp_lib_string_udls
# error "__cpp_lib_string_udls should be defined in c++14"
# endif
@@ -2087,14 +2047,6 @@
# error "__cpp_lib_clamp should have the value 201603L in c++17"
# endif
-# ifdef __cpp_lib_common_reference
-# error "__cpp_lib_common_reference should not be defined before c++20"
-# endif
-
-# ifdef __cpp_lib_common_reference_wrapper
-# error "__cpp_lib_common_reference_wrapper should not be defined before c++20"
-# endif
-
# ifndef __cpp_lib_complex_udls
# error "__cpp_lib_complex_udls should be defined in c++17"
# endif
@@ -2130,10 +2082,6 @@
# error "__cpp_lib_constexpr_dynamic_alloc should not be defined before c++20"
# endif
-# ifdef __cpp_lib_constexpr_forward_list
-# error "__cpp_lib_constexpr_forward_list should not be defined before c++26"
-# endif
-
# ifdef __cpp_lib_constexpr_functional
# error "__cpp_lib_constexpr_functional should not be defined before c++20"
# endif
@@ -2142,8 +2090,8 @@
# error "__cpp_lib_constexpr_iterator should not be defined before c++20"
# endif
-# ifdef __cpp_lib_constexpr_list
-# error "__cpp_lib_constexpr_list should not be defined before c++26"
+# ifdef __cpp_lib_constexpr_map
+# error "__cpp_lib_constexpr_map should not be defined before c++26"
# endif
# ifdef __cpp_lib_constexpr_memory
@@ -2253,7 +2201,7 @@
# error "__cpp_lib_expected should not be defined before c++23"
# endif
-# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_FILESYSTEM
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_FILESYSTEM && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)
# ifndef __cpp_lib_filesystem
# error "__cpp_lib_filesystem should be defined in c++17"
# endif
@@ -2262,7 +2210,7 @@
# endif
# else
# ifdef __cpp_lib_filesystem
-# error "__cpp_lib_filesystem should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_FILESYSTEM' is not met!"
+# error "__cpp_lib_filesystem should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_FILESYSTEM && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)' is not met!"
# endif
# endif
@@ -2731,10 +2679,6 @@
# error "__cpp_lib_ranges_find_last should not be defined before c++23"
# endif
-# ifdef __cpp_lib_ranges_indices
-# error "__cpp_lib_ranges_indices should not be defined before c++26"
-# endif
-
# ifdef __cpp_lib_ranges_iota
# error "__cpp_lib_ranges_iota should not be defined before c++23"
# endif
@@ -2936,10 +2880,6 @@
# error "__cpp_lib_string_resize_and_overwrite should not be defined before c++23"
# endif
-# ifdef __cpp_lib_string_subview
-# error "__cpp_lib_string_subview should not be defined before c++26"
-# endif
-
# ifndef __cpp_lib_string_udls
# error "__cpp_lib_string_udls should be defined in c++17"
# endif
@@ -3208,14 +3148,20 @@
# error "__cpp_lib_atomic_value_initialization should have the value 201911L in c++20"
# endif
-# ifndef __cpp_lib_atomic_wait
-# error "__cpp_lib_atomic_wait should be defined in c++20"
-# endif
-# if __cpp_lib_atomic_wait != 201907L
-# error "__cpp_lib_atomic_wait should have the value 201907L in c++20"
+# if !defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC
+# ifndef __cpp_lib_atomic_wait
+# error "__cpp_lib_atomic_wait should be defined in c++20"
+# endif
+# if __cpp_lib_atomic_wait != 201907L
+# error "__cpp_lib_atomic_wait should have the value 201907L in c++20"
+# endif
+# else
+# ifdef __cpp_lib_atomic_wait
+# error "__cpp_lib_atomic_wait should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC' is not met!"
+# endif
# endif
-# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)
# ifndef __cpp_lib_barrier
# error "__cpp_lib_barrier should be defined in c++20"
# endif
@@ -3224,7 +3170,7 @@
# endif
# else
# ifdef __cpp_lib_barrier
-# error "__cpp_lib_barrier should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
+# error "__cpp_lib_barrier should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
# endif
# endif
@@ -3323,20 +3269,6 @@
# error "__cpp_lib_clamp should have the value 201603L in c++20"
# endif
-# ifndef __cpp_lib_common_reference
-# error "__cpp_lib_common_reference should be defined in c++20"
-# endif
-# if __cpp_lib_common_reference != 202302L
-# error "__cpp_lib_common_reference should have the value 202302L in c++20"
-# endif
-
-# ifndef __cpp_lib_common_reference_wrapper
-# error "__cpp_lib_common_reference_wrapper should be defined in c++20"
-# endif
-# if __cpp_lib_common_reference_wrapper != 202302L
-# error "__cpp_lib_common_reference_wrapper should have the value 202302L in c++20"
-# endif
-
# ifndef __cpp_lib_complex_udls
# error "__cpp_lib_complex_udls should be defined in c++20"
# endif
@@ -3384,10 +3316,6 @@
# error "__cpp_lib_constexpr_dynamic_alloc should have the value 201907L in c++20"
# endif
-# ifdef __cpp_lib_constexpr_forward_list
-# error "__cpp_lib_constexpr_forward_list should not be defined before c++26"
-# endif
-
# ifndef __cpp_lib_constexpr_functional
# error "__cpp_lib_constexpr_functional should be defined in c++20"
# endif
@@ -3402,8 +3330,8 @@
# error "__cpp_lib_constexpr_iterator should have the value 201811L in c++20"
# endif
-# ifdef __cpp_lib_constexpr_list
-# error "__cpp_lib_constexpr_list should not be defined before c++26"
+# ifdef __cpp_lib_constexpr_map
+# error "__cpp_lib_constexpr_map should not be defined before c++26"
# endif
# ifndef __cpp_lib_constexpr_memory
@@ -3552,7 +3480,7 @@
# error "__cpp_lib_expected should not be defined before c++23"
# endif
-# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_FILESYSTEM
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_FILESYSTEM && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)
# ifndef __cpp_lib_filesystem
# error "__cpp_lib_filesystem should be defined in c++20"
# endif
@@ -3561,7 +3489,7 @@
# endif
# else
# ifdef __cpp_lib_filesystem
-# error "__cpp_lib_filesystem should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_FILESYSTEM' is not met!"
+# error "__cpp_lib_filesystem should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_FILESYSTEM && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)' is not met!"
# endif
# endif
@@ -3861,7 +3789,7 @@
# error "__cpp_lib_is_within_lifetime should not be defined before c++26"
# endif
-# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)
# ifndef __cpp_lib_jthread
# error "__cpp_lib_jthread should be defined in c++20"
# endif
@@ -3870,11 +3798,11 @@
# endif
# else
# ifdef __cpp_lib_jthread
-# error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
+# error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
# endif
# endif
-# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)
# ifndef __cpp_lib_latch
# error "__cpp_lib_latch should be defined in c++20"
# endif
@@ -3883,7 +3811,7 @@
# endif
# else
# ifdef __cpp_lib_latch
-# error "__cpp_lib_latch should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
+# error "__cpp_lib_latch should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
# endif
# endif
@@ -4117,10 +4045,6 @@
# error "__cpp_lib_ranges_find_last should not be defined before c++23"
# endif
-# ifdef __cpp_lib_ranges_indices
-# error "__cpp_lib_ranges_indices should not be defined before c++26"
-# endif
-
# ifdef __cpp_lib_ranges_iota
# error "__cpp_lib_ranges_iota should not be defined before c++23"
# endif
@@ -4217,7 +4141,7 @@
# endif
# endif
-# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)
# ifndef __cpp_lib_semaphore
# error "__cpp_lib_semaphore should be defined in c++20"
# endif
@@ -4226,7 +4150,7 @@
# endif
# else
# ifdef __cpp_lib_semaphore
-# error "__cpp_lib_semaphore should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
+# error "__cpp_lib_semaphore should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
# endif
# endif
@@ -4352,10 +4276,6 @@
# error "__cpp_lib_string_resize_and_overwrite should not be defined before c++23"
# endif
-# ifdef __cpp_lib_string_subview
-# error "__cpp_lib_string_subview should not be defined before c++26"
-# endif
-
# ifndef __cpp_lib_string_udls
# error "__cpp_lib_string_udls should be defined in c++20"
# endif
@@ -4663,14 +4583,20 @@
# error "__cpp_lib_atomic_value_initialization should have the value 201911L in c++23"
# endif
-# ifndef __cpp_lib_atomic_wait
-# error "__cpp_lib_atomic_wait should be defined in c++23"
-# endif
-# if __cpp_lib_atomic_wait != 201907L
-# error "__cpp_lib_atomic_wait should have the value 201907L in c++23"
+# if !defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC
+# ifndef __cpp_lib_atomic_wait
+# error "__cpp_lib_atomic_wait should be defined in c++23"
+# endif
+# if __cpp_lib_atomic_wait != 201907L
+# error "__cpp_lib_atomic_wait should have the value 201907L in c++23"
+# endif
+# else
+# ifdef __cpp_lib_atomic_wait
+# error "__cpp_lib_atomic_wait should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC' is not met!"
+# endif
# endif
-# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)
# ifndef __cpp_lib_barrier
# error "__cpp_lib_barrier should be defined in c++23"
# endif
@@ -4679,7 +4605,7 @@
# endif
# else
# ifdef __cpp_lib_barrier
-# error "__cpp_lib_barrier should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
+# error "__cpp_lib_barrier should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
# endif
# endif
@@ -4784,20 +4710,6 @@
# error "__cpp_lib_clamp should have the value 201603L in c++23"
# endif
-# ifndef __cpp_lib_common_reference
-# error "__cpp_lib_common_reference should be defined in c++23"
-# endif
-# if __cpp_lib_common_reference != 202302L
-# error "__cpp_lib_common_reference should have the value 202302L in c++23"
-# endif
-
-# ifndef __cpp_lib_common_reference_wrapper
-# error "__cpp_lib_common_reference_wrapper should be defined in c++23"
-# endif
-# if __cpp_lib_common_reference_wrapper != 202302L
-# error "__cpp_lib_common_reference_wrapper should have the value 202302L in c++23"
-# endif
-
# ifndef __cpp_lib_complex_udls
# error "__cpp_lib_complex_udls should be defined in c++23"
# endif
@@ -4860,10 +4772,6 @@
# error "__cpp_lib_constexpr_dynamic_alloc should have the value 201907L in c++23"
# endif
-# ifdef __cpp_lib_constexpr_forward_list
-# error "__cpp_lib_constexpr_forward_list should not be defined before c++26"
-# endif
-
# ifndef __cpp_lib_constexpr_functional
# error "__cpp_lib_constexpr_functional should be defined in c++23"
# endif
@@ -4878,8 +4786,8 @@
# error "__cpp_lib_constexpr_iterator should have the value 201811L in c++23"
# endif
-# ifdef __cpp_lib_constexpr_list
-# error "__cpp_lib_constexpr_list should not be defined before c++26"
+# ifdef __cpp_lib_constexpr_map
+# error "__cpp_lib_constexpr_map should not be defined before c++26"
# endif
# ifndef __cpp_lib_constexpr_memory
@@ -5037,7 +4945,7 @@
# error "__cpp_lib_expected should have the value 202211L in c++23"
# endif
-# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_FILESYSTEM
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_FILESYSTEM && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)
# ifndef __cpp_lib_filesystem
# error "__cpp_lib_filesystem should be defined in c++23"
# endif
@@ -5046,7 +4954,7 @@
# endif
# else
# ifdef __cpp_lib_filesystem
-# error "__cpp_lib_filesystem should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_FILESYSTEM' is not met!"
+# error "__cpp_lib_filesystem should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_FILESYSTEM && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)' is not met!"
# endif
# endif
@@ -5385,7 +5293,7 @@
# error "__cpp_lib_is_within_lifetime should not be defined before c++26"
# endif
-# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)
# ifndef __cpp_lib_jthread
# error "__cpp_lib_jthread should be defined in c++23"
# endif
@@ -5394,11 +5302,11 @@
# endif
# else
# ifdef __cpp_lib_jthread
-# error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
+# error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
# endif
# endif
-# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)
# ifndef __cpp_lib_latch
# error "__cpp_lib_latch should be defined in c++23"
# endif
@@ -5407,7 +5315,7 @@
# endif
# else
# ifdef __cpp_lib_latch
-# error "__cpp_lib_latch should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
+# error "__cpp_lib_latch should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
# endif
# endif
@@ -5698,10 +5606,6 @@
# error "__cpp_lib_ranges_find_last should have the value 202207L in c++23"
# endif
-# ifdef __cpp_lib_ranges_indices
-# error "__cpp_lib_ranges_indices should not be defined before c++26"
-# endif
-
# ifndef __cpp_lib_ranges_iota
# error "__cpp_lib_ranges_iota should be defined in c++23"
# endif
@@ -5709,11 +5613,17 @@
# error "__cpp_lib_ranges_iota should have the value 202202L in c++23"
# endif
-# ifndef __cpp_lib_ranges_join_with
-# error "__cpp_lib_ranges_join_with should be defined in c++23"
-# endif
-# if __cpp_lib_ranges_join_with != 202202L
-# error "__cpp_lib_ranges_join_with should have the value 202202L in c++23"
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_ranges_join_with
+# error "__cpp_lib_ranges_join_with should be defined in c++23"
+# endif
+# if __cpp_lib_ranges_join_with != 202202L
+# error "__cpp_lib_ranges_join_with should have the value 202202L in c++23"
+# endif
+# else
+# ifdef __cpp_lib_ranges_join_with
+# error "__cpp_lib_ranges_join_with should not be defined because it is unimplemented in libc++!"
+# endif
# endif
# ifndef __cpp_lib_ranges_repeat
@@ -5840,7 +5750,7 @@
# endif
# endif
-# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)
# ifndef __cpp_lib_semaphore
# error "__cpp_lib_semaphore should be defined in c++23"
# endif
@@ -5849,7 +5759,7 @@
# endif
# else
# ifdef __cpp_lib_semaphore
-# error "__cpp_lib_semaphore should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
+# error "__cpp_lib_semaphore should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
# endif
# endif
@@ -6002,10 +5912,6 @@
# error "__cpp_lib_string_resize_and_overwrite should have the value 202110L in c++23"
# endif
-# ifdef __cpp_lib_string_subview
-# error "__cpp_lib_string_subview should not be defined before c++26"
-# endif
-
# ifndef __cpp_lib_string_udls
# error "__cpp_lib_string_udls should be defined in c++23"
# endif
@@ -6325,8 +6231,8 @@
# ifndef __cpp_lib_atomic_ref
# error "__cpp_lib_atomic_ref should be defined in c++26"
# endif
-# if __cpp_lib_atomic_ref != 202411L
-# error "__cpp_lib_atomic_ref should have the value 202411L in c++26"
+# if __cpp_lib_atomic_ref != 201806L
+# error "__cpp_lib_atomic_ref should have the value 201806L in c++26"
# endif
# if !defined(_LIBCPP_VERSION)
@@ -6349,14 +6255,20 @@
# error "__cpp_lib_atomic_value_initialization should have the value 201911L in c++26"
# endif
-# ifndef __cpp_lib_atomic_wait
-# error "__cpp_lib_atomic_wait should be defined in c++26"
-# endif
-# if __cpp_lib_atomic_wait != 201907L
-# error "__cpp_lib_atomic_wait should have the value 201907L in c++26"
+# if !defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC
+# ifndef __cpp_lib_atomic_wait
+# error "__cpp_lib_atomic_wait should be defined in c++26"
+# endif
+# if __cpp_lib_atomic_wait != 201907L
+# error "__cpp_lib_atomic_wait should have the value 201907L in c++26"
+# endif
+# else
+# ifdef __cpp_lib_atomic_wait
+# error "__cpp_lib_atomic_wait should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC' is not met!"
+# endif
# endif
-# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)
# ifndef __cpp_lib_barrier
# error "__cpp_lib_barrier should be defined in c++26"
# endif
@@ -6365,7 +6277,7 @@
# endif
# else
# ifdef __cpp_lib_barrier
-# error "__cpp_lib_barrier should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
+# error "__cpp_lib_barrier should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
# endif
# endif
@@ -6473,20 +6385,6 @@
# error "__cpp_lib_clamp should have the value 201603L in c++26"
# endif
-# ifndef __cpp_lib_common_reference
-# error "__cpp_lib_common_reference should be defined in c++26"
-# endif
-# if __cpp_lib_common_reference != 202302L
-# error "__cpp_lib_common_reference should have the value 202302L in c++26"
-# endif
-
-# ifndef __cpp_lib_common_reference_wrapper
-# error "__cpp_lib_common_reference_wrapper should be defined in c++26"
-# endif
-# if __cpp_lib_common_reference_wrapper != 202302L
-# error "__cpp_lib_common_reference_wrapper should have the value 202302L in c++26"
-# endif
-
# ifndef __cpp_lib_complex_udls
# error "__cpp_lib_complex_udls should be defined in c++26"
# endif
@@ -6549,13 +6447,6 @@
# error "__cpp_lib_constexpr_dynamic_alloc should have the value 201907L in c++26"
# endif
-# ifndef __cpp_lib_constexpr_forward_list
-# error "__cpp_lib_constexpr_forward_list should be defined in c++26"
-# endif
-# if __cpp_lib_constexpr_forward_list != 202502L
-# error "__cpp_lib_constexpr_forward_list should have the value 202502L in c++26"
-# endif
-
# ifndef __cpp_lib_constexpr_functional
# error "__cpp_lib_constexpr_functional should be defined in c++26"
# endif
@@ -6570,11 +6461,11 @@
# error "__cpp_lib_constexpr_iterator should have the value 201811L in c++26"
# endif
-# ifndef __cpp_lib_constexpr_list
-# error "__cpp_lib_constexpr_list should be defined in c++26"
+# ifndef __cpp_lib_constexpr_map
+# error "__cpp_lib_constexpr_map should be defined in c++26"
# endif
-# if __cpp_lib_constexpr_list != 202502L
-# error "__cpp_lib_constexpr_list should have the value 202502L in c++26"
+# if __cpp_lib_constexpr_map != 202502L
+# error "__cpp_lib_constexpr_map should have the value 202502L in c++26"
# endif
# ifndef __cpp_lib_constexpr_memory
@@ -6653,11 +6544,17 @@
# error "__cpp_lib_constexpr_vector should have the value 201907L in c++26"
# endif
-# ifndef __cpp_lib_constrained_equality
-# error "__cpp_lib_constrained_equality should be defined in c++26"
-# endif
-# if __cpp_lib_constrained_equality != 202411L
-# error "__cpp_lib_constrained_equality should have the value 202411L in c++26"
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_constrained_equality
+# error "__cpp_lib_constrained_equality should be defined in c++26"
+# endif
+# if __cpp_lib_constrained_equality != 202403L
+# error "__cpp_lib_constrained_equality should have the value 202403L in c++26"
+# endif
+# else
+# ifdef __cpp_lib_constrained_equality
+# error "__cpp_lib_constrained_equality should not be defined because it is unimplemented in libc++!"
+# endif
# endif
# ifndef __cpp_lib_containers_ranges
@@ -6774,7 +6671,7 @@
# error "__cpp_lib_expected should have the value 202211L in c++26"
# endif
-# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_FILESYSTEM
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_FILESYSTEM && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)
# ifndef __cpp_lib_filesystem
# error "__cpp_lib_filesystem should be defined in c++26"
# endif
@@ -6783,7 +6680,7 @@
# endif
# else
# ifdef __cpp_lib_filesystem
-# error "__cpp_lib_filesystem should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_FILESYSTEM' is not met!"
+# error "__cpp_lib_filesystem should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_FILESYSTEM && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)' is not met!"
# endif
# endif
@@ -7269,7 +7166,7 @@
# endif
# endif
-# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)
# ifndef __cpp_lib_jthread
# error "__cpp_lib_jthread should be defined in c++26"
# endif
@@ -7278,11 +7175,11 @@
# endif
# else
# ifdef __cpp_lib_jthread
-# error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
+# error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
# endif
# endif
-# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)
# ifndef __cpp_lib_latch
# error "__cpp_lib_latch should be defined in c++26"
# endif
@@ -7291,7 +7188,7 @@
# endif
# else
# ifdef __cpp_lib_latch
-# error "__cpp_lib_latch should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
+# error "__cpp_lib_latch should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
# endif
# endif
@@ -7459,11 +7356,17 @@
# error "__cpp_lib_optional should have the value 202110L in c++26"
# endif
-# ifndef __cpp_lib_optional_range_support
-# error "__cpp_lib_optional_range_support should be defined in c++26"
-# endif
-# if __cpp_lib_optional_range_support != 202406L
-# error "__cpp_lib_optional_range_support should have the value 202406L in c++26"
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_optional_range_support
+# error "__cpp_lib_optional_range_support should be defined in c++26"
+# endif
+# if __cpp_lib_optional_range_support != 202406L
+# error "__cpp_lib_optional_range_support should have the value 202406L in c++26"
+# endif
+# else
+# ifdef __cpp_lib_optional_range_support
+# error "__cpp_lib_optional_range_support should not be defined because it is unimplemented in libc++!"
+# endif
# endif
# ifndef __cpp_lib_out_ptr
@@ -7612,13 +7515,6 @@
# error "__cpp_lib_ranges_find_last should have the value 202207L in c++26"
# endif
-# ifndef __cpp_lib_ranges_indices
-# error "__cpp_lib_ranges_indices should be defined in c++26"
-# endif
-# if __cpp_lib_ranges_indices != 202506L
-# error "__cpp_lib_ranges_indices should have the value 202506L in c++26"
-# endif
-
# ifndef __cpp_lib_ranges_iota
# error "__cpp_lib_ranges_iota should be defined in c++26"
# endif
@@ -7626,11 +7522,17 @@
# error "__cpp_lib_ranges_iota should have the value 202202L in c++26"
# endif
-# ifndef __cpp_lib_ranges_join_with
-# error "__cpp_lib_ranges_join_with should be defined in c++26"
-# endif
-# if __cpp_lib_ranges_join_with != 202202L
-# error "__cpp_lib_ranges_join_with should have the value 202202L in c++26"
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_ranges_join_with
+# error "__cpp_lib_ranges_join_with should be defined in c++26"
+# endif
+# if __cpp_lib_ranges_join_with != 202202L
+# error "__cpp_lib_ranges_join_with should have the value 202202L in c++26"
+# endif
+# else
+# ifdef __cpp_lib_ranges_join_with
+# error "__cpp_lib_ranges_join_with should not be defined because it is unimplemented in libc++!"
+# endif
# endif
# ifndef __cpp_lib_ranges_repeat
@@ -7775,7 +7677,7 @@
# endif
# endif
-# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)
# ifndef __cpp_lib_semaphore
# error "__cpp_lib_semaphore should be defined in c++26"
# endif
@@ -7784,7 +7686,7 @@
# endif
# else
# ifdef __cpp_lib_semaphore
-# error "__cpp_lib_semaphore should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"
+# error "__cpp_lib_semaphore should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
# endif
# endif
@@ -7964,13 +7866,6 @@
# error "__cpp_lib_string_resize_and_overwrite should have the value 202110L in c++26"
# endif
-# ifndef __cpp_lib_string_subview
-# error "__cpp_lib_string_subview should be defined in c++26"
-# endif
-# if __cpp_lib_string_subview != 202506L
-# error "__cpp_lib_string_subview should have the value 202506L in c++26"
-# endif
-
# ifndef __cpp_lib_string_udls
# error "__cpp_lib_string_udls should be defined in c++26"
# endif
@@ -8178,3 +8073,4 @@
#endif // TEST_STD_VER > 23
// clang-format on
+
diff --git a/libcxx/test/support/is_transparent.h b/libcxx/test/support/is_transparent.h
index 9d3791d68a865..846f8fa4d06dd 100644
--- a/libcxx/test/support/is_transparent.h
+++ b/libcxx/test/support/is_transparent.h
@@ -81,16 +81,17 @@ struct transparent_less_not_a_type
};
struct C2Int { // comparable to int
- C2Int() : i_(0) {}
- C2Int(int i): i_(i) {}
- int get () const { return i_; }
+ TEST_CONSTEXPR_CXX26 C2Int() : i_(0) {}
+ TEST_CONSTEXPR_CXX26 C2Int(int i) : i_(i) {}
+ TEST_CONSTEXPR_CXX26 int get() const { return i_; }
+
private:
int i_;
};
-bool operator <(int rhs, const C2Int& lhs) { return rhs < lhs.get(); }
-bool operator <(const C2Int& rhs, const C2Int& lhs) { return rhs.get() < lhs.get(); }
-bool operator <(const C2Int& rhs, int lhs) { return rhs.get() < lhs; }
+ TEST_CONSTEXPR_CXX26 bool operator<(int rhs, const C2Int& lhs) { return rhs < lhs.get(); }
+ TEST_CONSTEXPR_CXX26 bool operator<(const C2Int& rhs, const C2Int& lhs) { return rhs.get() < lhs.get(); }
+ TEST_CONSTEXPR_CXX26 bool operator<(const C2Int& rhs, int lhs) { return rhs.get() < lhs; }
#endif // TEST_STD_VER > 11
diff --git a/libcxx/test/support/private_constructor.h b/libcxx/test/support/private_constructor.h
index 24f540c6a7fdc..c7ed288c4032e 100644
--- a/libcxx/test/support/private_constructor.h
+++ b/libcxx/test/support/private_constructor.h
@@ -9,18 +9,22 @@
#ifndef TEST_SUPPORT_PRIVATE_CONSTRUCTOR_H
#define TEST_SUPPORT_PRIVATE_CONSTRUCTOR_H
+#include "test_macros.h"
+
struct PrivateConstructor {
+ TEST_CONSTEXPR_CXX26 PrivateConstructor static make(int v) { return PrivateConstructor(v); }
+ TEST_CONSTEXPR_CXX26 int get() const { return val; }
- PrivateConstructor static make ( int v ) { return PrivateConstructor(v); }
- int get () const { return val; }
private:
- PrivateConstructor ( int v ) : val(v) {}
- int val;
+ TEST_CONSTEXPR_CXX26 PrivateConstructor(int v) : val(v) {}
+ int val;
};
-bool operator < ( const PrivateConstructor &lhs, const PrivateConstructor &rhs ) { return lhs.get() < rhs.get(); }
+ TEST_CONSTEXPR_CXX26 bool operator<(const PrivateConstructor& lhs, const PrivateConstructor& rhs) {
+ return lhs.get() < rhs.get();
+ }
-bool operator < ( const PrivateConstructor &lhs, int rhs ) { return lhs.get() < rhs; }
-bool operator < ( int lhs, const PrivateConstructor &rhs ) { return lhs < rhs.get(); }
+ TEST_CONSTEXPR_CXX26 bool operator<(const PrivateConstructor& lhs, int rhs) { return lhs.get() < rhs; }
+ TEST_CONSTEXPR_CXX26 bool operator<(int lhs, const PrivateConstructor& rhs) { return lhs < rhs.get(); }
#endif // TEST_SUPPORT_PRIVATE_CONSTRUCTOR_H
diff --git a/libcxx/utils/generate_feature_test_macro_components.py b/libcxx/utils/generate_feature_test_macro_components.py
index f6f252751b3e3..dd7b3cfeb6d7e 100644
--- a/libcxx/utils/generate_feature_test_macro_components.py
+++ b/libcxx/utils/generate_feature_test_macro_components.py
@@ -195,10 +195,7 @@ def add_version_header(tc):
},
{
"name": "__cpp_lib_atomic_ref",
- "values": {
- "c++20": 201806,
- "c++26": 202411, # P2835R7: Expose std::atomic_ref 's object address
- },
+ "values": {"c++20": 201806},
"headers": ["atomic"],
},
{
@@ -216,13 +213,15 @@ def add_version_header(tc):
"name": "__cpp_lib_atomic_wait",
"values": {"c++20": 201907},
"headers": ["atomic"],
+ "test_suite_guard": "!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC",
+ "libcxx_guard": "_LIBCPP_AVAILABILITY_HAS_SYNC",
},
{
"name": "__cpp_lib_barrier",
"values": {"c++20": 201907},
"headers": ["barrier"],
- "test_suite_guard": "!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS",
- "libcxx_guard": "_LIBCPP_HAS_THREADS",
+ "test_suite_guard": "!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)",
+ "libcxx_guard": "_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC",
},
{
"name": "__cpp_lib_bind_back",
@@ -314,16 +313,6 @@ def add_version_header(tc):
"values": {"c++17": 201603},
"headers": ["algorithm"],
},
- {
- "name": "__cpp_lib_common_reference",
- "values": {"c++20": 202302},
- "headers": ["type_traits"],
- },
- {
- "name": "__cpp_lib_common_reference_wrapper",
- "values": {"c++20": 202302},
- "headers": ["functional"],
- },
{
"name": "__cpp_lib_complex_udls",
"values": {"c++14": 201309},
@@ -388,6 +377,11 @@ def add_version_header(tc):
"values": {"c++26": 202502},
"headers": ["list"],
},
+ {
+ "name": "__cpp_lib_constexpr_map",
+ "values": {"c++26": 202502},
+ "headers": ["map"],
+ },
{
"name": "__cpp_lib_constexpr_memory",
"values": {"c++20": 201811, "c++23": 202202},
@@ -442,10 +436,9 @@ def add_version_header(tc):
},
{
"name": "__cpp_lib_constrained_equality",
- "values": {
- "c++26": 202411, # P3379R0: Constrain std::expected equality operators
- },
- "headers": ["expected", "optional", "tuple", "utility", "variant"],
+ "values": {"c++26": 202403}, # P2944R3: Comparisons for reference_wrapper
+ "headers": ["optional", "tuple", "utility", "variant"],
+ "unimplemented": True,
},
{
"name": "__cpp_lib_containers_ranges",
@@ -542,8 +535,8 @@ def add_version_header(tc):
"name": "__cpp_lib_filesystem",
"values": {"c++17": 201703},
"headers": ["filesystem"],
- "test_suite_guard": "!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_FILESYSTEM",
- "libcxx_guard": "_LIBCPP_HAS_FILESYSTEM",
+ "test_suite_guard": "!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_FILESYSTEM && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)",
+ "libcxx_guard": "_LIBCPP_HAS_FILESYSTEM && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY",
},
{
"name": "__cpp_lib_flat_map",
@@ -570,7 +563,7 @@ def add_version_header(tc):
"headers": ["format"],
# Trying to use `std::format` where to_chars floating-point is not
# available causes compilation errors, even with non floating-point types.
- # https://llvm.org/PR125353
+ # https://github.com/llvm/llvm-project/issues/125353
"test_suite_guard": "!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_TO_CHARS_FLOATING_POINT",
"libcxx_guard": "_LIBCPP_AVAILABILITY_HAS_TO_CHARS_FLOATING_POINT",
},
@@ -869,15 +862,15 @@ def add_version_header(tc):
"name": "__cpp_lib_jthread",
"values": {"c++20": 201911},
"headers": ["stop_token", "thread"],
- "test_suite_guard": "!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS",
- "libcxx_guard": "_LIBCPP_HAS_THREADS",
+ "test_suite_guard": "!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)",
+ "libcxx_guard": "_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC",
},
{
"name": "__cpp_lib_latch",
"values": {"c++20": 201907},
"headers": ["latch"],
- "test_suite_guard": "!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS",
- "libcxx_guard": "_LIBCPP_HAS_THREADS",
+ "test_suite_guard": "!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)",
+ "libcxx_guard": "_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC",
},
{
"name": "__cpp_lib_launder",
@@ -1013,6 +1006,7 @@ def add_version_header(tc):
"name": "__cpp_lib_optional_range_support",
"values": {"c++26": 202406}, # P3168R2 Give std::optional Range Support
"headers": ["optional"],
+ "unimplemented": True,
},
{
"name": "__cpp_lib_out_ptr",
@@ -1054,7 +1048,7 @@ def add_version_header(tc):
"headers": ["ostream", "print"],
# Trying to use `std::print` where to_chars floating-point is not
# available causes compilation errors, even with non floating-point types.
- # https://llvm.org/PR125353
+ # https://github.com/llvm/llvm-project/issues/125353
"test_suite_guard": "!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_TO_CHARS_FLOATING_POINT",
"libcxx_guard": "_LIBCPP_AVAILABILITY_HAS_TO_CHARS_FLOATING_POINT",
},
@@ -1114,11 +1108,6 @@ def add_version_header(tc):
"values": {"c++23": 202207},
"headers": ["algorithm"],
},
- {
- "name": "__cpp_lib_ranges_indices",
- "values": {"c++26": 202506},
- "headers": ["ranges"],
- },
{
"name": "__cpp_lib_ranges_iota",
"values": {"c++23": 202202},
@@ -1128,6 +1117,7 @@ def add_version_header(tc):
"name": "__cpp_lib_ranges_join_with",
"values": {"c++23": 202202},
"headers": ["ranges"],
+ "unimplemented": True,
},
{
"name": "__cpp_lib_ranges_repeat",
@@ -1221,8 +1211,8 @@ def add_version_header(tc):
"name": "__cpp_lib_semaphore",
"values": {"c++20": 201907},
"headers": ["semaphore"],
- "test_suite_guard": "!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS",
- "libcxx_guard": "_LIBCPP_HAS_THREADS",
+ "test_suite_guard": "!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)",
+ "libcxx_guard": "_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC",
},
{
"name": "__cpp_lib_senders",
@@ -1340,11 +1330,6 @@ def add_version_header(tc):
"values": {"c++23": 202110},
"headers": ["string"],
},
- {
- "name": "__cpp_lib_string_subview",
- "values": {"c++26": 202506},
- "headers": ["string", "string_view"],
- },
{
"name": "__cpp_lib_string_udls",
"values": {"c++14": 201304},
@@ -1890,6 +1875,7 @@ def produce_tests():
{cxx_tests}
// clang-format on
+
""".format(
script_name=script_name,
header=h,
>From 2ad97b415eab45570d1eb187c4b47cdc7ccf4cca Mon Sep 17 00:00:00 2001
From: Vinay Deshmukh <vinay_deshmukh at outlook.com>
Date: Fri, 3 Oct 2025 16:10:17 -0400
Subject: [PATCH 02/11] Initial constexpr-ing
---
libcxx/include/map | 243 ++++++++++++++++++++++++++++-----------------
1 file changed, 151 insertions(+), 92 deletions(-)
diff --git a/libcxx/include/map b/libcxx/include/map
index b2c71d265c218..0bc7c4aa21a38 100644
--- a/libcxx/include/map
+++ b/libcxx/include/map
@@ -1661,26 +1661,28 @@ public:
template <class _Key2, class _Value2, class _Comp2, class _Alloc2>
friend class multimap;
- _LIBCPP_HIDE_FROM_ABI multimap() _NOEXCEPT_(
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multimap() _NOEXCEPT_(
is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_default_constructible<key_compare>::value&&
is_nothrow_copy_constructible<key_compare>::value)
: __tree_(__vc(key_compare())) {}
- _LIBCPP_HIDE_FROM_ABI explicit multimap(const key_compare& __comp) _NOEXCEPT_(
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit multimap(const key_compare& __comp) _NOEXCEPT_(
is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_copy_constructible<key_compare>::value)
: __tree_(__vc(__comp)) {}
- _LIBCPP_HIDE_FROM_ABI explicit multimap(const key_compare& __comp, const allocator_type& __a)
+ _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit multimap(const key_compare& __comp, const allocator_type& __a)
: __tree_(__vc(__comp), typename __base::allocator_type(__a)) {}
template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI multimap(_InputIterator __f, _InputIterator __l, const key_compare& __comp = key_compare())
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
+ multimap(_InputIterator __f, _InputIterator __l, const key_compare& __comp = key_compare())
: __tree_(__vc(__comp)) {
insert(__f, __l);
}
template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
multimap(_InputIterator __f, _InputIterator __l, const key_compare& __comp, const allocator_type& __a)
: __tree_(__vc(__comp), typename __base::allocator_type(__a)) {
insert(__f, __l);
@@ -1688,7 +1690,7 @@ public:
# if _LIBCPP_STD_VER >= 23
template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
multimap(from_range_t,
_Range&& __range,
const key_compare& __comp = key_compare(),
@@ -1700,260 +1702,316 @@ public:
# if _LIBCPP_STD_VER >= 14
template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI multimap(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
+ _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 multimap(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
: multimap(__f, __l, key_compare(), __a) {}
# endif
# if _LIBCPP_STD_VER >= 23
template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI multimap(from_range_t, _Range&& __range, const allocator_type& __a)
+ _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 multimap(from_range_t, _Range&& __range, const allocator_type& __a)
: multimap(from_range, std::forward<_Range>(__range), key_compare(), __a) {}
# endif
- _LIBCPP_HIDE_FROM_ABI multimap(const multimap& __m) = default;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multimap(const multimap& __m) = default;
- _LIBCPP_HIDE_FROM_ABI multimap& operator=(const multimap& __m) = default;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multimap& operator=(const multimap& __m) = default;
# ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI multimap(multimap&& __m) = default;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multimap(multimap&& __m) = default;
- _LIBCPP_HIDE_FROM_ABI multimap(multimap&& __m, const allocator_type& __a);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multimap(multimap&& __m, const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI multimap& operator=(multimap&& __m) = default;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multimap& operator=(multimap&& __m) = default;
- _LIBCPP_HIDE_FROM_ABI multimap(initializer_list<value_type> __il, const key_compare& __comp = key_compare())
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
+ multimap(initializer_list<value_type> __il, const key_compare& __comp = key_compare())
: __tree_(__vc(__comp)) {
insert(__il.begin(), __il.end());
}
- _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
multimap(initializer_list<value_type> __il, const key_compare& __comp, const allocator_type& __a)
: __tree_(__vc(__comp), typename __base::allocator_type(__a)) {
insert(__il.begin(), __il.end());
}
# if _LIBCPP_STD_VER >= 14
- _LIBCPP_HIDE_FROM_ABI multimap(initializer_list<value_type> __il, const allocator_type& __a)
+ _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 multimap(initializer_list<value_type> __il, const allocator_type& __a)
: multimap(__il, key_compare(), __a) {}
# endif
- _LIBCPP_HIDE_FROM_ABI multimap& operator=(initializer_list<value_type> __il) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multimap& operator=(initializer_list<value_type> __il) {
__tree_.__assign_multi(__il.begin(), __il.end());
return *this;
}
# endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI explicit multimap(const allocator_type& __a) : __tree_(typename __base::allocator_type(__a)) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit multimap(const allocator_type& __a)
+ : __tree_(typename __base::allocator_type(__a)) {}
- _LIBCPP_HIDE_FROM_ABI multimap(const multimap& __m, const allocator_type& __a)
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multimap(const multimap& __m, const allocator_type& __a)
: __tree_(__m.__tree_.value_comp(), typename __base::allocator_type(__a)) {
insert(__m.begin(), __m.end());
}
- _LIBCPP_HIDE_FROM_ABI ~multimap() {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 ~multimap() {
static_assert(sizeof(std::__diagnose_non_const_comparator<_Key, _Compare>()), "");
}
- _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __tree_.begin(); }
- _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __tree_.begin(); }
- _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __tree_.end(); }
- _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __tree_.end(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator begin() _NOEXCEPT { return __tree_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator begin() const _NOEXCEPT { return __tree_.begin(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator end() _NOEXCEPT { return __tree_.end(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator end() const _NOEXCEPT { return __tree_.end(); }
- _LIBCPP_HIDE_FROM_ABI reverse_iterator rbegin() _NOEXCEPT { return reverse_iterator(end()); }
- _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rbegin() const _NOEXCEPT { return const_reverse_iterator(end()); }
- _LIBCPP_HIDE_FROM_ABI reverse_iterator rend() _NOEXCEPT { return reverse_iterator(begin()); }
- _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend() const _NOEXCEPT { return const_reverse_iterator(begin()); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reverse_iterator rbegin() _NOEXCEPT {
+ return reverse_iterator(end());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator rbegin() const _NOEXCEPT {
+ return const_reverse_iterator(end());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reverse_iterator rend() _NOEXCEPT {
+ return reverse_iterator(begin());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator rend() const _NOEXCEPT {
+ return const_reverse_iterator(begin());
+ }
- _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return begin(); }
- _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return end(); }
- _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crbegin() const _NOEXCEPT { return rbegin(); }
- _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT { return rend(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator cbegin() const _NOEXCEPT { return begin(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator cend() const _NOEXCEPT { return end(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator crbegin() const _NOEXCEPT {
+ return rbegin();
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator crend() const _NOEXCEPT { return rend(); }
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __tree_.size() == 0; }
- _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __tree_.size(); }
- _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __tree_.max_size(); }
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool empty() const _NOEXCEPT {
+ return __tree_.size() == 0;
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type size() const _NOEXCEPT { return __tree_.size(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type max_size() const _NOEXCEPT {
+ return __tree_.max_size();
+ }
- _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT { return allocator_type(__tree_.__alloc()); }
- _LIBCPP_HIDE_FROM_ABI key_compare key_comp() const { return __tree_.value_comp().key_comp(); }
- _LIBCPP_HIDE_FROM_ABI value_compare value_comp() const { return value_compare(__tree_.value_comp().key_comp()); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 allocator_type get_allocator() const _NOEXCEPT {
+ return allocator_type(__tree_.__alloc());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 key_compare key_comp() const {
+ return __tree_.value_comp().key_comp();
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 value_compare value_comp() const {
+ return value_compare(__tree_.value_comp().key_comp());
+ }
# ifndef _LIBCPP_CXX03_LANG
template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI iterator emplace(_Args&&... __args) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator emplace(_Args&&... __args) {
return __tree_.__emplace_multi(std::forward<_Args>(__args)...);
}
template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI iterator emplace_hint(const_iterator __p, _Args&&... __args) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator emplace_hint(const_iterator __p, _Args&&... __args) {
return __tree_.__emplace_hint_multi(__p.__i_, std::forward<_Args>(__args)...);
}
template <class _Pp, __enable_if_t<is_constructible<value_type, _Pp>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI iterator insert(_Pp&& __p) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(_Pp&& __p) {
return __tree_.__emplace_multi(std::forward<_Pp>(__p));
}
template <class _Pp, __enable_if_t<is_constructible<value_type, _Pp>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __pos, _Pp&& __p) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __pos, _Pp&& __p) {
return __tree_.__emplace_hint_multi(__pos.__i_, std::forward<_Pp>(__p));
}
- _LIBCPP_HIDE_FROM_ABI iterator insert(value_type&& __v) { return __tree_.__emplace_multi(std::move(__v)); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(value_type&& __v) {
+ return __tree_.__emplace_multi(std::move(__v));
+ }
- _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, value_type&& __v) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __p, value_type&& __v) {
return __tree_.__emplace_hint_multi(__p.__i_, std::move(__v));
}
- _LIBCPP_HIDE_FROM_ABI void insert(initializer_list<value_type> __il) { insert(__il.begin(), __il.end()); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert(initializer_list<value_type> __il) {
+ insert(__il.begin(), __il.end());
+ }
# endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI iterator insert(const value_type& __v) { return __tree_.__emplace_multi(__v); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const value_type& __v) {
+ return __tree_.__emplace_multi(__v);
+ }
- _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, const value_type& __v) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __p, const value_type& __v) {
return __tree_.__emplace_hint_multi(__p.__i_, __v);
}
template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __f, _InputIterator __l) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert(_InputIterator __f, _InputIterator __l) {
__tree_.__insert_range_multi(__f, __l);
}
# if _LIBCPP_STD_VER >= 23
template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI void insert_range(_Range&& __range) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert_range(_Range&& __range) {
__tree_.__insert_range_multi(ranges::begin(__range), ranges::end(__range));
}
# endif
- _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p) { return __tree_.erase(__p.__i_); }
- _LIBCPP_HIDE_FROM_ABI iterator erase(iterator __p) { return __tree_.erase(__p.__i_); }
- _LIBCPP_HIDE_FROM_ABI size_type erase(const key_type& __k) { return __tree_.__erase_multi(__k); }
- _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __f, const_iterator __l) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator erase(const_iterator __p) {
+ return __tree_.erase(__p.__i_);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator erase(iterator __p) { return __tree_.erase(__p.__i_); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type erase(const key_type& __k) {
+ return __tree_.__erase_multi(__k);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator erase(const_iterator __f, const_iterator __l) {
return __tree_.erase(__f.__i_, __l.__i_);
}
# if _LIBCPP_STD_VER >= 17
- _LIBCPP_HIDE_FROM_ABI iterator insert(node_type&& __nh) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(node_type&& __nh) {
_LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
"node_type with incompatible allocator passed to multimap::insert()");
return __tree_.template __node_handle_insert_multi<node_type>(std::move(__nh));
}
- _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __hint, node_type&& __nh) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __hint, node_type&& __nh) {
_LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
"node_type with incompatible allocator passed to multimap::insert()");
return __tree_.template __node_handle_insert_multi<node_type>(__hint.__i_, std::move(__nh));
}
- _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 node_type extract(key_type const& __key) {
return __tree_.template __node_handle_extract<node_type>(__key);
}
- _LIBCPP_HIDE_FROM_ABI node_type extract(const_iterator __it) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 node_type extract(const_iterator __it) {
return __tree_.template __node_handle_extract<node_type>(__it.__i_);
}
template <class _Compare2>
- _LIBCPP_HIDE_FROM_ABI void merge(multimap<key_type, mapped_type, _Compare2, allocator_type>& __source) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
+ merge(multimap<key_type, mapped_type, _Compare2, allocator_type>& __source) {
_LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
__source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
return __tree_.__node_handle_merge_multi(__source.__tree_);
}
template <class _Compare2>
- _LIBCPP_HIDE_FROM_ABI void merge(multimap<key_type, mapped_type, _Compare2, allocator_type>&& __source) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
+ merge(multimap<key_type, mapped_type, _Compare2, allocator_type>&& __source) {
_LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
__source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
return __tree_.__node_handle_merge_multi(__source.__tree_);
}
template <class _Compare2>
- _LIBCPP_HIDE_FROM_ABI void merge(map<key_type, mapped_type, _Compare2, allocator_type>& __source) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
+ merge(map<key_type, mapped_type, _Compare2, allocator_type>& __source) {
_LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
__source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
return __tree_.__node_handle_merge_multi(__source.__tree_);
}
template <class _Compare2>
- _LIBCPP_HIDE_FROM_ABI void merge(map<key_type, mapped_type, _Compare2, allocator_type>&& __source) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
+ merge(map<key_type, mapped_type, _Compare2, allocator_type>&& __source) {
_LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
__source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
return __tree_.__node_handle_merge_multi(__source.__tree_);
}
# endif
- _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT { __tree_.clear(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void clear() _NOEXCEPT { __tree_.clear(); }
- _LIBCPP_HIDE_FROM_ABI void swap(multimap& __m) _NOEXCEPT_(__is_nothrow_swappable_v<__base>) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void swap(multimap& __m)
+ _NOEXCEPT_(__is_nothrow_swappable_v<__base>) {
__tree_.swap(__m.__tree_);
}
- _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __tree_.find(__k); }
- _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __tree_.find(__k); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator find(const key_type& __k) { return __tree_.find(__k); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator find(const key_type& __k) const {
+ return __tree_.find(__k);
+ }
# if _LIBCPP_STD_VER >= 14
template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
- _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator find(const _K2& __k) {
return __tree_.find(__k);
}
template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
- _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator find(const _K2& __k) const {
return __tree_.find(__k);
}
# endif
- _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const { return __tree_.__count_multi(__k); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type count(const key_type& __k) const {
+ return __tree_.__count_multi(__k);
+ }
# if _LIBCPP_STD_VER >= 14
template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
- _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type count(const _K2& __k) const {
return __tree_.__count_multi(__k);
}
# endif
# if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool contains(const key_type& __k) const {
+ return find(__k) != end();
+ }
template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
- _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool contains(const _K2& __k) const {
return find(__k) != end();
}
# endif // _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const key_type& __k) { return __tree_.lower_bound(__k); }
- _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const key_type& __k) const { return __tree_.lower_bound(__k); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator lower_bound(const key_type& __k) {
+ return __tree_.lower_bound(__k);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator lower_bound(const key_type& __k) const {
+ return __tree_.lower_bound(__k);
+ }
# if _LIBCPP_STD_VER >= 14
template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
- _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const _K2& __k) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator lower_bound(const _K2& __k) {
return __tree_.lower_bound(__k);
}
template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
- _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const _K2& __k) const {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator lower_bound(const _K2& __k) const {
return __tree_.lower_bound(__k);
}
# endif
- _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const key_type& __k) { return __tree_.upper_bound(__k); }
- _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const key_type& __k) const { return __tree_.upper_bound(__k); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator upper_bound(const key_type& __k) {
+ return __tree_.upper_bound(__k);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator upper_bound(const key_type& __k) const {
+ return __tree_.upper_bound(__k);
+ }
# if _LIBCPP_STD_VER >= 14
template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
- _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const _K2& __k) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator upper_bound(const _K2& __k) {
return __tree_.upper_bound(__k);
}
template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
- _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const _K2& __k) const {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator upper_bound(const _K2& __k) const {
return __tree_.upper_bound(__k);
}
# endif
- _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator> equal_range(const key_type& __k) {
return __tree_.__equal_range_multi(__k);
}
- _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator>
+ equal_range(const key_type& __k) const {
return __tree_.__equal_range_multi(__k);
}
# if _LIBCPP_STD_VER >= 14
template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
- _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator> equal_range(const _K2& __k) {
return __tree_.__equal_range_multi(__k);
}
template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
- _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator>
+ equal_range(const _K2& __k) const {
return __tree_.__equal_range_multi(__k);
}
# endif
@@ -2020,6 +2078,7 @@ multimap(initializer_list<pair<_Key, _Tp>>,
# ifndef _LIBCPP_CXX03_LANG
template <class _Key, class _Tp, class _Compare, class _Allocator>
+_LIBCPP_CONSTEXPR_SINCE_CXX26
multimap<_Key, _Tp, _Compare, _Allocator>::multimap(multimap&& __m, const allocator_type& __a)
: __tree_(std::move(__m.__tree_), typename __base::allocator_type(__a)) {
if (__a != __m.get_allocator()) {
@@ -2032,7 +2091,7 @@ multimap<_Key, _Tp, _Compare, _Allocator>::multimap(multimap&& __m, const alloca
# endif
template <class _Key, class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI bool
+inline _LIBCPP_HIDE_FROM_ABI bool _LIBCPP_CONSTEXPR_SINCE_CXX26
operator==(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<_Key, _Tp, _Compare, _Allocator>& __y) {
return __x.size() == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin());
}
@@ -2040,31 +2099,31 @@ operator==(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<
# if _LIBCPP_STD_VER <= 17
template <class _Key, class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI bool
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
operator<(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<_Key, _Tp, _Compare, _Allocator>& __y) {
return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI bool
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
operator!=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<_Key, _Tp, _Compare, _Allocator>& __y) {
return !(__x == __y);
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI bool
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
operator>(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<_Key, _Tp, _Compare, _Allocator>& __y) {
return __y < __x;
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI bool
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
operator>=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<_Key, _Tp, _Compare, _Allocator>& __y) {
return !(__x < __y);
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI bool
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
operator<=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<_Key, _Tp, _Compare, _Allocator>& __y) {
return !(__y < __x);
}
@@ -2072,7 +2131,7 @@ operator<=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<
# else // #if _LIBCPP_STD_VER <= 17
template <class _Key, class _Tp, class _Compare, class _Allocator>
-_LIBCPP_HIDE_FROM_ABI __synth_three_way_result<pair<const _Key, _Tp>>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __synth_three_way_result<pair<const _Key, _Tp>>
operator<=>(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
const multimap<_Key, _Tp, _Compare, _Allocator>& __y) {
return std::lexicographical_compare_three_way(__x.begin(), __x.end(), __y.begin(), __y.end(), __synth_three_way);
@@ -2081,7 +2140,7 @@ operator<=>(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
# endif // #if _LIBCPP_STD_VER <= 17
template <class _Key, class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI void
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
swap(multimap<_Key, _Tp, _Compare, _Allocator>& __x, multimap<_Key, _Tp, _Compare, _Allocator>& __y)
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
__x.swap(__y);
@@ -2089,7 +2148,7 @@ swap(multimap<_Key, _Tp, _Compare, _Allocator>& __x, multimap<_Key, _Tp, _Compar
# if _LIBCPP_STD_VER >= 20
template <class _Key, class _Tp, class _Compare, class _Allocator, class _Predicate>
-inline _LIBCPP_HIDE_FROM_ABI typename multimap<_Key, _Tp, _Compare, _Allocator>::size_type
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 typename multimap<_Key, _Tp, _Compare, _Allocator>::size_type
erase_if(multimap<_Key, _Tp, _Compare, _Allocator>& __c, _Predicate __pred) {
return std::__libcpp_erase_if_container(__c, __pred);
}
>From 2483a0c5ad2bc9747165273dca3b78882636f718 Mon Sep 17 00:00:00 2001
From: Vinay Deshmukh <vinay_deshmukh at outlook.com>
Date: Fri, 3 Oct 2025 22:30:14 -0400
Subject: [PATCH 03/11] Add constexpr boilerplate to tests
---
.../associative/multimap/empty.pass.cpp | 13 ++++++-
.../multimap/get_allocator.pass.cpp | 13 ++++++-
.../multimap/incomplete_type.pass.cpp | 12 +++++-
.../associative/multimap/iterator.pass.cpp | 37 ++++++++++++-------
.../associative/multimap/max_size.pass.cpp | 13 ++++++-
.../multimap/multimap.cons/alloc.pass.cpp | 14 ++++++-
.../assign_initializer_list.pass.cpp | 13 ++++++-
.../multimap/multimap.cons/compare.pass.cpp | 13 ++++++-
.../multimap.cons/compare_alloc.pass.cpp | 13 ++++++-
.../multimap/multimap.cons/copy.pass.cpp | 11 ++++--
.../multimap.cons/copy_alloc.pass.cpp | 12 ++++--
.../multimap.cons/copy_assign.pass.cpp | 11 ++++--
.../multimap/multimap.cons/deduct.pass.cpp | 12 +++++-
.../multimap.cons/deduct_const.pass.cpp | 12 +++++-
.../multimap/multimap.cons/default.pass.cpp | 14 ++++++-
.../multimap.cons/default_noexcept.pass.cpp | 14 ++++++-
.../multimap.cons/dtor_noexcept.pass.cpp | 14 ++++++-
.../multimap.cons/from_range.pass.cpp | 17 +++++++--
.../multimap.cons/initializer_list.pass.cpp | 14 ++++++-
.../initializer_list_compare.pass.cpp | 14 ++++++-
.../initializer_list_compare_alloc.pass.cpp | 14 ++++++-
.../multimap/multimap.cons/iter_iter.pass.cpp | 14 ++++++-
.../multimap.cons/iter_iter_comp.pass.cpp | 14 ++++++-
.../iter_iter_comp_alloc.pass.cpp | 14 ++++++-
.../multimap/multimap.cons/move.pass.cpp | 14 ++++++-
.../multimap.cons/move_alloc.pass.cpp | 14 ++++++-
.../multimap.cons/move_assign.pass.cpp | 14 ++++++-
.../multimap.cons/move_noexcept.pass.cpp | 14 ++++++-
.../multimap.erasure/erase_if.pass.cpp | 13 ++++++-
.../multimap.modifiers/clear.pass.cpp | 13 ++++++-
.../multimap.modifiers/emplace.pass.cpp | 13 ++++++-
.../multimap.modifiers/emplace_hint.pass.cpp | 13 ++++++-
.../multimap.modifiers/erase_iter.pass.cpp | 13 ++++++-
.../erase_iter_iter.pass.cpp | 13 ++++++-
.../multimap.modifiers/erase_key.pass.cpp | 13 ++++++-
.../extract_iterator.pass.cpp | 13 ++++++-
.../multimap.modifiers/extract_key.pass.cpp | 13 ++++++-
.../insert_allocator_requirements.pass.cpp | 13 ++++++-
.../multimap.modifiers/insert_cv.pass.cpp | 13 ++++++-
.../insert_initializer_list.pass.cpp | 13 ++++++-
.../insert_iter_cv.pass.cpp | 13 ++++++-
.../insert_iter_iter.pass.cpp | 11 ++++--
.../insert_iter_rv.pass.cpp | 13 ++++++-
.../insert_node_type.pass.cpp | 13 ++++++-
.../insert_node_type_hint.pass.cpp | 13 ++++++-
.../multimap.modifiers/insert_range.pass.cpp | 13 ++++++-
.../multimap.modifiers/insert_rv.pass.cpp | 13 ++++++-
.../multimap.modifiers/merge.pass.cpp | 23 +++++++++---
.../compare.three_way.pass.cpp | 14 ++++++-
.../multimap.nonmember/op_compare.pass.cpp | 29 +++++++++++----
.../multimap.observers/key_comp.pass.cpp | 13 ++++++-
.../multimap.observers/value_comp.pass.cpp | 13 ++++++-
.../multimap/multimap.ops/count.pass.cpp | 13 ++++++-
.../multimap/multimap.ops/count0.pass.cpp | 14 ++++++-
.../multimap.ops/count_transparent.pass.cpp | 13 ++++++-
.../multimap.ops/equal_range.pass.cpp | 13 ++++++-
.../multimap.ops/equal_range0.pass.cpp | 14 ++++++-
.../equal_range_transparent.pass.cpp | 17 +++++++--
.../multimap/multimap.ops/find.pass.cpp | 16 ++++++--
.../multimap/multimap.ops/find0.pass.cpp | 17 +++++++--
.../multimap.ops/lower_bound.pass.cpp | 16 ++++++--
.../multimap.ops/lower_bound0.pass.cpp | 17 +++++++--
.../multimap.ops/upper_bound.pass.cpp | 16 ++++++--
.../multimap.ops/upper_bound0.pass.cpp | 17 +++++++--
.../multimap.special/member_swap.pass.cpp | 13 ++++++-
.../multimap.special/non_member_swap.pass.cpp | 13 ++++++-
.../multimap.special/swap_noexcept.pass.cpp | 13 ++++++-
.../multimap.value_compare/invoke.pass.cpp | 13 ++++++-
.../multimap.value_compare/types.pass.cpp | 11 +++++-
.../associative/multimap/size.pass.cpp | 13 ++++++-
.../associative/multimap/types.pass.cpp | 11 +++++-
71 files changed, 837 insertions(+), 168 deletions(-)
diff --git a/libcxx/test/std/containers/associative/multimap/empty.pass.cpp b/libcxx/test/std/containers/associative/multimap/empty.pass.cpp
index c183cc385a916..0064990ffb49a 100644
--- a/libcxx/test/std/containers/associative/multimap/empty.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/empty.pass.cpp
@@ -10,7 +10,7 @@
// class multimap
-// bool empty() const;
+// bool empty() const; // constexpr since C++26
#include <map>
#include <cassert>
@@ -18,7 +18,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef std::multimap<int, double> M;
M m;
@@ -40,5 +41,13 @@ int main(int, char**) {
}
#endif
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
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 102dd0b5a36cc..9da0baabcd0d0 100644
--- a/libcxx/test/std/containers/associative/multimap/get_allocator.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/get_allocator.pass.cpp
@@ -10,7 +10,7 @@
// class multimap
-// allocator_type get_allocator() const
+// allocator_type get_allocator() const // constexpr since C++26
#include <map>
#include <cassert>
@@ -19,7 +19,8 @@
#include "test_allocator.h"
#include "test_macros.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
typedef std::pair<const int, std::string> ValueType;
{
std::allocator<ValueType> alloc;
@@ -32,5 +33,13 @@ int main(int, char**) {
assert(m.get_allocator() == alloc);
}
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
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 470275aea064b..46ab176a6c065 100644
--- a/libcxx/test/std/containers/associative/multimap/incomplete_type.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/incomplete_type.pass.cpp
@@ -26,11 +26,21 @@ struct A {
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; }
-int main(int, char**) {
+
+TEST_CONSTEXPR_CXX26
+bool test() {
A a;
// Make sure that the allocator isn't rebound to and incomplete type
std::multimap<int, int, std::less<int>, complete_type_allocator<std::pair<const int, int> > > m;
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
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 ffdc39ff35563..7fd50ade0cde9 100644
--- a/libcxx/test/std/containers/associative/multimap/iterator.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/iterator.pass.cpp
@@ -10,20 +10,22 @@
// class multimap
-// iterator begin();
-// const_iterator begin() const;
-// iterator end();
-// const_iterator end() const;
+// iterator begin(); // constexpr since C++26
+// const_iterator begin() const; // constexpr since C++26
+// iterator end(); // constexpr since C++26
+// const_iterator end() const; // constexpr since C++26
+
//
-// reverse_iterator rbegin();
-// const_reverse_iterator rbegin() const;
-// reverse_iterator rend();
-// const_reverse_iterator rend() const;
+// reverse_iterator rbegin(); // constexpr since C++26
+// const_reverse_iterator rbegin() const; // constexpr since C++26
+// reverse_iterator rend(); // constexpr since C++26
+// const_reverse_iterator rend() const; // constexpr since C++26
+
//
-// const_iterator cbegin() const;
-// const_iterator cend() const;
-// const_reverse_iterator crbegin() const;
-// const_reverse_iterator crend() const;
+// const_iterator cbegin() const; // constexpr since C++26
+// const_iterator cend() const; // constexpr since C++26
+// const_reverse_iterator crbegin() const; // constexpr since C++26
+// const_reverse_iterator crend() const; // constexpr since C++26
#include <map>
#include <cassert>
@@ -32,7 +34,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
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),
@@ -165,5 +168,13 @@ int main(int, char**) {
}
#endif
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
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 c6208d27336b5..38befc8b215f4 100644
--- a/libcxx/test/std/containers/associative/multimap/max_size.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/max_size.pass.cpp
@@ -10,7 +10,7 @@
// class multimap
-// size_type max_size() const;
+// size_type max_size() const; // constexpr since C++26
#include <cassert>
#include <limits>
@@ -20,7 +20,8 @@
#include "test_allocator.h"
#include "test_macros.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
typedef std::pair<const int, int> KV;
{
typedef limited_allocator<KV, 10> A;
@@ -45,5 +46,13 @@ int main(int, char**) {
assert(c.max_size() <= alloc_max_size(c.get_allocator()));
}
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
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 10184633a82de..237ac723a827d 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
@@ -10,7 +10,7 @@
// class multimap
-// explicit multimap(const allocator_type& a);
+// explicit multimap(const allocator_type& a); // constexpr since C++26
#include <map>
#include <cassert>
@@ -19,7 +19,8 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef std::less<int> C;
typedef test_allocator<std::pair<const int, double> > A;
@@ -47,5 +48,14 @@ int main(int, char**) {
}
#endif
+ return true;
+}
+
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#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 d1de8fab172cf..678a346ab610e 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
@@ -12,7 +12,7 @@
// class multimap
-// multimap& operator=(initializer_list<value_type> il);
+// multimap& operator=(initializer_list<value_type> il); // constexpr since C++26
#include <map>
#include <cassert>
@@ -20,7 +20,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef std::multimap<int, double> C;
typedef C::value_type V;
@@ -58,5 +59,13 @@ int main(int, char**) {
assert(*++i == V(3, 2));
}
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
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 84584a427ead0..c4646741d35fe 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
@@ -10,7 +10,7 @@
// class multimap
-// explicit multimap(const key_compare& comp);
+// explicit multimap(const key_compare& comp); // constexpr since C++26
#include <map>
#include <cassert>
@@ -19,7 +19,8 @@
#include "../../../test_compare.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef test_less<int> C;
const std::multimap<int, double, C> m(C(3));
@@ -37,5 +38,13 @@ int main(int, char**) {
}
#endif
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#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 207e7e271234f..5a5e3f02abc06 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
@@ -10,7 +10,7 @@
// class multimap
-// multimap(const key_compare& comp, const allocator_type& a);
+// multimap(const key_compare& comp, const allocator_type& a); // constexpr since C++26
#include <map>
#include <cassert>
@@ -20,7 +20,8 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef test_less<int> C;
typedef test_allocator<std::pair<const int, double> > A;
@@ -51,5 +52,13 @@ int main(int, char**) {
}
#endif
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
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 724755d1ef655..5ac74e2e18c3e 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
@@ -10,7 +10,7 @@
// class multimap
-// multimap(const multimap& m);
+// multimap(const multimap& m); // constexpr since C++26
#include <map>
#include <cassert>
@@ -83,7 +83,8 @@ void test_alloc() {
}
}
-void test() {
+TEST_CONSTEXPR_CXX26
+bool test() {
test_alloc<std::allocator>();
test_alloc<min_allocator>(); // Make sure that fancy pointers work
@@ -132,10 +133,14 @@ void test() {
assert(orig.size() == 3);
assert(orig.get_allocator() == other_allocator<V>(10));
}
+ return true;
}
int main(int, char**) {
- test();
+ assert(test());
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#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 055efaecfca54..85edf2bce3b1b 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
@@ -10,7 +10,7 @@
// class multimap
-// multimap(const multimap& m, const allocator_type& a);
+// multimap(const multimap& m, const allocator_type& a); // constexpr since C++26
#include <map>
#include <cassert>
@@ -83,7 +83,8 @@ void test_alloc(const Alloc& new_alloc) {
}
}
-void test() {
+TEST_CONSTEXPR_CXX26
+bool test() {
test_alloc(std::allocator<std::pair<const int, int> >());
test_alloc(test_allocator<std::pair<const int, int> >(25)); // Make sure that the new allocator is actually used
test_alloc(min_allocator<std::pair<const int, int> >()); // Make sure that fancy pointers work
@@ -102,10 +103,15 @@ void test() {
assert(orig.size() == 3);
assert(orig.key_comp() == test_less<int>(3));
}
+ return true;
}
int main(int, char**) {
- test();
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#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 e52da3a4a6313..4410309fc4536 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
@@ -10,7 +10,7 @@
// class multimap
-// multimap& operator=(const multimap& m);
+// multimap& operator=(const multimap& m); // constexpr since C++26
#include <algorithm>
#include <cassert>
@@ -245,7 +245,8 @@ void test_alloc(const Alloc& lhs_alloc = Alloc(),
check_alloc_invariant();
}
-void test() {
+TEST_CONSTEXPR_CXX26
+bool test() {
test_alloc<std::allocator<std::pair<const int, int> > >();
#if TEST_STD_VER >= 11
test_alloc<min_allocator<std::pair<const int, int> > >();
@@ -288,10 +289,14 @@ void test() {
assert(orig.size() == 3);
assert(orig.key_comp() == test_less<int>(3));
}
+ return true;
}
int main(int, char**) {
- test();
+ assert(test());
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#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 1e318890e58ac..534c6a76f0a6c 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
@@ -51,7 +51,8 @@
using P = std::pair<int, long>;
using PC = std::pair<const int, long>;
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
const P arr[] = {{1, 1L}, {2, 2L}, {1, 1L}, {INT_MAX, 1L}, {3, 1L}};
std::multimap m(std::begin(arr), std::end(arr));
@@ -215,4 +216,13 @@ int main(int, char**) {
AssociativeContainerDeductionGuidesSfinaeAway<std::multimap, std::multimap<int, long>>();
return 0;
+
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
}
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 ae1e5622797cd..d39d5ee61d440 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
@@ -39,7 +39,8 @@ 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**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
const PCC arr[] = {{1, 1L}, {2, 2L}, {1, 1L}, {INT_MAX, 1L}, {3, 1L}};
std::multimap m(std::begin(arr), std::end(arr));
@@ -104,4 +105,13 @@ int main(int, char**) {
}
return 0;
+
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
}
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 f74723b3174f0..3c7e9fd797502 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
@@ -10,7 +10,7 @@
// class multimap
-// multimap();
+// multimap(); // constexpr since C++26
#include <map>
#include <cassert>
@@ -18,7 +18,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
std::multimap<int, double> m;
assert(m.empty());
@@ -52,4 +53,13 @@ int main(int, char**) {
#endif
return 0;
+
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
}
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 b6c4e0336394d..5f3f96a7c490f 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
@@ -12,7 +12,7 @@
// noexcept(
// is_nothrow_default_constructible<allocator_type>::value &&
// is_nothrow_default_constructible<key_compare>::value &&
-// is_nothrow_copy_constructible<key_compare>::value);
+// is_nothrow_copy_constructible<key_compare>::value); // constexpr since C++26
// This tests a conforming extension
@@ -32,7 +32,8 @@ struct some_comp {
bool operator()(const T&, const T&) const { return false; }
};
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
typedef std::pair<const MoveOnly, MoveOnly> V;
#if defined(_LIBCPP_VERSION)
{
@@ -54,4 +55,13 @@ int main(int, char**) {
}
return 0;
+
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
}
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 62afae92b6902..c9e706adc4f7e 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
@@ -8,7 +8,7 @@
// <map>
-// ~multimap() // implied noexcept;
+// ~multimap() // implied noexcept; // constexpr since C++26
// UNSUPPORTED: c++03
@@ -26,7 +26,8 @@ struct some_comp {
bool operator()(const T&, const T&) const { return false; }
};
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
typedef std::pair<const MoveOnly, MoveOnly> V;
{
typedef std::multimap<MoveOnly, MoveOnly> C;
@@ -48,4 +49,13 @@ int main(int, char**) {
#endif // _LIBCPP_VERSION
return 0;
+
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
}
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 fd8ca64f1cce6..55485e37eb9b6 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
@@ -9,11 +9,12 @@
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
// template<container-compatible-range<value_type> R>
-// multimap(from_range_t, R&& rg, const Compare& comp = Compare(), const Allocator& = Allocator()); // C++23
+// multimap(from_range_t, R&& rg, const Compare& comp = Compare(), const Allocator& = Allocator()); // C++23 // constexpr since C++26
+
//
// template<container-compatible-range<value_type> R>
// multimap(from_range_t, R&& rg, const Allocator& a))
-// : multimap(from_range, std::forward<R>(rg), Compare(), a) { } // C++23
+// : multimap(from_range, std::forward<R>(rg), Compare(), a) { } // C++23 // constexpr since C++26
#include <array>
#include <map>
@@ -28,7 +29,8 @@ void test_duplicates() {
assert(std::ranges::is_permutation(input, c));
}
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
using T = std::pair<const int, int>;
for_all_iterators_and_allocators<T>([]<class Iter, class Sent, class Alloc>() {
test_associative_map<std::multimap, int, int, Iter, Sent, test_less<int>, Alloc>();
@@ -42,4 +44,13 @@ int main(int, char**) {
test_map_exception_safety_throwing_allocator<std::multimap, int, int>();
return 0;
+
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
}
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 db91af00359e8..3b7948f86d808 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
@@ -12,7 +12,7 @@
// class multimap
-// multimap(initializer_list<value_type> il, const key_compare& comp = key_compare());
+// multimap(initializer_list<value_type> il, const key_compare& comp = key_compare()); // constexpr since C++26
#include <map>
#include <cassert>
@@ -20,7 +20,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef std::multimap<int, double> C;
typedef C::value_type V;
@@ -57,4 +58,13 @@ int main(int, char**) {
}
return 0;
+
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
}
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 0d346d7226353..761b6c50c122a 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
@@ -12,7 +12,7 @@
// class multimap
-// multimap(initializer_list<value_type> il, const key_compare& comp = key_compare());
+// multimap(initializer_list<value_type> il, const key_compare& comp = key_compare()); // constexpr since C++26
#include <map>
#include <cassert>
@@ -20,7 +20,8 @@
#include "../../../test_compare.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef test_less<int> Cmp;
typedef std::multimap<int, double, Cmp> C;
@@ -61,4 +62,13 @@ int main(int, char**) {
}
return 0;
+
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
}
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 493f1bafbc1b7..ab4525f195bba 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
@@ -12,7 +12,7 @@
// class multimap
-// multimap(initializer_list<value_type> il, const key_compare& comp, const allocator_type& a);
+// multimap(initializer_list<value_type> il, const key_compare& comp, const allocator_type& a); // constexpr since C++26
#include <map>
#include <cassert>
@@ -21,7 +21,8 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef test_less<int> Cmp;
typedef test_allocator<std::pair<const int, double> > A;
@@ -109,4 +110,13 @@ int main(int, char**) {
}
return 0;
+
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
}
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 55542914f9a01..a67eb64ad1f31 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
@@ -11,7 +11,7 @@
// class multimap
// template <class InputIterator>
-// multimap(InputIterator first, InputIterator last);
+// multimap(InputIterator first, InputIterator last); // constexpr since C++26
#include <map>
#include <cassert>
@@ -19,7 +19,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef std::pair<const int, double> V;
V ar[] = {
@@ -107,4 +108,13 @@ int main(int, char**) {
#endif
return 0;
+
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
}
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 128d54a3d6b4e..3343070015b27 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
@@ -12,7 +12,7 @@
// template <class InputIterator>
// multimap(InputIterator first, InputIterator last,
-// const key_compare& comp);
+// const key_compare& comp); // constexpr since C++26
#include <map>
#include <cassert>
@@ -21,7 +21,8 @@
#include "../../../test_compare.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef std::pair<const int, double> V;
V ar[] = {
@@ -82,4 +83,13 @@ int main(int, char**) {
#endif
return 0;
+
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
}
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 68d658c2edf85..301db57304d8f 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
@@ -12,7 +12,7 @@
// template <class InputIterator>
// multimap(InputIterator first, InputIterator last,
-// const key_compare& comp, const allocator_type& a);
+// const key_compare& comp, const allocator_type& a); // constexpr since C++26
#include <map>
#include <cassert>
@@ -22,7 +22,8 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef std::pair<const int, double> V;
V ar[] = {
@@ -117,4 +118,13 @@ int main(int, char**) {
#endif
return 0;
+
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
}
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 d229c6f7d5f49..1b28ae6a0233e 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
@@ -12,7 +12,7 @@
// class multimap
-// multimap(multimap&& m);
+// multimap(multimap&& m); // constexpr since C++26
#include <map>
#include <cassert>
@@ -22,7 +22,8 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
typedef std::pair<const int, double> V;
{
typedef test_less<int> C;
@@ -128,4 +129,13 @@ int main(int, char**) {
}
return 0;
+
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
}
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 31ff8ff792566..ea2af4294e9dc 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
@@ -12,7 +12,7 @@
// class multimap
-// multimap(multimap&& m, const allocator_type& a);
+// multimap(multimap&& m, const allocator_type& a); // constexpr since C++26
#include <map>
#include <cassert>
@@ -24,7 +24,8 @@
#include "min_allocator.h"
#include "Counter.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef std::pair<MoveOnly, MoveOnly> V;
typedef std::pair<const MoveOnly, MoveOnly> VC;
@@ -151,4 +152,13 @@ int main(int, char**) {
}
return 0;
+
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
}
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 bbf766eec3e40..0ef6aa0f67978 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
@@ -12,7 +12,7 @@
// class multimap
-// multimap& operator=(multimap&& m);
+// multimap& operator=(multimap&& m); // constexpr since C++26
#include <map>
#include <cassert>
@@ -23,7 +23,8 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef std::pair<MoveOnly, MoveOnly> V;
typedef std::pair<const MoveOnly, MoveOnly> VC;
@@ -98,4 +99,13 @@ int main(int, char**) {
}
return 0;
+
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
}
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 2af0324575d9c..2b53adde08a45 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
@@ -10,7 +10,7 @@
// multimap(multimap&&)
// noexcept(is_nothrow_move_constructible<allocator_type>::value &&
-// is_nothrow_move_constructible<key_compare>::value);
+// is_nothrow_move_constructible<key_compare>::value); // constexpr since C++26
// This tests a conforming extension
@@ -30,7 +30,8 @@ struct some_comp {
bool operator()(const T&, const T&) const { return false; }
};
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
#if defined(_LIBCPP_VERSION)
typedef std::pair<const MoveOnly, MoveOnly> V;
{
@@ -52,4 +53,13 @@ int main(int, char**) {
}
return 0;
+
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
}
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 4391bb36f741f..e5c1a066dc80d 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
@@ -11,7 +11,7 @@
// template <class Key, class T, class Compare, class Allocator, class Predicate>
// typename multimap<Key, T, Compare, Allocator>::size_type
-// erase_if(multimap<Key, T, Compare, Allocator>& c, Predicate pred);
+// erase_if(multimap<Key, T, Compare, Allocator>& c, Predicate pred); // constexpr since C++26
#include <map>
@@ -74,7 +74,8 @@ void test() {
test0<S>({1, 2, 3}, False, {1, 2, 3}, 0);
}
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test_erase() {
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>>>>();
@@ -82,5 +83,13 @@ int main(int, char**) {
test<std::multimap<long, short>>();
test<std::multimap<short, double>>();
+ return true;
+}
+int main(int, char**) {
+ assert(test_erase());
+
+#if TEST_STD_VER >= 26
+ static_assert(test_erase());
+#endif
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 08dfcea99cf5b..2fb17930bcd46 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
@@ -10,7 +10,7 @@
// class multimap
-// void clear() noexcept;
+// void clear() noexcept; // constexpr since C++26
#include <map>
#include <cassert>
@@ -18,7 +18,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef std::multimap<int, double> M;
typedef std::pair<int, double> P;
@@ -60,5 +61,13 @@ int main(int, char**) {
}
#endif
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#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 9a7526c16adf7..e5f38017979af 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
@@ -13,7 +13,7 @@
// class multimap
// template <class... Args>
-// iterator emplace(Args&&... args);
+// iterator emplace(Args&&... args); // constexpr since C++26
#include <map>
#include <cassert>
@@ -23,7 +23,8 @@
#include "DefaultOnly.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef std::multimap<int, DefaultOnly> M;
typedef M::iterator R;
@@ -135,5 +136,13 @@ int main(int, char**) {
assert(m.begin()->second == 3.5);
}
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
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 8b9081082bb23..055461751a925 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
@@ -13,7 +13,7 @@
// class multimap
// template <class... Args>
-// iterator emplace_hint(const_iterator position, Args&&... args);
+// iterator emplace_hint(const_iterator position, Args&&... args); // constexpr since C++26
#include <map>
#include <cassert>
@@ -23,7 +23,8 @@
#include "DefaultOnly.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef std::multimap<int, DefaultOnly> M;
typedef M::iterator R;
@@ -135,5 +136,13 @@ int main(int, char**) {
assert(m.begin()->second == 3.5);
}
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
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 67e957e9e3a72..dabdadd9b4d75 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
@@ -10,7 +10,7 @@
// class multimap
-// iterator erase(const_iterator position);
+// iterator erase(const_iterator position); // constexpr since C++26
#include <map>
#include <cassert>
@@ -25,7 +25,8 @@ struct TemplateConstructor {
bool operator<(const TemplateConstructor&, const TemplateConstructor&) { return false; }
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef std::multimap<int, double> M;
typedef std::pair<int, double> P;
@@ -295,5 +296,13 @@ int main(int, char**) {
}
#endif
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#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 22a34a19d9897..62845c39ebee5 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
@@ -10,7 +10,7 @@
// class multimap
-// iterator erase(const_iterator first, const_iterator last);
+// iterator erase(const_iterator first, const_iterator last); // constexpr since C++26
#include <map>
#include <cassert>
@@ -18,7 +18,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef std::multimap<int, double> M;
typedef std::pair<int, double> P;
@@ -152,5 +153,13 @@ int main(int, char**) {
}
#endif
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#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 1dde462f096a1..933aa8bf983ee 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
@@ -10,7 +10,7 @@
// class multimap
-// size_type erase(const key_type& k);
+// size_type erase(const key_type& k); // constexpr since C++26
#include <map>
#include <cassert>
@@ -18,7 +18,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef std::multimap<int, double> M;
typedef std::pair<int, double> P;
@@ -148,5 +149,13 @@ int main(int, char**) {
}
#endif
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#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 85beba3015e56..e86100b23374d 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
@@ -12,7 +12,7 @@
// class multimap
-// node_type extract(const_iterator);
+// node_type extract(const_iterator); // constexpr since C++26
#include <map>
#include "test_macros.h"
@@ -39,7 +39,8 @@ void test(Container& c) {
assert(c.size() == 0);
}
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
using map_type = std::multimap<int, int>;
map_type m = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}};
@@ -59,5 +60,13 @@ int main(int, char**) {
test(m);
}
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
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 b3027b3b0f727..8fecc135ccc41 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
@@ -12,7 +12,7 @@
// class multimap
-// node_type extract(key_type const&);
+// node_type extract(key_type const&); // constexpr since C++26
#include <map>
#include "test_macros.h"
@@ -43,7 +43,8 @@ void test(Container& c, KeyTypeIter first, KeyTypeIter last) {
}
}
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
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};
@@ -67,5 +68,13 @@ int main(int, char**) {
test(m, std::begin(keys), std::end(keys));
}
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
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 68767d002d0ca..866165ac14b1b 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
@@ -10,7 +10,7 @@
// class multimap
-// insert(...)
+// insert(...) // constexpr since C++26
// UNSUPPORTED: c++03
@@ -20,9 +20,18 @@
#include "container_test_types.h"
#include "../../../map_allocator_requirement_test_templates.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
testMultimapInsert<TCT::multimap<> >();
testMultimapInsertHint<TCT::multimap<> >();
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
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 a6869a73e1e04..e50bb3f49adb6 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
@@ -10,7 +10,7 @@
// class multimap
-// iterator insert(const value_type& v);
+// iterator insert(const value_type& v); // constexpr since C++26
#include <map>
#include <cassert>
@@ -53,7 +53,8 @@ void do_insert_test() {
assert(r->second == 3.5);
}
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef std::multimap<int, double> Container;
do_insert_test<Container>();
@@ -65,5 +66,13 @@ int main(int, char**) {
}
#endif
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#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 a8f40aa2b09e4..ffbb90d258425 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
@@ -12,7 +12,7 @@
// class multimap
-// void insert(initializer_list<value_type> il);
+// void insert(initializer_list<value_type> il); // constexpr since C++26
#include <map>
#include <cassert>
@@ -20,7 +20,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef std::multimap<int, double> C;
typedef C::value_type V;
@@ -66,5 +67,13 @@ int main(int, char**) {
assert(*++i == V(3, 1.5));
}
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
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 ef47d841775d3..f7f7013a02a4a 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
@@ -10,7 +10,7 @@
// class multimap
-// iterator insert(const_iterator position, const value_type& v);
+// iterator insert(const_iterator position, const value_type& v); // constexpr since C++26
#include <map>
#include <cassert>
@@ -53,7 +53,8 @@ void do_insert_hint_test() {
assert(r->second == 4.5);
}
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
do_insert_hint_test<std::multimap<int, double> >();
#if TEST_STD_VER >= 11
{
@@ -62,5 +63,13 @@ int main(int, char**) {
}
#endif
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#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 3f145cc81ff46..bf6a66d2ddbdb 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
@@ -11,7 +11,7 @@
// class multimap
// template <class InputIterator>
-// void insert(InputIterator first, InputIterator last);
+// void insert(InputIterator first, InputIterator last); // constexpr since C++26
#include <array>
#include <cassert>
@@ -195,13 +195,18 @@ void test_alloc() {
}
}
-void test() {
+TEST_CONSTEXPR_CXX26
+bool test() {
test_alloc<cpp17_input_iterator<std::pair<const int, int>*>, std::allocator<std::pair<const int, int> > >();
test_alloc<cpp17_input_iterator<std::pair<const int, int>*>, min_allocator<std::pair<const int, int> > >();
+ return true;
}
int main(int, char**) {
- test();
+ assert(test());
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#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 a56f237eb63ac..dac06ebde844e 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
@@ -13,7 +13,7 @@
// class multimap
// template <class P>
-// iterator insert(const_iterator position, P&& p);
+// iterator insert(const_iterator position, P&& p); // constexpr since C++26
#include <map>
#include <cassert>
@@ -53,7 +53,8 @@ void do_insert_rv_test() {
assert(r->second == 2);
}
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
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> >();
@@ -93,5 +94,13 @@ int main(int, char**) {
assert(r->second == 2);
}
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
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 a488bc6617ccb..f24c4c101347c 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
@@ -12,7 +12,7 @@
// class multimap
-// iterator insert(node_type&&);
+// iterator insert(node_type&&); // constexpr since C++26
#include <map>
#include <type_traits>
@@ -64,11 +64,20 @@ void test(Container& c) {
}
}
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test_insert_node_type() {
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 true;
+}
+int main(int, char**) {
+ assert(test_insert_node_type());
+
+#if TEST_STD_VER >= 26
+ static_assert(test_insert_node_type());
+#endif
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 7e855801045b8..fdb0a2f997c7a 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
@@ -12,7 +12,7 @@
// class multimap
-// iterator insert(const_iterator hint, node_type&&);
+// iterator insert(const_iterator hint, node_type&&); // constexpr since C++26
#include <map>
#include "test_macros.h"
@@ -50,11 +50,20 @@ void test(Container& c) {
}
}
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
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 true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
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 efd257a4f2c0e..4956fcf8be149 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
@@ -13,14 +13,15 @@
// <map>
// template<container-compatible-range<value_type> R>
-// void insert_range(R&& rg); // C++23
+// void insert_range(R&& rg); // C++23 // constexpr since C++26
#include <map>
#include "../../../insert_range_maps_sets.h"
#include "test_macros.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
// 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>;
@@ -37,5 +38,13 @@ int main(int, char**) {
test_map_insert_range_exception_safety_throwing_copy<std::multimap>();
test_assoc_map_insert_range_exception_safety_throwing_allocator<std::multimap, int, int>();
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
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 bf32b996e1836..b152ab176c132 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
@@ -13,7 +13,7 @@
// class multimap
// template <class P>
-// iterator insert(P&& p);
+// iterator insert(P&& p); // constexpr since C++26
#include <map>
#include <cassert>
@@ -53,7 +53,8 @@ void do_insert_rv_test() {
assert(r->second == 3);
}
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
do_insert_rv_test<std::multimap<int, MoveOnly>>();
{
typedef std::multimap<int, MoveOnly, std::less<int>, min_allocator<std::pair<const int, MoveOnly>>> M;
@@ -88,5 +89,13 @@ int main(int, char**) {
assert(r->second == 3);
}
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
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 d7952763ca9bb..9f4426e5a4e98 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
@@ -13,13 +13,16 @@
// class multimap
// template <class C2>
-// void merge(map<key_type, value_type, C2, allocator_type>& source);
+// void merge(map<key_type, value_type, C2, allocator_type>& source); // constexpr since C++26
+
// template <class C2>
-// void merge(map<key_type, value_type, C2, allocator_type>&& source);
+// void merge(map<key_type, value_type, C2, allocator_type>&& source); // constexpr since C++26
+
// template <class C2>
-// void merge(multimap<key_type, value_type, C2, allocator_type>& source);
+// void merge(multimap<key_type, value_type, C2, allocator_type>& source); // constexpr since C++26
+
// template <class C2>
-// void merge(multimap<key_type, value_type, C2, allocator_type>&& source);
+// void merge(multimap<key_type, value_type, C2, allocator_type>&& source); // constexpr since C++26
#include <map>
#include <cassert>
@@ -46,7 +49,8 @@ struct throw_comparator {
};
#endif
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
std::multimap<int, int> src{{1, 0}, {3, 0}, {5, 0}};
std::multimap<int, int> dst{{2, 0}, {4, 0}, {5, 0}};
@@ -135,5 +139,14 @@ int main(int, char**) {
first.merge(std::move(second));
}
}
+
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.nonmember/compare.three_way.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.nonmember/compare.three_way.pass.cpp
index c7febc362cd63..5ada9b9c107f5 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.nonmember/compare.three_way.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.nonmember/compare.three_way.pass.cpp
@@ -14,15 +14,25 @@
// template<class Key, class T, class Compare, class Allocator>
// synth-three-way-result<pair<const Key, T>>
// operator<=>(const multimap<Key, T, Compare, Allocator>& x,
-// const multimap<Key, T, Compare, Allocator>& y);
+// const multimap<Key, T, Compare, Allocator>& y); // constexpr since C++26
#include <cassert>
#include <map>
#include "test_container_comparisons.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
assert(test_ordered_map_container_spaceship<std::multimap>());
// `std::multimap` is not constexpr, so no `static_assert` test here.
+
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
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 fe5f401e19b5c..f7799b0b314c6 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
@@ -10,27 +10,32 @@
// template<class Key, class T, class Compare, class Alloc>
// bool operator==(const std::multimap<Key, T, Compare, Alloc>& lhs,
-// const std::multimap<Key, T, Compare, Alloc>& rhs);
+// const std::multimap<Key, T, Compare, Alloc>& rhs); // constexpr since C++26
+
//
// template<class Key, class T, class Compare, class Alloc>
// bool operator!=(const std::multimap<Key, T, Compare, Alloc>& lhs,
-// const std::multimap<Key, T, Compare, Alloc>& rhs);
+// const std::multimap<Key, T, Compare, Alloc>& rhs); // constexpr since C++26
+
//
// template<class Key, class T, class Compare, class Alloc>
// bool operator<(const std::multimap<Key, T, Compare, Alloc>& lhs,
-// const std::multimap<Key, T, Compare, Alloc>& rhs);
+// const std::multimap<Key, T, Compare, Alloc>& rhs); // constexpr since C++26
+
//
// template<class Key, class T, class Compare, class Alloc>
// bool operator>(const std::multimap<Key, T, Compare, Alloc>& lhs,
-// const std::multimap<Key, T, Compare, Alloc>& rhs);
+// const std::multimap<Key, T, Compare, Alloc>& rhs); // constexpr since C++26
+
//
// template<class Key, class T, class Compare, class Alloc>
// bool operator<=(const std::multimap<Key, T, Compare, Alloc>& lhs,
-// const std::multimap<Key, T, Compare, Alloc>& rhs);
+// const std::multimap<Key, T, Compare, Alloc>& rhs); // constexpr since C++26
+
//
// template<class Key, class T, class Compare, class Alloc>
// bool operator>=(const std::multimap<Key, T, Compare, Alloc>& lhs,
-// const std::multimap<Key, T, Compare, Alloc>& rhs);
+// const std::multimap<Key, T, Compare, Alloc>& rhs); // constexpr since C++26
#include <map>
#include <cassert>
@@ -38,7 +43,8 @@
#include "test_comparisons.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
typedef std::multimap<int, std::string> map_type;
typedef map_type::value_type value_type;
{
@@ -86,5 +92,14 @@ int main(int, char**) {
const map_type &cm1 = m1, cm2 = m2;
assert(testComparisons(cm1, cm2, false, true));
}
+
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
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 29cdecd6fef48..7157d1746127f 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
@@ -8,13 +8,14 @@
// <map>
-// key_compare key_comp() const;
+// key_compare key_comp() const; // constexpr since C++26
#include <map>
#include <cassert>
#include <string>
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
typedef std::multimap<int, std::string> map_type;
map_type m;
@@ -26,5 +27,13 @@ int main(int, char**) {
assert(cm.key_comp()(i1->first, i2->first));
assert(!cm.key_comp()(i2->first, i1->first));
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
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 542ed6d71c8d1..7013fb1c700d7 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
@@ -8,13 +8,14 @@
// <map>
-// value_compare value_comp() const;
+// value_compare value_comp() const; // constexpr since C++26
#include <map>
#include <cassert>
#include <string>
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
typedef std::multimap<int, std::string> map_type;
map_type m;
@@ -26,5 +27,13 @@ int main(int, char**) {
assert(cm.value_comp()(*i1, *i2));
assert(!cm.value_comp()(*i2, *i1));
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
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 8dfda74577e35..6ca22198b5c8e 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
@@ -10,7 +10,7 @@
// class multimap
-// size_type count(const key_type& k) const;
+// size_type count(const key_type& k) const; // constexpr since C++26
#include <map>
#include <cassert>
@@ -20,7 +20,8 @@
#include "private_constructor.h"
#include "is_transparent.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
typedef std::pair<const int, double> V;
{
typedef std::multimap<int, double> M;
@@ -139,5 +140,13 @@ int main(int, char**) {
}
#endif
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#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 36f0ac2647ba3..6b0ab0036e4c6 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
@@ -12,7 +12,8 @@
// class multimap
-// size_type count(const key_type& k) const;
+// size_type count(const key_type& k) const; // constexpr since C++26
+
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
@@ -24,7 +25,8 @@
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef std::multimap<int, double, transparent_less> M;
assert(M().count(C2Int{5}) == 0);
@@ -38,5 +40,13 @@ int main(int, char**) {
assert(M().count(C2Int{5}) == 0);
}
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
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 d8dc81884388e..68d824e91334b 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
@@ -13,7 +13,7 @@
// class multimap
// template<typename K>
-// size_type count(const K& x) const; // C++14
+// size_type count(const K& x) const; // C++14 // constexpr since C++26
#include <cassert>
#include <map>
@@ -29,11 +29,20 @@ struct Comp {
bool operator()(int lhs, const std::pair<int, int>& rhs) const { return lhs < rhs.first; }
};
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
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);
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
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 d06a04e40c6b0..fd355bc711981 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
@@ -11,7 +11,7 @@
// class multimap
// pair<iterator, iterator> equal_range(const key_type& k);
-// pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
+// pair<const_iterator, const_iterator> equal_range(const key_type& k) const; // constexpr since C++26
#include <map>
#include <cassert>
@@ -21,7 +21,8 @@
#include "private_constructor.h"
#include "is_transparent.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
typedef std::pair<const int, double> V;
{
typedef std::multimap<int, double> M;
@@ -228,5 +229,13 @@ int main(int, char**) {
}
#endif
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#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 a362c03e26385..be5ef23690f82 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
@@ -13,7 +13,8 @@
// class multimap
// pair<iterator, iterator> equal_range(const key_type& k);
-// pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
+// pair<const_iterator, const_iterator> equal_range(const key_type& k) const; // constexpr since C++26
+
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
@@ -25,7 +26,8 @@
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef std::multimap<int, double, transparent_less> M;
typedef std::pair<typename M::iterator, typename M::iterator> P;
@@ -48,5 +50,13 @@ int main(int, char**) {
assert(result.first == result.second);
}
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
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 f2caf36b1a4ee..dd5ba0590eed5 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
@@ -13,9 +13,11 @@
// class multimap
// template<typename K>
-// pair<iterator,iterator> equal_range(const K& x); // C++14
+// pair<iterator,iterator> equal_range(const K& x); // C++14 // constexpr since C++26
+
// template<typename K>
-// pair<const_iterator,const_iterator> equal_range(const K& x) const;
+// pair<const_iterator,const_iterator> equal_range(const K& x) const; // constexpr since C++26
+
// // C++14
#include <cassert>
@@ -32,7 +34,8 @@ struct Comp {
bool operator()(int lhs, const std::pair<int, int>& rhs) const { return lhs < rhs.first; }
};
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
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);
@@ -45,5 +48,13 @@ int main(int, char**) {
assert(nels == 3);
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
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 7939e77da308d..43af30c6db286 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
@@ -10,8 +10,9 @@
// class multimap
-// iterator find(const key_type& k);
-// const_iterator find(const key_type& k) const;
+// iterator find(const key_type& k); // constexpr since C++26
+
+// const_iterator find(const key_type& k) const; // constexpr since C++26
#include <map>
#include <cassert>
@@ -30,7 +31,8 @@ bool iter_in_range(Iter first, Iter last, Iter to_find) {
return false;
}
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
typedef std::pair<const int, double> V;
{
typedef std::multimap<int, double> M;
@@ -186,5 +188,13 @@ int main(int, char**) {
}
#endif
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#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 ccb0900e76835..9df8f89c50bb1 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
@@ -12,8 +12,10 @@
// class multimap
-// iterator find(const key_type& k);
-// const_iterator find(const key_type& k) const;
+// iterator find(const key_type& k); // constexpr since C++26
+
+// const_iterator find(const key_type& k) const; // constexpr since C++26
+
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
@@ -25,7 +27,8 @@
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef std::multimap<int, double, transparent_less> M;
M example;
@@ -42,5 +45,13 @@ int main(int, char**) {
assert(example.find(C2Int{5}) == example.end());
}
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
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 704cfff775884..911bddc554d8c 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
@@ -10,8 +10,9 @@
// class multimap
-// iterator lower_bound(const key_type& k);
-// const_iterator lower_bound(const key_type& k) const;
+// iterator lower_bound(const key_type& k); // constexpr since C++26
+
+// const_iterator lower_bound(const key_type& k) const; // constexpr since C++26
#include <map>
#include <cassert>
@@ -21,7 +22,8 @@
#include "private_constructor.h"
#include "is_transparent.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
typedef std::pair<const int, double> V;
{
typedef std::multimap<int, double> M;
@@ -178,5 +180,13 @@ int main(int, char**) {
#endif
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
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 4b4853062001f..d3acdd66319be 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
@@ -12,8 +12,10 @@
// class multimap
-// iterator lower_bound(const key_type& k);
-// const_iterator lower_bound(const key_type& k) const;
+// iterator lower_bound(const key_type& k); // constexpr since C++26
+
+// const_iterator lower_bound(const key_type& k) const; // constexpr since C++26
+
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
@@ -25,7 +27,8 @@
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef std::multimap<int, double, transparent_less> M;
M example;
@@ -42,5 +45,13 @@ int main(int, char**) {
assert(example.lower_bound(C2Int{5}) == example.end());
}
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
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 164cfc7c88ac9..62bc1c11bc5ad 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
@@ -10,8 +10,9 @@
// class multimap
-// iterator upper_bound(const key_type& k);
-// const_iterator upper_bound(const key_type& k) const;
+// iterator upper_bound(const key_type& k); // constexpr since C++26
+
+// const_iterator upper_bound(const key_type& k) const; // constexpr since C++26
#include <map>
#include <cassert>
@@ -21,7 +22,8 @@
#include "private_constructor.h"
#include "is_transparent.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
typedef std::pair<const int, double> V;
{
typedef std::multimap<int, double> M;
@@ -177,5 +179,13 @@ int main(int, char**) {
#endif
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
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 f2ae94577b6c1..e8729d593edb0 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
@@ -12,8 +12,10 @@
// class multimap
-// iterator upper_bound(const key_type& k);
-// const_iterator upper_bound(const key_type& k) const;
+// iterator upper_bound(const key_type& k); // constexpr since C++26
+
+// const_iterator upper_bound(const key_type& k) const; // constexpr since C++26
+
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
@@ -25,7 +27,8 @@
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef std::multimap<int, double, transparent_less> M;
M example;
@@ -42,5 +45,13 @@ int main(int, char**) {
assert(example.upper_bound(C2Int{5}) == example.end());
}
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
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 e3ebe7980dd52..9acee383a56dd 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
@@ -10,7 +10,7 @@
// class multimap
-// void swap(multimap& m);
+// void swap(multimap& m); // constexpr since C++26
#include <map>
#include <cassert>
@@ -18,7 +18,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
typedef std::pair<const int, double> V;
{
typedef std::multimap<int, double> M;
@@ -109,5 +110,13 @@ int main(int, char**) {
}
#endif
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#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 7e771c9a034d9..855bfc0919549 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
@@ -12,7 +12,7 @@
// template <class Key, class T, class Compare, class Allocator>
// void
-// swap(multimap<Key, T, Compare, Allocator>& x, multimap<Key, T, Compare, Allocator>& y);
+// swap(multimap<Key, T, Compare, Allocator>& x, multimap<Key, T, Compare, Allocator>& y); // constexpr since C++26
#include <map>
#include <cassert>
@@ -21,7 +21,8 @@
#include "../../../test_compare.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
typedef std::pair<const int, double> V;
{
typedef std::multimap<int, double> M;
@@ -166,5 +167,13 @@ int main(int, char**) {
}
#endif
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#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 cc8af8bf3a30f..c194ba9f13c23 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
@@ -16,7 +16,7 @@
//
// In C++17, the standard says that swap shall have:
// noexcept(allocator_traits<Allocator>::is_always_equal::value &&
-// noexcept(swap(declval<Compare&>(), declval<Compare&>())));
+// noexcept(swap(declval<Compare&>(), declval<Compare&>()))); // constexpr since C++26
// This tests a conforming extension
@@ -86,7 +86,8 @@ struct some_alloc3 {
typedef std::false_type is_always_equal;
};
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
typedef std::pair<const MoveOnly, MoveOnly> V;
{
typedef std::multimap<MoveOnly, MoveOnly> C;
@@ -132,5 +133,13 @@ int main(int, char**) {
# endif // _LIBCPP_VERSION
#endif
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#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 67b4743097da8..08afcddacdb83 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
@@ -10,7 +10,7 @@
// class value_compare
-// bool operator()( const value_type& lhs, const value_type& rhs ) const;
+// bool operator()( const value_type& lhs, const value_type& rhs ) const; // constexpr since C++26
#include <map>
#include <cassert>
@@ -27,7 +27,8 @@ struct CallCompMember : MMap::value_compare {
}
};
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
typedef std::multimap<int, std::string> map_type;
map_type m;
@@ -43,5 +44,13 @@ int main(int, char**) {
assert(!vc(*i2, *i1));
assert(!call_comp(*i2, *i1));
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
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 bd1165e61aa9b..7938217c3d27a 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
@@ -17,7 +17,8 @@
#include "test_macros.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
typedef std::multimap<int, std::string> map_type;
typedef map_type::value_compare value_compare;
typedef map_type::value_type value_type;
@@ -26,5 +27,13 @@ int main(int, char**) {
ASSERT_SAME_TYPE(value_compare::first_argument_type, value_type);
ASSERT_SAME_TYPE(value_compare::second_argument_type, value_type);
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
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 77bd807db6b10..430c81e3254fb 100644
--- a/libcxx/test/std/containers/associative/multimap/size.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/size.pass.cpp
@@ -10,7 +10,7 @@
// class multimap
-// size_type size() const;
+// size_type size() const; // constexpr since C++26
#include <map>
#include <cassert>
@@ -18,7 +18,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef std::multimap<int, double> M;
M m;
@@ -56,5 +57,13 @@ int main(int, char**) {
}
#endif
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#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 2b182c36c1a7d..48ad6eae69988 100644
--- a/libcxx/test/std/containers/associative/multimap/types.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/types.pass.cpp
@@ -34,7 +34,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef std::multimap<int, double> C;
static_assert((std::is_same<C::key_type, int>::value), "");
@@ -67,5 +68,13 @@ int main(int, char**) {
}
#endif
+ return true;
+}
+int main(int, char**) {
+ assert(test());
+
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
>From c2b7c58734a71670541bb6ef21a4b9027d8d5405 Mon Sep 17 00:00:00 2001
From: Vinay Deshmukh <vinay_deshmukh at outlook.com>
Date: Sat, 18 Oct 2025 09:42:30 -0400
Subject: [PATCH 04/11] find . -name "*.cpp" -type f -exec sed -i '' -E 's/
assert\(test\(\)\);/ test\(\);/' {} +
---
libcxx/test/std/containers/associative/multimap/empty.pass.cpp | 2 +-
.../std/containers/associative/multimap/get_allocator.pass.cpp | 2 +-
.../containers/associative/multimap/incomplete_type.pass.cpp | 2 +-
.../test/std/containers/associative/multimap/iterator.pass.cpp | 2 +-
.../test/std/containers/associative/multimap/max_size.pass.cpp | 2 +-
.../associative/multimap/multimap.cons/alloc.pass.cpp | 2 +-
.../multimap/multimap.cons/assign_initializer_list.pass.cpp | 2 +-
.../associative/multimap/multimap.cons/compare.pass.cpp | 2 +-
.../associative/multimap/multimap.cons/compare_alloc.pass.cpp | 2 +-
.../containers/associative/multimap/multimap.cons/copy.pass.cpp | 2 +-
.../associative/multimap/multimap.cons/copy_alloc.pass.cpp | 2 +-
.../associative/multimap/multimap.cons/copy_assign.pass.cpp | 2 +-
.../associative/multimap/multimap.cons/deduct.pass.cpp | 2 +-
.../associative/multimap/multimap.cons/deduct_const.pass.cpp | 2 +-
.../associative/multimap/multimap.cons/default.pass.cpp | 2 +-
.../multimap/multimap.cons/default_noexcept.pass.cpp | 2 +-
.../associative/multimap/multimap.cons/dtor_noexcept.pass.cpp | 2 +-
.../associative/multimap/multimap.cons/from_range.pass.cpp | 2 +-
.../multimap/multimap.cons/initializer_list.pass.cpp | 2 +-
.../multimap/multimap.cons/initializer_list_compare.pass.cpp | 2 +-
.../multimap.cons/initializer_list_compare_alloc.pass.cpp | 2 +-
.../associative/multimap/multimap.cons/iter_iter.pass.cpp | 2 +-
.../associative/multimap/multimap.cons/iter_iter_comp.pass.cpp | 2 +-
.../multimap/multimap.cons/iter_iter_comp_alloc.pass.cpp | 2 +-
.../containers/associative/multimap/multimap.cons/move.pass.cpp | 2 +-
.../associative/multimap/multimap.cons/move_alloc.pass.cpp | 2 +-
.../associative/multimap/multimap.cons/move_assign.pass.cpp | 2 +-
.../associative/multimap/multimap.cons/move_noexcept.pass.cpp | 2 +-
.../associative/multimap/multimap.modifiers/clear.pass.cpp | 2 +-
.../associative/multimap/multimap.modifiers/emplace.pass.cpp | 2 +-
.../multimap/multimap.modifiers/emplace_hint.pass.cpp | 2 +-
.../associative/multimap/multimap.modifiers/erase_iter.pass.cpp | 2 +-
.../multimap/multimap.modifiers/erase_iter_iter.pass.cpp | 2 +-
.../associative/multimap/multimap.modifiers/erase_key.pass.cpp | 2 +-
.../multimap/multimap.modifiers/extract_iterator.pass.cpp | 2 +-
.../multimap/multimap.modifiers/extract_key.pass.cpp | 2 +-
.../multimap.modifiers/insert_allocator_requirements.pass.cpp | 2 +-
.../associative/multimap/multimap.modifiers/insert_cv.pass.cpp | 2 +-
.../multimap.modifiers/insert_initializer_list.pass.cpp | 2 +-
.../multimap/multimap.modifiers/insert_iter_cv.pass.cpp | 2 +-
.../multimap/multimap.modifiers/insert_iter_iter.pass.cpp | 2 +-
.../multimap/multimap.modifiers/insert_iter_rv.pass.cpp | 2 +-
.../multimap/multimap.modifiers/insert_node_type_hint.pass.cpp | 2 +-
.../multimap/multimap.modifiers/insert_range.pass.cpp | 2 +-
.../associative/multimap/multimap.modifiers/insert_rv.pass.cpp | 2 +-
.../associative/multimap/multimap.modifiers/merge.pass.cpp | 2 +-
.../multimap/multimap.nonmember/compare.three_way.pass.cpp | 2 +-
.../associative/multimap/multimap.nonmember/op_compare.pass.cpp | 2 +-
.../associative/multimap/multimap.observers/key_comp.pass.cpp | 2 +-
.../associative/multimap/multimap.observers/value_comp.pass.cpp | 2 +-
.../containers/associative/multimap/multimap.ops/count.pass.cpp | 2 +-
.../associative/multimap/multimap.ops/count0.pass.cpp | 2 +-
.../multimap/multimap.ops/count_transparent.pass.cpp | 2 +-
.../associative/multimap/multimap.ops/equal_range.pass.cpp | 2 +-
.../associative/multimap/multimap.ops/equal_range0.pass.cpp | 2 +-
.../multimap/multimap.ops/equal_range_transparent.pass.cpp | 2 +-
.../containers/associative/multimap/multimap.ops/find.pass.cpp | 2 +-
.../containers/associative/multimap/multimap.ops/find0.pass.cpp | 2 +-
.../associative/multimap/multimap.ops/lower_bound.pass.cpp | 2 +-
.../associative/multimap/multimap.ops/lower_bound0.pass.cpp | 2 +-
.../associative/multimap/multimap.ops/upper_bound.pass.cpp | 2 +-
.../associative/multimap/multimap.ops/upper_bound0.pass.cpp | 2 +-
.../associative/multimap/multimap.special/member_swap.pass.cpp | 2 +-
.../multimap/multimap.special/non_member_swap.pass.cpp | 2 +-
.../multimap/multimap.special/swap_noexcept.pass.cpp | 2 +-
.../associative/multimap/multimap.value_compare/invoke.pass.cpp | 2 +-
.../associative/multimap/multimap.value_compare/types.pass.cpp | 2 +-
libcxx/test/std/containers/associative/multimap/size.pass.cpp | 2 +-
libcxx/test/std/containers/associative/multimap/types.pass.cpp | 2 +-
69 files changed, 69 insertions(+), 69 deletions(-)
diff --git a/libcxx/test/std/containers/associative/multimap/empty.pass.cpp b/libcxx/test/std/containers/associative/multimap/empty.pass.cpp
index 0064990ffb49a..16bc5f49a1f92 100644
--- a/libcxx/test/std/containers/associative/multimap/empty.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/empty.pass.cpp
@@ -44,7 +44,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 9da0baabcd0d0..b11c83f8fb3e4 100644
--- a/libcxx/test/std/containers/associative/multimap/get_allocator.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/get_allocator.pass.cpp
@@ -36,7 +36,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 46ab176a6c065..c7f0bbb6029f0 100644
--- a/libcxx/test/std/containers/associative/multimap/incomplete_type.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/incomplete_type.pass.cpp
@@ -37,7 +37,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
diff --git a/libcxx/test/std/containers/associative/multimap/iterator.pass.cpp b/libcxx/test/std/containers/associative/multimap/iterator.pass.cpp
index 7fd50ade0cde9..31f7e7e73cc5f 100644
--- a/libcxx/test/std/containers/associative/multimap/iterator.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/iterator.pass.cpp
@@ -171,7 +171,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 38befc8b215f4..4e63aa139aa8c 100644
--- a/libcxx/test/std/containers/associative/multimap/max_size.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/max_size.pass.cpp
@@ -49,7 +49,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 237ac723a827d..1d7af0ab1ffff 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
@@ -52,7 +52,7 @@ bool test() {
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 678a346ab610e..2c72d14f84324 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
@@ -62,7 +62,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 c4646741d35fe..172f305641737 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
@@ -41,7 +41,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 5a5e3f02abc06..c5ee100b23f75 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
@@ -55,7 +55,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 5ac74e2e18c3e..622db9c04451b 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
@@ -137,7 +137,7 @@ bool test() {
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
#endif
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 85edf2bce3b1b..8212368de6fb2 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
@@ -107,7 +107,7 @@ bool test() {
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 4410309fc4536..7557d2ff00845 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
@@ -293,7 +293,7 @@ bool test() {
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
#endif
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 534c6a76f0a6c..609658ac68fcd 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
@@ -220,7 +220,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 d39d5ee61d440..d3f836ad5a60a 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
@@ -109,7 +109,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 3c7e9fd797502..a9defa8467520 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
@@ -57,7 +57,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 5f3f96a7c490f..7dde8ba1cdb21 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
@@ -59,7 +59,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 c9e706adc4f7e..661b945d6035f 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
@@ -53,7 +53,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 55485e37eb9b6..e742e385d4801 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
@@ -48,7 +48,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 3b7948f86d808..ec0d4be6f57bb 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
@@ -62,7 +62,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 761b6c50c122a..e4576f5536d96 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
@@ -66,7 +66,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 ab4525f195bba..08d885aa165de 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
@@ -114,7 +114,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 a67eb64ad1f31..b92455a0cd06d 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
@@ -112,7 +112,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 3343070015b27..82693683b2633 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
@@ -87,7 +87,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 301db57304d8f..2e0b689399279 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
@@ -122,7 +122,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 1b28ae6a0233e..5bd983d69573f 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
@@ -133,7 +133,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 ea2af4294e9dc..3aeeaa26ca04d 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
@@ -156,7 +156,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 0ef6aa0f67978..0319463bcb9d2 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
@@ -103,7 +103,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 2b53adde08a45..06da43dde5241 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
@@ -57,7 +57,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 2fb17930bcd46..5517f0f5e6408 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
@@ -64,7 +64,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 e5f38017979af..0ee315975c7c7 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
@@ -139,7 +139,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 055461751a925..f719cdb92ea10 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
@@ -139,7 +139,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 dabdadd9b4d75..bdbfa55df4972 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
@@ -299,7 +299,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 62845c39ebee5..94e32323b6cf1 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
@@ -156,7 +156,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 933aa8bf983ee..7a45890adfd86 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
@@ -152,7 +152,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 e86100b23374d..8b9760f2f3e32 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
@@ -63,7 +63,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 8fecc135ccc41..ba9fd4a76d7bb 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
@@ -71,7 +71,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 866165ac14b1b..a8ea207b770ff 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
@@ -28,7 +28,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 e50bb3f49adb6..9b5b9ef33fec4 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
@@ -69,7 +69,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 ffbb90d258425..7935c2fffe3f4 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
@@ -70,7 +70,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 f7f7013a02a4a..6bf4fad73807f 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
@@ -66,7 +66,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 bf6a66d2ddbdb..130207e2ea44f 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
@@ -203,7 +203,7 @@ bool test() {
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
#endif
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 dac06ebde844e..c24f852ce22f5 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
@@ -97,7 +97,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 fdb0a2f997c7a..225811bef2c24 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
@@ -60,7 +60,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 4956fcf8be149..57ad02822f931 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
@@ -41,7 +41,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 b152ab176c132..cd60b44cadb33 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
@@ -92,7 +92,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 9f4426e5a4e98..a276ba171dbb6 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
@@ -143,7 +143,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.nonmember/compare.three_way.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.nonmember/compare.three_way.pass.cpp
index 5ada9b9c107f5..f5fb607d60dd6 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.nonmember/compare.three_way.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.nonmember/compare.three_way.pass.cpp
@@ -29,7 +29,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 f7799b0b314c6..7696d68b42391 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
@@ -96,7 +96,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 7157d1746127f..0185028d1f8c7 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
@@ -30,7 +30,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 7013fb1c700d7..1fca7be8a46e8 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
@@ -30,7 +30,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 6ca22198b5c8e..b5a8b617f48b3 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
@@ -143,7 +143,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 6b0ab0036e4c6..2262c8eee96aa 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
@@ -43,7 +43,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 68d824e91334b..33ec954d8746d 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
@@ -39,7 +39,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 fd355bc711981..617ef2b0b5d34 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
@@ -232,7 +232,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 be5ef23690f82..f9d70b5cb4956 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
@@ -53,7 +53,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 dd5ba0590eed5..e0155f6b9f913 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
@@ -51,7 +51,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 43af30c6db286..8045d0471f242 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
@@ -191,7 +191,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 9df8f89c50bb1..4b30ebaf30a6e 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
@@ -48,7 +48,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 911bddc554d8c..04cfe545e49a3 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
@@ -183,7 +183,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 d3acdd66319be..058815f7712d8 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
@@ -48,7 +48,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 62bc1c11bc5ad..8df7c3d2b76ad 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
@@ -182,7 +182,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 e8729d593edb0..e53efd9b5e8b6 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
@@ -48,7 +48,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 9acee383a56dd..b4a5f2e1fa6f0 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
@@ -113,7 +113,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 855bfc0919549..5912e79501fa4 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
@@ -170,7 +170,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 c194ba9f13c23..0277d02e367a7 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
@@ -136,7 +136,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 08afcddacdb83..bc8b52949d9b9 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
@@ -47,7 +47,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
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 7938217c3d27a..6bc756e8fc96b 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
@@ -30,7 +30,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
diff --git a/libcxx/test/std/containers/associative/multimap/size.pass.cpp b/libcxx/test/std/containers/associative/multimap/size.pass.cpp
index 430c81e3254fb..98c966bf80368 100644
--- a/libcxx/test/std/containers/associative/multimap/size.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/size.pass.cpp
@@ -60,7 +60,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
diff --git a/libcxx/test/std/containers/associative/multimap/types.pass.cpp b/libcxx/test/std/containers/associative/multimap/types.pass.cpp
index 48ad6eae69988..a6238e6803b35 100644
--- a/libcxx/test/std/containers/associative/multimap/types.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/types.pass.cpp
@@ -71,7 +71,7 @@ bool test() {
return true;
}
int main(int, char**) {
- assert(test());
+ test();
#if TEST_STD_VER >= 26
static_assert(test());
>From aa4244f3e8a83c1afe02a46f01fc4d3a8974687d Mon Sep 17 00:00:00 2001
From: Vinay Deshmukh <vinay_deshmukh at outlook.com>
Date: Sat, 18 Oct 2025 10:23:45 -0400
Subject: [PATCH 05/11] multimap.cons WIP
---
.../associative/multimap/multimap.cons/dtor_noexcept.pass.cpp | 2 --
.../associative/multimap/multimap.cons/from_range.pass.cpp | 1 +
2 files changed, 1 insertion(+), 2 deletions(-)
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 661b945d6035f..9bfa5de90cdb0 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
@@ -48,8 +48,6 @@ bool test() {
}
#endif // _LIBCPP_VERSION
- return 0;
-
return true;
}
int main(int, char**) {
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 e742e385d4801..407e98ff585c3 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,6 +22,7 @@
#include "../../from_range_associative_containers.h"
#include "test_macros.h"
+TEST_CONSTEXPR_CXX26
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'}};
>From bb5c90d47e0b67f98c7a439fc3c8f9049f06e3e4 Mon Sep 17 00:00:00 2001
From: Vinay Deshmukh <vinay_deshmukh at outlook.com>
Date: Sat, 18 Oct 2025 12:17:03 -0400
Subject: [PATCH 06/11] multimap.cons excep move_alloc and move_assign
---
libcxx/include/__tree | 18 ++++++++++--------
.../multimap/multimap.cons/copy.pass.cpp | 2 +-
.../multimap/multimap.cons/copy_alloc.pass.cpp | 2 +-
.../multimap.cons/copy_assign.pass.cpp | 17 +++++++++++++----
.../multimap/multimap.cons/deduct.pass.cpp | 2 --
.../multimap.cons/deduct_const.pass.cpp | 2 --
.../multimap/multimap.cons/default.pass.cpp | 2 --
.../multimap.cons/default_noexcept.pass.cpp | 2 --
.../multimap/multimap.cons/from_range.pass.cpp | 2 --
.../multimap.cons/initializer_list.pass.cpp | 2 --
.../initializer_list_compare.pass.cpp | 2 --
.../initializer_list_compare_alloc.pass.cpp | 2 --
.../multimap/multimap.cons/iter_iter.pass.cpp | 2 --
.../multimap.cons/iter_iter_comp.pass.cpp | 2 --
.../iter_iter_comp_alloc.pass.cpp | 2 --
.../multimap/multimap.cons/move.pass.cpp | 2 --
.../multimap/multimap.cons/move_alloc.pass.cpp | 2 --
.../multimap.cons/move_assign.pass.cpp | 2 --
.../multimap.cons/move_noexcept.pass.cpp | 2 --
19 files changed, 25 insertions(+), 44 deletions(-)
diff --git a/libcxx/include/__tree b/libcxx/include/__tree
index ecaa72f591622..e41627bc4b820 100644
--- a/libcxx/include/__tree
+++ b/libcxx/include/__tree
@@ -1120,20 +1120,22 @@ public:
return;
if (__root() == nullptr) { // Make sure we always have a root node
- __insert_node_at(
- __end_node(), __end_node()->__left_, static_cast<__node_base_pointer>(__construct_node(*__first).release()));
+ __insert_node_at(__end_node(),
+ __end_node()->__left_,
+ std::__static_fancy_pointer_cast<__node_base_pointer>(__construct_node(*__first).release()));
++__first;
}
- auto __max_node = static_cast<__node_pointer>(std::__tree_max(static_cast<__node_base_pointer>(__root())));
+ auto __max_node = std::__static_fancy_pointer_cast<__node_pointer>(
+ std::__tree_max(std::__static_fancy_pointer_cast<__node_base_pointer>(__root())));
for (; __first != __last; ++__first) {
__node_holder __nd = __construct_node(*__first);
// Always check the max node first. This optimizes for sorted ranges inserted at the end.
if (!value_comp()(__nd->__get_value(), __max_node->__get_value())) { // __node >= __max_val
- __insert_node_at(static_cast<__end_node_pointer>(__max_node),
+ __insert_node_at(std::__static_fancy_pointer_cast<__end_node_pointer>(__max_node),
__max_node->__right_,
- static_cast<__node_base_pointer>(__nd.get()));
+ std::__static_fancy_pointer_cast<__node_base_pointer>(__nd.get()));
__max_node = __nd.release();
} else {
__end_node_pointer __parent;
@@ -1841,7 +1843,7 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf_high(__end_node_pointer& __parent
}
} else {
if (__nd->__right_ != nullptr)
- __nd = static_cast<__node_pointer>(__nd->__right_);
+ __nd = std::__static_fancy_pointer_cast<__node_pointer>(__nd->__right_);
else {
__parent = std::__static_fancy_pointer_cast<__end_node_pointer>(__nd);
return __nd->__right_;
@@ -2003,8 +2005,8 @@ __tree<_Tp, _Compare, _Allocator>::__emplace_multi(_Args&&... __args) {
__node_holder __h = __construct_node(std::forward<_Args>(__args)...);
__end_node_pointer __parent;
__node_base_pointer& __child = __find_leaf_high(__parent, __h->__get_value());
- __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
- return iterator(static_cast<__node_pointer>(__h.release()));
+ __insert_node_at(__parent, __child, std::__static_fancy_pointer_cast<__node_base_pointer>(__h.get()));
+ return iterator(std::__static_fancy_pointer_cast<__node_pointer>(__h.release()));
}
template <class _Tp, class _Compare, class _Allocator>
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 622db9c04451b..999d6be70b3c8 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
@@ -21,7 +21,7 @@
#include "min_allocator.h"
template <template <class> class Alloc>
-void test_alloc() {
+TEST_CONSTEXPR_CXX26 void test_alloc() {
{ // Simple check
using V = std::pair<const int, int>;
using Map = std::multimap<int, int, std::less<int>, Alloc<V> >;
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 8212368de6fb2..5414bfd4444bc 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
@@ -21,7 +21,7 @@
#include "min_allocator.h"
template <class Alloc>
-void test_alloc(const Alloc& new_alloc) {
+TEST_CONSTEXPR_CXX26 void test_alloc(const Alloc& new_alloc) {
{ // Simple check
using V = std::pair<const int, int>;
using Map = std::multimap<int, int, std::less<int>, Alloc>;
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 7557d2ff00845..ad6e54b3e5847 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
@@ -33,17 +33,20 @@ class tracking_allocator {
using value_type = T;
using propagate_on_container_copy_assignment = std::true_type;
+ TEST_CONSTEXPR_CXX26
tracking_allocator(std::vector<void*>& allocs) : allocs_(&allocs) {}
template <class U>
- tracking_allocator(const tracking_allocator<U>& other) : allocs_(other.allocs_) {}
+ TEST_CONSTEXPR_CXX26 tracking_allocator(const tracking_allocator<U>& other) : allocs_(other.allocs_) {}
+ TEST_CONSTEXPR_CXX26
T* allocate(std::size_t n) {
T* allocation = std::allocator<T>().allocate(n);
allocs_->push_back(allocation);
return allocation;
}
+ TEST_CONSTEXPR_CXX26
void deallocate(T* ptr, std::size_t n) TEST_NOEXCEPT {
auto res = std::remove(allocs_->begin(), allocs_->end(), ptr);
assert(res != allocs_->end() && "Trying to deallocate memory from different allocator?");
@@ -51,23 +54,27 @@ class tracking_allocator {
std::allocator<T>().deallocate(ptr, n);
}
+ TEST_CONSTEXPR_CXX26
friend bool operator==(const tracking_allocator& lhs, const tracking_allocator& rhs) {
return lhs.allocs_ == rhs.allocs_;
}
+ TEST_CONSTEXPR_CXX26
friend bool operator!=(const tracking_allocator& lhs, const tracking_allocator& rhs) {
return lhs.allocs_ != rhs.allocs_;
}
};
struct NoOp {
+ TEST_CONSTEXPR_CXX26
void operator()() {}
};
template <class Alloc, class AllocatorInvariant = NoOp>
-void test_alloc(const Alloc& lhs_alloc = Alloc(),
- const Alloc& rhs_alloc = Alloc(),
- AllocatorInvariant check_alloc_invariant = NoOp()) {
+TEST_CONSTEXPR_CXX26 void
+test_alloc(const Alloc& lhs_alloc = Alloc(),
+ const Alloc& rhs_alloc = Alloc(),
+ AllocatorInvariant check_alloc_invariant = NoOp()) {
{ // Test empty/non-empty multimap combinations
{ // assign from a non-empty container into an empty one
using V = std::pair<const int, int>;
@@ -258,9 +265,11 @@ bool test() {
std::vector<void*>* rhs_allocs_;
public:
+ TEST_CONSTEXPR_CXX26
AssertEmpty(std::vector<void*>& lhs_allocs, std::vector<void*>& rhs_allocs)
: lhs_allocs_(&lhs_allocs), rhs_allocs_(&rhs_allocs) {}
+ TEST_CONSTEXPR_CXX26
void operator()() {
assert(lhs_allocs_->empty());
assert(rhs_allocs_->empty());
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 609658ac68fcd..3fff9ee5318fc 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
@@ -215,8 +215,6 @@ bool test() {
AssociativeContainerDeductionGuidesSfinaeAway<std::multimap, std::multimap<int, long>>();
- return 0;
-
return true;
}
int main(int, char**) {
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 d3f836ad5a60a..4fef8e2e24857 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
@@ -104,8 +104,6 @@ bool test() {
assert(m.get_allocator().get_id() == 45);
}
- return 0;
-
return true;
}
int main(int, char**) {
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 a9defa8467520..6f58dc2c57a88 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
@@ -52,8 +52,6 @@ bool test() {
}
#endif
- return 0;
-
return true;
}
int main(int, char**) {
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 7dde8ba1cdb21..1ba25223345b0 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
@@ -54,8 +54,6 @@ bool test() {
static_assert(!std::is_nothrow_default_constructible<C>::value, "");
}
- return 0;
-
return true;
}
int main(int, char**) {
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 407e98ff585c3..90312fa6f96f1 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
@@ -44,8 +44,6 @@ bool test() {
test_map_exception_safety_throwing_copy<std::multimap>();
test_map_exception_safety_throwing_allocator<std::multimap, int, int>();
- return 0;
-
return true;
}
int main(int, char**) {
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 ec0d4be6f57bb..b72ad05a56713 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
@@ -57,8 +57,6 @@ bool test() {
assert(*++i == V(3, 2));
}
- return 0;
-
return true;
}
int main(int, char**) {
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 e4576f5536d96..90923a0fe6ee9 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
@@ -61,8 +61,6 @@ bool test() {
assert(m.key_comp() == Cmp(4));
}
- return 0;
-
return true;
}
int main(int, char**) {
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 08d885aa165de..fd7039e4c47e8 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
@@ -109,8 +109,6 @@ bool test() {
assert(m.get_allocator() == A{});
}
- return 0;
-
return true;
}
int main(int, char**) {
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 b92455a0cd06d..a3c2c38f0176d 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
@@ -107,8 +107,6 @@ bool test() {
# endif
#endif
- return 0;
-
return true;
}
int main(int, char**) {
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 82693683b2633..2ab6821882f0b 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
@@ -82,8 +82,6 @@ bool test() {
}
#endif
- return 0;
-
return true;
}
int main(int, char**) {
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 2e0b689399279..9733cbe0151d4 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
@@ -117,8 +117,6 @@ bool test() {
}
#endif
- return 0;
-
return true;
}
int main(int, char**) {
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 5bd983d69573f..f35d8b1d98929 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
@@ -128,8 +128,6 @@ bool test() {
assert(std::distance(mo.begin(), mo.end()) == 0);
}
- return 0;
-
return true;
}
int main(int, char**) {
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 3aeeaa26ca04d..b7a32a6c49133 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
@@ -151,8 +151,6 @@ bool test() {
LIBCPP_ASSERT(m1.empty());
}
- return 0;
-
return true;
}
int main(int, char**) {
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 0319463bcb9d2..28fd8b2d1e33b 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
@@ -98,8 +98,6 @@ bool test() {
assert(m1.empty());
}
- return 0;
-
return true;
}
int main(int, char**) {
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 06da43dde5241..705362d0be016 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
@@ -52,8 +52,6 @@ bool test() {
static_assert(!std::is_nothrow_move_constructible<C>::value, "");
}
- return 0;
-
return true;
}
int main(int, char**) {
>From eec7088bf92833ec410a596297ec40bdd8d01873 Mon Sep 17 00:00:00 2001
From: Vinay Deshmukh <vinay_deshmukh at outlook.com>
Date: Sat, 18 Oct 2025 13:17:50 -0400
Subject: [PATCH 07/11] multimpa.erasure
---
.../associative/multimap/multimap.erasure/erase_if.pass.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
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 e5c1a066dc80d..9ae4944444900 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,7 +21,7 @@
using Init = std::initializer_list<int>;
template <typename M>
-M make(Init vals) {
+TEST_CONSTEXPR_CXX26 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));
@@ -29,7 +29,7 @@ M make(Init vals) {
}
template <typename M, typename Pred>
-void test0(Init vals, Pred p, Init expected, std::size_t expected_erased_count) {
+TEST_CONSTEXPR_CXX26 void test0(Init vals, Pred p, Init expected, std::size_t expected_erased_count) {
M s = make<M>(vals);
ASSERT_SAME_TYPE(typename M::size_type, decltype(std::erase_if(s, p)));
assert(expected_erased_count == std::erase_if(s, p));
@@ -37,7 +37,7 @@ void test0(Init vals, Pred p, Init expected, std::size_t expected_erased_count)
}
template <typename S>
-void test() {
+TEST_CONSTEXPR_CXX26 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; };
>From c4db7f90fe9740e3782201379b79ff4fd9e56adb Mon Sep 17 00:00:00 2001
From: Vinay Deshmukh <vinay_deshmukh at outlook.com>
Date: Sat, 18 Oct 2025 14:16:32 -0400
Subject: [PATCH 08/11] multimap.modifiers
---
libcxx/include/__tree | 164 ++++++++++++------
.../multimap.modifiers/emplace.pass.cpp | 97 ++++++-----
.../multimap.modifiers/emplace_hint.pass.cpp | 97 ++++++-----
.../multimap.modifiers/erase_iter.pass.cpp | 3 +-
.../extract_iterator.pass.cpp | 15 +-
.../multimap.modifiers/extract_key.pass.cpp | 13 +-
.../insert_allocator_requirements.pass.cpp | 11 +-
.../multimap.modifiers/insert_cv.pass.cpp | 2 +-
.../insert_iter_cv.pass.cpp | 2 +-
.../insert_iter_iter.pass.cpp | 2 +-
.../insert_iter_rv.pass.cpp | 2 +-
.../insert_node_type.pass.cpp | 12 +-
.../insert_node_type_hint.pass.cpp | 10 +-
.../multimap.modifiers/insert_range.pass.cpp | 1 +
.../multimap.modifiers/insert_rv.pass.cpp | 2 +-
.../multimap.modifiers/merge.pass.cpp | 12 +-
16 files changed, 260 insertions(+), 185 deletions(-)
diff --git a/libcxx/include/__tree b/libcxx/include/__tree
index e41627bc4b820..b6e21323741bc 100644
--- a/libcxx/include/__tree
+++ b/libcxx/include/__tree
@@ -36,6 +36,7 @@
#include <__type_traits/is_same.h>
#include <__type_traits/is_specialization.h>
#include <__type_traits/is_swappable.h>
+#include <__type_traits/make_transparent.h>
#include <__type_traits/remove_const.h>
#include <__utility/forward.h>
#include <__utility/lazy_synth_three_way_comparator.h>
@@ -1140,7 +1141,7 @@ public:
} else {
__end_node_pointer __parent;
__node_base_pointer& __child = __find_leaf_high(__parent, __nd->__get_value());
- __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd.release()));
+ __insert_node_at(__parent, __child, std::__static_fancy_pointer_cast<__node_base_pointer>(__nd.release()));
}
}
}
@@ -1214,16 +1215,18 @@ public:
template <class _NodeHandle>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator
__node_handle_insert_unique(const_iterator, _NodeHandle&&);
- template <class _Tree>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __node_handle_merge_unique(_Tree& __source);
+ template <class _Comp2>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
+ __node_handle_merge_unique(__tree<_Tp, _Comp2, _Allocator>& __source);
template <class _NodeHandle>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator __node_handle_insert_multi(_NodeHandle&&);
template <class _NodeHandle>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator
__node_handle_insert_multi(const_iterator, _NodeHandle&&);
- template <class _Tree>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __node_handle_merge_multi(_Tree& __source);
+ template <class _Comp2>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
+ __node_handle_merge_multi(__tree<_Tp, _Comp2, _Allocator>& __source);
template <class _NodeHandle>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _NodeHandle __node_handle_extract(key_type const&);
@@ -1262,34 +1265,89 @@ public:
template <class _Key>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type __count_multi(const _Key& __k) const;
+ template <bool _LowerBound, class _Key>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __end_node_pointer
+ __lower_upper_bound_unique_impl(const _Key& __v) const {
+ auto __rt = __root();
+ auto __result = __end_node();
+ auto __comp = __lazy_synth_three_way_comparator<_Compare, _Key, value_type>(value_comp());
+ while (__rt != nullptr) {
+ auto __comp_res = __comp(__v, __rt->__get_value());
+
+ if (__comp_res.__less()) {
+ __result = std::__static_fancy_pointer_cast<__end_node_pointer>(__rt);
+ __rt = std::__static_fancy_pointer_cast<__node_pointer>(__rt->__left_);
+ } else if (__comp_res.__greater()) {
+ __rt = std::__static_fancy_pointer_cast<__node_pointer>(__rt->__right_);
+ } else if _LIBCPP_CONSTEXPR (_LowerBound) {
+ return std::__static_fancy_pointer_cast<__end_node_pointer>(__rt);
+ } else {
+ return __rt->__right_ ? std::__static_fancy_pointer_cast<__end_node_pointer>(std::__tree_min(__rt->__right_))
+ : __result;
+ }
+ }
+ return __result;
+ }
+
template <class _Key>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator lower_bound(const _Key& __v) {
- return __lower_bound(__v, __root(), __end_node());
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator __lower_bound_unique(const _Key& __v) {
+ return iterator(__lower_upper_bound_unique_impl<true>(__v));
}
+
template <class _Key>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator
- __lower_bound(const _Key& __v, __node_pointer __root, __end_node_pointer __result);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator __lower_bound_unique(const _Key& __v) const {
+ return const_iterator(__lower_upper_bound_unique_impl<true>(__v));
+ }
+
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator __upper_bound_unique(const _Key& __v) {
+ return iterator(__lower_upper_bound_unique_impl<false>(__v));
+ }
+
template <class _Key>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator lower_bound(const _Key& __v) const {
- return __lower_bound(__v, __root(), __end_node());
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator __upper_bound_unique(const _Key& __v) const {
+ return iterator(__lower_upper_bound_unique_impl<false>(__v));
}
+
+private:
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator
+ __lower_bound_multi(const _Key& __v, __node_pointer __root, __end_node_pointer __result);
+
template <class _Key>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator
- __lower_bound(const _Key& __v, __node_pointer __root, __end_node_pointer __result) const;
+ __lower_bound_multi(const _Key& __v, __node_pointer __root, __end_node_pointer __result) const;
+
+public:
template <class _Key>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator upper_bound(const _Key& __v) {
- return __upper_bound(__v, __root(), __end_node());
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator __lower_bound_multi(const _Key& __v) {
+ return __lower_bound_multi(__v, __root(), __end_node());
}
template <class _Key>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator
- __upper_bound(const _Key& __v, __node_pointer __root, __end_node_pointer __result);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator __lower_bound_multi(const _Key& __v) const {
+ return __lower_bound_multi(__v, __root(), __end_node());
+ }
+
template <class _Key>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator upper_bound(const _Key& __v) const {
- return __upper_bound(__v, __root(), __end_node());
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator __upper_bound_multi(const _Key& __v) {
+ return __upper_bound_multi(__v, __root(), __end_node());
}
+
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator __upper_bound_multi(const _Key& __v) const {
+ return __upper_bound_multi(__v, __root(), __end_node());
+ }
+
+private:
+ template <class _Key>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator
+ __upper_bound_multi(const _Key& __v, __node_pointer __root, __end_node_pointer __result);
+
template <class _Key>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator
- __upper_bound(const _Key& __v, __node_pointer __root, __end_node_pointer __result) const;
+ __upper_bound_multi(const _Key& __v, __node_pointer __root, __end_node_pointer __result) const;
+
+public:
template <class _Key>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator> __equal_range_unique(const _Key& __k);
template <class _Key>
@@ -1836,9 +1894,9 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf_high(__end_node_pointer& __parent
while (true) {
if (value_comp()(__v, __nd->__get_value())) {
if (__nd->__left_ != nullptr)
- __nd = static_cast<__node_pointer>(__nd->__left_);
+ __nd = std::__static_fancy_pointer_cast<__node_pointer>(__nd->__left_);
else {
- __parent = static_cast<__end_node_pointer>(__nd);
+ __parent = std::__static_fancy_pointer_cast<__end_node_pointer>(__nd);
return __parent->__left_;
}
} else {
@@ -1905,7 +1963,8 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(const _Key& __v) {
}
__node_base_pointer* __node_ptr = __root_ptr();
- auto __comp = __lazy_synth_three_way_comparator<_Compare, _Key, value_type>(value_comp());
+ auto&& __transparent = std::__as_transparent(value_comp());
+ auto __comp = __lazy_synth_three_way_comparator<__make_transparent_t<_Compare>, _Key, value_type>(__transparent);
while (true) {
auto __comp_res = __comp(__v, __nd->__get_value());
@@ -2122,12 +2181,10 @@ __tree<_Tp, _Compare, _Allocator>::__node_handle_extract(const_iterator __p) {
}
template <class _Tp, class _Compare, class _Allocator>
-template <class _Tree>
+template <class _Comp2>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
-__tree<_Tp, _Compare, _Allocator>::__node_handle_merge_unique(_Tree& __source) {
- static_assert(is_same<typename _Tree::__node_pointer, __node_pointer>::value, "");
-
- for (typename _Tree::iterator __i = __source.begin(); __i != __source.end();) {
+__tree<_Tp, _Compare, _Allocator>::__node_handle_merge_unique(__tree<_Tp, _Comp2, _Allocator>& __source) {
+ for (iterator __i = __source.begin(); __i != __source.end();) {
__node_pointer __src_ptr = __i.__get_np();
auto [__parent, __child] = __find_equal(__src_ptr->__get_value());
++__i;
@@ -2147,7 +2204,7 @@ __tree<_Tp, _Compare, _Allocator>::__node_handle_insert_multi(_NodeHandle&& __nh
__node_pointer __ptr = __nh.__ptr_;
__end_node_pointer __parent;
__node_base_pointer& __child = __find_leaf_high(__parent, __ptr->__get_value());
- __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__ptr));
+ __insert_node_at(__parent, __child, std::__static_fancy_pointer_cast<__node_base_pointer>(__ptr));
__nh.__release_ptr();
return iterator(__ptr);
}
@@ -2162,18 +2219,16 @@ __tree<_Tp, _Compare, _Allocator>::__node_handle_insert_multi(const_iterator __h
__node_pointer __ptr = __nh.__ptr_;
__end_node_pointer __parent;
__node_base_pointer& __child = __find_leaf(__hint, __parent, __ptr->__get_value());
- __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__ptr));
+ __insert_node_at(__parent, __child, std::__static_fancy_pointer_cast<__node_base_pointer>(__ptr));
__nh.__release_ptr();
return iterator(__ptr);
}
template <class _Tp, class _Compare, class _Allocator>
-template <class _Tree>
+template <class _Comp2>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
-__tree<_Tp, _Compare, _Allocator>::__node_handle_merge_multi(_Tree& __source) {
- static_assert(is_same<typename _Tree::__node_pointer, __node_pointer>::value, "");
-
- for (typename _Tree::iterator __i = __source.begin(); __i != __source.end();) {
+__tree<_Tp, _Compare, _Allocator>::__node_handle_merge_multi(__tree<_Tp, _Comp2, _Allocator>& __source) {
+ for (iterator __i = __source.begin(); __i != __source.end();) {
__node_pointer __src_ptr = __i.__get_np();
__end_node_pointer __parent;
__node_base_pointer& __child = __find_leaf_high(__parent, __src_ptr->__get_value());
@@ -2254,22 +2309,25 @@ __tree<_Tp, _Compare, _Allocator>::__count_multi(const _Key& __k) const {
while (__rt != nullptr) {
auto __comp_res = __comp(__k, __rt->__get_value());
if (__comp_res.__less()) {
- __result = static_cast<__end_node_pointer>(__rt);
- __rt = static_cast<__node_pointer>(__rt->__left_);
+ __result = std::__static_fancy_pointer_cast<__end_node_pointer>(__rt);
+ __rt = std::__static_fancy_pointer_cast<__node_pointer>(__rt->__left_);
} else if (__comp_res.__greater())
- __rt = static_cast<__node_pointer>(__rt->__right_);
+ __rt = std::__static_fancy_pointer_cast<__node_pointer>(__rt->__right_);
else
return std::distance(
- __lower_bound(__k, static_cast<__node_pointer>(__rt->__left_), static_cast<__end_node_pointer>(__rt)),
- __upper_bound(__k, static_cast<__node_pointer>(__rt->__right_), __result));
+ __lower_bound_multi(__k,
+ std::__static_fancy_pointer_cast<__node_pointer>(__rt->__left_),
+ std::__static_fancy_pointer_cast<__end_node_pointer>(__rt)),
+ __upper_bound_multi(__k, std::__static_fancy_pointer_cast<__node_pointer>(__rt->__right_), __result));
}
return 0;
}
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
-typename __tree<_Tp, _Compare, _Allocator>::iterator _LIBCPP_CONSTEXPR_SINCE_CXX26
-__tree<_Tp, _Compare, _Allocator>::__lower_bound(const _Key& __v, __node_pointer __root, __end_node_pointer __result) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::iterator
+__tree<_Tp, _Compare, _Allocator>::__lower_bound_multi(
+ const _Key& __v, __node_pointer __root, __end_node_pointer __result) {
while (__root != nullptr) {
if (!value_comp()(__root->__get_value(), __v)) {
__result = std::__static_fancy_pointer_cast<__end_node_pointer>(__root);
@@ -2283,7 +2341,7 @@ __tree<_Tp, _Compare, _Allocator>::__lower_bound(const _Key& __v, __node_pointer
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
_LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::const_iterator
-__tree<_Tp, _Compare, _Allocator>::__lower_bound(
+__tree<_Tp, _Compare, _Allocator>::__lower_bound_multi(
const _Key& __v, __node_pointer __root, __end_node_pointer __result) const {
while (__root != nullptr) {
if (!value_comp()(__root->__get_value(), __v)) {
@@ -2298,7 +2356,8 @@ __tree<_Tp, _Compare, _Allocator>::__lower_bound(
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
_LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::iterator
-__tree<_Tp, _Compare, _Allocator>::__upper_bound(const _Key& __v, __node_pointer __root, __end_node_pointer __result) {
+__tree<_Tp, _Compare, _Allocator>::__upper_bound_multi(
+ const _Key& __v, __node_pointer __root, __end_node_pointer __result) {
while (__root != nullptr) {
if (value_comp()(__v, __root->__get_value())) {
__result = std::__static_fancy_pointer_cast<__end_node_pointer>(__root);
@@ -2312,7 +2371,7 @@ __tree<_Tp, _Compare, _Allocator>::__upper_bound(const _Key& __v, __node_pointer
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
_LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::const_iterator
-__tree<_Tp, _Compare, _Allocator>::__upper_bound(
+__tree<_Tp, _Compare, _Allocator>::__upper_bound_multi(
const _Key& __v, __node_pointer __root, __end_node_pointer __result) const {
while (__root != nullptr) {
if (value_comp()(__v, __root->__get_value())) {
@@ -2387,13 +2446,15 @@ _LIBCPP_CONSTEXPR_SINCE_CXX26
while (__rt != nullptr) {
auto __comp_res = __comp(__k, __rt->__get_value());
if (__comp_res.__less()) {
- __result = static_cast<__end_node_pointer>(__rt);
- __rt = static_cast<__node_pointer>(__rt->__left_);
+ __result = std::__static_fancy_pointer_cast<__end_node_pointer>(__rt);
+ __rt = std::__static_fancy_pointer_cast<__node_pointer>(__rt->__left_);
} else if (__comp_res.__greater())
- __rt = static_cast<__node_pointer>(__rt->__right_);
+ __rt = std::__static_fancy_pointer_cast<__node_pointer>(__rt->__right_);
else
- return _Pp(__lower_bound(__k, static_cast<__node_pointer>(__rt->__left_), static_cast<__end_node_pointer>(__rt)),
- __upper_bound(__k, static_cast<__node_pointer>(__rt->__right_), __result));
+ return _Pp(__lower_bound_multi(__k,
+ std::__static_fancy_pointer_cast<__node_pointer>(__rt->__left_),
+ std::__static_fancy_pointer_cast<__end_node_pointer>(__rt)),
+ __upper_bound_multi(__k, std::__static_fancy_pointer_cast<__node_pointer>(__rt->__right_), __result));
}
return _Pp(iterator(__result), iterator(__result));
}
@@ -2415,8 +2476,9 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) const {
} else if (__comp_res.__greater())
__rt = static_cast<__node_pointer>(__rt->__right_);
else
- return _Pp(__lower_bound(__k, static_cast<__node_pointer>(__rt->__left_), static_cast<__end_node_pointer>(__rt)),
- __upper_bound(__k, static_cast<__node_pointer>(__rt->__right_), __result));
+ return _Pp(
+ __lower_bound_multi(__k, static_cast<__node_pointer>(__rt->__left_), static_cast<__end_node_pointer>(__rt)),
+ __upper_bound_multi(__k, static_cast<__node_pointer>(__rt->__right_), __result));
}
return _Pp(const_iterator(__result), const_iterator(__result));
}
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 0ee315975c7c7..e50b91388a01c 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
@@ -25,31 +25,34 @@
TEST_CONSTEXPR_CXX26
bool test() {
- {
- typedef std::multimap<int, DefaultOnly> M;
- typedef M::iterator R;
- M m;
+ // DefaultOnly::count is static
+ if (!TEST_IS_CONSTANT_EVALUATED) {
+ {
+ 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);
+ }
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);
}
- assert(DefaultOnly::count == 0);
{
typedef std::multimap<int, Emplaceable> M;
typedef M::iterator R;
@@ -80,31 +83,33 @@ bool test() {
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;
+ if (!TEST_IS_CONSTANT_EVALUATED) {
+ {
+ 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);
+ }
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);
}
- assert(DefaultOnly::count == 0);
{
typedef std::multimap<int, Emplaceable, std::less<int>, min_allocator<std::pair<const int, Emplaceable>>> M;
typedef M::iterator R;
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 f719cdb92ea10..ef7ba53dcdac5 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
@@ -25,31 +25,34 @@
TEST_CONSTEXPR_CXX26
bool test() {
- {
- typedef std::multimap<int, DefaultOnly> M;
- typedef M::iterator R;
- M m;
+ // DefaultOnly::count is static
+ if (!TEST_IS_CONSTANT_EVALUATED) {
+ {
+ 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);
+ }
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);
}
- assert(DefaultOnly::count == 0);
{
typedef std::multimap<int, Emplaceable> M;
typedef M::iterator R;
@@ -80,31 +83,33 @@ bool test() {
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;
+ if (!TEST_IS_CONSTANT_EVALUATED) {
+ {
+ 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);
+ }
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);
}
- assert(DefaultOnly::count == 0);
{
typedef std::multimap<int, Emplaceable, std::less<int>, min_allocator<std::pair<const int, Emplaceable>>> M;
typedef M::iterator R;
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 bdbfa55df4972..dcbeff1a1df3e 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
@@ -20,9 +20,10 @@
struct TemplateConstructor {
template <typename T>
- TemplateConstructor(const T&) {}
+ TEST_CONSTEXPR_CXX26 TemplateConstructor(const T&) {}
};
+TEST_CONSTEXPR_CXX26
bool operator<(const TemplateConstructor&, const TemplateConstructor&) { return false; }
TEST_CONSTEXPR_CXX26
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 8b9760f2f3e32..bb3abaa8faa6a 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,7 +20,7 @@
#include "Counter.h"
template <class Container>
-void test(Container& c) {
+TEST_CONSTEXPR_CXX26 void test(Container& c) {
std::size_t sz = c.size();
auto some_key = c.cbegin()->first;
@@ -29,9 +29,13 @@ void test(Container& c) {
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);
+
+ if (!TEST_IS_CONSTANT_EVALUATED) {
+ // FIXME: CWG1514: key() is not `constexpr`
+ 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());
}
@@ -47,7 +51,8 @@ bool test() {
test(m);
}
- {
+ // Counter_base::gConstructed is static
+ if (!TEST_IS_CONSTANT_EVALUATED) {
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);
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 ba9fd4a76d7bb..03dbdc7c8551c 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,7 +20,7 @@
#include "Counter.h"
template <class Container, class KeyTypeIter>
-void test(Container& c, KeyTypeIter first, KeyTypeIter last) {
+TEST_CONSTEXPR_CXX26 void test(Container& c, KeyTypeIter first, KeyTypeIter last) {
std::size_t sz = c.size();
assert((std::size_t)std::distance(first, last) == sz);
@@ -28,9 +28,11 @@ void test(Container& c, KeyTypeIter first, KeyTypeIter last) {
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);
+ if (!TEST_IS_CONSTANT_EVALUATED) {
+ 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());
}
@@ -51,7 +53,8 @@ bool test() {
test(m, std::begin(keys), std::end(keys));
}
- {
+ // Counter_base::gConstructed is static
+ if (!TEST_IS_CONSTANT_EVALUATED) {
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};
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 a8ea207b770ff..484efe892c843 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,18 +20,9 @@
#include "container_test_types.h"
#include "../../../map_allocator_requirement_test_templates.h"
-TEST_CONSTEXPR_CXX26
-bool test() {
+int main(int, char**) {
testMultimapInsert<TCT::multimap<> >();
testMultimapInsertHint<TCT::multimap<> >();
- return true;
-}
-int main(int, char**) {
- test();
-
-#if TEST_STD_VER >= 26
- static_assert(test());
-#endif
return 0;
}
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 9b5b9ef33fec4..2e17bca6724e5 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
@@ -19,7 +19,7 @@
#include "min_allocator.h"
template <class Container>
-void do_insert_test() {
+TEST_CONSTEXPR_CXX26 void do_insert_test() {
typedef Container M;
typedef typename M::iterator R;
typedef typename M::value_type VT;
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 6bf4fad73807f..611dfba0c6447 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,7 +19,7 @@
#include "min_allocator.h"
template <class Container>
-void do_insert_hint_test() {
+TEST_CONSTEXPR_CXX26 void do_insert_hint_test() {
typedef Container M;
typedef typename M::iterator R;
typedef typename M::value_type VT;
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 130207e2ea44f..7d776b3e086dd 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
@@ -22,7 +22,7 @@
#include "test_macros.h"
template <class Iter, class Alloc>
-void test_alloc() {
+TEST_CONSTEXPR_CXX26 void test_alloc() {
{ // Check that an empty range works correctly
{ // Without elements in the container
using Map = std::multimap<int, int, std::less<int>, Alloc>;
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 c24f852ce22f5..5408f98688072 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,7 +23,7 @@
#include "test_macros.h"
template <class Container, class Pair>
-void do_insert_rv_test() {
+TEST_CONSTEXPR_CXX26 void do_insert_rv_test() {
typedef Container M;
typedef Pair P;
typedef typename M::iterator R;
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 f24c4c101347c..bc278a2f0d37f 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
@@ -20,19 +20,19 @@
#include "min_allocator.h"
template <class Container>
-typename Container::node_type
+TEST_CONSTEXPR_CXX26 std::pair<Container, typename Container::node_type>
node_factory(typename Container::key_type const& key, typename Container::mapped_type const& mapped) {
- static Container c;
+ Container c;
auto it = c.insert({key, mapped});
- return c.extract(it);
+ return {c, c.extract(it)};
}
template <class Container>
-void test(Container& c) {
+TEST_CONSTEXPR_CXX26 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);
+ auto [/*Container*/ staticContainer, /*typename Container::node_type*/ node] = nf(i, i + 1);
assert(!node.empty());
typename Container::iterator it = c.insert(std::move(node));
assert(node.empty());
@@ -49,7 +49,7 @@ void test(Container& c) {
}
{ // Insert duplicate node.
- typename Container::node_type dupl = nf(0, 42);
+ auto [/*Container*/ staticContainer, /*typename Container::node_type*/ dupl] = nf(0, 42);
auto it = c.insert(std::move(dupl));
assert(dupl.empty());
assert(it != c.end());
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 225811bef2c24..2fa2fc06a9b38 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
@@ -19,19 +19,19 @@
#include "min_allocator.h"
template <class Container>
-typename Container::node_type
+TEST_CONSTEXPR_CXX26 std::pair<Container, typename Container::node_type>
node_factory(typename Container::key_type const& key, typename Container::mapped_type const& mapped) {
- static Container c;
+ Container c;
auto it = c.insert({key, mapped});
- return c.extract(it);
+ return {c, c.extract(it)};
}
template <class Container>
-void test(Container& c) {
+TEST_CONSTEXPR_CXX26 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);
+ auto [/*Container*/ staticContainer, /*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));
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 57ad02822f931..918d30b44508d 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
@@ -9,6 +9,7 @@
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
// Some fields in the test case variables are deliberately not explicitly initialized, this silences a warning on GCC.
// ADDITIONAL_COMPILE_FLAGS(gcc-style-warnings): -Wno-missing-field-initializers
+// ADDITIONAL_COMPILE_FLAGS(has-fconstexpr-steps): -fconstexpr-steps=2147483647
// <map>
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 cd60b44cadb33..44112cd721977 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,7 +23,7 @@
#include "test_macros.h"
template <class Container>
-void do_insert_rv_test() {
+TEST_CONSTEXPR_CXX26 void do_insert_rv_test() {
typedef std::multimap<int, MoveOnly> M;
typedef typename M::iterator R;
typedef typename M::value_type VT;
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 a276ba171dbb6..eb1599c45852d 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
@@ -30,7 +30,7 @@
#include "Counter.h"
template <class Map>
-bool map_equal(const Map& map, Map other) {
+TEST_CONSTEXPR_CXX26 bool map_equal(const Map& map, Map other) {
return map == other;
}
@@ -60,7 +60,7 @@ bool test() {
}
#ifndef TEST_HAS_NO_EXCEPTIONS
- {
+ if (!TEST_IS_CONSTANT_EVALUATED) {
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));
@@ -79,13 +79,14 @@ bool test() {
assert(map_equal(dst, map_type({{2, 0}, {4, 0}, {5, 0}}, throw_comparator(do_throw))));
}
#endif
- assert(Counter_base::gConstructed == 0);
+ if (!TEST_IS_CONSTANT_EVALUATED)
+ assert(Counter_base::gConstructed == 0);
struct comparator {
comparator() = default;
bool operator()(const Counter<int>& lhs, const Counter<int>& rhs) const { return lhs < rhs; }
};
- {
+ if (!TEST_IS_CONSTANT_EVALUATED) {
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;
@@ -125,7 +126,8 @@ bool test() {
}
assert(Counter_base::gConstructed == 0);
}
- assert(Counter_base::gConstructed == 0);
+ if (!TEST_IS_CONSTANT_EVALUATED)
+ assert(Counter_base::gConstructed == 0);
{
std::multimap<int, int> first;
{
>From 1b932d6bc6cf7550af5501a8be01d8b3b3c0bb66 Mon Sep 17 00:00:00 2001
From: Vinay Deshmukh <vinay_deshmukh at outlook.com>
Date: Sat, 18 Oct 2025 14:25:41 -0400
Subject: [PATCH 09/11] multimap.observers
---
.../associative/multimap/multimap.observers/key_comp.pass.cpp | 2 ++
.../associative/multimap/multimap.observers/value_comp.pass.cpp | 2 ++
2 files changed, 4 insertions(+)
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 0185028d1f8c7..0e6fb6728651a 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
@@ -14,6 +14,8 @@
#include <cassert>
#include <string>
+#include "test_macros.h"
+
TEST_CONSTEXPR_CXX26
bool test() {
typedef std::multimap<int, std::string> map_type;
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 1fca7be8a46e8..a31464065b4dc 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
@@ -14,6 +14,8 @@
#include <cassert>
#include <string>
+#include "test_macros.h"
+
TEST_CONSTEXPR_CXX26
bool test() {
typedef std::multimap<int, std::string> map_type;
>From 1cc13ecb476371d68e2d9dc26775a45cef9395d3 Mon Sep 17 00:00:00 2001
From: Vinay Deshmukh <vinay_deshmukh at outlook.com>
Date: Sat, 18 Oct 2025 14:29:55 -0400
Subject: [PATCH 10/11] multimap.ops
---
libcxx/include/__tree | 13 +++++++------
.../multimap.ops/count_transparent.pass.cpp | 5 +++++
.../multimap.ops/equal_range_transparent.pass.cpp | 5 +++++
.../associative/multimap/multimap.ops/find.pass.cpp | 2 +-
4 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/libcxx/include/__tree b/libcxx/include/__tree
index b6e21323741bc..7460db8e76e4b 100644
--- a/libcxx/include/__tree
+++ b/libcxx/include/__tree
@@ -2471,14 +2471,15 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) const {
while (__rt != nullptr) {
auto __comp_res = __comp(__k, __rt->__get_value());
if (__comp_res.__less()) {
- __result = static_cast<__end_node_pointer>(__rt);
- __rt = static_cast<__node_pointer>(__rt->__left_);
+ __result = std::__static_fancy_pointer_cast<__end_node_pointer>(__rt);
+ __rt = std::__static_fancy_pointer_cast<__node_pointer>(__rt->__left_);
} else if (__comp_res.__greater())
- __rt = static_cast<__node_pointer>(__rt->__right_);
+ __rt = std::__static_fancy_pointer_cast<__node_pointer>(__rt->__right_);
else
- return _Pp(
- __lower_bound_multi(__k, static_cast<__node_pointer>(__rt->__left_), static_cast<__end_node_pointer>(__rt)),
- __upper_bound_multi(__k, static_cast<__node_pointer>(__rt->__right_), __result));
+ return _Pp(__lower_bound_multi(__k,
+ std::__static_fancy_pointer_cast<__node_pointer>(__rt->__left_),
+ std::__static_fancy_pointer_cast<__end_node_pointer>(__rt)),
+ __upper_bound_multi(__k, std::__static_fancy_pointer_cast<__node_pointer>(__rt->__right_), __result));
}
return _Pp(const_iterator(__result), const_iterator(__result));
}
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 33ec954d8746d..686fb302de473 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
@@ -19,13 +19,18 @@
#include <map>
#include <utility>
+#include "test_macros.h"
+
struct Comp {
using is_transparent = void;
+ TEST_CONSTEXPR_CXX26
bool operator()(const std::pair<int, int>& lhs, const std::pair<int, int>& rhs) const { return lhs < rhs; }
+ TEST_CONSTEXPR_CXX26
bool operator()(const std::pair<int, int>& lhs, int rhs) const { return lhs.first < rhs; }
+ TEST_CONSTEXPR_CXX26
bool operator()(int lhs, const std::pair<int, int>& rhs) const { return lhs < rhs.first; }
};
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 e0155f6b9f913..533e01d013163 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
@@ -24,13 +24,18 @@
#include <map>
#include <utility>
+#include "test_macros.h"
+
struct Comp {
using is_transparent = void;
+ TEST_CONSTEXPR_CXX26
bool operator()(const std::pair<int, int>& lhs, const std::pair<int, int>& rhs) const { return lhs < rhs; }
+ TEST_CONSTEXPR_CXX26
bool operator()(const std::pair<int, int>& lhs, int rhs) const { return lhs.first < rhs; }
+ TEST_CONSTEXPR_CXX26
bool operator()(int lhs, const std::pair<int, int>& rhs) const { return lhs < rhs.first; }
};
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 8045d0471f242..3653ea57e4874 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
@@ -23,7 +23,7 @@
#include "is_transparent.h"
template <class Iter>
-bool iter_in_range(Iter first, Iter last, Iter to_find) {
+TEST_CONSTEXPR_CXX26 bool iter_in_range(Iter first, Iter last, Iter to_find) {
for (; first != last; ++first) {
if (first == to_find)
return true;
>From b64ebc05081c109dae995b4a482378c3d9a13d8b Mon Sep 17 00:00:00 2001
From: Vinay Deshmukh <vinay_deshmukh at outlook.com>
Date: Sat, 18 Oct 2025 15:07:31 -0400
Subject: [PATCH 11/11] wip
wip
---
libcxx/docs/FeatureTestMacroTable.rst | 16 +++-
libcxx/docs/ReleaseNotes/22.rst | 12 +++
.../include/__type_traits/make_transparent.h | 2 +-
.../__utility/default_three_way_comparator.h | 2 +-
libcxx/include/map | 75 +++++++++----------
libcxx/include/version | 37 +++++----
libcxx/test/std/containers/Emplaceable.h | 22 +++---
.../multimap.value_compare/invoke.pass.cpp | 4 +
.../generate_feature_test_macro_components.py | 61 +++++++++------
9 files changed, 143 insertions(+), 88 deletions(-)
diff --git a/libcxx/docs/FeatureTestMacroTable.rst b/libcxx/docs/FeatureTestMacroTable.rst
index 1e096bcb325d1..f4696437070dc 100644
--- a/libcxx/docs/FeatureTestMacroTable.rst
+++ b/libcxx/docs/FeatureTestMacroTable.rst
@@ -198,6 +198,10 @@ Status
---------------------------------------------------------- -----------------
``__cpp_lib_char8_t`` ``201907L``
---------------------------------------------------------- -----------------
+ ``__cpp_lib_common_reference`` ``202302L``
+ ---------------------------------------------------------- -----------------
+ ``__cpp_lib_common_reference_wrapper`` ``202302L``
+ ---------------------------------------------------------- -----------------
``__cpp_lib_concepts`` ``202002L``
---------------------------------------------------------- -----------------
``__cpp_lib_constexpr_algorithms`` ``201806L``
@@ -376,7 +380,7 @@ Status
---------------------------------------------------------- -----------------
``__cpp_lib_ranges_iota`` ``202202L``
---------------------------------------------------------- -----------------
- ``__cpp_lib_ranges_join_with`` *unimplemented*
+ ``__cpp_lib_ranges_join_with`` ``202202L``
---------------------------------------------------------- -----------------
``__cpp_lib_ranges_repeat`` ``202207L``
---------------------------------------------------------- -----------------
@@ -414,6 +418,8 @@ Status
---------------------------------------------------------- -----------------
``__cpp_lib_atomic_min_max`` *unimplemented*
---------------------------------------------------------- -----------------
+ ``__cpp_lib_atomic_ref`` ``202411L``
+ ---------------------------------------------------------- -----------------
``__cpp_lib_bind_front`` ``202306L``
---------------------------------------------------------- -----------------
``__cpp_lib_bitset`` ``202306L``
@@ -430,7 +436,7 @@ Status
---------------------------------------------------------- -----------------
``__cpp_lib_constexpr_queue`` ``202502L``
---------------------------------------------------------- -----------------
- ``__cpp_lib_constrained_equality`` *unimplemented*
+ ``__cpp_lib_constrained_equality`` ``202411L``
---------------------------------------------------------- -----------------
``__cpp_lib_copyable_function`` *unimplemented*
---------------------------------------------------------- -----------------
@@ -478,7 +484,7 @@ Status
---------------------------------------------------------- -----------------
``__cpp_lib_not_fn`` ``202306L``
---------------------------------------------------------- -----------------
- ``__cpp_lib_optional_range_support`` *unimplemented*
+ ``__cpp_lib_optional_range_support`` ``202406L``
---------------------------------------------------------- -----------------
``__cpp_lib_out_ptr`` ``202311L``
---------------------------------------------------------- -----------------
@@ -486,6 +492,8 @@ Status
---------------------------------------------------------- -----------------
``__cpp_lib_ranges_concat`` *unimplemented*
---------------------------------------------------------- -----------------
+ ``__cpp_lib_ranges_indices`` ``202506L``
+ ---------------------------------------------------------- -----------------
``__cpp_lib_ratio`` ``202306L``
---------------------------------------------------------- -----------------
``__cpp_lib_rcu`` *unimplemented*
@@ -504,6 +512,8 @@ Status
---------------------------------------------------------- -----------------
``__cpp_lib_sstream_from_string_view`` ``202306L``
---------------------------------------------------------- -----------------
+ ``__cpp_lib_string_subview`` ``202506L``
+ ---------------------------------------------------------- -----------------
``__cpp_lib_string_view`` ``202403L``
---------------------------------------------------------- -----------------
``__cpp_lib_submdspan`` *unimplemented*
diff --git a/libcxx/docs/ReleaseNotes/22.rst b/libcxx/docs/ReleaseNotes/22.rst
index c6ee41bccdb30..135b44920f49a 100644
--- a/libcxx/docs/ReleaseNotes/22.rst
+++ b/libcxx/docs/ReleaseNotes/22.rst
@@ -40,6 +40,10 @@ Implemented Papers
- P2321R2: ``zip`` (`Github <https://llvm.org/PR105169>`__) (The paper is partially implemented. ``zip_transform_view``
is implemented in this release)
+- P3044R2: sub-``string_view`` from ``string`` (`Github <https://llvm.org/PR148140>`__)
+- P3223R2: Making ``std::istream::ignore`` less surprising (`Github <https://llvm.org/PR148178>`__)
+- P3060R3: Add ``std::views::indices(n)`` (`Github <https://llvm.org/PR148175>`__)
+- P2835R7: Expose ``std::atomic_ref``'s object address (`Github <https://llvm.org/PR118377>`__)
- P3168R2: Give ``std::optional`` Range Support (`Github <https://llvm.org/PR105430>`__)
- P3372R3: ``constexpr map`` (`Github <https://llvm.org/PR134330>`__) (The paper is partially implemented. ``constexpr map`` is implemented in this release)
@@ -64,6 +68,14 @@ Improvements and New Features
- Multiple internal types have been refactored to use ``[[no_unique_address]]``, resulting in faster compile times and
reduced debug information.
+- The performance of ``std::find`` has been improved by up to 2x for integral types
+- The ``std::distance`` and ``std::ranges::distance`` algorithms have been optimized for segmented iterators (e.g.,
+ ``std::join_view`` iterators), reducing the complexity from ``O(n)`` to ``O(n / segment_size)``. Benchmarks show
+ performance improvements of over 1600x in favorable cases with large segment sizes (e.g., 1024).
+- The ``std::{fill, fill_n}`` and ``std::ranges::{fill, fill_n}`` algorithms have been optimized for segmented iterators,
+ resulting in a performance improvement of at least 10x for ``std::deque<int>`` iterators and
+ ``std::join_view<std::vector<std::vector<int>>>`` iterators.
+
Deprecations and Removals
-------------------------
diff --git a/libcxx/include/__type_traits/make_transparent.h b/libcxx/include/__type_traits/make_transparent.h
index 4d3207a807fa7..78cf31f6172be 100644
--- a/libcxx/include/__type_traits/make_transparent.h
+++ b/libcxx/include/__type_traits/make_transparent.h
@@ -33,7 +33,7 @@ template <class _Comparator>
using __make_transparent_t _LIBCPP_NODEBUG = typename __make_transparent<_Comparator>::type;
template <class _Comparator, __enable_if_t<is_same<_Comparator, __make_transparent_t<_Comparator> >::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI _Comparator& __as_transparent(_Comparator& __comp) {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _Comparator& __as_transparent(_Comparator& __comp) {
return __comp;
}
diff --git a/libcxx/include/__utility/default_three_way_comparator.h b/libcxx/include/__utility/default_three_way_comparator.h
index 92cdce6aae117..3f6bb1d7455b6 100644
--- a/libcxx/include/__utility/default_three_way_comparator.h
+++ b/libcxx/include/__utility/default_three_way_comparator.h
@@ -31,7 +31,7 @@ template <class _LHS, class _RHS>
struct __default_three_way_comparator<_LHS,
_RHS,
__enable_if_t<is_arithmetic<_LHS>::value && is_arithmetic<_RHS>::value> > {
- _LIBCPP_HIDE_FROM_ABI static int operator()(_LHS __lhs, _RHS __rhs) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 static int operator()(_LHS __lhs, _RHS __rhs) {
if (__lhs < __rhs)
return -1;
if (__lhs > __rhs)
diff --git a/libcxx/include/map b/libcxx/include/map
index 0bc7c4aa21a38..5874e551a7f0b 100644
--- a/libcxx/include/map
+++ b/libcxx/include/map
@@ -1414,8 +1414,8 @@ template <class _InputIterator,
class _Compare = less<__iter_key_type<_InputIterator>>,
class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>,
class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
- class = enable_if_t<!__is_allocator<_Compare>::value, void>,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+ class = enable_if_t<!__is_allocator_v<_Compare>>,
+ class = enable_if_t<__is_allocator_v<_Allocator>>>
map(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator())
-> map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Compare, _Allocator>;
@@ -1423,8 +1423,8 @@ map(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocat
template <ranges::input_range _Range,
class _Compare = less<__range_key_type<_Range>>,
class _Allocator = allocator<__range_to_alloc_type<_Range>>,
- class = enable_if_t<!__is_allocator<_Compare>::value, void>,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+ class = enable_if_t<!__is_allocator_v<_Compare>>,
+ class = enable_if_t<__is_allocator_v<_Allocator>>>
map(from_range_t, _Range&&, _Compare = _Compare(), _Allocator = _Allocator())
-> map<__range_key_type<_Range>, __range_mapped_type<_Range>, _Compare, _Allocator>;
# endif
@@ -1433,16 +1433,15 @@ template <class _Key,
class _Tp,
class _Compare = less<remove_const_t<_Key>>,
class _Allocator = allocator<pair<const _Key, _Tp>>,
- class = enable_if_t<!__is_allocator<_Compare>::value, void>,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
-map(initializer_list<pair<_Key, _Tp>>,
- _Compare = _Compare(),
- _Allocator = _Allocator()) -> map<remove_const_t<_Key>, _Tp, _Compare, _Allocator>;
+ class = enable_if_t<!__is_allocator_v<_Compare>>,
+ class = enable_if_t<__is_allocator_v<_Allocator>>>
+map(initializer_list<pair<_Key, _Tp>>, _Compare = _Compare(), _Allocator = _Allocator())
+ -> map<remove_const_t<_Key>, _Tp, _Compare, _Allocator>;
template <class _InputIterator,
class _Allocator,
class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+ class = enable_if_t<__is_allocator_v<_Allocator>>>
map(_InputIterator, _InputIterator, _Allocator)
-> map<__iter_key_type<_InputIterator>,
__iter_mapped_type<_InputIterator>,
@@ -1450,14 +1449,14 @@ map(_InputIterator, _InputIterator, _Allocator)
_Allocator>;
# if _LIBCPP_STD_VER >= 23
-template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator_v<_Allocator>>>
map(from_range_t, _Range&&, _Allocator)
-> map<__range_key_type<_Range>, __range_mapped_type<_Range>, less<__range_key_type<_Range>>, _Allocator>;
# endif
-template <class _Key, class _Tp, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value, void>>
-map(initializer_list<pair<_Key, _Tp>>,
- _Allocator) -> map<remove_const_t<_Key>, _Tp, less<remove_const_t<_Key>>, _Allocator>;
+template <class _Key, class _Tp, class _Allocator, class = enable_if_t<__is_allocator_v<_Allocator>>>
+map(initializer_list<pair<_Key, _Tp>>, _Allocator)
+ -> map<remove_const_t<_Key>, _Tp, less<remove_const_t<_Key>>, _Allocator>;
# endif
# ifndef _LIBCPP_CXX03_LANG
@@ -1625,10 +1624,11 @@ public:
protected:
key_compare comp;
- _LIBCPP_HIDE_FROM_ABI value_compare(key_compare __c) : comp(__c) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 value_compare(key_compare __c) : comp(__c) {}
public:
- _LIBCPP_HIDE_FROM_ABI bool operator()(const value_type& __x, const value_type& __y) const {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
+ operator()(const value_type& __x, const value_type& __y) const {
return comp(__x.first, __y.first);
}
};
@@ -1963,37 +1963,37 @@ public:
# endif // _LIBCPP_STD_VER >= 20
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator lower_bound(const key_type& __k) {
- return __tree_.lower_bound(__k);
+ return __tree_.__lower_bound_multi(__k);
}
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator lower_bound(const key_type& __k) const {
- return __tree_.lower_bound(__k);
+ return __tree_.__lower_bound_multi(__k);
}
# if _LIBCPP_STD_VER >= 14
template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator lower_bound(const _K2& __k) {
- return __tree_.lower_bound(__k);
+ return __tree_.__lower_bound_multi(__k);
}
template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator lower_bound(const _K2& __k) const {
- return __tree_.lower_bound(__k);
+ return __tree_.__lower_bound_multi(__k);
}
# endif
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator upper_bound(const key_type& __k) {
- return __tree_.upper_bound(__k);
+ return __tree_.__upper_bound_multi(__k);
}
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator upper_bound(const key_type& __k) const {
- return __tree_.upper_bound(__k);
+ return __tree_.__upper_bound_multi(__k);
}
# if _LIBCPP_STD_VER >= 14
template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator upper_bound(const _K2& __k) {
- return __tree_.upper_bound(__k);
+ return __tree_.__upper_bound_multi(__k);
}
template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator upper_bound(const _K2& __k) const {
- return __tree_.upper_bound(__k);
+ return __tree_.__upper_bound_multi(__k);
}
# endif
@@ -2030,8 +2030,8 @@ template <class _InputIterator,
class _Compare = less<__iter_key_type<_InputIterator>>,
class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>,
class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
- class = enable_if_t<!__is_allocator<_Compare>::value, void>,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+ class = enable_if_t<!__is_allocator_v<_Compare>>,
+ class = enable_if_t<__is_allocator_v<_Allocator>>>
multimap(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator())
-> multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Compare, _Allocator>;
@@ -2039,8 +2039,8 @@ multimap(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Al
template <ranges::input_range _Range,
class _Compare = less<__range_key_type<_Range>>,
class _Allocator = allocator<__range_to_alloc_type<_Range>>,
- class = enable_if_t<!__is_allocator<_Compare>::value, void>,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+ class = enable_if_t<!__is_allocator_v<_Compare>>,
+ class = enable_if_t<__is_allocator_v<_Allocator>>>
multimap(from_range_t, _Range&&, _Compare = _Compare(), _Allocator = _Allocator())
-> multimap<__range_key_type<_Range>, __range_mapped_type<_Range>, _Compare, _Allocator>;
# endif
@@ -2049,16 +2049,15 @@ template <class _Key,
class _Tp,
class _Compare = less<remove_const_t<_Key>>,
class _Allocator = allocator<pair<const _Key, _Tp>>,
- class = enable_if_t<!__is_allocator<_Compare>::value, void>,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
-multimap(initializer_list<pair<_Key, _Tp>>,
- _Compare = _Compare(),
- _Allocator = _Allocator()) -> multimap<remove_const_t<_Key>, _Tp, _Compare, _Allocator>;
+ class = enable_if_t<!__is_allocator_v<_Compare>>,
+ class = enable_if_t<__is_allocator_v<_Allocator>>>
+multimap(initializer_list<pair<_Key, _Tp>>, _Compare = _Compare(), _Allocator = _Allocator())
+ -> multimap<remove_const_t<_Key>, _Tp, _Compare, _Allocator>;
template <class _InputIterator,
class _Allocator,
class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
- class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+ class = enable_if_t<__is_allocator_v<_Allocator>>>
multimap(_InputIterator, _InputIterator, _Allocator)
-> multimap<__iter_key_type<_InputIterator>,
__iter_mapped_type<_InputIterator>,
@@ -2066,14 +2065,14 @@ multimap(_InputIterator, _InputIterator, _Allocator)
_Allocator>;
# if _LIBCPP_STD_VER >= 23
-template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value, void>>
+template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator_v<_Allocator>>>
multimap(from_range_t, _Range&&, _Allocator)
-> multimap<__range_key_type<_Range>, __range_mapped_type<_Range>, less<__range_key_type<_Range>>, _Allocator>;
# endif
-template <class _Key, class _Tp, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value, void>>
-multimap(initializer_list<pair<_Key, _Tp>>,
- _Allocator) -> multimap<remove_const_t<_Key>, _Tp, less<remove_const_t<_Key>>, _Allocator>;
+template <class _Key, class _Tp, class _Allocator, class = enable_if_t<__is_allocator_v<_Allocator>>>
+multimap(initializer_list<pair<_Key, _Tp>>, _Allocator)
+ -> multimap<remove_const_t<_Key>, _Tp, less<remove_const_t<_Key>>, _Allocator>;
# endif
# ifndef _LIBCPP_CXX03_LANG
diff --git a/libcxx/include/version b/libcxx/include/version
index 03d14bb146741..a895c4db4f01e 100644
--- a/libcxx/include/version
+++ b/libcxx/include/version
@@ -37,7 +37,8 @@ __cpp_lib_atomic_float 201711L <atomic>
__cpp_lib_atomic_is_always_lock_free 201603L <atomic>
__cpp_lib_atomic_lock_free_type_aliases 201907L <atomic>
__cpp_lib_atomic_min_max 202403L <atomic>
-__cpp_lib_atomic_ref 201806L <atomic>
+__cpp_lib_atomic_ref 202411L <atomic>
+ 201806L // C++20
__cpp_lib_atomic_shared_ptr 201711L <atomic>
__cpp_lib_atomic_value_initialization 201911L <atomic> <memory>
__cpp_lib_atomic_wait 201907L <atomic>
@@ -59,6 +60,8 @@ __cpp_lib_char8_t 201907L <atomic> <filesy
__cpp_lib_chrono 201611L <chrono>
__cpp_lib_chrono_udls 201304L <chrono>
__cpp_lib_clamp 201603L <algorithm>
+__cpp_lib_common_reference 202302L <type_traits>
+__cpp_lib_common_reference_wrapper 202302L <functional>
__cpp_lib_complex_udls 201309L <complex>
__cpp_lib_concepts 202002L <concepts>
__cpp_lib_constexpr_algorithms 202306L <algorithm> <utility>
@@ -84,8 +87,8 @@ __cpp_lib_constexpr_tuple 201811L <tuple>
__cpp_lib_constexpr_typeinfo 202106L <typeinfo>
__cpp_lib_constexpr_utility 201811L <utility>
__cpp_lib_constexpr_vector 201907L <vector>
-__cpp_lib_constrained_equality 202403L <optional> <tuple> <utility>
- <variant>
+__cpp_lib_constrained_equality 202411L <expected> <optional> <tuple>
+ <utility> <variant>
__cpp_lib_containers_ranges 202202L <deque> <forward_list> <list>
<map> <queue> <set>
<stack> <string> <unordered_map>
@@ -204,6 +207,7 @@ __cpp_lib_ranges_chunk_by 202202L <ranges>
__cpp_lib_ranges_concat 202403L <ranges>
__cpp_lib_ranges_contains 202207L <algorithm>
__cpp_lib_ranges_find_last 202207L <algorithm>
+__cpp_lib_ranges_indices 202506L <ranges>
__cpp_lib_ranges_iota 202202L <numeric>
__cpp_lib_ranges_join_with 202202L <ranges>
__cpp_lib_ranges_repeat 202207L <ranges>
@@ -244,6 +248,7 @@ __cpp_lib_starts_ends_with 201711L <string> <string
__cpp_lib_stdatomic_h 202011L <stdatomic.h>
__cpp_lib_string_contains 202011L <string> <string_view>
__cpp_lib_string_resize_and_overwrite 202110L <string>
+__cpp_lib_string_subview 202506L <string> <string_view>
__cpp_lib_string_udls 201304L <string>
__cpp_lib_string_view 202403L <string> <string_view>
201803L // C++20
@@ -332,7 +337,7 @@ __cpp_lib_void_t 201411L <type_traits>
# define __cpp_lib_clamp 201603L
# define __cpp_lib_enable_shared_from_this 201603L
// # define __cpp_lib_execution 201603L
-# if _LIBCPP_HAS_FILESYSTEM && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY
+# if _LIBCPP_HAS_FILESYSTEM
# define __cpp_lib_filesystem 201703L
# endif
# define __cpp_lib_gcd_lcm 201606L
@@ -390,10 +395,8 @@ __cpp_lib_void_t 201411L <type_traits>
# define __cpp_lib_atomic_ref 201806L
// # define __cpp_lib_atomic_shared_ptr 201711L
# define __cpp_lib_atomic_value_initialization 201911L
-# if _LIBCPP_AVAILABILITY_HAS_SYNC
-# define __cpp_lib_atomic_wait 201907L
-# endif
-# if _LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC
+# define __cpp_lib_atomic_wait 201907L
+# if _LIBCPP_HAS_THREADS
# define __cpp_lib_barrier 201907L
# endif
# define __cpp_lib_bind_front 201907L
@@ -403,6 +406,8 @@ __cpp_lib_void_t 201411L <type_traits>
# if _LIBCPP_HAS_CHAR8_T
# define __cpp_lib_char8_t 201907L
# endif
+# define __cpp_lib_common_reference 202302L
+# define __cpp_lib_common_reference_wrapper 202302L
# define __cpp_lib_concepts 202002L
# define __cpp_lib_constexpr_algorithms 201806L
# define __cpp_lib_constexpr_complex 201711L
@@ -436,10 +441,10 @@ __cpp_lib_void_t 201411L <type_traits>
// # define __cpp_lib_is_layout_compatible 201907L
# define __cpp_lib_is_nothrow_convertible 201806L
// # define __cpp_lib_is_pointer_interconvertible 201907L
-# if _LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC
+# if _LIBCPP_HAS_THREADS
# define __cpp_lib_jthread 201911L
# endif
-# if _LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC
+# if _LIBCPP_HAS_THREADS
# define __cpp_lib_latch 201907L
# endif
# define __cpp_lib_list_remove_return_type 201806L
@@ -452,7 +457,7 @@ __cpp_lib_void_t 201411L <type_traits>
# endif
# define __cpp_lib_ranges 202110L
# define __cpp_lib_remove_cvref 201711L
-# if _LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC
+# if _LIBCPP_HAS_THREADS
# define __cpp_lib_semaphore 201907L
# endif
# undef __cpp_lib_shared_ptr_arrays
@@ -520,7 +525,7 @@ __cpp_lib_void_t 201411L <type_traits>
# define __cpp_lib_ranges_contains 202207L
# define __cpp_lib_ranges_find_last 202207L
# define __cpp_lib_ranges_iota 202202L
-// # define __cpp_lib_ranges_join_with 202202L
+# define __cpp_lib_ranges_join_with 202202L
# define __cpp_lib_ranges_repeat 202207L
// # define __cpp_lib_ranges_slide 202202L
# define __cpp_lib_ranges_starts_ends_with 202106L
@@ -541,6 +546,8 @@ __cpp_lib_void_t 201411L <type_traits>
# define __cpp_lib_aligned_accessor 202411L
// # define __cpp_lib_associative_heterogeneous_insertion 202306L
// # define __cpp_lib_atomic_min_max 202403L
+# undef __cpp_lib_atomic_ref
+# define __cpp_lib_atomic_ref 202411L
# undef __cpp_lib_bind_front
# define __cpp_lib_bind_front 202306L
# define __cpp_lib_bitset 202306L
@@ -553,7 +560,7 @@ __cpp_lib_void_t 201411L <type_traits>
# define __cpp_lib_constexpr_new 202406L
# endif
# define __cpp_lib_constexpr_queue 202502L
-// # define __cpp_lib_constrained_equality 202403L
+# define __cpp_lib_constrained_equality 202411L
// # define __cpp_lib_copyable_function 202306L
// # define __cpp_lib_debugging 202311L
// # define __cpp_lib_default_template_type_for_algorithm_values 202403L
@@ -583,11 +590,12 @@ __cpp_lib_void_t 201411L <type_traits>
# define __cpp_lib_mdspan 202406L
# undef __cpp_lib_not_fn
# define __cpp_lib_not_fn 202306L
-// # define __cpp_lib_optional_range_support 202406L
+# define __cpp_lib_optional_range_support 202406L
# undef __cpp_lib_out_ptr
# define __cpp_lib_out_ptr 202311L
// # define __cpp_lib_philox_engine 202406L
// # define __cpp_lib_ranges_concat 202403L
+# define __cpp_lib_ranges_indices 202506L
# define __cpp_lib_ratio 202306L
// # define __cpp_lib_rcu 202306L
# define __cpp_lib_reference_wrapper 202403L
@@ -597,6 +605,7 @@ __cpp_lib_void_t 201411L <type_traits>
# define __cpp_lib_span_at 202311L
# define __cpp_lib_span_initializer_list 202311L
# define __cpp_lib_sstream_from_string_view 202306L
+# define __cpp_lib_string_subview 202506L
# undef __cpp_lib_string_view
# define __cpp_lib_string_view 202403L
// # define __cpp_lib_submdspan 202306L
diff --git a/libcxx/test/std/containers/Emplaceable.h b/libcxx/test/std/containers/Emplaceable.h
index d9d0965fa64cb..d8d3407791731 100644
--- a/libcxx/test/std/containers/Emplaceable.h
+++ b/libcxx/test/std/containers/Emplaceable.h
@@ -15,20 +15,20 @@
#if TEST_STD_VER >= 11
class Emplaceable {
- Emplaceable(const Emplaceable&);
- Emplaceable& operator=(const Emplaceable&);
+ TEST_CONSTEXPR Emplaceable(const Emplaceable&);
+ TEST_CONSTEXPR_CXX14 Emplaceable& operator=(const Emplaceable&);
int int_;
double double_;
public:
- TEST_CONSTEXPR_CXX26 Emplaceable() : int_(0), double_(0) {}
- TEST_CONSTEXPR_CXX26 Emplaceable(int i, double d) : int_(i), double_(d) {}
- TEST_CONSTEXPR_CXX26 Emplaceable(Emplaceable&& x) : int_(x.int_), double_(x.double_) {
+ TEST_CONSTEXPR_CXX20 Emplaceable() : int_(0), double_(0) {}
+ TEST_CONSTEXPR_CXX20 Emplaceable(int i, double d) : int_(i), double_(d) {}
+ TEST_CONSTEXPR_CXX20 Emplaceable(Emplaceable&& x) : int_(x.int_), double_(x.double_) {
x.int_ = 0;
x.double_ = 0;
}
- TEST_CONSTEXPR_CXX26 Emplaceable& operator=(Emplaceable&& x) {
+ TEST_CONSTEXPR_CXX20 Emplaceable& operator=(Emplaceable&& x) {
int_ = x.int_;
x.int_ = 0;
double_ = x.double_;
@@ -36,10 +36,12 @@ class Emplaceable {
return *this;
}
- TEST_CONSTEXPR_CXX26 bool operator==(const Emplaceable& x) const { return int_ == x.int_ && double_ == x.double_; }
- TEST_CONSTEXPR_CXX26 bool operator<(const Emplaceable& x) const { return int_ < x.int_ || (int_ == x.int_ && double_ < x.double_); }
+ TEST_CONSTEXPR_CXX20 bool operator==(const Emplaceable& x) const { return int_ == x.int_ && double_ == x.double_; }
+ TEST_CONSTEXPR_CXX20 bool operator<(const Emplaceable& x) const {
+ return int_ < x.int_ || (int_ == x.int_ && double_ < x.double_);
+ }
- TEST_CONSTEXPR_CXX26 int get() const { return int_; }
+ TEST_CONSTEXPR_CXX20 int get() const { return int_; }
};
template <>
@@ -47,7 +49,7 @@ struct std::hash<Emplaceable> {
typedef Emplaceable argument_type;
typedef std::size_t result_type;
- std::size_t operator()(const Emplaceable& x) const { return static_cast<std::size_t>(x.get()); }
+ TEST_CONSTEXPR_CXX20 std::size_t operator()(const Emplaceable& x) const { return static_cast<std::size_t>(x.get()); }
};
#endif // TEST_STD_VER >= 11
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 bc8b52949d9b9..5936a407b88fa 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
@@ -17,11 +17,15 @@
#include <string>
#include <utility>
+#include "test_macros.h"
+
template <typename MMap>
struct CallCompMember : MMap::value_compare {
+ TEST_CONSTEXPR_CXX26
CallCompMember(const typename MMap::value_compare& vc) : MMap::value_compare(vc) {}
typedef typename MMap::value_type value_type;
+ TEST_CONSTEXPR_CXX26
bool operator()(const value_type& value1, const value_type& value2) const {
return this->comp(value1.first, value2.first);
}
diff --git a/libcxx/utils/generate_feature_test_macro_components.py b/libcxx/utils/generate_feature_test_macro_components.py
index dd7b3cfeb6d7e..096a2c116718c 100644
--- a/libcxx/utils/generate_feature_test_macro_components.py
+++ b/libcxx/utils/generate_feature_test_macro_components.py
@@ -195,7 +195,10 @@ def add_version_header(tc):
},
{
"name": "__cpp_lib_atomic_ref",
- "values": {"c++20": 201806},
+ "values": {
+ "c++20": 201806,
+ "c++26": 202411, # P2835R7: Expose std::atomic_ref 's object address
+ },
"headers": ["atomic"],
},
{
@@ -213,15 +216,13 @@ def add_version_header(tc):
"name": "__cpp_lib_atomic_wait",
"values": {"c++20": 201907},
"headers": ["atomic"],
- "test_suite_guard": "!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC",
- "libcxx_guard": "_LIBCPP_AVAILABILITY_HAS_SYNC",
},
{
"name": "__cpp_lib_barrier",
"values": {"c++20": 201907},
"headers": ["barrier"],
- "test_suite_guard": "!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)",
- "libcxx_guard": "_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC",
+ "test_suite_guard": "!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS",
+ "libcxx_guard": "_LIBCPP_HAS_THREADS",
},
{
"name": "__cpp_lib_bind_back",
@@ -313,6 +314,16 @@ def add_version_header(tc):
"values": {"c++17": 201603},
"headers": ["algorithm"],
},
+ {
+ "name": "__cpp_lib_common_reference",
+ "values": {"c++20": 202302},
+ "headers": ["type_traits"],
+ },
+ {
+ "name": "__cpp_lib_common_reference_wrapper",
+ "values": {"c++20": 202302},
+ "headers": ["functional"],
+ },
{
"name": "__cpp_lib_complex_udls",
"values": {"c++14": 201309},
@@ -436,9 +447,10 @@ def add_version_header(tc):
},
{
"name": "__cpp_lib_constrained_equality",
- "values": {"c++26": 202403}, # P2944R3: Comparisons for reference_wrapper
- "headers": ["optional", "tuple", "utility", "variant"],
- "unimplemented": True,
+ "values": {
+ "c++26": 202411, # P3379R0: Constrain std::expected equality operators
+ },
+ "headers": ["expected", "optional", "tuple", "utility", "variant"],
},
{
"name": "__cpp_lib_containers_ranges",
@@ -535,8 +547,8 @@ def add_version_header(tc):
"name": "__cpp_lib_filesystem",
"values": {"c++17": 201703},
"headers": ["filesystem"],
- "test_suite_guard": "!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_FILESYSTEM && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY)",
- "libcxx_guard": "_LIBCPP_HAS_FILESYSTEM && _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY",
+ "test_suite_guard": "!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_FILESYSTEM",
+ "libcxx_guard": "_LIBCPP_HAS_FILESYSTEM",
},
{
"name": "__cpp_lib_flat_map",
@@ -563,7 +575,7 @@ def add_version_header(tc):
"headers": ["format"],
# Trying to use `std::format` where to_chars floating-point is not
# available causes compilation errors, even with non floating-point types.
- # https://github.com/llvm/llvm-project/issues/125353
+ # https://llvm.org/PR125353
"test_suite_guard": "!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_TO_CHARS_FLOATING_POINT",
"libcxx_guard": "_LIBCPP_AVAILABILITY_HAS_TO_CHARS_FLOATING_POINT",
},
@@ -862,15 +874,15 @@ def add_version_header(tc):
"name": "__cpp_lib_jthread",
"values": {"c++20": 201911},
"headers": ["stop_token", "thread"],
- "test_suite_guard": "!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)",
- "libcxx_guard": "_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC",
+ "test_suite_guard": "!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS",
+ "libcxx_guard": "_LIBCPP_HAS_THREADS",
},
{
"name": "__cpp_lib_latch",
"values": {"c++20": 201907},
"headers": ["latch"],
- "test_suite_guard": "!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)",
- "libcxx_guard": "_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC",
+ "test_suite_guard": "!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS",
+ "libcxx_guard": "_LIBCPP_HAS_THREADS",
},
{
"name": "__cpp_lib_launder",
@@ -1006,7 +1018,6 @@ def add_version_header(tc):
"name": "__cpp_lib_optional_range_support",
"values": {"c++26": 202406}, # P3168R2 Give std::optional Range Support
"headers": ["optional"],
- "unimplemented": True,
},
{
"name": "__cpp_lib_out_ptr",
@@ -1048,7 +1059,7 @@ def add_version_header(tc):
"headers": ["ostream", "print"],
# Trying to use `std::print` where to_chars floating-point is not
# available causes compilation errors, even with non floating-point types.
- # https://github.com/llvm/llvm-project/issues/125353
+ # https://llvm.org/PR125353
"test_suite_guard": "!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_TO_CHARS_FLOATING_POINT",
"libcxx_guard": "_LIBCPP_AVAILABILITY_HAS_TO_CHARS_FLOATING_POINT",
},
@@ -1108,6 +1119,11 @@ def add_version_header(tc):
"values": {"c++23": 202207},
"headers": ["algorithm"],
},
+ {
+ "name": "__cpp_lib_ranges_indices",
+ "values": {"c++26": 202506},
+ "headers": ["ranges"],
+ },
{
"name": "__cpp_lib_ranges_iota",
"values": {"c++23": 202202},
@@ -1117,7 +1133,6 @@ def add_version_header(tc):
"name": "__cpp_lib_ranges_join_with",
"values": {"c++23": 202202},
"headers": ["ranges"],
- "unimplemented": True,
},
{
"name": "__cpp_lib_ranges_repeat",
@@ -1211,8 +1226,8 @@ def add_version_header(tc):
"name": "__cpp_lib_semaphore",
"values": {"c++20": 201907},
"headers": ["semaphore"],
- "test_suite_guard": "!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)",
- "libcxx_guard": "_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC",
+ "test_suite_guard": "!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS",
+ "libcxx_guard": "_LIBCPP_HAS_THREADS",
},
{
"name": "__cpp_lib_senders",
@@ -1330,6 +1345,11 @@ def add_version_header(tc):
"values": {"c++23": 202110},
"headers": ["string"],
},
+ {
+ "name": "__cpp_lib_string_subview",
+ "values": {"c++26": 202506},
+ "headers": ["string", "string_view"],
+ },
{
"name": "__cpp_lib_string_udls",
"values": {"c++14": 201304},
@@ -1875,7 +1895,6 @@ def produce_tests():
{cxx_tests}
// clang-format on
-
""".format(
script_name=script_name,
header=h,
More information about the libcxx-commits
mailing list